diff options
Diffstat (limited to 'wizards/com/sun/star/wizards/ui/DocumentPreview.java')
-rw-r--r-- | wizards/com/sun/star/wizards/ui/DocumentPreview.java | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/wizards/com/sun/star/wizards/ui/DocumentPreview.java b/wizards/com/sun/star/wizards/ui/DocumentPreview.java index 173fae87f01b..db7a3fd959fc 100644 --- a/wizards/com/sun/star/wizards/ui/DocumentPreview.java +++ b/wizards/com/sun/star/wizards/ui/DocumentPreview.java @@ -37,6 +37,7 @@ import com.sun.star.uno.UnoRuntime; import com.sun.star.util.CloseVetoException; import com.sun.star.util.XCloseable; import com.sun.star.wizards.common.Properties; +import com.sun.star.wizards.common.PropertyNames; /** * @author rpiterman @@ -75,7 +76,7 @@ public class DocumentPreview { //((XWindow)UnoRuntime.queryInterface(XWindow.class,control)).addPaintListener(this); - xControl = (XControl) UnoRuntime.queryInterface(XControl.class, control); + xControl = UnoRuntime.queryInterface(XControl.class, control); //register this object as a listener, to close the frame when disposing. //((XComponent) UnoRuntime.queryInterface(XComponent.class, control)).addEventListener(this); @@ -98,7 +99,7 @@ public class DocumentPreview protected XComponent setDocument(String url, PropertyValue[] lArgs) throws com.sun.star.lang.IllegalArgumentException, IOException, CloseVetoException { loadArgs = lArgs; - XComponentLoader xCompLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, xFrame); + XComponentLoader xCompLoader = UnoRuntime.queryInterface(XComponentLoader.class, xFrame); xFrame.activate(); return xComponent = xCompLoader.loadComponentFromURL(url, "_self", 0, loadArgs); } @@ -115,7 +116,7 @@ public class DocumentPreview { if (xFrame != null) { - ((XCloseable) UnoRuntime.queryInterface(XCloseable.class, xFrame)).close(false); + UnoRuntime.queryInterface(XCloseable.class, xFrame).close(false); } } @@ -126,7 +127,7 @@ public class DocumentPreview case PREVIEW_MODE: return setDocument(url, new String[] { - "Preview", "ReadOnly" + "Preview", PropertyNames.READ_ONLY }, new Object[] { Boolean.TRUE, Boolean.TRUE @@ -148,11 +149,11 @@ public class DocumentPreview public void createPreviewFrame(XMultiServiceFactory xmsf, XControl xControl) throws com.sun.star.uno.Exception, com.sun.star.lang.IllegalArgumentException { XWindowPeer controlPeer = xControl.getPeer(); - XWindow controlWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xControl); + XWindow controlWindow = UnoRuntime.queryInterface(XWindow.class, xControl); Rectangle r = controlWindow.getPosSize(); Object toolkit = xmsf.createInstance("com.sun.star.awt.Toolkit"); - XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, toolkit); + XToolkit xToolkit = UnoRuntime.queryInterface(XToolkit.class, toolkit); WindowDescriptor aDescriptor = new WindowDescriptor(); aDescriptor.Type = WindowClass.SIMPLE; @@ -163,9 +164,9 @@ public class DocumentPreview aDescriptor.WindowAttributes = VclWindowPeerAttribute.CLIPCHILDREN | WindowAttribute.SHOW; XWindowPeer xPeer = xToolkit.createWindow(aDescriptor); - xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xPeer); + xWindow = UnoRuntime.queryInterface(XWindow.class, xPeer); Object frame = xmsf.createInstance("com.sun.star.frame.Frame"); - xFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class, frame); + xFrame = UnoRuntime.queryInterface(XFrame.class, frame); // XFrame xF = (XFrame) UnoRuntime.queryInterface(XFrame.class, Desktop.getDesktop(xmsf)); // xFrame = xF.findFrame("_blank", 0); xFrame.initialize(xWindow); |