[Solved] Opening OptionsDialog UI from the menu

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
OlivierR
Posts: 38
Joined: Sun Jul 25, 2010 3:13 pm

[Solved] Opening OptionsDialog UI from the menu

Post by OlivierR »

Hi *,

In LibreOffice, with the Lightproof grammar checker, there is a OptionsDialog which can be opened from the Extension Manager by clicking on Options, this is a leave of the Options dialog of LibreOffice.

For the French derivative of Lightproof, I created a menu from which I’d like to add a button “Options” to go directly to this Options dialog.

What URL should I specify?

Addon.xcu for the menu:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<oor:component-data
      xmlns:oor="http://openoffice.org/2001/registry"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      oor:package="org.openoffice.Office"
      oor:name="Addons">
  <node oor:name="AddonUI">
  
    <node oor:name="OfficeMenuBar">
        <node oor:name="dicollecte.Tools" oor:op="replace">
            <prop oor:name="Title" oor:type="xs:string">
                <value/>
                <value xml:lang="fr">Grammalecte</value>
                <value xml:lang="en-US">Grammalecte</value>
            </prop>
            <prop oor:name="Target" oor:type="xs:string">
                <value>_self</value>
            </prop>
            <node oor:name="Submenu">
                <node oor:name="m1" oor:op="replace">
                    <prop oor:name="URL" oor:type="xs:string">
                        <value>service:dicollecte.TextFormatter</value>
                    </prop>
                    <prop oor:name="Title" oor:type="xs:string">
                        <value/>
                        <value xml:lang="fr">Formateur de texte…</value>
                        <value xml:lang="en-US">Text Formatter_</value>
                    </prop>
                    <prop oor:name="Context" oor:type="xs:string">
                        <value>com.sun.star.text.TextDocument</value>
                    </prop>
                </node>
                <node oor:name="m2" oor:op="replace">
                    <prop oor:name="URL" oor:type="xs:string">
                        <value>service:dicollecte.Conjugueur</value>
                    </prop>
                    <prop oor:name="Title" oor:type="xs:string">
                        <value/>
                        <value xml:lang="fr">Conjugueur…</value>
                        <value xml:lang="en-US">Conjugator…</value>
                    </prop>
                    <prop oor:name="Target" oor:type="xs:string">
                        <value>_self</value>
                    </prop>
                    <prop oor:name="Context" oor:type="xs:string">
                        <value>com.sun.star.text.TextDocument</value>
                    </prop>
                </node>
                <node oor:name="m3" oor:op="replace">
                    <prop oor:name="URL" oor:type="xs:string">
                        <value>service:dicollecte.FrenchDictionarySwitcher</value>
                    </prop>
                    <prop oor:name="Title" oor:type="xs:string">
                        <value/>
                        <value xml:lang="fr">Dictionnaire orthographique…</value>
                        <value xml:lang="en-US">French spelling dictionary…</value>
                    </prop>
                    <prop oor:name="Target" oor:type="xs:string">
                        <value>_self</value>
                    </prop>
                    <prop oor:name="Context" oor:type="xs:string">
                        <value>com.sun.star.text.TextDocument</value>
                    </prop>
                </node>
                <node oor:name="m4" oor:op="replace">
                    <prop oor:name="URL" oor:type="xs:string">
                        <value>_______________________________UNKNOWN_URL________________________________</value>
                    </prop>
                    <prop oor:name="Title" oor:type="xs:string">
                        <value/>
                        <value xml:lang="fr">Options…</value>
                        <value xml:lang="en-US">Options…</value>
                    </prop>
                    <prop oor:name="Target" oor:type="xs:string">
                        <value>_self</value>
                    </prop>
                    <prop oor:name="Context" oor:type="xs:string">
                        <value>com.sun.star.text.TextDocument</value>
                    </prop>
                </node>
            </node>
        </node>
    </node>
  </node>
</oor:component-data>
OptionsDialog.xcu:

Code: Select all

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE oor:component-data SYSTEM "../../../../component-update.dtd">
<oor:component-data oor:name="OptionsDialog" oor:package="org.openoffice.Office" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <node oor:name="Nodes">
                <node oor:name="org.openoffice.lightproof" oor:op="fuse">
                        <prop oor:name="Label">
                                <value xml:lang="en">Dictionaries</value>
                                <value xml:lang="hu">Szótárak</value>
                        </prop>
                        <node oor:name="Leaves">

                                <node oor:name="org.openoffice.lightproof.grammalecte" oor:op="fuse">
                                        
                                        <prop oor:name="Id">
                                                <value>org.openoffice.comp.pyuno.lightproof.oxt.grammalecte</value>
                                        </prop>
                                        
                                        <prop oor:name="Label">

                                                <value xml:lang="en">Grammar checking (French)</value>

                                                <value xml:lang="fr">Grammalecte (Français)</value>

                                        </prop>
                                        
                                        <prop oor:name="OptionsPage">
                                                <value>%origin%/fr.xdl</value>
                                        </prop>
                                        
                                        <prop oor:name="EventHandlerService">
                                                <value>org.openoffice.comp.pyuno.LightproofOptionsEventHandler.grammalecte</value>
                                        </prop>
                                        
                                </node>

                        </node>
                </node>
        </node>
</oor:component-data>
Last edited by OlivierR on Sat Dec 21, 2013 11:23 pm, edited 1 time in total.
LibreOffice 6.4Windows 10
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: Opening OptionsDialog UI from the menu

Post by hanya »

I tried to find the way to open the option dialog like opened through Option button on the extension manager, but it was not accessible.
You can open the option dialog for specific page opened if your page has an entry in the tree of the options, with the following dispatch:

Code: Select all

.uno:OptionsTreeDialog?OptionsPageURL:string=%origin%/fr.xdl
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
OlivierR
Posts: 38
Joined: Sun Jul 25, 2010 3:13 pm

Re: Opening OptionsDialog UI from the menu

Post by OlivierR »

That’s it! Thanks a lot.
LibreOffice 6.4Windows 10
Post Reply