[api-dev] Are there changes to the resourceURL 's ?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[api-dev] Are there changes to the resourceURL 's ?

Fernand Vanrie
I trie to remove some buttons on the standard Toolbar

I found some BASIC code made by Andrew Pitonyack,  but i run in a error,
saying that  "private:resource/toolbar/standardbar" is no valid element
for settings in the UIConfigurationManager

Please try this simple code from in a writerdoc

  oDoc = ThisComponent

    iToolType = com.sun.star.ui.UIElementType.TOOLBAR

    oFrame = oDoc.getCurrentController().getFrame()
    oCfgManager = oDoc.getUIConfigurationManager()
    oToolInfo = oCfgManager.getUIElementsInfo( iToolType )
    For Each x in oFrame.LayoutManager.getElements()
    print x.ResourceURL
   REM private:resource/toolbar/standardbar" is prentent
      stoolbar = "private:resource/menubar/menubar"
       if x.ResourceURL = sToolBar Then

          oImageMgr = oCfgManager.getImageManager()
          xray oCfgManager

          oToolbarSettings = oCfgManager.getSettings(sToolbar, true)
REM here i hot the erro that there is no
"private:resource/menubar/menubar"to use for setting  ????
        end if



Thanks for any hint !

Fernand
Reply | Threaded
Open this post in threaded view
|

Re: [api-dev] Are there changes to the resourceURL 's ?

Ariel Constenla-Haile
Hello Fernand,

On Tuesday 21 December 2010, 14:42, Fernand Vanrie wrote:
> I trie to remove some buttons on the standard Toolbar
>
> I found some BASIC code made by Andrew Pitonyack,  but i run in a error,
> saying that  "private:resource/toolbar/standardbar" is no valid element
> for settings in the UIConfigurationManager

your code below checks for "private:resource/menubar/menubar"
Obviously, if you ask for info about com.sun.star.ui.UIElementType.TOOLBAR,
there won't be MenuBar info!

> Please try this simple code from in a writerdoc
>
>   oDoc = ThisComponent
>
>     iToolType = com.sun.star.ui.UIElementType.TOOLBAR
>
>     oFrame = oDoc.getCurrentController().getFrame()
>     oCfgManager = oDoc.getUIConfigurationManager()
>     oToolInfo = oCfgManager.getUIElementsInfo( iToolType )
>     For Each x in oFrame.LayoutManager.getElements()
>     print x.ResourceURL
>    REM private:resource/toolbar/standardbar" is prentent
>       stoolbar = "private:resource/menubar/menubar"
this is the resource URL for the MenuBar!
May be a copy & paste mistake.


Regards
--
Ariel Constenla-Haile
La Plata, Argentina

signature.asc (853 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [api-dev] Are there changes to the resourceURL 's ?

Fernand Vanrie
  Ariel ,

Stupit me :-)

not a typo, just the wrong copy of one of my  tests
The problem is still there

  oFrame = oDoc.getCurrentController().getFrame()
    oCfgManager = oDoc.getUIConfigurationManager()
    oToolInfo = oCfgManager.getUIElementsInfo( iToolType )
sToolbar = "private:resource/toolbar/standardbar"
    For Each x in oFrame.LayoutManager.getElements()
          if x.ResourceURL = sToolBar Then

  rem the Resource is here

       oImageMgr = oCfgManager.getImageManager()
          oToolbarSettings = oCfgManager.getSettings(sToolbar, true)

but no settings  for "private:resource/toolbar/standardbar"
i get a error error: com.sun.star.container.NosuchElement exception
when not starting with "private:resource/toolbar/" then is get a
iIlegalArgumentexception so it must start with private:resource/toolbar/
but why is "standardbar" not present ??

where can i find the right resourceURL's ?

fernand

