diff options
Diffstat (limited to 'odk/examples/DevelopersGuide/GUI/UnoDialogSample.java')
-rw-r--r-- | odk/examples/DevelopersGuide/GUI/UnoDialogSample.java | 188 |
1 files changed, 94 insertions, 94 deletions
diff --git a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java index 6db2ef162e63..2b47e82e8975 100644 --- a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java +++ b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java @@ -139,7 +139,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis oUnoDialogSample.initialize( new String[] {"Height", "Moveable", "Name","PositionX","PositionY", "Step", "TabIndex","Title","Width"}, new Object[] { new Integer(380), Boolean.TRUE, "MyTestDialog", new Integer(102),new Integer(41), new Integer(0), new Short((short) 0), "OpenOffice", new Integer(380)}); Object oFTHeaderModel = oUnoDialogSample.m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlFixedTextModel"); - XMultiPropertySet xFTHeaderModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oFTHeaderModel); + XMultiPropertySet xFTHeaderModelMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oFTHeaderModel); xFTHeaderModelMPSet.setPropertyValues( new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Width"}, new Object[] { new Integer(8), "This code-sample demonstrates how to create various controls in a dialog", "HeaderLabel", new Integer(106), new Integer(6), new Integer(300)}); @@ -167,7 +167,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis oUnoDialogSample.addRoadmap(oUnoDialogSample.getRoadmapItemStateChangeListener()); oUnoDialogSample.insertRoadmapItem(0, true, "Introduction", 1); oUnoDialogSample.insertRoadmapItem(1, true, "Documents", 2); - oUnoDialogSample.xDialog = (XDialog) UnoRuntime.queryInterface(XDialog.class, oUnoDialogSample.m_xDialogControl); + oUnoDialogSample.xDialog = UnoRuntime.queryInterface(XDialog.class, oUnoDialogSample.m_xDialogControl); oUnoDialogSample.executeDialog(); }catch( Exception e ) { System.err.println( e + e.getMessage()); @@ -197,9 +197,9 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis aNodePath[0] = new PropertyValue(); aNodePath[0].Name = "nodepath"; aNodePath[0].Value = _sKeyName; - XMultiServiceFactory xMSFConfig = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oConfigProvider); + XMultiServiceFactory xMSFConfig = UnoRuntime.queryInterface(XMultiServiceFactory.class, oConfigProvider); Object oNode = xMSFConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", aNodePath); - XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oNode); + XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, oNode); return xNameAccess; } catch (Exception exception) { exception.printStackTrace(System.err); @@ -222,7 +222,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // get the Image Url and process the Url by the macroexpander... sImageUrl = (String) xNameAccess.getByName(_sImageName); Object oMacroExpander = this.m_xContext.getValueByName("/singletons/com.sun.star.util.theMacroExpander"); - XMacroExpander xMacroExpander = (XMacroExpander) UnoRuntime.queryInterface(XMacroExpander.class, oMacroExpander); + XMacroExpander xMacroExpander = UnoRuntime.queryInterface(XMacroExpander.class, oMacroExpander); sImageUrl = xMacroExpander.expandMacros(sImageUrl); sImageUrl = sImageUrl.substring(new String("vnd.sun.star.expand:").length(), sImageUrl.length()); sImageUrl = sImageUrl.trim(); @@ -245,22 +245,22 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis Object oDialogModel = _xMCF.createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", m_xContext); // The XMultiServiceFactory of the dialogmodel is needed to instantiate the controls... - m_xMSFDialogModel = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oDialogModel); + m_xMSFDialogModel = UnoRuntime.queryInterface(XMultiServiceFactory.class, oDialogModel); // The named container is used to insert the created controls into... - m_xDlgModelNameContainer = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oDialogModel); + m_xDlgModelNameContainer = UnoRuntime.queryInterface(XNameContainer.class, oDialogModel); // create the dialog... Object oUnoDialog = _xMCF.createInstanceWithContext("com.sun.star.awt.UnoControlDialog", m_xContext); - m_xDialogControl = (XControl) UnoRuntime.queryInterface(XControl.class, oUnoDialog); + m_xDialogControl = UnoRuntime.queryInterface(XControl.class, oUnoDialog); // The scope of the control container is public... - m_xDlgContainer = (XControlContainer) UnoRuntime.queryInterface(XControlContainer.class, oUnoDialog); + m_xDlgContainer = UnoRuntime.queryInterface(XControlContainer.class, oUnoDialog); - m_xTopWindow = (XTopWindow) UnoRuntime.queryInterface(XTopWindow.class, m_xDlgContainer); + m_xTopWindow = UnoRuntime.queryInterface(XTopWindow.class, m_xDlgContainer); // link the dialog and its model... - XControlModel xControlModel = (XControlModel) UnoRuntime.queryInterface(XControlModel.class, oDialogModel); + XControlModel xControlModel = UnoRuntime.queryInterface(XControlModel.class, oDialogModel); m_xDialogControl.setModel(xControlModel); } catch (com.sun.star.uno.Exception exception) { exception.printStackTrace(System.err); @@ -276,7 +276,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis addRoadmap(getRoadmapItemStateChangeListener()); insertRoadmapItem(0, true, "Introduction", 1); insertRoadmapItem(1, true, "Documents", 2); - xDialog = (XDialog) UnoRuntime.queryInterface(XDialog.class, m_xDialogControl); + xDialog = UnoRuntime.queryInterface(XDialog.class, m_xDialogControl); return xDialog.execute(); } @@ -285,8 +285,8 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis if (m_xWindowPeer == null) { createWindowPeer(); } - xDialog = (XDialog) UnoRuntime.queryInterface(XDialog.class, m_xDialogControl); - m_xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, m_xDialogControl); + xDialog = UnoRuntime.queryInterface(XDialog.class, m_xDialogControl); + m_xComponent = UnoRuntime.queryInterface(XComponent.class, m_xDialogControl); return xDialog.execute(); } @@ -300,7 +300,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis public void initialize(String[] PropertyNames, Object[] PropertyValues) throws com.sun.star.script.BasicErrorException{ try{ - XMultiPropertySet xMultiPropertySet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, m_xDlgModelNameContainer); + XMultiPropertySet xMultiPropertySet = UnoRuntime.queryInterface(XMultiPropertySet.class, m_xDlgModelNameContainer); xMultiPropertySet.setPropertyValues(PropertyNames, PropertyValues); } catch (com.sun.star.uno.Exception ex) { ex.printStackTrace(System.err); @@ -319,11 +319,11 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis public XWindowPeer createWindowPeer(XWindowPeer _xWindowParentPeer) throws com.sun.star.script.BasicErrorException{ try{ if (_xWindowParentPeer == null){ - XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, m_xDlgContainer); + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, m_xDlgContainer); xWindow.setVisible(false); Object tk = m_xMCF.createInstanceWithContext("com.sun.star.awt.Toolkit", m_xContext); - XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, tk); - mxReschedule = (XReschedule) UnoRuntime.queryInterface(XReschedule.class, xToolkit); + XToolkit xToolkit = UnoRuntime.queryInterface(XToolkit.class, tk); + mxReschedule = UnoRuntime.queryInterface(XReschedule.class, xToolkit); m_xDialogControl.createPeer(xToolkit, _xWindowParentPeer); m_xWindowPeer = m_xDialogControl.getPeer(); return m_xWindowPeer; @@ -368,7 +368,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis public Object insertControlModel(String ServiceName, String sName, String[] sProperties, Object[] sValues) throws com.sun.star.script.BasicErrorException{ try { Object oControlModel = m_xMSFDialogModel.createInstance(ServiceName); - XMultiPropertySet xControlMultiPropertySet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oControlModel); + XMultiPropertySet xControlMultiPropertySet = UnoRuntime.queryInterface(XMultiPropertySet.class, oControlModel); xControlMultiPropertySet.setPropertyValues(sProperties, sValues); m_xDlgModelNameContainer.insertByName(sName, oControlModel); return oControlModel; @@ -387,7 +387,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // create a controlmodel at the multiservicefactory of the dialog model... Object oFTModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlFixedTextModel"); - XMultiPropertySet xFTModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oFTModel); + XMultiPropertySet xFTModelMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oFTModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xFTModelMPSet.setPropertyValues( @@ -398,13 +398,13 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // The following property may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration - XPropertySet xFTPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oFTModel); + XPropertySet xFTPSet = UnoRuntime.queryInterface(XPropertySet.class, oFTModel); xFTPSet.setPropertyValue("Label", _sLabel); // reference the control by the Name XControl xFTControl = m_xDlgContainer.getControl(sName); - xFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, xFTControl); - XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xFTControl); + xFixedText = UnoRuntime.queryInterface(XFixedText.class, xFTControl); + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, xFTControl); xWindow.addMouseListener(_xMouseListener); } catch (com.sun.star.uno.Exception ex) { /* perform individual exception handling here. @@ -430,7 +430,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // create a controlmodel at the multiservicefactory of the dialog model... Object oCFModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlCurrencyFieldModel"); - XMultiPropertySet xCFModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oCFModel); + XMultiPropertySet xCFModelMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oCFModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xCFModelMPSet.setPropertyValues( @@ -439,7 +439,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oCFModel); - XPropertySet xCFModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oCFModel); + XPropertySet xCFModelPSet = UnoRuntime.queryInterface(XPropertySet.class, oCFModel); // The following properties may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration @@ -449,7 +449,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // add a textlistener that is notified on each change of the controlvalue... Object oCFControl = m_xDlgContainer.getControl(sName); - xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, oCFControl); + xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, oCFControl); xTextComponent.addTextListener(_xTextListener); } catch (com.sun.star.uno.Exception ex) { /* perform individual exception handling here. @@ -477,7 +477,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // create a controlmodel at the multiservicefactory of the dialog model... Object oPBModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlProgressBarModel"); - XMultiPropertySet xPBModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oPBModel); + XMultiPropertySet xPBModelMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oPBModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xPBModelMPSet.setPropertyValues( new String[] {"Height", "Name", "PositionX", "PositionY", "Width"}, @@ -485,7 +485,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oPBModel); - xPBModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oPBModel); + xPBModelPSet = UnoRuntime.queryInterface(XPropertySet.class, oPBModel); // The following properties may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration @@ -515,7 +515,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // create a controlmodel at the multiservicefactory of the dialog model... Object oFLModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlFixedLineModel"); - XMultiPropertySet xFLModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oFLModel); + XMultiPropertySet xFLModelMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oFLModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xFLModelMPSet.setPropertyValues( @@ -527,7 +527,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // The following property may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration - XPropertySet xFLPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oFLModel); + XPropertySet xFLPSet = UnoRuntime.queryInterface(XPropertySet.class, oFLModel); xFLPSet.setPropertyValue("Label", _sLabel); } catch (com.sun.star.uno.Exception ex) { /* perform individual exception handling here. @@ -552,7 +552,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // create a controlmodel at the multiservicefactory of the dialog model... Object oGBModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlGroupBoxModel"); - XMultiPropertySet xGBModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oGBModel); + XMultiPropertySet xGBModelMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oGBModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xGBModelMPSet.setPropertyValues( @@ -564,7 +564,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // The following property may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration - XPropertySet xGBPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oGBModel); + XPropertySet xGBPSet = UnoRuntime.queryInterface(XPropertySet.class, oGBModel); xGBPSet.setPropertyValue("Label", "~My GroupBox"); } catch (com.sun.star.uno.Exception ex) { /* perform individual exception handling here. @@ -590,7 +590,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // create a controlmodel at the multiservicefactory of the dialog model... Object oTFModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlEditModel"); - XMultiPropertySet xTFModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oTFModel); + XMultiPropertySet xTFModelMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oTFModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xTFModelMPSet.setPropertyValues( @@ -599,7 +599,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oTFModel); - XPropertySet xTFModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oTFModel); + XPropertySet xTFModelPSet = UnoRuntime.queryInterface(XPropertySet.class, oTFModel); // The following property may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration @@ -607,8 +607,8 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis XControl xTFControl = m_xDlgContainer.getControl(sName); // add a textlistener that is notified on each change of the controlvalue... - xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, xTFControl); - XWindow xTFWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xTFControl); + xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, xTFControl); + XWindow xTFWindow = UnoRuntime.queryInterface(XWindow.class, xTFControl); xTFWindow.addFocusListener(_xFocusListener); xTextComponent.addTextListener(_xTextListener); xTFWindow.addKeyListener(this); @@ -635,7 +635,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // create a controlmodel at the multiservicefactory of the dialog model... Object oTFModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlTimeFieldModel"); - XMultiPropertySet xTFModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oTFModel); + XMultiPropertySet xTFModelMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oTFModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xTFModelMPSet.setPropertyValues( @@ -644,7 +644,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oTFModel); - xTFModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oTFModel); + xTFModelPSet = UnoRuntime.queryInterface(XPropertySet.class, oTFModel); // The following properties may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration @@ -677,7 +677,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // create a controlmodel at the multiservicefactory of the dialog model... Object oDFModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlDateFieldModel"); - XMultiPropertySet xDFModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oDFModel); + XMultiPropertySet xDFModelMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oDFModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xDFModelMPSet.setPropertyValues( @@ -686,7 +686,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oDFModel); - xDFModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oDFModel); + xDFModelPSet = UnoRuntime.queryInterface(XPropertySet.class, oDFModel); // The following properties may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration @@ -697,7 +697,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis Object oDFControl = m_xDlgContainer.getControl(sName); // add a SpinListener that is notified on each change of the controlvalue... - XSpinField xSpinField = (XSpinField) UnoRuntime.queryInterface(XSpinField.class, oDFControl); + XSpinField xSpinField = UnoRuntime.queryInterface(XSpinField.class, oDFControl); xSpinField.addSpinListener(_xSpinListener); } catch (com.sun.star.uno.Exception ex) { /* perform individual exception handling here. @@ -723,7 +723,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // create a controlmodel at the multiservicefactory of the dialog model... Object oPFModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlPatternFieldModel"); - XMultiPropertySet xPFModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oPFModel); + XMultiPropertySet xPFModelMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oPFModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xPFModelMPSet.setPropertyValues( @@ -732,7 +732,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oPFModel); - xPFModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oPFModel); + xPFModelPSet = UnoRuntime.queryInterface(XPropertySet.class, oPFModel); // The following properties may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration @@ -767,7 +767,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // create a controlmodel at the multiservicefactory of the dialog model... Object oNFModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlNumericFieldModel"); - XMultiPropertySet xNFModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oNFModel); + XMultiPropertySet xNFModelMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oNFModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xNFModelMPSet.setPropertyValues( new String[] {"Height", "Name", "PositionX", "PositionY", "Spin", "StrictFormat", "Width"}, @@ -775,7 +775,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oNFModel); - xNFModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oNFModel); + xNFModelPSet = UnoRuntime.queryInterface(XPropertySet.class, oNFModel); // The following properties may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration xNFModelPSet.setPropertyValue("ValueMin", new Double(_fValueMin)); @@ -811,7 +811,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // create a controlmodel at the multiservicefactory of the dialog model... Object oSBModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlScrollBarModel"); - XMultiPropertySet xSBModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oSBModel); + XMultiPropertySet xSBModelMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oSBModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xSBModelMPSet.setPropertyValues( new String[] {"Height", "Name", "Orientation", "PositionX", "PositionY", "Width"}, @@ -820,7 +820,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oSBModel); - xSBModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oSBModel); + xSBModelPSet = UnoRuntime.queryInterface(XPropertySet.class, oSBModel); // The following properties may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration xSBModelPSet.setPropertyValue("ScrollValueMin", new Integer(0)); @@ -831,7 +831,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // Add an Adjustment that will listen to changes of the scrollbar... XControl xSBControl = m_xDlgContainer.getControl(sName); - XScrollBar xScrollBar = (XScrollBar) UnoRuntime.queryInterface(XScrollBar.class, xSBControl); + XScrollBar xScrollBar = UnoRuntime.queryInterface(XScrollBar.class, xSBControl); xScrollBar.addAdjustmentListener(_xAdjustmentListener); } catch (com.sun.star.uno.Exception ex) { /* perform individual exception handling here. @@ -880,21 +880,21 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis Object oCBModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlCheckBoxModel"); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! - XMultiPropertySet xCBMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oCBModel); + XMultiPropertySet xCBMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oCBModel); xCBMPSet.setPropertyValues( new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Width" } , new Object[] {new Integer(8), "~Include page number", sName, new Integer(_nPosX), new Integer(_nPosY), new Integer(_nWidth)}); // The following property may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration - XPropertySet xCBModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xCBMPSet); + XPropertySet xCBModelPSet = UnoRuntime.queryInterface(XPropertySet.class, xCBMPSet); xCBModelPSet.setPropertyValue("TriState", Boolean.TRUE); xCBModelPSet.setPropertyValue("State", new Short((short) 1)); // add the model to the NameContainer of the dialog model m_xDlgModelNameContainer.insertByName(sName, oCBModel); XControl xCBControl = m_xDlgContainer.getControl(sName); - xCheckBox = (XCheckBox) UnoRuntime.queryInterface(XCheckBox.class, xCBControl); + xCheckBox = UnoRuntime.queryInterface(XCheckBox.class, xCBControl); // An ActionListener will be notified on the activation of the button... xCheckBox.addItemListener(_xItemListener); } catch (com.sun.star.uno.Exception ex) { @@ -922,7 +922,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // create a controlmodel at the multiservicefactory of the dialog model... Object oRBModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlRadioButtonModel"); - XMultiPropertySet xRBMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oRBModel); + XMultiPropertySet xRBMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oRBModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xRBMPSet.setPropertyValues( new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "State", "TabIndex", "Width" } , @@ -934,7 +934,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis sName = createUniqueName(m_xDlgModelNameContainer, "OptionButton"); oRBModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlRadioButtonModel"); - xRBMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oRBModel); + xRBMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oRBModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xRBMPSet.setPropertyValues( new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "TabIndex", "Width" } , @@ -964,14 +964,14 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // create a controlmodel at the multiservicefactory of the dialog model... Object oListBoxModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlListBoxModel"); - XMultiPropertySet xLBModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oListBoxModel); + XMultiPropertySet xLBModelMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oListBoxModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xLBModelMPSet.setPropertyValues( new String[] {"Dropdown", "Height", "Name", "PositionX", "PositionY", "Step", "StringItemList", "Width" } , new Object[] {Boolean.TRUE, new Integer(12), sName, new Integer(_nPosX), new Integer(_nPosY), new Integer(_nStep), _sStringItemList, new Integer(_nWidth)}); // The following property may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration - XPropertySet xLBModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xLBModelMPSet); + XPropertySet xLBModelPSet = UnoRuntime.queryInterface(XPropertySet.class, xLBModelMPSet); xLBModelPSet.setPropertyValue("MultiSelection", Boolean.TRUE); short[] nSelItems = new short[] {(short) 1, (short) 3}; xLBModelPSet.setPropertyValue("SelectedItems", nSelItems); @@ -979,7 +979,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis m_xDlgModelNameContainer.insertByName(sName, xLBModelMPSet); XControl xControl = m_xDlgContainer.getControl(sName); // retrieve a ListBox that is more convenient to work with than the Model of the ListBox... - xListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, xControl); + xListBox = UnoRuntime.queryInterface(XListBox.class, xControl); } catch (com.sun.star.uno.Exception ex) { /* perform individual exception handling here. * Possible exception types are: @@ -1006,7 +1006,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // create a controlmodel at the multiservicefactory of the dialog model... Object oComboBoxModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlComboBoxModel"); - XMultiPropertySet xCbBModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oComboBoxModel); + XMultiPropertySet xCbBModelMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oComboBoxModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xCbBModelMPSet.setPropertyValues( new String[] {"Dropdown", "Height", "Name", "PositionX", "PositionY", "StringItemList", "Width" } , @@ -1014,7 +1014,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // The following property may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration - XPropertySet xCbBModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xCbBModelMPSet); + XPropertySet xCbBModelPSet = UnoRuntime.queryInterface(XPropertySet.class, xCbBModelMPSet); xCbBModelPSet.setPropertyValue("MaxTextLen", new Short((short) 10)); xCbBModelPSet.setPropertyValue("ReadOnly", Boolean.FALSE); @@ -1023,7 +1023,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis XControl xControl = m_xDlgContainer.getControl(sName); // retrieve a ListBox that is more convenient to work with than the Model of the ListBox... - xComboBox = (XComboBox) UnoRuntime.queryInterface(XComboBox.class, xControl); + xComboBox = UnoRuntime.queryInterface(XComboBox.class, xControl); } catch (com.sun.star.uno.Exception ex) { /* perform individual exception handling here. * Possible exception types are: @@ -1049,13 +1049,13 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // create a controlmodel at the multiservicefactory of the dialog model... Object oFFModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlFormattedFieldModel"); - XMultiPropertySet xFFModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oFFModel); + XMultiPropertySet xFFModelMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oFFModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xFFModelMPSet.setPropertyValues( new String[] {"EffectiveValue", "Height", "Name", "PositionX", "PositionY", "StrictFormat", "Spin", "Width"}, new Object[] { new Double(12348), new Integer(12), sName, new Integer(_nPosX), new Integer(_nPosY), Boolean.TRUE, Boolean.TRUE, new Integer(_nWidth)}); - xFFModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oFFModel); + xFFModelPSet = UnoRuntime.queryInterface(XPropertySet.class, oFFModel); // to define a numberformat you always need a locale... com.sun.star.lang.Locale aLocale = new com.sun.star.lang.Locale(); aLocale.Country = "US"; @@ -1065,7 +1065,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // a NumberFormatsSupplier has to be created first "in the open countryside"... Object oNumberFormatsSupplier = m_xMCF.createInstanceWithContext("com.sun.star.util.NumberFormatsSupplier", m_xContext); - XNumberFormatsSupplier xNumberFormatsSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, oNumberFormatsSupplier); + XNumberFormatsSupplier xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, oNumberFormatsSupplier); XNumberFormats xNumberFormats = xNumberFormatsSupplier.getNumberFormats(); // is the numberformat already defined? int nFormatKey = xNumberFormats.queryKey(sFormatString, aLocale, true); @@ -1085,7 +1085,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // finally we add a Spin-Listener to the control XControl xFFControl = m_xDlgContainer.getControl(sName); // add a SpinListener that is notified on each change of the controlvalue... - XSpinField xSpinField = (XSpinField) UnoRuntime.queryInterface(XSpinField.class, xFFControl); + XSpinField xSpinField = UnoRuntime.queryInterface(XSpinField.class, xFFControl); xSpinField.addSpinListener(_xSpinListener); } catch (com.sun.star.uno.Exception ex) { @@ -1116,31 +1116,31 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // retrieve the configured Work path... Object oPathSettings = m_xMCF.createInstanceWithContext("com.sun.star.util.PathSettings",m_xContext); - XPropertySet xPropertySet = (XPropertySet) com.sun.star.uno.UnoRuntime.queryInterface(XPropertySet.class, oPathSettings); + XPropertySet xPropertySet = com.sun.star.uno.UnoRuntime.queryInterface(XPropertySet.class, oPathSettings); String sWorkUrl = (String) xPropertySet.getPropertyValue("Work"); // convert the Url to a system path that is "human readable"... Object oFCProvider = m_xMCF.createInstanceWithContext("com.sun.star.ucb.FileContentProvider", m_xContext); - XFileIdentifierConverter xFileIdentifierConverter = (XFileIdentifierConverter) UnoRuntime.queryInterface(XFileIdentifierConverter.class, oFCProvider); + XFileIdentifierConverter xFileIdentifierConverter = UnoRuntime.queryInterface(XFileIdentifierConverter.class, oFCProvider); String sSystemWorkPath = xFileIdentifierConverter.getSystemPathFromFileURL(sWorkUrl); // create a controlmodel at the multiservicefactory of the dialog model... Object oFCModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlFileControlModel"); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! - XMultiPropertySet xFCModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oFCModel); + XMultiPropertySet xFCModelMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oFCModel); xFCModelMPSet.setPropertyValues( new String[] {"Height", "Name", "PositionX", "PositionY", "Text", "Width"}, new Object[] { new Integer(14), sName, new Integer(_nPosX), new Integer(_nPosY), sSystemWorkPath, new Integer(_nWidth)}); // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oFCModel); - XPropertySet xFCModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oFCModel); + XPropertySet xFCModelPSet = UnoRuntime.queryInterface(XPropertySet.class, oFCModel); // add a textlistener that is notified on each change of the controlvalue... XControl xFCControl = m_xDlgContainer.getControl(sName); - xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, xFCControl); - XWindow xFCWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xFCControl); + xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, xFCControl); + XWindow xFCWindow = UnoRuntime.queryInterface(XWindow.class, xFCControl); xTextComponent.addTextListener(_xTextListener); } catch (com.sun.star.uno.Exception ex) { /* perform individual exception handling here. @@ -1166,7 +1166,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // create a controlmodel at the multiservicefactory of the dialog model... Object oButtonModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlButtonModel"); - XMultiPropertySet xButtonMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oButtonModel); + XMultiPropertySet xButtonMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oButtonModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xButtonMPSet.setPropertyValues( new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "PushButtonType", "Width" } , @@ -1175,7 +1175,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // add the model to the NameContainer of the dialog model m_xDlgModelNameContainer.insertByName(sName, oButtonModel); XControl xButtonControl = m_xDlgContainer.getControl(sName); - xButton = (XButton) UnoRuntime.queryInterface(XButton.class, xButtonControl); + xButton = UnoRuntime.queryInterface(XButton.class, xButtonControl); // An ActionListener will be notified on the activation of the button... xButton.addActionListener(_xActionListener); } catch (com.sun.star.uno.Exception ex) { @@ -1198,10 +1198,10 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis * @return the windowpeer of the frame */ public XWindowPeer getWindowPeer(XTextDocument _xTextDocument){ - XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, _xTextDocument); + XModel xModel = UnoRuntime.queryInterface(XModel.class, _xTextDocument); XFrame xFrame = xModel.getCurrentController().getFrame(); XWindow xWindow = xFrame.getContainerWindow(); - XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xWindow); + XWindowPeer xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xWindow); return xWindowPeer; } @@ -1209,7 +1209,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis XFrame xRetFrame = null; try { Object oDesktop = m_xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", m_xContext); - XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, oDesktop); + XDesktop xDesktop = UnoRuntime.queryInterface(XDesktop.class, oDesktop); xRetFrame = xDesktop.getCurrentFrame(); } catch (com.sun.star.uno.Exception ex) { ex.printStackTrace(); @@ -1221,9 +1221,9 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis public void textChanged(TextEvent textEvent) { try { // get the control that has fired the event, - XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, textEvent.Source); + XControl xControl = UnoRuntime.queryInterface(XControl.class, textEvent.Source); XControlModel xControlModel = xControl.getModel(); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xControlModel); String sName = (String) xPSet.getPropertyValue("Name"); // just in case the listener has been added to several controls, // we make sure we refer to the right one @@ -1248,9 +1248,9 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis public void up(SpinEvent spinEvent) { try { // get the control that has fired the event, - XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, spinEvent.Source); + XControl xControl = UnoRuntime.queryInterface(XControl.class, spinEvent.Source); XControlModel xControlModel = xControl.getModel(); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xControlModel); String sName = (String) xPSet.getPropertyValue("Name"); // just in case the listener has been added to several controls, // we make sure we refer to the right one @@ -1287,9 +1287,9 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis public void actionPerformed(ActionEvent rEvent) { try{ // get the control that has fired the event, - XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, rEvent.Source); + XControl xControl = UnoRuntime.queryInterface(XControl.class, rEvent.Source); XControlModel xControlModel = xControl.getModel(); - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel); + XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xControlModel); String sName = (String) xPSet.getPropertyValue("Name"); // just in case the listener has been added to several controls, // we make sure we refer to the right one @@ -1315,7 +1315,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // get the window of the Window that has gained the Focus... // Note that the xWindow is just a representation of the controlwindow // but not of the control itself - XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, _focusEvent.NextFocus); + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, _focusEvent.NextFocus); } } @@ -1335,15 +1335,15 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis public void mouseEntered(MouseEvent _mouseEvent) { try { // retrieve the control that the event has been invoked at... - XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, _mouseEvent.Source); + XControl xControl = UnoRuntime.queryInterface(XControl.class, _mouseEvent.Source); Object tk = m_xMCF.createInstanceWithContext("com.sun.star.awt.Toolkit", m_xContext); - XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, tk); + XToolkit xToolkit = UnoRuntime.queryInterface(XToolkit.class, tk); // create the peer of the control by passing the windowpeer of the parent // in this case the windowpeer of the control xControl.createPeer(xToolkit, m_xWindowPeer); // create a pointer object "in the open countryside" and set the type accordingly... Object oPointer = this.m_xMCF.createInstanceWithContext("com.sun.star.awt.Pointer", this.m_xContext); - XPointer xPointer = (XPointer) UnoRuntime.queryInterface(XPointer.class, oPointer); + XPointer xPointer = UnoRuntime.queryInterface(XPointer.class, oPointer); xPointer.setType(com.sun.star.awt.SystemPointer.REFHAND); // finally set the created pointer at the windowpeer of the control xControl.getPeer().setPointer(xPointer); @@ -1357,10 +1357,10 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis public void itemStateChanged(ItemEvent itemEvent) { try{ // retrieve the control that the event has been invoked at... - XCheckBox xCheckBox = (XCheckBox) UnoRuntime.queryInterface(XCheckBox.class, itemEvent.Source); + XCheckBox xCheckBox = UnoRuntime.queryInterface(XCheckBox.class, itemEvent.Source); // retrieve the control that we want to disable or enable - XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, m_xDlgContainer.getControl("CommandButton1")); - XPropertySet xModelPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControl.getModel()); + XControl xControl = UnoRuntime.queryInterface(XControl.class, m_xDlgContainer.getControl("CommandButton1")); + XPropertySet xModelPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xControl.getModel()); short nState = xCheckBox.getState(); boolean bdoEnable = true; switch (nState){ @@ -1417,7 +1417,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // create a unique name by means of an own implementation... String sRoadmapName = createUniqueName(m_xDlgModelNameContainer, "Roadmap"); - xDialogModelPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, m_xMSFDialogModel); + xDialogModelPropertySet = UnoRuntime.queryInterface(XPropertySet.class, m_xMSFDialogModel); // Similar to the office assistants the roadmap is adjusted to the height of the dialog // where a certain space is left at the bottom for the buttons... int nDialogHeight = ((Integer) xDialogModelPropertySet.getPropertyValue("Height")).intValue(); @@ -1426,21 +1426,21 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis Object oRoadmapModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlRoadmapModel"); // define the properties of the roadmapmodel - XMultiPropertySet xRMMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oRoadmapModel); + XMultiPropertySet xRMMPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, oRoadmapModel); xRMMPSet.setPropertyValues( new String[] {"Complete", "Height", "Name", "PositionX", "PositionY", "Text", "Width" }, new Object[] {Boolean.FALSE, new Integer(nDialogHeight - 26), sRoadmapName, new Integer(0), new Integer(0), "Steps", new Integer(85)}); - m_xRMPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmapModel); + m_xRMPSet = UnoRuntime.queryInterface(XPropertySet.class, oRoadmapModel); // add the roadmapmodel to the dialog container.. m_xDlgModelNameContainer.insertByName(sRoadmapName, oRoadmapModel); // the roadmapmodel is a SingleServiceFactory to instantiate the roadmapitems... - m_xSSFRoadmap = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class, oRoadmapModel); - m_xRMIndexCont = (XIndexContainer) UnoRuntime.queryInterface(XIndexContainer.class, oRoadmapModel); + m_xSSFRoadmap = UnoRuntime.queryInterface(XSingleServiceFactory.class, oRoadmapModel); + m_xRMIndexCont = UnoRuntime.queryInterface(XIndexContainer.class, oRoadmapModel); // add the itemlistener to the control... XControl xRMControl = this.m_xDlgContainer.getControl(sRoadmapName); - XItemEventBroadcaster xRMBroadcaster = (XItemEventBroadcaster) UnoRuntime.queryInterface(XItemEventBroadcaster.class, xRMControl); + XItemEventBroadcaster xRMBroadcaster = UnoRuntime.queryInterface(XItemEventBroadcaster.class, xRMControl); xRMBroadcaster.addItemListener( getRoadmapItemStateChangeListener() ); } catch (java.lang.Exception jexception) { jexception.printStackTrace(System.err); @@ -1457,7 +1457,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // a roadmap is a SingleServiceFactory that can only create roadmapitems that are the only possible // element types of the container Object oRoadmapItem = m_xSSFRoadmap.createInstance(); - XPropertySet xRMItemPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmapItem); + XPropertySet xRMItemPSet = UnoRuntime.queryInterface(XPropertySet.class, oRoadmapItem); xRMItemPSet.setPropertyValue("Label", _sLabel); // sometimes steps are supposed to be set disabled depending on the program logic... xRMItemPSet.setPropertyValue("Enabled", new Boolean(_bEnabled)); |