Routines You Should Not Use and Other Curiosities


I first heard my good friend Manfred say that "the book that is forbidden to read turns one reader into three." Do not apply this logic to the routines outlined in this section. These routines are not officially documented; even if they work now, they may stop working in the near future. Deprecated routines may still exist and they may work. They may also be removed at any time. Empty stubs exist, compile, and run, but do nothing. You may find older code that uses these legacy functions (see Table 14 ). Good programming practice will avoid using them, but you may see them in some applications and source code. It's good to know they exist, but it isn't smart to use functions that are not supported.

Table 14: Deprecated and not-yet-implemented routines.

Routine

Comment

AboutStarBasic

Deprecated empty stub that used to be an information dialog.

SendKeys

Empty stub.

DumpAllObjects( path , bool)

Internal debugging routine.

Load(Object)

Deprecated.

Unload(Object)

Deprecated.

LoadPicture(path)

Deprecated. Loads an image file.

SavePicture(obj, path)

Deprecated. Fails to save an image file.

CreatePropertySet(object)

Deprecated. Early UNO support function.

CCur(expression)

Purposely generates a run-time error. Convert to currency.

StrConv

Purposely generates a run-time error. Convert strings to different cases.

DateAdd

Empty stub. Add date components .

DateDiff

Empty stub. Difference between two date components.

DatePart

Empty stub. Extract a specific date component.

DumpAllObjects is an internal debugging routine that accepts two arguments. The first argument is a file name that will contain the text output. The second argument is a Boolean value that determines if each object should be fully loaded before it is dumped. For performance reasons, some properties are not created until they are accessed for the first time. This is true, even for BASIC objects that wrap UNO objects.

 DumpAllObjects("C:\foo.txt", true)   'Fully load all objects before dumping 

The LoadPicture and SavePicture routines refer to the old BASIC dialogs that are not implemented using UNO. The object returned by LoadPicture was used to set a picture on an image control. There is now an image control that uses the UNO API to set the picture.

 Dim v v = LoadPicture("C:\test1.jpg") 'This seems to load the picture SavePicture(v, "C:\test2.jpg")  'This writes a zero length file 

The CreatePropertySet function accepts an object as an argument and returns a property set. The property set is empty and not very useful. This function was created when the UNO functionality was first introduced, and will be removed from the source code in the future. If you find code that uses this function, I recommend that you change it.

 v = CreatePropertySet(ThisComponent.Text) 

The CCur function converts a numerical expression to a currency object. In OOo Basic a run-time error occurs; invalid procedure call. Visual Basic .NET has also removed support for the CCur function as well as the Currency data type. OOo Basic still supports the Currency data type.

The StrConv function, which is only an empty stub, would normally convert a string in some requested way-for example, to uppercase, lowercase, or proper case. In OOo Basic a run-time error occurs; invalid procedure call.

Campatibility  

Visual Basic supports the StrConv function; OOo Basic generates a run-time error.

Date and time values contain different components-for example, the day, month, or seconds. The functions DateAdd, DateDiff, and DatePart, if they were implemented, would operate on individual components. For example, add one year, how many days elapsed, and give me the "minutes" component. In OOo Basic, all of the arguments are ignored and nothing is done. These functions are really just empty stubs in the source code.

Campatibility  

Visual Basic supports the functions DateAdd, DateDiff, and DatePart. OOo Basic does not support these functions; your code will silently do nothing.




OpenOffice.org Macros Explained
OpenOffice.org Macros Explained
ISBN: 1930919514
EAN: 2147483647
Year: 2004
Pages: 203

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net