diff options
Diffstat (limited to 'odk/examples/DevelopersGuide/GUI/UnoMenu.java')
-rw-r--r-- | odk/examples/DevelopersGuide/GUI/UnoMenu.java | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/odk/examples/DevelopersGuide/GUI/UnoMenu.java b/odk/examples/DevelopersGuide/GUI/UnoMenu.java index c5fdbe218350..86942f91c0d6 100644 --- a/odk/examples/DevelopersGuide/GUI/UnoMenu.java +++ b/odk/examples/DevelopersGuide/GUI/UnoMenu.java @@ -65,8 +65,8 @@ public UnoMenu(XComponentContext _xContext, XMultiComponentFactory _xMCF) { try{ // create a popup menu Object oPopupMenu = m_xMCF.createInstanceWithContext("stardiv.Toolkit.VCLXPopupMenu", m_xContext); - xPopupMenu = (XPopupMenu) UnoRuntime.queryInterface(XPopupMenu.class, oPopupMenu); - XMenuExtended xMenuExtended = (XMenuExtended) UnoRuntime.queryInterface(XMenuExtended.class, xPopupMenu); + xPopupMenu = UnoRuntime.queryInterface(XPopupMenu.class, oPopupMenu); + XMenuExtended xMenuExtended = UnoRuntime.queryInterface(XMenuExtended.class, xPopupMenu); xPopupMenu.insertItem((short) 0, "~First Entry", MenuItemStyle.AUTOCHECK, (short) 0); xPopupMenu.insertItem((short) 1, "First ~Radio Entry", (short) (MenuItemStyle.RADIOCHECK + MenuItemStyle.AUTOCHECK), (short) 1); @@ -92,7 +92,7 @@ public UnoMenu(XComponentContext _xContext, XMultiComponentFactory _xMCF) { // create a menubar at the global MultiComponentFactory... Object oMenuBar = m_xMCF.createInstanceWithContext("stardiv.Toolkit.VCLXMenuBar", m_xContext); // add the menu items... - XMenuBar xMenuBar = (XMenuBar) UnoRuntime.queryInterface(XMenuBar.class, oMenuBar); + XMenuBar xMenuBar = UnoRuntime.queryInterface(XMenuBar.class, oMenuBar); xMenuBar.insertItem((short) 0, "~First MenuBar Item", com.sun.star.awt.MenuItemStyle.AUTOCHECK, (short) 0); xMenuBar.insertItem((short) 1, "~Second MenuBar Item", com.sun.star.awt.MenuItemStyle.AUTOCHECK, (short) 1); xMenuBar.setPopupMenu((short) 0, getPopupMenu()); @@ -103,7 +103,7 @@ public UnoMenu(XComponentContext _xContext, XMultiComponentFactory _xMCF) { }} protected void closeDialog(){ - XComponent xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, mxTopWindow); + XComponent xComponent = UnoRuntime.queryInterface(XComponent.class, mxTopWindow); if (xComponent != null){ xComponent.dispose(); } @@ -117,7 +117,7 @@ public UnoMenu(XComponentContext _xContext, XMultiComponentFactory _xMCF) { 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); + 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(); @@ -130,17 +130,17 @@ public UnoMenu(XComponentContext _xContext, XMultiComponentFactory _xMCF) { // create the window... XWindowPeer xWindowPeer = xToolkit.createWindow(aWindowDescriptor); - XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xWindowPeer); + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, xWindowPeer); // create a frame and initialize it with the created window... Object oFrame = m_xMCF.createInstanceWithContext("com.sun.star.frame.Frame", m_xContext); - m_xFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class, oFrame); + m_xFrame = UnoRuntime.queryInterface(XFrame.class, oFrame); Object oDesktop = m_xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", m_xContext); - XFramesSupplier xFramesSupplier = (XFramesSupplier) UnoRuntime.queryInterface(XFramesSupplier.class, oDesktop); + XFramesSupplier xFramesSupplier = UnoRuntime.queryInterface(XFramesSupplier.class, oDesktop); m_xFrame.setCreator(xFramesSupplier); // get the XTopWindow interface.. - xTopWindow = (XTopWindow) UnoRuntime.queryInterface(XTopWindow.class, xWindow); + xTopWindow = UnoRuntime.queryInterface(XTopWindow.class, xWindow); } catch (com.sun.star.lang.IllegalArgumentException ex) { ex.printStackTrace(); } catch (com.sun.star.uno.Exception ex) { @@ -150,7 +150,7 @@ public UnoMenu(XComponentContext _xContext, XMultiComponentFactory _xMCF) { } public void addMenuBar(XWindow _xWindow){ - XTopWindow xTopWindow = (XTopWindow) UnoRuntime.queryInterface(XTopWindow.class, _xWindow); + XTopWindow xTopWindow = UnoRuntime.queryInterface(XTopWindow.class, _xWindow); addMenuBar(xTopWindow, this); } |