| View previous topic :: View next topic |
| Author |
Message |
plehal Newbie

Joined: 28 Oct 2009 Posts: 3
|
Posted: Mon Nov 02, 2009 6:26 am Post subject: Loading xdl (dialog) file in java extension |
|
|
I want to open a dialog from within the extension written in java. Can someone please, let me know the URL for making this call. e.g loading dialog from a script has a url like
"vnd.sun.star.script:mylibrary?location=application"
I need to know the url in case of an extension. |
|
| Back to top |
|
 |
hanya Super User

Joined: 04 May 2005 Posts: 543 Location: Japan
|
|
| Back to top |
|
 |
plehal Newbie

Joined: 28 Oct 2009 Posts: 3
|
Posted: Mon Nov 02, 2009 1:02 pm Post subject: Loading xdl (dialog) file in java extension |
|
|
I already know to create dialog using XDialogProvider2 like
theDialog = xDialogProvider.createDialogWithHandler( "vnd.sun.star.script:putil.PunjabiUtilities?location=application", this);
The problem I have is that I am trying to create java extension which is little different from creating java macro. All I need to know is the url to call in case of extension and location of dialogs in oxt file.
Sorry, if my question is really dumb but I am kind of stuck on this. Right now I am using Swing frame for dialog. The extension in case is http://extensions.services.openoffice.org/project/PunjabiUtilities |
|
| Back to top |
|
 |
hanya Super User

Joined: 04 May 2005 Posts: 543 Location: Japan
|
Posted: Mon Nov 02, 2009 5:53 pm Post subject: Re: Loading xdl (dialog) file in java extension |
|
|
| plehal wrote: | | The problem I have is that I am trying to create java extension which is little different from creating java macro. All I need to know is the url to call in case of extension and location of dialogs in oxt file. |
Put your dialog.xdl file into a directory in the extension package and get its url like the following written in the OOoBasic:
| Code: | Sub CreateDialogPlacedInTheExtension
sExtension_Id = "org.hoge.Something"
sDirURL = GetPackageDirURL(sExtension_Id)
sDialogURL = sDirURL & "/dialogs/dialog.xdl"
oDialog = CreateUnoService("com.sun.star.awt.DialogProvider").createDialog(sDialogURL)
oDialog.execute()
End Sub
Function GetPackageDirURL( sIdentifier As String ) As String
Dim oPIP As Object
oPIP = GetDefaultContext().getByName( _
"/singletons/com.sun.star.deployment.PackageInformationProvider")
GetPackageDirURL = oPIP.getPackageLocation(sIdentifier)
End Function
|
css.deployment.PackageInformationProvider can be used after OOo 2.3 and it causes version dependent problem. If you want to make your extension that can be used with earlier 2.3, try /singletons/com.sun.star.deployment.thePackageManagerFactory to find your extension installed directory.
I mention about the way with a dialog installed with a basic library or a dialog included into a dialog library. Put your dialog in the extension package as a menber of a basic or a dialog library. In this case, you can point the dialog with "vnd.sun.star.script:Library_NAME.Dialog_NAME?location=application".
In this way, your dialog is shown in the basic library and it may be modified if the dialog library is not readonly. |
|
| Back to top |
|
 |
|