Andrew Douglas Pitonyak wrote:
Carsten Driesner wrote:
Andrew Douglas Pitonyak wrote:

I have been documenting all of this...
I must remove the "window state" using "configuration access". <sigh>

Hi Andrew,

On the first look this may seem to be complicated, but we chose to use two different configurations to store different aspects of a toolbar. The content of the toolbar is stored in the UI configuration, the state of the toolbar in the OpenOffice.org configuration. The content of a toolbar can also be stored in a document (something the OpenOffice.org configuration is not able to do).

Do you need help how to access the window state using the configuration access? One more question, what toolbar setting do you want to remove (what's the name of the toolbar)?

Regards,
Carsten
Yes, I could use a simple example that demonstrates how to remove a toolbar that I create. I found this problem because I removed the settings, and then I could no longer insert them again and they were not there. If I know how to remove them from the configuration access, this would help.
Hi Andrew,

No problem at all. Please have a look at the following code snippet which removes the configuration settings for toolbar and the window state entry from the configuration.

REM  *****  BASIC  *****

Sub Main
    REM *** Removes a custom toolbar persistently from the Basic IDE

    REM *** The name of the custom toolbar. A custom toolbar name MUST
    REM *** start with "custom_"!
    sToolbar = "private:resource/toolbar/custom_toolbar"
    sBasicIDEModuleIdentifier = "com.sun.star.script.BasicIDE"
        
REM *** Retrieve the module configuration manager from central module configuration manager supplier oModuleCfgMgrSupplier = createUnoService("com.sun.star.ui.ModuleUIConfigurationManagerSupplier")

REM *** Retrieve the module configuration manager with the module identifier
    REM *** See com.sun.star.frame.ModuleManager for more information
oModuleCfgMgr = oModuleCfgMgrSupplier.getUIConfigurationManager( "com.sun.star.script.BasicIDE" )

    REM *** Create single window state service
oWindowState = createUnoService("com.sun.star.ui.WindowStateConfiguration")

    REM *** Retrieve the window state configuration for the Basic IDE
oBasicWindowState = oWindowState.getByName( sBasicIDEModuleIdentifier )
        
    REM *** Remove the settings for our custom toolbar.
    if ( oModuleCfgMgr.hasSettings( sToolbar )) then
        oModuleCfgMgr.removeSettings( sToolbar, oToolbarSettings )
        oModuleCfgMgr.store()
    endif

    REM *** Remove the window state settings for our custom toolbar
    if oBasicWindowState.hasByName( sToolbar ) then
        oBasicWindowState.removeByName( sToolbar )
    end if
End Sub

If you have problems or questions don't hesitate to ask.

Regards,
Carsten

--
Carsten Driesner (cd) - Project Lead OpenOffice.org Framework
Framework wiki: http://wiki.services.openoffice.org/wiki/Framework
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to