How to get localize label of toolbar and toolbars items

View: New views
3 Messages — Rating Filter:   Alert me  

How to get localize label of toolbar and toolbars items

by Анисимов Александр :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.

Thank you in advance for your kind reply

--
--
.''`.   With best regards,
: :' :  Alexander Anisimov
`. `'   JID alexanis@...
   `-   Debian - when you have better things to do than fixing systems

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: How to get localize label of toolbar and toolbars items

by Carsten Driesner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: How to get localize label of toolbar and toolbars items

by Анисимов Александр :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Carsten,

Thank a lot for your answer. It's very helpful :)

--
--
.''`.   With best regards,
: :' :  Alexander Anisimov
`. `'   JID alexanis@...
   `-    Debian - when you have better things to do than fixing systems

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...