Collabora Office 23.05 Help
Functions and subroutines for debugging Basic macros.
Sub ActivateReadOnlyFlag()
Sub DeactivateReadOnlyFlag()
Sub SetBasicReadOnlyFlag(bReadOnly as Boolean)
Sub WritedbgInfo(LocObject as Object)
Sub WriteDbgString(LocString as String)
Sub ShowArray(LocArray())
Sub ShowPropertyValues(oLocObject as Object)
Sub ShowNameValuePair(Pair())
' Retrieves all the Elements of aSequence of an object, with the
' possibility to define a filter(sfilter <> "")
Sub ShowElementNames(
oLocElements() as Object,
Optional sFiltername as String)
' Retrieves all the supported servicenames of an object, with the
' possibility to define a filter(sfilter <> "")
Sub ShowSupportedServiceNames(
oLocObject as Object,
Optional sFilterName as String)
' Retrieves all the available Servicenames of an object, with the
' possibility to define a filter(sfilter <> "")
Sub ShowAvailableServiceNames(
oLocObject as Object,
Optional sFilterName as String)
Sub ShowCommands(oLocObject as Object)
Sub ProtectCurrentSheets()
Sub FillDocument()
Functions and subroutines for handling ListBox elements.
Miscellaneous functions and subroutines.
Function RegisterNewDataSource(
DSName as String,
PropertyList(),
Optional DriverProperties()
as New com.sun.star.beans.PropertyValue)
Function ConnecttoDatabase(
DSName as String,
UserID as String,
Password as String,
Optional Propertylist(),
Optional DriverProperties()
as New com.sun.star.beans.PropertyValue)
Function GetStarOfficeLocale()
as New com.sun.star.lang.Locale
Function GetRegistryKeyContent(
sKeyName as string,
Optional bforUpdate as Boolean)
Function GetProductname() as String
' Opens a Document, checks beforehand, whether it has to be loaded or whether it is already on the desktop. If the parameter bDisposable is set to False then the returned document should not be disposed afterwards, because it is already opened.
Function OpenDocument(
DocPath as String,
Args(),
Optional bDisposable as Boolean)
Function TaskonDesktop(DocPath as String) as Boolean
' Retrieves a FileName out of a StarOffice-Document.
Function RetrieveFileName(LocDoc as Object)
' Gets a special configured PathSetting.
Function GetPathSettings(
sPathType as String,
Optional bshowall as Boolean,
Optional ListIndex as integer) as String
' Gets the fully qualified path to a subdirectory of the Template Directory, e. g. with the parameter "wizard/bitmap". The parameter must be passed over in Url-scription. The return-Value is in Urlscription.
Function GetOfficeSubPath(
sOfficePath as String,
ByVal sSubDir as String)
Sub ShowNoOfficePathError()
Function InitResources(
Description,
ShortDescription as String) as boolean
Function GetResText( nID as integer ) As string
Function CutPathView(
sDocUrl as String,
Optional PathLen as Integer)
' Deletes the content of all cells that are softformatted according to the 'InputStyleName'.
Sub DeleteInputCells(
oSheet as Object,
InputStyleName as String)
' Inserts a certain String to all cells of a Range that is passed over either as an object or as the RangeName.
Sub ChangeValueofRange(
oSheet as Object,
Range,
ReplaceValue,
Optional StyleName as String)
Sub ReplaceRangeValues(
oRange as Object,
ReplaceValue)
' Returns the Value of the first cell of a Range.
Function GetValueofCellbyName(
oSheet as Object,
sCellName as String)
Function DuplicateRow(
oSheet as Object,
RangeName as String)
' Returns the String of the first cell of a Range.
Function GetStringofCellbyName(
oSheet as Object,
sCellName as String)
' Returns a named Cell
Function GetCellByName(
oSheet as Object,
sCellName as String) as Object
' Changes the numeric Value of a cell by transmitting the String of the numeric Value.
Sub ChangeCellValue(
oCell as Object,
ValueString as String)
Function GetDocumentType(oDocument)
Function GetNumberFormatType(
oDocFormats,
oFormatObject as Object) as Integer
Sub ProtectSheets(Optional oSheets as Object)
Sub UnprotectSheets(Optional oSheets as Object)
Function GetRowIndex(
oSheet as Object,
RowName as String)
Function GetColumnIndex(
oSheet as Object,
ColName as String)
Function CopySheetbyName(
oSheets as Object,
OldName as String,
NewName as String,
DestPos as Integer) as Object
' Dis-or enables a Window and adjusts the mousepointer accordingly
Sub ToggleWindow(bDoEnable as Boolean)
Function CheckNewSheetname(
oSheets as Object,
Sheetname as String,
Optional oLocale) as String
Sub AddNewSheetName(
oSheets as Object,
ByVal SheetName as String)
Function GetSheetIndex(oSheets, sName) as Integer
Function GetLastUsedRow(oSheet as Object) as Integer
' Note To set a one lined frame you have to set the inner width to 0 In the API all Units that refer to pt-Heights are "1/100mm" The convert factor from 1pt to 1/100 mm is approximately 35
Function ModifyBorderLineWidth(
ByVal oStyleBorder,
iInnerLineWidth as Integer,
iOuterLineWidth as Integer)
Sub AttachBasicMacroToEvent(
oDocument as Object,
EventName as String,
SubPath as String)
Function ModifyPropertyValue(
oContent() as New com.sun.star.beans.PropertyValue,
TargetProperties()
as New com.sun.star.beans.PropertyValue)
Function GetPropertyValueIndex(
SearchName as String,
TargetProperties()
as New com.sun.star.beans.PropertyValue ) as Integer
Sub DispatchSlot(SlotID as Integer)
'returns the type of the office application FatOffice = 0, WebTop = 1 This routine has to be changed if the Product Name is being changed!
Function IsFatOffice() As Boolean
Function GetLocale(
sLanguage as String,
sCountry as String)
Sub ToggleDesignMode(oDocument as Object)
Function isHighContrast(oPeer as Object)
Function CreateNewDocument(
sType as String,
Optional sAddMsg as String) as Object
' This Sub has been used in order to ensure that after disposing a document from the backing window it is returned to the backing window, so the office won't be closed
Sub DisposeDocument(oDocument as Object)
'Function to calculate if the year is a leap year
Function CalIsLeapYear(
ByVal iYear as Integer) as Boolean
Functions and subroutines for module control.
' Gets the Shape of a Control( e. g. to reset the size or Position of the control
' Parameters:
' The 'oContainer' is the Document or a specific sheet of a Calc - Document
' 'CName' is the Name of the Control
Function GetControlShape(
oContainer as Object,
CName as String)
' Returns the View of a Control
' Parameters:
' The 'oContainer' is the Document or a specific sheet of a Calc - Document
' The 'oController' is always directly attached to the Document
' 'CName' is the Name of the Control
Function getControlView(
oContainer ,
oController as Object,
CName as String) as Object
' Parameters:
' The 'oContainer' is the Document or a specific sheet of a Calc - Document
' 'CName' is the Name of the Control
Function DisposeControl(
oContainer as Object,
CName as String) as Boolean
' Returns a sequence of a group of controls like option buttons or checkboxes
' The 'oContainer' is the Document or a specific sheet of a Calc - Document
' 'sGroupName' is the Name of the Controlgroup
Function GetControlGroupModel(
oContainer as Object,
sGroupName as String )
' Returns the Referencevalue of a group of e.g. option buttons or check boxes
' 'oControlGroup' is a sequence of the Control objects
Function GetRefValue(
oControlGroup() as Object)
Function GetRefValueOfControlGroup(
oContainer as Object,
GroupName as String)
Function GetOptionGroupValue(
oContainer as Object,
OptGroupName as String) as Boolean
Function WriteOptValueToCell(
oSheet as Object,
OptGroupName as String,
iCol as Integer,
iRow as Integer) as Boolean
Function LoadDialog(
Libname as String,
DialogName as String,
Optional oLibContainer)
Refer to Opening a Dialog with Basic for an example of LoadDialog function.
Sub GetFolderName(oRefModel as Object)
Sub GetFileName(
oRefModel as Object,
Filternames())
Function StoreDocument(
oDocument as Object,
FilterNames() as String,
DefaultName as String,
DisplayDirectory as String,
Optional iAddProcedure as Integer) as String
Sub AddFiltersToDialog(
FilterNames() as String,
oDialog as Object)
Sub SwitchMousePointer(
oWindowPeer as Object,
bDoEnable as Boolean)
Sub ShowOverwriteAllDialog(
FilePath as String,
sTitle as String)
Sub SetOVERWRITEToQuery()
Sub SetOVERWRITEToAlways()
Sub SetOVERWRITEToNever()
Advanced functions and subroutines for string manipulation.
Function ElimChar(
ByVal BigString as String,
ElimArray() as String)
' Deletes out of a String 'BigString' a possible Partstring 'CompString'
Function DeleteStr(
ByVal BigString,
CompString as String) as String
' Finds a PartString, that is framed by the Strings 'Prestring' and 'PostString'
Function FindPartString(
BigString,
PreString,
PostString as String,
SearchPos as Integer) as String
' Note iCompare = 0 (Binary comparison)
' iCompare = 1 (Text comparison)
Function PartStringInArray(
BigArray(),
SearchString as String,
iCompare as Integer) as Integer
' Deletes the String 'SmallString' out of the String 'BigString'
' in case SmallString's Position in BigString is right at the end
Function RtrimStr(
ByVal BigString,
SmallString as String) as String
' Deletes the Char 'CompChar' out of the String 'BigString'
' in case CompChar's Position in BigString is right at the beginning
Function LTRimChar(
ByVal BigString as String,
CompChar as String) as String
' Retrieves an Array out of a String.
' The fields of the Array are separated by the parameter 'Separator', that is contained
' in the Array
' The Array MaxIndex delivers the highest Index of this Array
Function ArrayOutOfString(
BigString,
Separator as String,
Optional MaxIndex as Integer)
' Deletes all fieldvalues in one-dimensional Array
Sub ClearArray(BigArray)
' Deletes all fieldvalues in a multidimensional Array
Sub ClearMultiDimArray(
BigArray,
DimCount as integer)
' Checks if a Field (LocField) is already defined in an Array
' Returns 'True' or 'False'
Function FieldinArray(
LocArray(),
MaxIndex as integer,
LocField as String) As Boolean
' Checks if a Field (LocField) is already defined in an Array
' Returns 'True' or 'False'
Function FieldinList(
LocField,
BigList()) As Boolean
' Retrieves the Index of the delivered String 'SearchString' in
' the Array LocList()'
Function IndexinArray(
SearchString as String,
LocList()) as Integer
Sub MultiArrayInListbox(
oDialog as Object,
ListboxName as String,
ValList(),
iDim as Integer)
' Searches for a String in a two-dimensional Array by querying all Searchindexes of the second dimension
' and delivers the specific String of the ReturnIndex in the second dimension of the Searchlist()
Function StringInMultiArray(
SearchList(),
SearchString as String,
SearchIndex as Integer,
ReturnIndex as Integer,
Optional MaxIndex as Integer) as String
' Searches for a Value in multidimensial Array by querying all Searchindices of the passed dimension
' and delivers the Index where it is found.
Function GetIndexInMultiArray(
SearchList(),
SearchValue,
SearchIndex as Integer) as Integer
' Searches for a Value in multidimensial Array by querying all Searchindices of the passed dimension
' and delivers the Index where the Searchvalue is found as a part string
Function GetIndexForPartStringinMultiArray(
SearchList(),
SearchValue,
SearchIndex as Integer) as Integer
Function ArrayfromMultiArray(
MultiArray as String,
iDim as Integer)
' Replaces the string "OldReplace" through the String "NewReplace" in the String
' 'BigString'
Function ReplaceString(
ByVal Bigstring,
NewReplace,
OldReplace as String) as String
' Retrieves the second value for a next to 'SearchString' in
' a two-dimensional string-Array
Function FindSecondValue(
SearchString as String,
TwoDimList() as String ) as String
' raises a base to a certain power
Function Power(
Basis as Double,
Exponent as Double) as Double
' rounds a Real to a given Number of Decimals
Function Round(
BaseValue as Double,
Decimals as Integer) as Double
'Retrieves the mere filename out of a whole path
Function FileNameoutofPath(
ByVal Path as String,
Optional Separator as String) as String
Function GetFileNameExtension(
ByVal FileName as String)
Function GetFileNameWithoutExtension(
ByVal FileName as String,
Optional Separator as String)
Function DirectoryNameoutofPath(
sPath as String,
Separator as String) as String
Function CountCharsinString(
BigString,
LocChar as String,
ByVal StartPos as Integer) as Integer
Function BubbleSortList(
ByVal SortList(),
optional sort2ndValue as Boolean)
'This function bubble sorts an array of maximum 2 dimensions.
'The default sorting order is the first dimension
'Only if sort2ndValue is True the second dimension is the relevant for the sorting order
Function GetValueoutofList(
SearchValue,
BigList(),
iDim as Integer,
Optional ValueIndex)
Function AddListtoList(
ByVal FirstArray(),
ByVal SecondArray(),
Optional StartIndex)
Function CheckDouble(DoubleString as String)
Universal Content Broker functions and subroutines.
Function ReadDirectories(
ByVal AnchorDir As String,
bRecursive as Boolean,
bcheckFileType as Boolean,
bGetByTitle as Boolean,
Optional sFileContent(),
Optional sExtension as String)
Sub AddFoldertoList(
sDirURL as String,
iDirIndex)
Sub AddFileNameToList(
sFileArray(),
FileName as String,
FileContent as String,
bGetByTitle as Boolean,
CurIndex)
Function RetrieveDocTitle(
oDocProps as Object,
sFileName as String) As String
' Retrieves The Filecontent of a Document by extracting the content
' from the Header of the document
Function GetRealFileContent(
FileName as String) As String
Function CopyRecursively(
SourceFilePath as String,
SourceStemDir as String,
TargetStemDir as String)
' Opens a help url referenced by a Help ID that is retrieved from the calling button tag
Sub ShowHelperDialog(aEvent)
Sub SaveDataToFile(
FilePath as String,
DataList())
Function LoadDataFromFile(
FilePath as String,
DataList()) as Boolean
Function CreateFolder(sNewFolder) as Boolean