Christian Andersson wrote:
I'm interested a bit in how to do this, are there any examples on the
net you can point to?
I just implemented it that way:
public void showModal(javax.swing.JDialog dialog) {
try {
Object tempDialogModel =
multiComponentFactory.createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel",
context);
XPropertySet properties = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, tempDialogModel);
properties.setPropertyValue("PositionX", new Integer(0));
properties.setPropertyValue("PositionY", new Integer(0));
properties.setPropertyValue("Width", new Integer(1));
properties.setPropertyValue("Height", new Integer(1));
final Object tempDialog =
multiComponentFactory.createInstanceWithContext("com.sun.star.awt.UnoControlDialog",
context);
XControl xControl = (XControl)
UnoRuntime.queryInterface(XControl.class, tempDialog);
XControlModel xControlModel = (XControlModel)
UnoRuntime.queryInterface(XControlModel.class, tempDialogModel);
xControl.setModel(xControlModel);
Object toolkit =
multiComponentFactory.createInstanceWithContext("com.sun.star.awt.Toolkit",
context);
XToolkit xToolkit = (XToolkit)
UnoRuntime.queryInterface(XToolkit.class, toolkit);
XWindow xWindow = (XWindow)
UnoRuntime.queryInterface(XWindow.class, xControl);
xWindow.setVisible(false);
xControl.createPeer(xToolkit, null);
final XDialog xTempDialog = (XDialog)
UnoRuntime.queryInterface(XDialog.class, tempDialog);
dialog.addWindowListener(new WindowAdapter() {
public void windowClosed(WindowEvent e) {
xTempDialog.endExecute();
XComponent component = (XComponent)
UnoRuntime.queryInterface(XComponent.class, tempDialog);
component.dispose();
}
});
dialog.setVisible(true);
xTempDialog.execute();
} catch (com.sun.star.uno.Exception ex) {
ex.printStackTrace();
}
}
But in my case that small dialog is still visible and considerably
larger than 1 pixel. I will try if I can somehow get it off-screen or
really invisible (but still modal). If you find something out, please
inform me.
Thanks Mathias for that hint. It's at least a good point to start from :-)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]