You are viewing a plain text version of this content. The canonical link for it is here.
Posted to api@openoffice.apache.org by Berkhan Dipso <be...@prmyazilim.com> on 2015/07/31 08:47:01 UTC

Display options dialog from toolbar

Hi;

 

I'm trying to add a button to my Java OpenOffice Extension that is going to
show my Options page.

 

I've achieved to show the options page, but I can not activate the tree node
of my extension.

 

I've found two threads about this issue:

https://forum.openoffice.org/en/forum/viewtopic.php?f=47
<https://forum.openoffice.org/en/forum/viewtopic.php?f=47&t=48260> &t=48260

https://forum.openoffice.org/en/forum/viewtopic.php?f=20
<https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=66473> &t=66473

 

Both of them mentioning "OptionsPageURL" parameter. But I can not make it
work.

The things I've tried so far:

 

1)      Get the path of the dialog using component path:

 

XPackageInformationProvider xPackageInformationProvider =
PackageInformationProvider.get(m_xContext);

String extensionCurrentPath =
xPackageInformationProvider.getPackageLocation("com.prm.UnifierAddOn");

//This returns :
file:///C:/Users/Berkhan/Documents/NetBeansProjects/UnifierAddOn/build/soffi
ce_debug/user/uno_packages/cache/uno_packages/sv13d2ra.tmp_/UnifierAddOn.oxt
<file:///C:\Users\Berkhan\Documents\NetBeansProjects\UnifierAddOn\build\soff
ice_debug\user\uno_packages\cache\uno_packages\sv13d2ra.tmp_\UnifierAddOn.ox
t> 

 

com.sun.star.beans.PropertyValue[] args = new
com.sun.star.beans.PropertyValue[1];

args[0] = new PropertyValue(

"OptionsPageURL", 0, 

extensionCurrentPath + "/dialogs/EntryDialogUnifier.xdl",

PropertyState.DIRECT_VALUE);

 

XDispatchProvider docDispatchProvider =
UnoRuntime.queryInterface(XDispatchProvider.class, m_xFrame);

DispatchResultEvent dRE = (DispatchResultEvent) dispatcher.executeDispatch( 

                                                docDispatchProvider,

                                                ".uno:OptionsTreeDialog", 

                                                "", 

                                                0, 

                                                args

                    );

 

2)      Use path of the dialog given in OptionsDialog.xcu

com.sun.star.beans.PropertyValue[] args = new
com.sun.star.beans.PropertyValue[1];

args[0] = new PropertyValue(

"OptionsPageURL", 0, 

"%origin%/../../../../../dialogs/EntryDialogUnifier.xdl",

PropertyState.DIRECT_VALUE);

XDispatchProvider docDispatchProvider =
UnoRuntime.queryInterface(XDispatchProvider.class, m_xFrame);

DispatchResultEvent dRE = (DispatchResultEvent) dispatcher.executeDispatch( 

                                                docDispatchProvider,

                                                ".uno:OptionsTreeDialog", 

                                                "", 

                                                0, 

                                                args

                    );

 

3)      Adding the parameter to dispatch URL:

DispatchResultEvent dRE = (DispatchResultEvent) dispatcher.executeDispatch( 

                                                docDispatchProvider,

                                                ".uno:OptionsTreeDialog", 

                                                + "?OptionsPageURL:string="

                                                +
"%origin%/../../../../../dialogs/EntryDialogUnifier.xdl"

                                                "", 

                                                0, 

                                                new PropertyValue [] {}

                    );

//I also tried to pass extensionCurrentPath .

 

None of them worked.

 

How can I test my code? And is there a tool to show me the right value to
pass to "OptionsPageURL" parameter?

 

Or is it just not working in OO 4.1.1 ?

 

Please advise. Thanks.

 

 

Berkhan Dipşo

Solutions Architect

Tel          : +90 (216) 469 96 00 (14)

GSM      : +90 (533) 03 03 550

 

PRM YAZILIM

Oracle Gold Partner

Primavera Specialized

 <http://www.prmyazilim.com/> www.prmyazilim.com

 

 <http://www.linkedin/company/prm-yazilim>
http://www.linkedin/company/prm-yazilim

 <http://www.twitter.com/prmyazilim> http://www.twitter.com/prmyazilim

 

6-10 Temmuz - İSTANBUL

Primavera eğitimlerine ön kayıt icin:

 <http://apps.primavera-tr.com/drupal/node/15>
http://apps.primavera-tr.com/drupal/node/15

 


Re: Display options dialog from toolbar

Posted by Tsutomu Uchino <ha...@gmail.com>.
Hi,

The following Basic code still works well on AOO 4.1.1.

sub OpenExtensionsOptionPage
pip =
GetDefaultContext().getByName("/singletons/com.sun.star.deployment.PackageInformationProvider")
sLocation = pip.getPackageLocation("mytools.bookmarks.BookmarksMenu")

dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
arg = CreateUnoStruct("com.sun.star.beans.PropertyValue")
arg.Name = "OptionsPageURL"
arg.Value = sLocation & "/dialogs/Options.xdl"
dispatcher.executeDispatch(_
  ThisComponent.CurrentController.Frame, _
  ".uno:OptionsTreeDialog", "", 0, Array(arg))
end sub

