Alexander Anisimov wrote:
Hello,

I try to get localize label of toolbar. According to
http://api.openoffice.org/docs/common/ref/com/sun/star/ui/UIElementSettings.html
I need to get UIName property.

[code]
XUIConfigurationManager xuicm =
getModuleUIConfigurationManager("com.sun.star.text.TextDocument");
XIndexAccess xia = xuicm.getSettings(ToolBars.StandardBar, true);
XPropertySet xps = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, xia);
String UIName = (String) xps.getPropertyValue("UIName");
[/code]

But UIName is empty. Label of toolbar items is empty too. I could I get it.
Hi Alexander,

The properties you have found are reserved for user defined strings only. The default values can be found in the configuration. There are two services which provides you this information. Please have a look at the following Basic code.

----

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

Sub Main
        REM *** Retrieve localized toolbar name and command label
        sModuleName  = "com.sun.star.sheet.SpreadsheetDocument"
        sToolbarName = "private:resource/toolbar/standardbar"
        sCommand     = ".uno:Open"
        
        REM *** Create central service for window states
        oWindowState = 
createUnoService("com.sun.star.ui.WindowStateConfiguration")
        
        REM *** Retrieve our module window state object ( Calc )
        oCalcWindowState = oWindowState.getByName( sModuleName )
        
        REM *** Retrieve window collection for our module (Calc)
        oToolbarProps = oCalcWindowState.getByName( sToolbarName )

        for j = 0 to ubound( oToolbarProps )
                if oToolbarProps(j).Name = "UIName" then
                        sUIName = oToolbarProps(j).Value
                endif
        next j
        
oCommandService = createUnoService("com.sun.star.frame.UICommandDescription")
        oCalcCommands = oCommandService.getByName( sModuleName )
        oCommandProps = oCalcCommands.getByName( sCommand )
        
        for j = 0 to ubound( oCommandProps )
                if oCommandProps(j).Name = "Label" then
                        sLabel = oCommandProps(j).Value
                endif
        next j
                
        msgbox "Toolbar label localized: "+sUIName
        msgbox "Command ("+sCommand+") label localized: "+sLabel
        
End Sub


Regards,
Carsten

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to