diff options
Diffstat (limited to 'odk/examples/DevelopersGuide/GUI/DialogDocument.java')
-rw-r--r-- | odk/examples/DevelopersGuide/GUI/DialogDocument.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/odk/examples/DevelopersGuide/GUI/DialogDocument.java b/odk/examples/DevelopersGuide/GUI/DialogDocument.java index 5edefb8b118e..0d6f29d2a1ed 100644 --- a/odk/examples/DevelopersGuide/GUI/DialogDocument.java +++ b/odk/examples/DevelopersGuide/GUI/DialogDocument.java @@ -51,11 +51,11 @@ import com.sun.star.uno.XComponentContext; public class DialogDocument extends UnoDialogSample { - + public DialogDocument(XComponentContext _xContext, XMultiComponentFactory _xMCF) { super(_xContext, _xMCF); } - + public static void main(String args[]){ DialogDocument oDialogDocument = null; try { @@ -75,8 +75,8 @@ public class DialogDocument extends UnoDialogSample { // add the model to the NameContainer of the dialog model oDialogDocument.m_xDlgModelNameContainer.insertByName("Headerlabel", oFTHeaderModel); oDialogDocument.showDocumentinDialogWindow(oDialogDocument.m_xWindowPeer, new Rectangle(40, 50, 420, 550), "private:factory/swriter"); - - oDialogDocument.insertButton(oDialogDocument, 126, 370, 50, "~Close dialog", (short) PushButtonType.OK_value); + + oDialogDocument.insertButton(oDialogDocument, 126, 370, 50, "~Close dialog", (short) PushButtonType.OK_value); oDialogDocument.executeDialog(); }catch( Exception ex ) { ex.printStackTrace(System.out); @@ -88,16 +88,16 @@ public class DialogDocument extends UnoDialogSample { } } } - + System.exit( 0 ); } - + public void showDocumentinDialogWindow(XWindowPeer _xParentWindowPeer, Rectangle _aRectangle, String _sUrl){ try { // The Toolkit is the creator of all windows... Object oToolkit = m_xMCF.createInstanceWithContext("com.sun.star.awt.Toolkit", m_xContext); XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, oToolkit); - + // set up a window description and create the window. A parent window is always necessary for this... com.sun.star.awt.WindowDescriptor aWindowDescriptor = new com.sun.star.awt.WindowDescriptor(); // a simple window is enough for this purpose... @@ -107,20 +107,20 @@ public class DialogDocument extends UnoDialogSample { aWindowDescriptor.Parent = _xParentWindowPeer; aWindowDescriptor.ParentIndex = 1; aWindowDescriptor.Bounds = _aRectangle; - + // set the window attributes... // The attribute CLIPCHILDREN causes the parent to not repaint the areas of the children... aWindowDescriptor.WindowAttributes = VclWindowPeerAttribute.CLIPCHILDREN + WindowAttribute.BORDER + WindowAttribute.SHOW; XWindowPeer xWindowPeer = xToolkit.createWindow(aWindowDescriptor); XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xWindowPeer); XView xView = (XView) UnoRuntime.queryInterface(XView.class, xWindow); - + // create a frame and initialize it with the created window... Object oFrame = m_xMCF.createInstanceWithContext("com.sun.star.frame.Frame", m_xContext); // The frame should be of global scope because it's within the responsibility to dispose it after usage m_xFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class, oFrame); m_xFrame.initialize(xWindow); - + // load the document and open it in preview mode XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, m_xFrame); PropertyValue[] aPropertyValues = new PropertyValue[2]; @@ -141,5 +141,5 @@ public class DialogDocument extends UnoDialogSample { throw new java.lang.RuntimeException("cannot happen..."); } } - + } |