Therefore, your first code should work, it seems. Sorry, but I have no idea
why your one do not work.

Using %origin% is not valid inside any code in 2 and 3. If %origin% is
placed in the configuration data (XCU file),
it is replaced by the expanded path during the extension installation.

Regards,
Tsutomu


2015-07-31 15:47 GMT+09:00 Berkhan Dipso <be...@prmyazilim.com>:

> Hi;
>
>
>
> I'm trying to add a button to my Java OpenOffice Extension that is going to
> show my Options page.
>
>
>
> I've achieved to show the options page, but I can not activate the tree
> node
> of my extension.
>
>
>
> I've found two threads about this issue:
>
> https://forum.openoffice.org/en/forum/viewtopic.php?f=47
> <https://forum.openoffice.org/en/forum/viewtopic.php?f=47&t=48260>
> &t=48260
>
> https://forum.openoffice.org/en/forum/viewtopic.php?f=20
> <https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=66473>
> &t=66473
>
>
>
> Both of them mentioning "OptionsPageURL" parameter. But I can not make it
> work.
>
> The things I've tried so far:
>
>
>
> 1)      Get the path of the dialog using component path:
>
>
>
> XPackageInformationProvider xPackageInformationProvider =
> PackageInformationProvider.get(m_xContext);
>
> String extensionCurrentPath =
> xPackageInformationProvider.getPackageLocation("com.prm.UnifierAddOn");
>
> //This returns :
>
> file:///C:/Users/Berkhan/Documents/NetBeansProjects/UnifierAddOn/build/soffi
>
> ce_debug/user/uno_packages/cache/uno_packages/sv13d2ra.tmp_/UnifierAddOn.oxt
>
> <file:///C:\Users\Berkhan\Documents\NetBeansProjects\UnifierAddOn\build\soff
>
> ice_debug\user\uno_packages\cache\uno_packages\sv13d2ra.tmp_\UnifierAddOn.ox
> t>
>
>
>
> com.sun.star.beans.PropertyValue[] args = new
> com.sun.star.beans.PropertyValue[1];
>
> args[0] = new PropertyValue(
>
> "OptionsPageURL", 0,
>
> extensionCurrentPath + "/dialogs/EntryDialogUnifier.xdl",
>
> PropertyState.DIRECT_VALUE);
>
>
>
> XDispatchProvider docDispatchProvider =
> UnoRuntime.queryInterface(XDispatchProvider.class, m_xFrame);
>
> DispatchResultEvent dRE = (DispatchResultEvent) dispatcher.executeDispatch(
>
>                                                 docDispatchProvider,
>
>                                                 ".uno:OptionsTreeDialog",
>
>                                                 "",
>
>                                                 0,
>
>                                                 args
>
>                     );
>
>
>
> 2)      Use path of the dialog given in OptionsDialog.xcu
>
> com.sun.star.beans.PropertyValue[] args = new
> com.sun.star.beans.PropertyValue[1];
>
> args[0] = new PropertyValue(
>
> "OptionsPageURL", 0,
>
> "%origin%/../../../../../dialogs/EntryDialogUnifier.xdl",
>
> PropertyState.DIRECT_VALUE);
>
> XDispatchProvider docDispatchProvider =
> UnoRuntime.queryInterface(XDispatchProvider.class, m_xFrame);
>
> DispatchResultEvent dRE = (DispatchResultEvent) dispatcher.executeDispatch(
>
>                                                 docDispatchProvider,
>
>                                                 ".uno:OptionsTreeDialog",
>
>                                                 "",
>
>                                                 0,
>
>                                                 args
>
>                     );
>
>
>
> 3)      Adding the parameter to dispatch URL:
>
> DispatchResultEvent dRE = (DispatchResultEvent) dispatcher.executeDispatch(
>
>                                                 docDispatchProvider,
>
>                                                 ".uno:OptionsTreeDialog",
>
>                                                 + "?OptionsPageURL:string="
>
>                                                 +
> "%origin%/../../../../../dialogs/EntryDialogUnifier.xdl"
>
>                                                 "",
>
>                                                 0,
>
>                                                 new PropertyValue [] {}
>
>                     );
>
> //I also tried to pass extensionCurrentPath .
>
>
>
> None of them worked.
>
>
>
> How can I test my code? And is there a tool to show me the right value to
> pass to "OptionsPageURL" parameter?
>
>
>
> Or is it just not working in OO 4.1.1 ?
>
>
>
> Please advise. Thanks.
>
>
>
>
>
> Berkhan Dipşo
>
> Solutions Architect
>
> Tel          : +90 (216) 469 96 00 (14)
>
> GSM      : +90 (533) 03 03 550
>
>
>
> PRM YAZILIM
>
> Oracle Gold Partner
>
> Primavera Specialized
>
>  <http://www.prmyazilim.com/> www.prmyazilim.com
>
>
>
>  <http://www.linkedin/company/prm-yazilim>
> http://www.linkedin/company/prm-yazilim
>
>  <http://www.twitter.com/prmyazilim> http://www.twitter.com/prmyazilim
>
>
>
> 6-10 Temmuz - İSTANBUL
>
> Primavera eğitimlerine ön kayıt icin:
>
>  <http://apps.primavera-tr.com/drupal/node/15>
> http://apps.primavera-tr.com/drupal/node/15
>
>
>
>