extension_manager_tools.inc
Created: Thu Jul 26 11:23:08 2007
|
extension_manager_tools.inc: function hExtensionAddGUI( sPathToExtension as string, bExtensionHasLicense as boolean ) as integer
|
Add an extension via Extension Manager
This function adds an extension to the office using the
Extension Manager GUI (formerly known as Package Manager).
It notifies about unexpected messageboxes, progressbars, missing
depency warnings as well as license agreements. The function
will exit on any error, print a message and return an errorcode.
The errorcode must be evaluated, some errors are fatal. Cleanup must be
done outside of this function.
All new extensions are installed below My Packages (to the userlayer).
Starting point is any document or the backing window, the function
will return to the starting document if possible
Input value(s):
- Path to extension (string)
- The path must be absolute
- Expect a license text (boolean)
- TRUE: Extension shows license text during installation
- FALSE: Custom package without license
Return Value:
- Errorcode (Integer)
- 0 = No errors, extension was added correctly
- 1 = Extension Manager could not be opened (fatal)
- 2 = Add-Button is not enabled (recover)
- 3 = Error while opening file (fatal)
- 4 = Unexpected messagebox was displayed (recover)
- 5 = Unsatisfied dependencies dialog was displayed (fatal)
- 6 = Expected license dialog is missing (recover)
- 7 = Unexpected license dialog is displayed (fatal)
- 8 = Unknown error / did not return to extension manager (fatal)
- 9 = Extension not found (test on filesystem level)
Description:
- Verify that the path to the extension is correct on filesystem level
- Open the Extension Manager
- Click the "Add" button
- Enter the path to the extension, click "Open"
- Check for errormessages
- Check for unsatisfied dependencies
- Check for software license agreement
- Expected license exists (good)
- Expected license does not exist (bad)
- License exists but was not expected (bad)
- License does not exist and was not expected (good)
- The progressbar is still open, wait until it is closed
- Verify that we are back on the Extension Manager GUI
- Close the Extension Manager
extension_manager_tools.inc: function hExtensionRemoveGUI( cExtensionName as string ) as integer
|
Remove an extension via Extension Manager
This function removes a package/an extension by name.
It will notify about errorconditions such as non existing packages,
errors during removal etc.
Some errors are considered fatal, others are recovered. If the error
is non-fatal, the function returns to the document it started from
The function will do printlogs but no warnings so you must evaluate
the returncode and you must clean up manually
Starting point is any document or backing window, the function will return
to the starting point if possible
Input value(s):
- UI Name of the extension (string)
Return Value:
- Errorcode (integer)
- 0 = No errors, extension was removed
- 1 = Failure to open Extension Manager (fatal)
- 2 = Cannot delete found extension, remove-button is disabled (fatal)
- 3 = The extension was not found (non-fatal)
Description:
- Open the Extension Manager
- Expand "My packages"
- Find out how many extensions are listed below "My packages"
- Locate the extension and delete it if found
- Close the Extension Manager
extension_manager_tools.inc: function sExtensionCLI(sCommand as string, sExtensionName as string, optional sExtensionPath as string) as string
|
Add/remove an extension with the command line tool 'unopkg'///'
INPUT: sCommand: string of command from "add remove list reinstall" ///'
INPUT: sExtensionName: name of the extension ///'
INPUT: optional sExtensionPath: path to the extension ///'
RETURN: currently nothing ///'
extension_manager_tools.inc: function hExtensionGetItemList( cItemList() as string ) as integer
|
Get the list of all items in the extensions list
The array contains the list of all items in the extension manager GUI,
including all components of the extensions. Consider this when defining
the size of the array to be passed to this function as problems here are
hard to debug.
Starting point is any document, the function will return to the
calling document on completion
Input:
- Array for the list items (string)
Return Value:
- Number of items (integer)
- 0 on any error
- 2 if no extensions exist (My Macros/OpenOffice.org macros nodes present
- > 2 if any changes to the default exist
Description:
- Open the Extension Manager via UNO slot
- Check that it is open, if not: Abort
- Get the number of items in the extension manager treelist
- Retrieve the item names
- Close Extension Manager
extension_manager_tools.inc: function hSelectExtensionID( iPos as integer ) as string
|
Select an item by index in the list of available extensions
This function needs the Extension Manager to be open. It will only
select extensions but not their components.
Input:
- Absolute position of the extension to be selected (Integer)
Return Value:
- Name of the selected extension (String)
- Empty string on error (index out of range)
Description:
- Expand the shared extensions node
- Expand "My Extensions"
- Step through the treelist until the desired item has been found
- Retrieve the name of the selected extension
extension_manager_tools.inc: function hSelectExtensionName( cName as string ) as integer
|
Select an item by name in the list of available extensions
This function needs the Extension Manager to be open. It will only
select extensions but not their components.
Input:
- Name of the extension (String)
- Name of any item in the treelist, even those of top nodes
Return Value:
- Absolute position of the selected extension (Integer)
- 0 = Extension was not found
- > 0 = Absolute position of the extension/node
Description:
- Expand the shared extensions node
- Expand "My Extensions"
- Retrieve the number of listed nodes
- Step through the treelist until the desired item has been found
- Retrieve the absolute position of the selected extension
extension_manager_tools.inc: function hSelectOptionsItem( cName as string, iIndex as integer ) as integer
|
Select an item in Tools/Options and verify
You need to open the Tools/Options dialog before using this function,
it will not close the dialog either. No warnlogs are printed so evaluation
of the return value is mandatory
Parameter(s):
- Name of the extension node (string)
- Name of the module
- Name of the leaf
- Node must be valid
- Position of the node (absolute) (integer)
- All nodes are expanded
- Position must be valid (> 0 and ≤ number of nodes in list)
Returns:
- Errorcondition (integer)
- 0 = Success
- 1 = Partial success - node is at wrong position
- 2 = Node does not exist
- 3 = Dialog not open
- 4 = Index out of range (incorrect call to function)
Description:
- Make sure we are on the Tools/Options dialog
- Expand all nodes on "OptionsListe"
- Search for the node at the given index, handle errors, exit function
extension_manager_tools.inc: function hIsExtensionAlreadyInstalled( cName as string ) as boolean
|
Check if an extension is already installed
The function opents the Extension Manager, finds (or not) the extension
and returns an appropriate return value. The Extension Manager is
closed again at the end.
Input:
- Name of the extension (String)
Return Value:
- is the extension allredy installed (boolean)
- false = Extension is not installed
- true = Extension is installed
Description:
- Open ToolsExtensionManager
- Check if hSelectExtensionName returns 0, if so return false otherwise return true
- Close the Extension Manager with OK
extension_manager_tools.inc: function hDisableUserExtensionGUI( extension_name as string ) as integer
|
Disable a userspace extension by name via GUI
This function tries to disable an Extension specified by name. There
are several reasons why this might fail so it is required to evaluate the
returnvalue as the function will not print any warnings. If the function
fails this is most likely caused by a) the extension already being
disabled or b) the extension belonging to the shared layer.
The Extension Manager needs to be open when function is called.
Parameter(s):
- Name of the extension to be disabled (string)
- Only extensions from the user layer can be disabled
Returns:
- Errorcondition (integer)
- 0 = Extension was found and disabled
- 1 = Extension does not exist
- 2 = Extension could not be disabled
Description:
- Open Tools/Extension Manger
- Find the extension, if not found return 1
- Try to disable the extension, if not possible return 2
- Close the Extension Manager
- Trying to execute .close() which might be blocked by the progress bar
extension_manager_tools.inc: function hExpandExtensionTreeGUI() as integer
|
Expand the top nodes in the extension tree
This function expands the two default nodes in the Extension manager
"OpenOffice.org Extensions" and "My Extensions"
so all installed extensions but not their components are visible.
The Extension Manager has to be open when calling this function.
Parameter(s):
- No input parameters
Returns:
- Number of extensions listed after the top nodes have been expanded
- 0 : any error (Reserved, currently unused)
- > 0 : Number of visible nodes
Description:
- Expand the shared extensions node
- Expand "My Extensions"
- Retrieve the number of currently visible nodes