> Hello Fernand,
>
> On Tuesday 21 December 2010, 14:42, Fernand Vanrie wrote:
>> I trie to remove some buttons on the standard Toolbar
>>
>> I found some BASIC code made by Andrew Pitonyack,  but i run in a error,
>> saying that  "private:resource/toolbar/standardbar" is no valid element
>> for settings in the UIConfigurationManager
> your code below checks for "private:resource/menubar/menubar"
> Obviously, if you ask for info about com.sun.star.ui.UIElementType.TOOLBAR,
> there won't be MenuBar info!
>
>> Please try this simple code from in a writerdoc
>>
>>    oDoc = ThisComponent
>>
>>      iToolType = com.sun.star.ui.UIElementType.TOOLBAR
>>
>>      oFrame = oDoc.getCurrentController().getFrame()
>>      oCfgManager = oDoc.getUIConfigurationManager()
>>      oToolInfo = oCfgManager.getUIElementsInfo( iToolType )
>>      For Each x in oFrame.LayoutManager.getElements()
>>      print x.ResourceURL
>>     REM private:resource/toolbar/standardbar" is prentent
>>        stoolbar = "private:resource/menubar/menubar"
> this is the resource URL for the MenuBar!
> May be a copy&  paste mistake.
>
>
> Regards


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

Reply | Threaded
Open this post in threaded view
|

Re: [api-dev] Are there changes to the resourceURL 's ?

Ariel Constenla-Haile
Hello Fernand,

On Tuesday 21 December 2010, 16:42, Fernand Vanrie wrote:

>   Ariel ,
>
> Stupit me :-)
>
> not a typo, just the wrong copy of one of my  tests
> The problem is still there
>
>   oFrame = oDoc.getCurrentController().getFrame()
>     oCfgManager = oDoc.getUIConfigurationManager()
>     oToolInfo = oCfgManager.getUIElementsInfo( iToolType )
> sToolbar = "private:resource/toolbar/standardbar"
>     For Each x in oFrame.LayoutManager.getElements()
>           if x.ResourceURL = sToolBar Then
>
>   rem the Resource is here
>
>        oImageMgr = oCfgManager.getImageManager()
>           oToolbarSettings = oCfgManager.getSettings(sToolbar, true)
>
> but no settings  for "private:resource/toolbar/standardbar"
> i get a error error: com.sun.star.container.NosuchElement exception
> when not starting with "private:resource/toolbar/" then is get a
> iIlegalArgumentexception so it must start with private:resource/toolbar/
> but why is "standardbar" not present ??
you can not take for granted that the standard toolbar is named standardbar in
every module.
For example, in OOo Base it's named toolbar


> where can i find the right resourceURL's ?

you have to look at the basis layer of your office installation:
<ROOT>/openoffice.org/basis3.4/share/config/soffice.cfg/modules/
there you have a folder for each module.
Inside every folder, you have another folder for each UIElelemt type (well,
only menubar, statusbar and toolbar at the moment).

For example,
<ROOT>/openoffice.org/basis3.4/share/config/soffice.cfg/modules/dbapp/toolbar/toolbar.xml
has for resource URL "private:resource/toolbar/toolbar"
The resource URL is formed following the pattern
private:resource/TYPE/file_name_no_xml_extension

Another example:
<ROOT>/openoffice.org/basis3.4/share/config/soffice.cfg/modules/dbapp/toolbar/reportobjectbar.xml
is "private:resource/toolbar/reportobjectbar"


Regards
--
Ariel Constenla-Haile
La Plata, Argentina

