-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Mathias,

> What means "without success"? What exactly did you do and what exactly 
> happened?

that means, the preview is not closed, if i open a message box directly after 
the
excecuteDispatch(), it does not matter if i use the SynchronMode or not ...
the message box is shown in preview mode, after closing it, preview mode is 
still active ...
without showMessageBox() the preview is closed ...

here is a snippet of my code:

   PropertyValue[] xProps = new PropertyValue[1];

   xProps[0] = new PropertyValue();
   xProps[0].Name = "SynchronMode";
   xProps[0].Value = Boolean.TRUE;

   executeDispatch(getModel().getCurrentController().getFrame(), 
".uno:ClosePreview", xProps);
   showMessageBox();


    public Object executeDispatch(XFrame xFrame, String sUrl, PropertyValue 
xProp[]) {

        Object dispatchHelper = null;
        try {
            dispatchHelper = xComponentContext.getServiceManager()
                    
.createInstanceWithContext("com.sun.star.frame.DispatchHelper",
                            xComponentContext);
        } catch (Exception e) {
            return null;
        }

        XDispatchHelper xDispatch = (XDispatchHelper) UnoRuntime
                .queryInterface(XDispatchHelper.class, dispatchHelper);

        XDispatchProvider xProvider = (XDispatchProvider) UnoRuntime
                .queryInterface(XDispatchProvider.class, xFrame);

        Object oDispatch = xDispatch.executeDispatch(xProvider, sUrl, "", 0, 
xProp);

        return oDispatch;
    }

    public void showMessageBox() {

        XWindow xParent = null;
        XFrame xFrame = xController.getFrame();
        XToolkit xToolkit = null;

        if (xFrame != null)
            xParent = xFrame.getContainerWindow();

        try {
            xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class,
                    xComponentContext.getServiceManager()
                            .createInstanceWithContext(
                                    "com.sun.star.awt.Toolkit",
                                    xComponentContext));
        } catch (Exception e) {
            e.printStackTrace();
        }


Oliver
- --

GnuPG key 0xCFD04A45: 8822 057F 4956 46D3 352C 1A06 4E2C AB40 CFD0 4A45
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE7atbTiyrQM/QSkURAp3RAJ0azSb+i4rboSD9ymm58sSGwA5l/ACePnYJ
aoXXQSB/o85j7PPL9UQKTd8=
=J1QP
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to