Libreria”Tools” di LibreOffice 7.3

()

La libreria Tools

Per accedere a questo comando…

Aprite Strumenti – Macro – LibreOffice Basic – Modifica e selezionate il contenitore LibreOffice Macro.

Questa libreria deve essere caricata prima dell’esecuzione. Eseguite l’istruzione seguente prima di eseguire una macro che utilizza questa libreria: GlobalScope.BasicLibraries.LoadLibrary(“Tools”)

Modulo Debug,

Modulo ListBox,

Modulo Misc,

Modulo ModuleControls,

Modulo Strings,

Modulo UCB,

Modulo Debug

Funzioni e subroutine per il debug delle macro Basic.

MacroParametri di chiamata e commenti
ActivateReadOnlyFlagSub ActivateReadOnlyFlag()
DeactivateReadOnlyFlagSub DeactivateReadOnlyFlag()
SetBasicReadOnlyFlagSub SetBasicReadOnlyFlag(bReadOnly as Boolean)
WritedbgInfoSub WritedbgInfo(LocObject as Object)
WriteDbgStringSub WriteDbgString(LocString as String)
ShowArraySub ShowArray(LocArray())
ShowPropertyValuesSub ShowPropertyValues(oLocObject as Object)
ShowNameValuePairSub ShowNameValuePair(Pair())
ShowElementNames‘ 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)
ShowSupportedServiceNames‘ 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)
ShowAvailableServiceNames‘ 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)
ShowCommandsSub ShowCommands(oLocObject as Object)
ProtectCurrentSheetsSub ProtectCurrentSheets()
FillDocumentSub FillDocument()

Modulo ListBox

Funzioni e subroutine per gestire gli elementi ListBox.

Questa pagina necessita di ulteriore lavoro per essere corretta e completata. Unitevi al progetto LibreOffice e aiutateci alla stesura delle informazioni mancanti.

Modulo Misc

Funzioni e subroutine varie.

MacroParametri di chiamata e commenti
RegisterNewDataSourceFunction RegisterNewDataSource( DSName as String, PropertyList(), Optional DriverProperties() as New com.sun.star.beans.PropertyValue)
ConnecttoDatabaseFunction ConnecttoDatabase( DSName as String, UserID as String, Password as String, Optional Propertylist(), Optional DriverProperties() as New com.sun.star.beans.PropertyValue)
GetStarOfficeLocaleFunction GetStarOfficeLocale() as New com.sun.star.lang.Locale
GetRegistryKeyContentFunction GetRegistryKeyContent( sKeyName as string, Optional bforUpdate as Boolean)
GetProductnameFunction GetProductname() as String
OpenDocument‘ 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)
TaskonDesktopFunction TaskonDesktop(DocPath as String) as Boolean
RetrieveFileName‘ Retrieves a FileName out of a StarOffice-Document.Function RetrieveFileName(LocDoc as Object)
GetPathSettings‘ Gets a special configured PathSetting.Function GetPathSettings( sPathType as String, Optional bshowall as Boolean, Optional ListIndex as integer) as String
GetOfficeSubPath‘ 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)
ShowNoOfficePathErrorSub ShowNoOfficePathError()
InitResourcesFunction InitResources( Description, ShortDescription as String) as boolean
GetResTextFunction GetResText( nID as integer ) As string
CutPathViewFunction CutPathView( sDocUrl as String, Optional PathLen as Integer)
DeleteInputCells‘ Deletes the content of all cells that are softformatted according to the ‘InputStyleName’.Sub DeleteInputCells( oSheet as Object, InputStyleName as String)
ChangeValueofRange‘ Inserts a certain String to all cells of a Range that ist passed over either as an object or as the RangeName.Sub ChangeValueofRange( oSheet as Object, Range, ReplaceValue, Optional StyleName as String)
ReplaceRangeValuesSub ReplaceRangeValues( oRange as Object, ReplaceValue)
GetValueofCellbyName‘ Returns the Value of the first cell of a Range.Function GetValueofCellbyName( oSheet as Object, sCellName as String)
DuplicateRowFunction DuplicateRow( oSheet as Object, RangeName as String)
GetStringofCellbyName‘ Returns the String of the first cell of a Range.Function GetStringofCellbyName( oSheet as Object, sCellName as String)
GetCellByName‘ Returns a named CellFunction GetCellByName( oSheet as Object, sCellName as String) as Object
ChangeCellValue‘ Changes the numeric Value of a cell by transmitting the String of the numeric Value.Sub ChangeCellValue( oCell as Object, ValueString as String)
GetDocumentTypeFunction GetDocumentType(oDocument)
GetNumberFormatTypeFunction GetNumberFormatType( oDocFormats, oFormatObject as Object) as Integer
ProtectSheetsSub ProtectSheets(Optional oSheets as Object)
UnprotectSheetsSub UnprotectSheets(Optional oSheets as Object)
GetRowIndexFunction GetRowIndex( oSheet as Object, RowName as String)
GetColumnIndexFunction GetColumnIndex( oSheet as Object, ColName as String)
CopySheetbyNameFunction CopySheetbyName( oSheets as Object, OldName as String, NewName as String, DestPos as Integer) as Object
ToggleWindow‘ Dis-or enables a Window and adjusts the mousepointer accordinglySub ToggleWindow(bDoEnable as Boolean)
CheckNewSheetnameFunction CheckNewSheetname( oSheets as Object, Sheetname as String, Optional oLocale) as String
AddNewSheetNameSub AddNewSheetName( oSheets as Object, ByVal SheetName as String)
GetSheetIndexFunction GetSheetIndex(oSheets, sName) as Integer
GetLastUsedRowFunction GetLastUsedRow(oSheet as Object) as Integer
ModifyBorderLineWidth‘ 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 35Function ModifyBorderLineWidth( ByVal oStyleBorder, iInnerLineWidth as Integer, iOuterLineWidth as Integer)
AttachBasicMacroToEventSub AttachBasicMacroToEvent( oDocument as Object, EventName as String, SubPath as String)
ModifyPropertyValueFunction ModifyPropertyValue( oContent() as New com.sun.star.beans.PropertyValue, TargetProperties() as New com.sun.star.beans.PropertyValue)
GetPropertyValueIndexFunction GetPropertyValueIndex( SearchName as String, TargetProperties() as New com.sun.star.beans.PropertyValue ) as Integer
DispatchSlotSub DispatchSlot(SlotID as Integer)
IsFatOffice‘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
GetLocaleFunction GetLocale( sLanguage as String, sCountry as String)
ToggleDesignModeSub ToggleDesignMode(oDocument as Object)
isHighContrastFunction isHighContrast(oPeer as Object)
CreateNewDocumentFunction CreateNewDocument( sType as String, Optional sAddMsg as String) as Object
DisposeDocument‘ 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 closedSub DisposeDocument(oDocument as Object)
CalIsLeapYear‘Function to calculate if the year is a leap yearFunction CalIsLeapYear( ByVal iYear as Integer) as Boolean

