Hi,
I used below two OOo Macro procedures to create and delete an empty custom
Toolbar.
At first, I create the Toolbar, and then delete it. In Calc UI, an empty
Toolbar will
appear and then disappear.
but Next, I create the toolbar, and then delete it again. the custom
Toolbar
still in there. that because oModuleCfgMgr.hasSettings( sToolbar ) return
false.
And I checked "oBasicWindowState", when custom Toolbar first be inserted,
name
"private:resource/toolbar/custom_toolbar" be register correctly, but when I
add
the custom Toolbar again, is do not exist in "oBasicWindowState".
Is this a bug? or does the Macro is misused?
thanks.
Jiao Jianhua
Sub NewCustBar
sToolbar = "private:resource/toolbar/custom_toolbar"
oModuleCfgMgrSupplier = createUnoService("
com.sun.star.ui.ModuleUIConfigurationManagerSupplier")
oModuleCfgMgr = oModuleCfgMgrSupplier.getUIConfigurationManager( "
com.sun.star.sheet.SpreadsheetDocument" )
oToolbarSettings = oModuleCfgMgr.createSettings()
oToolbarSettings.UIName = "My little custom toolbar"
sString = "My Macro's"
REM *** Set the settings for our new empty custom toolbar.
(replace/insert)
if ( oModuleCfgMgr.hasSettings( sToolbar )) then
oModuleCfgMgr.replaceSettings( sToolbar, oToolbarSettings )
else
oModuleCfgMgr.insertSettings( sToolbar, oToolbarSettings )
endif
End Sub
Sub RemoveCustBar
sToolbar = "private:resource/toolbar/custom_toolbar"
sModuleIdentifier = "com.sun.star.sheet.SpreadsheetDocument"
oModuleCfgMgrSupplier = createUnoService("
com.sun.star.ui.ModuleUIConfigurationManagerSupplier")
oModuleCfgMgr = oModuleCfgMgrSupplier.getUIConfigurationManager( "
com.sun.star.sheet.SpreadsheetDocument" )
oWindowState = createUnoService("
com.sun.star.ui.WindowStateConfiguration")
oBasicWindowState = oWindowState.getByName( sModuleIdentifier )
if ( oModuleCfgMgr.hasSettings( sToolbar )) then
oModuleCfgMgr.removeSettings( sToolbar, oToolbarSettings )
'oModuleCfgMgr.store()
endif
if oBasicWindowState.hasByName( sToolbar ) then
oBasicWindowState.removeByName( sToolbar )
end if
End Sub
--
\*
Study...
*/