Hallo Stefan,
Stefan Kuhn schrieb:
Hallo,

ich würde gerne in einem BeanShell-Makro einen vorhandenen Dialog
öffnen. Allerdings funktioniert das nicht so wie ich es mir wünsche. Der
Dialog scheint immer null zu sein, so dass das execute nicht aufgerufen
wird.

Wo liegt denn Dein vorhandener Dialog?
Es scheint mindestens die Zeile xDialogProvider.createDialog("vnd.sun.star.script:" +
        "ScriptBindingLibrary.MeinDialog?location=application");

zu fehlen.

Hier mal die entsprechenden Codezeilen:

// get the remote office component context
remoteContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
remoteServiceManager = remoteContext.getServiceManager();

// get the Desktop
desktop = remoteServiceManager
        .createInstanceWithContext("com.sun.star.frame.Desktop",      
remoteContext);

// query the XComponentLoader interface from the desktop
componentLoader = UnoRuntime.queryInterface(XComponentLoader.class,             
desktop);

// create empty array of PropertyValue structs, needed for
loadComponentFromURL PropertyValue[] loadProps = new PropertyValue[0];

//spreadsheetComponentSVerweis = componentLoader
        .loadComponentFromURL("file:///c:/oo/SVerweis.ods", "_blank", 0,
loadProps);

Object[] argModel = new Object[1];
argModel[0] =  XSCRIPTCONTEXT.getDocument();          //returns XModel

obj = remoteServiceManager.createInstanceWithArgumentsAndContext(
        "com.sun.star.awt.DialogProvider2", argModel, remoteContext);

xDialogProvider = UnoRuntime.queryInterface(XDialogProvider2.class,             
        obj);

xDialog = xDialogProvider.createDialogWithHandler("TestPOC",          
argModel[0]);

if (null != xDialog) {
        xDialog.execute();
}


Hat irgendwer eine Idee?

Hast Du Dir das Beispiel "Highlight" aus der Standardinstallation mal angeschaut?


Gruß Peter


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@de.openoffice.org
For additional commands, e-mail: dev-h...@de.openoffice.org

Antwort per Email an