signature.asc (853 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [api-dev] Are there changes to the resourceURL 's ?

Fernand Vanrie
Ariel ,

Thanks for this extended explaination, now i now where to look and go.

But no the namings are correct, and the relevant to the xml files in the
places you told.

the code start with making a emnumration for the resourceURL's par module:

For Each x in oFrame.LayoutManager.getElements()>>  gives me all the correct ResourceURL's

then is choose manualy the right one, in my case "private:resource/toolbar/standardbar"

then i follow the code and

oToolbarSettings = oCfgManager.getSettings("private:resource/toolbar/standardbar", true)

gives me the error that there is no such element in the container ??

so what is the resourceURL for oCfgManager.getSettings( "private:resource/toolbar/standardbar" , true)

the DEVguide says:

a resource URL which identifies the user interface element. A resourcce URL must
meet the following syntax: "private:resource/$type/$name. It is only allowed to
use ascii characters for type and name.

here $type = "toolbar" and $name = "standardbar"

smiles like a bug (i run OOO330m17 on Windows)

Fernand


> Hello Fernand,
>
> On Tuesday 21 December 2010, 16:42, Fernand Vanrie wrote:
>>    Ariel ,
>>
>> Stupit me :-)
>>
>> not a typo, just the wrong copy of one of my  tests
>> The problem is still there
>>
>>    oFrame = oDoc.getCurrentController().getFrame()
>>      oCfgManager = oDoc.getUIConfigurationManager()
>>      oToolInfo = oCfgManager.getUIElementsInfo( iToolType )
>> sToolbar = "private:resource/toolbar/standardbar"
>>      For Each x in oFrame.LayoutManager.getElements()
>>            if x.ResourceURL = sToolBar Then
>>
>>    rem the Resource is here
>>
>>         oImageMgr = oCfgManager.getImageManager()
>>            oToolbarSettings = oCfgManager.getSettings(sToolbar, true)
>>
>> but no settings  for "private:resource/toolbar/standardbar"
>> i get a error error: com.sun.star.container.NosuchElement exception
>> when not starting with "private:resource/toolbar/" then is get a
>> iIlegalArgumentexception so it must start with private:resource/toolbar/
>> but why is "standardbar" not present ??
> you can not take for granted that the standard toolbar is named standardbar in
> every module.
> For example, in OOo Base it's named toolbar
>
>
>> where can i find the right resourceURL's ?
> you have to look at the basis layer of your office installation:
> <ROOT>/openoffice.org/basis3.4/share/config/soffice.cfg/modules/
> there you have a folder for each module.
> Inside every folder, you have another folder for each UIElelemt type (well,
> only menubar, statusbar and toolbar at the moment).
>
> For example,
> <ROOT>/openoffice.org/basis3.4/share/config/soffice.cfg/modules/dbapp/toolbar/toolbar.xml
> has for resource URL "private:resource/toolbar/toolbar"
> The resource URL is formed following the pattern
> private:resource/TYPE/file_name_no_xml_extension
>
> Another example:
> <ROOT>/openoffice.org/basis3.4/share/config/soffice.cfg/modules/dbapp/toolbar/reportobjectbar.xml
> is "private:resource/toolbar/reportobjectbar"
>
>
> Regards


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

Reply | Threaded
Open this post in threaded view
|

Re: [api-dev] <SOLVED>Are there changes to the resourceURL 's ?

Fernand Vanrie
Ariel,

found a work arround due to a other peace of code from the famous
"ms777"  who is  gui anyway a Sun engineer ?
  oEL =
oFrame.LayoutManager.getElement("private:resource/toolbar/standardbar")
this ellement is found
and now "oEL.getsettings(true)" works like a charm

Thanks anyway for the help and explanations

Fernand

Sould I  life a   issue for the  first approach ?