Modulo ModuleControls

Funzioni e subroutine per il controllo dei moduli.

MacroParametri di chiamata e commenti
GetControlShape‘ 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 ControlFunction GetControlShape( oContainer as Object, CName as String)
getControlView‘ 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 ControlFunction getControlView( oContainer , oController as Object, CName as String) as Object
DisposeControl‘ Parameters:’ The ‘oContainer’ is the Document or a specific sheet of a Calc – Document’ ‘CName’ is the Name of the ControlFunction DisposeControl( oContainer as Object, CName as String) as Boolean
GetControlGroupModel‘ 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 ControlgroupFunction GetControlGroupModel( oContainer as Object, sGroupName as String )
GetRefValue‘ Returns the Referencevalue of a group of e.g. option buttons or check boxes’ ‘oControlGroup’ is a sequence of the Control objectsFunction GetRefValue( oControlGroup() as Object)
GetRefValueOfControlGroupFunction GetRefValueOfControlGroup( oContainer as Object, GroupName as String)
GetOptionGroupValueFunction GetOptionGroupValue( oContainer as Object, OptGroupName as String) as Boolean
WriteOptValueToCellFunction WriteOptValueToCell( oSheet as Object, OptGroupName as String, iCol as Integer, iRow as Integer) as Boolean
LoadDialogFunction LoadDialog( Libname as String, DialogName as String, Optional oLibContainer)Per un esempio di funzione LoadDialog, consultate il capitolo Visualizzare una finestra di dialogo usando Basic.
GetFolderNameSub GetFolderName(oRefModel as Object)
GetFileNameSub GetFileName( oRefModel as Object, Filternames())
StoreDocumentFunction StoreDocument( oDocument as Object, FilterNames() as String, DefaultName as String, DisplayDirectory as String, Optional iAddProcedure as Integer) as String
AddFiltersToDialogSub AddFiltersToDialog( FilterNames() as String, oDialog as Object)
SwitchMousePointerSub SwitchMousePointer( oWindowPeer as Object, bDoEnable as Boolean)
ShowOverwriteAllDialogSub ShowOverwriteAllDialog( FilePath as String, sTitle as String)
SetOVERWRITEToQuerySub SetOVERWRITEToQuery()
SetOVERWRITEToAlwaysSub SetOVERWRITEToAlways()
SetOVERWRITEToNeverSub SetOVERWRITEToNever()

Modulo Strings

Funzioni e subroutine per la manipolazione delle stringhe.

