[Solved] My addon's option dialog doesn't show up

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
meaulnes
Posts: 77
Joined: Thu May 07, 2009 8:38 pm

[Solved] My addon's option dialog doesn't show up

Post by meaulnes »

Hi

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>
my last trials show the following:
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>
The DialogEventHandler.java is placed under Sources Packages/com/example/ and the FooOptionsPage.xdl at the same place than in the example (%origin%/dialogs).

I really need help as I have been blocked for many days now.


Moved to the Macros and UNO API forum. (TheGurkha, Moderator).
Thanks
Last edited by meaulnes on Wed Jul 08, 2009 2:33 pm, edited 1 time in total.
OOo 3.1 on Ubuntu 9.10
blento
Posts: 4
Joined: Mon Jun 29, 2009 3:15 pm
Location: FRANCE - La Rochelle

Re: My addon's option dialog doesn't show up

Post by blento »

Hi,

%origin% is the root of your extention. So, the good value is :

Code: Select all

<value>%origin%/dialogs/FooOptionsPage.xld</value>
It's work for me ...
__________________________________________________________________________________________
Blento
Windows XP sp2 / ?ubuntu 9.04
Open Office 3.1 + oooSdk 3
Netbeans 6.1 + 2.0.3_org-openoffice-extensions.nbm / jre 1.6U13
OOo 3.1.X on Ms Windows XP + ?ubuntu
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: My addon's option dialog doesn't show up

Post by hanya »

Could you instantiate your handler service correctly like a following?

Code: Select all

Sub main
oObj = CreateUnoService("com.example.DialogEventHandler")
xray oObj
end sub
And I suppose you to put your file of OptionPages configuration data in the top most directory of your extension package. The place of the file is not important for the file of the configuration data, only descriptions in the META-INF/manifest.xml entries that specifies the position of the file and the kind of the type are important. They are processed at the installation time of the extension package and they are fused into the extension configurations.
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
blento
Posts: 4
Joined: Mon Jun 29, 2009 3:15 pm
Location: FRANCE - La Rochelle

Re: My addon's option dialog doesn't show up

Post by blento »

I don't try call my handler manually. The handler is call by OpenOffice when the user is openning the options panel.

If you are using Netbeans with the Ooo plugin, you can read this post to register your handler class
http://user.services.openoffice.org/en/ ... 20&t=19784
This handler class must be regsiter in the manifest file of your jar package, not on the manifest file of your oxt package.


The content of my jar manifest file :

Code: Select all

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 10.0-b22 (Sun Microsystems Inc.)
UNO-Type-Path: OooCnafGed_IDL_types.jar
RegistrationClassName: fr.caf.caf17.oo.cnafGed.CentralRegistrationClass
Class-Path: external_jars/swing-layout-1.0.3.jar external_jars/dom4j-1.6.1.jar external_jars/jai_codec.jar external_jars/jai_core.jar
external_jars/mlibwrapper_jai.jar external_jars/jpedal_gpl.jar

Name: fr/caf/caf17/oo/cnafGed/CentralRegistrationClass.class
RegistrationClasses: fr.caf.caf17.oo.cnafGed.OooCnafGed, fr.caf.caf17.oo.cnafGed.options.DialogEventHandler
You can find my Handler class on the last line



The content of my oxt manifest file is :

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<manifest:manifest xmlns:manifest="http://openoffice.org/2001/manifest">
  <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-typelibrary;type=RDB"
                       manifest:full-path="types.rdb"/>
  <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Java"
                       manifest:full-path="OooCnafGed.jar"/>
  <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-typelibrary;type=Java"
                       manifest:full-path="OooCnafGed_IDL_types.jar"/>
  <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
                       manifest:full-path="registry\data\org\openoffice\Office\OooCnafGedDialog.xcu"/>
  <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
                       manifest:full-path="registry\data\org\openoffice\Office\ProtocolHandler.xcu"/>
  <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-schema"
                       manifest:full-path="registry\schema\fr\caf\caf17\oo\cnafGed\OooCnafGed.xcs"/>
</manifest:manifest>

For the location of the xdl file, i put it in %origin%/dialogs directory.
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: My addon's option dialog doesn't show up

Post by hanya »

blento wrote:Hi,

%origin% is the root of your extention. So, the good value is :

Code: Select all

<value>%origin%/dialogs/FooOptionsPage.xld</value>
It's work for me ...
No, %origin% means the directory of the configuration file is installed and it has not fixed yet, see http://www.openoffice.org/issues/show_bug.cgi?id=85438 .
And it is described in the DevGuide: http://wiki.services.openoffice.org/wik ... dOns/Menus .
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
blento
Posts: 4
Joined: Mon Jun 29, 2009 3:15 pm
Location: FRANCE - La Rochelle

Re: My addon's option dialog doesn't show up

Post by blento »

hanya wrote:
No, %origin% means the directory of the configuration file is installed
Exactly, %origin% don't means the root directory of extension. The registry part of the extension was unzip for ooo integration by the extension manager.
We can found in uno_packages\cache\registry\com.sun.star.comp.deployment.configuration.PackageRegistryBackend\registry\data\org\openoffice\Office directory the OptionsDialog .xcu with the reference to our xdl file :

Code: Select all

    <prop oor:name="OptionsPage">
      <value>vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE/uno_packages/5B.tmp_/OooCnafGed.oxt/dialogs/OooCnafGedPanel.xdl</value>
     </prop>
OooCnafGed.oxt is my extension. So %origin% = "$UNO_SHARED_PACKAGES_CACHE/uno_packages/5B.tmp_/OooCnafGed.oxt" ?

The xdl file is not deploy out this directory. So, it's easy to find the good url in relation to oxt root.

The URL to my xld file is :

Code: Select all

<value>%origin%/dialogs/OooCnafGedPanel.xld</value>
The directory structure of my component with the netbeans extension for Ooo
The directory structure of my component with the netbeans extension for Ooo
Thanks to Hanya for this precision.
__________________________________________________________________________________________
Blento
Windows XP sp2 / ?ubuntu 9.04
Open Office 3.1 + oooSdk 3
Netbeans 6.1 + 2.0.3_org-openoffice-extensions.nbm / jre 1.6U13
OOo 3.1.X on Ms Windows XP + ?ubuntu
meaulnes
Posts: 77
Joined: Thu May 07, 2009 8:38 pm

Re: My addon's option dialog doesn't show up

Post by meaulnes »

Hi

I am not sure I understand well what has been said on this subject.
In fact, I gave up some time ago.
I needed to save some options but not absolutely to use the option dialog offered by OO.
I managed to use the ConfigurationProvider and the ConfigurationUpdateAccess without the option dialog.

I completely forgot to read this thread so my apologies to those who documented the topic

But one question: shall we mark it as SOLVED ?
OOo 3.1 on Ubuntu 9.10
blento
Posts: 4
Joined: Mon Jun 29, 2009 3:15 pm
Location: FRANCE - La Rochelle

Re: My addon's option dialog doesn't show up

Post by blento »

Hi Meaulnes,

If you found a way to store options without dialog, you can mark this subject as SOLVED.
__________________________________________________________________________________________
Blento
Windows XP sp2 / ?ubuntu 9.04
Open Office 3.1 + oooSdk 3
Netbeans 6.1 + 2.0.3_org-openoffice-extensions.nbm / jre 1.6U13
OOo 3.1.X on Ms Windows XP + ?ubuntu
Post Reply