II am a beginner in UNO and OO but I have managed to write an extension to Writer so you can have an idea of what I can understand and what I can't.
It works as I want but I now want to make the option page.
I refered to the OptionsPageDemo example of the Develpers's guide but I must confess I am not completely at ease with registrations concept.
Here is roughly what I did:
- I copied the DialogEventHandler.java and the ConfigurationAccessAction.java files in my source folder.
- I just in order to set the mechanism , I copied the same dialogs as the example in a folder I created under the root of my project (here a "dialogs" folder).
- I created a sequence of folders under registery in the OXT node . I mean schema, a name, a name and copied the .xcs schema in the final folder
- I copied the OptionDialog.xcu file in registery/data/org/openoffice/Office folder
- I adapted the various mane of packages to my own folder structure in the .xcu and .xcs files and also the service name in DialogEventHandler
Eventually I got the right entry menu in the option memu under Writer's entry but the command is with no effect.
From my diffrent manipulations I deduced that it is not a problem of schema as the example given shows the option dialog with the xcs file removed . I guess the xcs file only deals with the loading and saving of option data but this is an other matter which I will consider later on.
At the moment, I just want to focuse on the displaying of the option dialog but I don't know if it is my code that triggers its apparition or if is it the OO code. I have a tendency to think that it is the second option which is true and so I don't understand why I doesn't work.
I have a doubt about the path indicated for the dialog in the OptionDialog.xcu file as I don't understand the meaning of /../../../../../ in
Code: Select all
<prop oor:name="OptionsPage">
<value>%origin%/../../../../../dialogs/FooOptionsPage.xdl</value>
</prop>when I test the example I can see (putting break points in the code) that the following method are called after clicking the option menu entry:
getServices Names (in DialogEventHandler.java)
getComponentFactory (in the same)
getComponentFactory (in CentralRegistration.java)
_DialogEventHandler
CalHandlerMethod
In my case nothing happen except that the option windows is cleared and the title of the dialog is set to a one which correspond to my addon's option dialog.However we never enter the DialogEventHandler.java code( but sould we?).
Here is a copy of my OptionsDialog.xcu:
Code: Select all
<oor:component-data oor:name="OptionsDialog" oor:package="org.openoffice.Office"
xmlns:oor="http://openoffice.org/2001/registry"
xmlns:xs="http://www.w2.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<node oor:name="Nodes">
<node oor:name="Writer" oor:op="fuse">
<node oor:name="Leaves">
<node oor:name="com.example.Jilt" oor:op="fuse">
<prop oor:name="Id">
<value>com.example.Jilt</value>
</prop>
<prop oor:name="Label">
<value xml:lang="en-US">Demo Options</value>
</prop>
<prop oor:name="OptionsPage">
<value>%origin%/../../../../../dialogs/FooOptionsPage.xdl</value>
</prop>
<prop oor:name="EventHandlerService">
<value>com.example.DialogEventHandler</value>
</prop>
</node>
</node>
</node>
</node>
</oor:component-data>I really need help as I have been blocked for many days now.
Moved to the Macros and UNO API forum. (TheGurkha, Moderator).
Thanks