MacroParametri di chiamata e commenti
ElimCharFunction ElimChar( ByVal BigString as String, ElimArray() as String)
DeleteStr‘ Deletes out of a String ‘BigString’ a possible Partstring ‘CompString’Function DeleteStr( ByVal BigString, CompString as String) as String
FindPartString‘ Finds a PartString, that is framed by the Strings ‘Prestring’ and ‘PostString’Function FindPartString( BigString, PreString, PostString as String, SearchPos as Integer) as String
PartStringInArray‘ Note iCompare = 0 (Binary comparison)’ iCompare = 1 (Text comparison)Function PartStringInArray( BigArray(), SearchString as String, iCompare as Integer) as Integer
RTrimStr‘ Deletes the String ‘SmallString’ out of the String ‘BigString” in case SmallString’s Position in BigString is right at the endFunction RtrimStr( ByVal BigString, SmallString as String) as String
LTRimChar‘ Deletes the Char ‘CompChar’ out of the String ‘BigString” in case CompChar’s Position in BigString is right at the beginningFunction LTRimChar( ByVal BigString as String, CompChar as String) as String
ArrayOutOfString‘ 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 ArrayFunction ArrayOutOfString( BigString, Separator as String, Optional MaxIndex as Integer)
ClearArray‘ Deletes all fieldvalues in one-dimensional ArraySub ClearArray(BigArray)
ClearMultiDimArray‘ Deletes all fieldvalues in a multidimensional ArraySub ClearMultiDimArray( BigArray, DimCount as integer)
FieldinArray‘ 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
FieldinList‘ Checks if a Field (LocField) is already defined in an Array’ Returns ‘True’ or ‘False’Function FieldinList( LocField, BigList()) As Boolean
IndexinArray‘ Retrieves the Index of the delivered String ‘SearchString’ in’ the Array LocList()’Function IndexinArray( SearchString as String, LocList()) as Integer
MultiArrayInListboxSub MultiArrayInListbox( oDialog as Object, ListboxName as String, ValList(), iDim as Integer)
StringInMultiArray‘ 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
GetIndexInMultiArray‘ 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
GetIndexForPartString_ inMultiArray‘ 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 stringFunction GetIndexForPartStringinMultiArray( SearchList(), SearchValue, SearchIndex as Integer) as Integer
ArrayfromMultiArrayFunction ArrayfromMultiArray( MultiArray as String, iDim as Integer)
ReplaceString‘ Replaces the string “OldReplace” through the String “NewReplace” in the String’ ‘BigString’Function ReplaceString( ByVal Bigstring, NewReplace, OldReplace as String) as String
FindSecondValue‘ Retrieves the second value for a next to ‘SearchString’ in’ a two-dimensional string-ArrayFunction FindSecondValue( SearchString as String, TwoDimList() as String ) as String
Power‘ raises a base to a certain powerFunction Power( Basis as Double, Exponent as Double) as Double
Round‘ rounds a Real to a given Number of DecimalsFunction Round( BaseValue as Double, Decimals as Integer) as Double
FileNameoutofPath‘Retrieves the mere filename out of a whole pathFunction FileNameoutofPath( ByVal Path as String, Optional Separator as String) as String
GetFileNameExtensionFunction GetFileNameExtension( ByVal FileName as String)
GetFileNameWithoutExtensionFunction GetFileNameWithoutExtension( ByVal FileName as String, Optional Separator as String)
DirectoryNameoutofPathFunction DirectoryNameoutofPath( sPath as String, Separator as String) as String
CountCharsinStringFunction CountCharsinString( BigString, LocChar as String, ByVal StartPos as Integer) as Integer
BubbleSortListFunction 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
GetValueoutofListFunction GetValueoutofList( SearchValue, BigList(), iDim as Integer, Optional ValueIndex)
AddListtoListFunction AddListtoList( ByVal FirstArray(), ByVal SecondArray(), Optional StartIndex)
CheckDoubleFunction CheckDouble(DoubleString as String)

Modulo UCB

Funzioni e subroutine Universal Content Broker.

MacroParametri di chiamata e commenti
ReadDirectoriesFunction ReadDirectories( ByVal AnchorDir As String, bRecursive as Boolean, bcheckFileType as Boolean, bGetByTitle as Boolean, Optional sFileContent(), Optional sExtension as String)
AddFoldertoListSub AddFoldertoList( sDirURL as String, iDirIndex)
AddFileNameToListSub AddFileNameToList( sFileArray(), FileName as String, FileContent as String, bGetByTitle as Boolean, CurIndex)
RetrieveDocTitleFunction RetrieveDocTitle( oDocProps as Object, sFileName as String) As String
GetRealFileContent‘ Retrieves The Filecontent of a Document by extracting the content’ from the Header of the documentFunction GetRealFileContent( FileName as String) As String
CopyRecursivelyFunction CopyRecursively( SourceFilePath as String, SourceStemDir as String, TargetStemDir as String)
ShowHelperDialog‘ Opens a help url referenced by a Help ID that is retrieved from the calling button tagSub ShowHelperDialog(aEvent)
SaveDataToFileSub SaveDataToFile( FilePath as String, DataList())
LoadDataFromFileFunction LoadDataFromFile( FilePath as String, DataList()) as Boolean
CreateFolderFunction CreateFolder(sNewFolder) as Boolean
/ 5
Grazie per aver votato!

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?