> Ariel ,
>
> Thanks for this extended explaination, now i now where to look and go.
>
> But no the namings are correct, and the relevant to the xml files in
> the places you told.
>
> the code start with making a emnumration for the resourceURL's par
> module:
>
> For Each x in oFrame.LayoutManager.getElements()>>  gives me all the
> correct ResourceURL's
>
> then is choose manualy the right one, in my case
> "private:resource/toolbar/standardbar"
>
> then i follow the code and
>
> oToolbarSettings =
> oCfgManager.getSettings("private:resource/toolbar/standardbar", true)
>
> gives me the error that there is no such element in the container ??
>
> so what is the resourceURL for oCfgManager.getSettings(
> "private:resource/toolbar/standardbar" , true)
>
> the DEVguide says:
>
> a resource URL which identifies the user interface element. A
> resourcce URL must
> meet the following syntax: "private:resource/$type/$name. It is only
> allowed to
> use ascii characters for type and name.
>
> here $type = "toolbar" and $name = "standardbar"
>
> smiles like a bug (i run OOO330m17 on Windows)
>
> Fernand
>
>
>> Hello Fernand,
>>
>> On Tuesday 21 December 2010, 16:42, Fernand Vanrie wrote:
>>>    Ariel ,
>>>
>>> Stupit me :-)
>>>
>>> not a typo, just the wrong copy of one of my  tests
>>> The problem is still there
>>>
>>>    oFrame = oDoc.getCurrentController().getFrame()
>>>      oCfgManager = oDoc.getUIConfigurationManager()
>>>      oToolInfo = oCfgManager.getUIElementsInfo( iToolType )
>>> sToolbar = "private:resource/toolbar/standardbar"
>>>      For Each x in oFrame.LayoutManager.getElements()
>>>            if x.ResourceURL = sToolBar Then
>>>
>>>    rem the Resource is here
>>>
>>>         oImageMgr = oCfgManager.getImageManager()
>>>            oToolbarSettings = oCfgManager.getSettings(sToolbar, true)
>>>
>>> but no settings  for "private:resource/toolbar/standardbar"
>>> i get a error error: com.sun.star.container.NosuchElement exception
>>> when not starting with "private:resource/toolbar/" then is get a
>>> iIlegalArgumentexception so it must start with
>>> private:resource/toolbar/
>>> but why is "standardbar" not present ??
>> you can not take for granted that the standard toolbar is named
>> standardbar in
>> every module.
>> For example, in OOo Base it's named toolbar
>>
>>
>>> where can i find the right resourceURL's ?
>> you have to look at the basis layer of your office installation:
>> <ROOT>/openoffice.org/basis3.4/share/config/soffice.cfg/modules/
>> there you have a folder for each module.
>> Inside every folder, you have another folder for each UIElelemt type
>> (well,
>> only menubar, statusbar and toolbar at the moment).
>>
>> For example,
>> <ROOT>/openoffice.org/basis3.4/share/config/soffice.cfg/modules/dbapp/toolbar/toolbar.xml
>>
>> has for resource URL "private:resource/toolbar/toolbar"
>> The resource URL is formed following the pattern
>> private:resource/TYPE/file_name_no_xml_extension
>>
>> Another example:
>> <ROOT>/openoffice.org/basis3.4/share/config/soffice.cfg/modules/dbapp/toolbar/reportobjectbar.xml
>>
>> is "private:resource/toolbar/reportobjectbar"
>>
>>
>> Regards
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]


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

Reply | Threaded
Open this post in threaded view
|

Re: [api-dev] Are there changes to the resourceURL 's ?

Carsten Driesner-3
In reply to this post by Fernand Vanrie
On 22.12.2010 10:25, Fernand Vanrie wrote:

> Ariel ,
>
> Thanks for this extended explaination, now i now where to look and go.
>
> But no the namings are correct, and the relevant to the xml files in the
> places you told.
>
> the code start with making a emnumration for the resourceURL's par module:
>
> For Each x in oFrame.LayoutManager.getElements()>> gives me all the
> correct ResourceURL's
>
> then is choose manualy the right one, in my case
> "private:resource/toolbar/standardbar"
>
> then i follow the code and
>
> oToolbarSettings =
> oCfgManager.getSettings("private:resource/toolbar/standardbar", true)
>
> gives me the error that there is no such element in the container ??
>
> so what is the resourceURL for oCfgManager.getSettings(
> "private:resource/toolbar/standardbar" , true)
>
> the DEVguide says:
>
> a resource URL which identifies the user interface element. A resourcce
> URL must
> meet the following syntax: "private:resource/$type/$name. It is only
> allowed to
> use ascii characters for type and name.
>
> here $type = "toolbar" and $name = "standardbar"
>
> smiles like a bug (i run OOO330m17 on Windows)

Hi Fernand,

This is not a bug but you use the wrong UI configuration manager.
oCfgManager = oDoc.getUIConfigurationManager() provides you the UI
configuration manager of the DOCUMENT! Normally the document contains no
UI configuration element data. You have to retrieve the module UI
configuration manager or you can go the way via the Layout Manager.

Regards,
Carsten

--
Example to retrieve the module UI configuration manager.
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 module identifier
REM *** See com.sun.star.frame.ModuleManager for more information
oModuleCfgMgr = oModuleCfgMgrSupplier.getUIConfigurationManager(
"com.sun.star.text.TextDocument" )
oSettings = oModuleCfgMgr.getSettings(
"private:resource/toolbar/standardbar", true )

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