# How to change toolbar icon back to text?

Running LibreOffice version 5.3.4.2

Step-1: I created a macro and then added it to the formatting toolbar. The macro displayed on the toolbar as the text name I gave the macro. So far so good.

Step-2: I then used the customize function to "Change icon" which associated an icon to the macro. The icon is displayed on the toolbar instead of the text name which is what I wanted.

(Have to use small icons for the icon to display. This is a bug that needs to be fixed. The icons should display in the other icon sizes as well.)

Now I decided that I don't want the icon and want the macro's name to display as in step-1. I can't find a way to delete the icon using the customize function. Even if I remove the macro from the toolbar and then add it to the toolbar, LibreOffice remembers the icon I used in step-2 so displays that icon instead of the macro's name.

How can I change the toolbar icon back to the macro's name displayed as text?

edit retag close merge delete

Sort by » oldest newest most voted

Hello @Raptor88,

To display Text only for your commandbutton, do:

1. Choose the menu "Tools : Customize...",
2. Select the tab "Toolbars",
3. Select the "Formatting" Toolbar ( where your macro button is ),
4. In the "Commands" listbox, select your macro button,
5. In the option list called "Style", select "Text".

For older version:

5, click on the button called "Toolbar", in the menu that pops up, select the item "Text only".

EDIT 2017-07-20

In order to delete your icon from your macro command, you could try the following approach:

Using the Image Manager from a component's UIConfigurationManager, you can associate a particular icon with a particular Command such as a Dispatch URI or a macro from your library. This associated icon is then automatically shown whenever that particular Command gets shown in the GUI.

In your case the icon is associated to a Macro, so its Command string would look something like : "vnd.sun.star.script:Library.Module.Macro?language=Basic&location=document".

To find out which of your macros have an icon associated to them in the current Component, you could inspect the result of getMacroIconNames( 0 ). If it contains your macro, then you can remove its associated icon by calling removeCommandIcon( 0, <your macro> ).

NB. this works for the current Office Module ( Base, Writer, Calc, etc ), if you run this macro from another Office Module, it gives different results.

Function getMacroIconNames( iImageType as Integer )
REM Returns an Array with Strings representing all Macros which have an icon associated with them ( From the current Component ).
REM iImageType: Short of type com.sun.star.ui.ImageType. ( 0=Default Size and Normal Contrast; 1=Big Size; 4=High Contrast )
Const sMacroURIHeader As String = "vnd.sun.star.script:"
Dim aMacroIconNames() As String, aAllIconNames() As String, sCommand\$, i%
aAllIconNames = getImageManager.getAllImageNames( iImageType )
For i = 0 To uBound( aAllIconNames )
sCommand = aAllIconNames( i )
ReDim Preserve aMacroIconNames( uBound( aMacroIconNames ) + 1 )
aMacroIconNames( uBound( aMacroIconNames ) ) = sCommand
End If
Next
getMacroIconNames = aMacroIconNames
End Function

Function getImageManager()
REM Returns the ImageManager for the current Office Module ( Writer, Base, etc ).
Dim oModuleMgr, oModuleCfgMgrSupplier, oModuleIdentifier, oModuleCfgMgr
oModuleMgr = createUnoService( "com.sun.star.frame.ModuleManager" )
oModuleCfgMgrSupplier = createUnoService( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" )
oModuleIdentifier = oModuleMgr.identify( ThisComponent )
oModuleCfgMgr = oModuleCfgMgrSupplier.getUIConfigurationManager( oModuleIdentifier )
getImageManager = oModuleCfgMgr.ImageManager
End Function

Sub removeCommandIcon( iImageType as Integer, strCommand as String )
REM Removes the graphic icon associated with the specified Command.
REM iImageType: Short of type com.sun.star.ui.ImageType. ( 0=Default; 0=Normal; 1=Big; 4=High Contrast )
REM strCommand: URI of a Command that has an associated icon to be removed from it.
On Local Error Resume Next
Dim oImageManager
oImageManager = getImageManager()
oImageManager.removeImages( iImageType, Array( strCommand ) )
oImageManager.store()
End Sub

more

Hi librebel, Thanks so much for taking the time to help. The procedure you posted is a bit too much for me. I've decided to rename my LibreOffice user profile. This forced LibreOffice to create a new user profile and it does not have any of my macros in it.

So I'm going to re-create all of my macros and make sure this time to not change the text names to icons. Easier for me, though is time consuming and a a PITA.

I wonder if OpenOffice has these same two "macro icons on the toolbar" bugs?

( 2017-07-20 11:43:45 +0200 )edit

Hi librebei,

Thanks for your reply. When I click the "Toolbar" button, I only see two options Rename and Delete, both are grayed out.

Here's what I'm seeing:

Thanks.

EDIT: Had to post as an answer to include the picture. Posting as comment doesn't allow including a picture.

.........................................................

To try to remove the icon for my macro from the toolbar, I deleted the macro. Then went to toolbar customize and removed the icon.

Created a new macro that did the same thing with the same name. Unbelievably, the toolbar icon was reassigned to the new macro. LibreOffice must store the icon associated with a macro name someplace and that association cannot be deleted even if the macro is deleted.

It appears that the only way to delete the toolbar icon association with a macro name is to delete the user profile for LibreOffice. When Writer is opened again, it creates a new user profile as if it is a fresh install. Then re-enter all of the macros again AND NEVER CREATE AN ICON ON A TOOLBAR FOR A MACRO IF THE MACRO NAME IS DESIRED.

Appears to be another bug for icons on the toolbar:

Bug-1: Toolbar icons must be set to "small" to display icons assigned to a macro on the toolbar.

Bug-2: There is no way to delete an icon for a macro name, in order to display the macro name instead of the icon, when small icons are selected. The macro name will display if "Automatic" or "Large" icons is selected which is because of Bug-1.

Seeing as how LibreOffice is free, I can't complain about these two bugs that I found. But I sure wish they would be fixed, or someone tells me how to do what I want.

Raptor88

more

Hello @Raptor88,

i can see in the image above there are 3 Style options just under the Toolbar listbox ( moved after Version 5.2.2.2 ) .. just click on the option "Text".

If there is an association between a particular icon and a particular command, it could be found and deleted using the ImageManager. Looking into that now...

( 2017-07-20 03:35:52 +0200 )edit

( 2017-07-20 06:45:17 +0200 )edit

-librebel said: i can see in the image above there are 3 Style options just under the Toolbar listbox ( moved after Version 5.2.2.2 ) .. just click on the option "Text".

-Raptor88 said: Clicking on that "Text" option changes all of the icons in the toolbar to text. I just want to change the icon assigned to my macro, to text. Thanks.

( 2017-07-20 11:36:16 +0200 )edit