How to remove custom toolbar?

Creating a macro - Writing a Script - Using the API

How to remove custom toolbar?

Postby grnhorn » Thu Aug 14, 2008 12:09 am

I am looking for a macro to remove a custom toolbar created by macro for BasicIDE. Every time I try it, it removes the bar, but I can't put it back without completely closing and reopening OO.

Thanks...
OOo 2.4.X on Ms Windows XP
grnhorn
 
Posts: 32
Joined: Sun Jul 13, 2008 2:07 pm

Re: How to remove custom toolbar?

Postby foxcole » Thu Aug 21, 2008 11:12 pm

grnhorn wrote:I am looking for a macro to remove a custom toolbar created by macro for BasicIDE. Every time I try it, it removes the bar, but I can't put it back without completely closing and reopening OO.

Hello, grnhorn.

Please help me understand your question... What do you mean by "every time I try it"---what are you trying, exactly? And if you're trying to remove the bar, why do you want to put it back? I'm confused.
Cheers!
---Fox

OOo 3.2.0 Portable, Windows 7 Home Premium 64-bit
User avatar
foxcole
Volunteer
 
Posts: 1507
Joined: Mon Oct 08, 2007 1:31 am
Location: Minneapolis, Minnesota

Re: How to remove custom toolbar?

Postby grnhorn » Thu Aug 21, 2008 11:45 pm

The following code will allow the installation of a toolbar for basicIDE, but if the toolbar is removed by code, it cannot be reinstalled. The reinstallation puts residue on the toolbar. Please run to see. Line use to remove tool bar is just above 'End Sub'.

Code: Select all   Expand viewCollapse view
Sub Main
   REM *** Creates a new custom toolbar persistently for the Basic IDE
   
   REM *** The name of our new custom toolbar. A custom toolbar name MUST
   REM *** start with "custom_"!
   sToolbar = "private:resource/toolbar/custom_toolbar"
   
   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 a settings container which will define the structure of our new
   
   REM *** custom toolbar.
   oToolbarSettings = oModuleCfgMgr.createSettings()
   
   REM *** Set a title for our new custom toolbar
   oToolbarSettings.UIName = "My little custom toolbar"
   
   REM *** Create a button for our new custom toolbar
   sString = "My Macro's"
REM This line of code does not work...
   oToolbarItem = CreateToolbarItem( "macro:///Standard.Module1.Test()", "Standard.Module1.Test" )
   oToolbarSettings.insertByIndex( nCount, oToolbarItem )
   
   REM *** Set the settings for our new custom toolbar. (replace/insert)
   if ( oModuleCfgMgr.hasSettings( sToolbar )) then
      oModuleCfgMgr.replaceSettings( sToolbar, oToolbarSettings )
   else
      oModuleCfgMgr.insertSettings( sToolbar, oToolbarSettings )
   endif

REM Line to remove toolbar:
'       oModuleCfgMgr.insertSettings( sToolbar, oToolbarSettings )

End Sub
OOo 2.4.X on Ms Windows XP
grnhorn
 
Posts: 32
Joined: Sun Jul 13, 2008 2:07 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 8 guests