[Libreoffice-commits] core.git: odk/examples qadevOOo/tests reportbuilder/java reportdesign/qa scripting/java scripting/workben sot/qa sw/qa ucb/qa ucb/test unoxml/qa

Noel Grandin noel at peralex.com
Fri Apr 19 00:52:29 PDT 2013


 odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java |    8 
 odk/examples/DevelopersGuide/Components/JavaComponent/TestJavaComponent.java                       |    4 
 odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java                       |   15 
 odk/examples/DevelopersGuide/Config/ConfigExamples.java                                            |   99 +--
 odk/examples/DevelopersGuide/Database/CodeSamples.java                                             |   39 -
 odk/examples/DevelopersGuide/Database/OpenQuery.java                                               |   24 
 odk/examples/DevelopersGuide/Database/RowSet.java                                                  |   32 -
 odk/examples/DevelopersGuide/Database/Sales.java                                                   |   37 -
 odk/examples/DevelopersGuide/Database/SalesMan.java                                                |    4 
 odk/examples/DevelopersGuide/Database/sdbcx.java                                                   |   63 +-
 odk/examples/DevelopersGuide/Drawing/ChangeOrderDemo.java                                          |    9 
 odk/examples/DevelopersGuide/Drawing/ControlAndSelectDemo.java                                     |   25 
 odk/examples/DevelopersGuide/Drawing/CustomShowDemo.java                                           |   29 
 odk/examples/DevelopersGuide/Drawing/DrawViewDemo.java                                             |   12 
 odk/examples/DevelopersGuide/Drawing/DrawingDemo.java                                              |   26 
 odk/examples/DevelopersGuide/Drawing/FillAndLineStyleDemo.java                                     |    6 
 odk/examples/DevelopersGuide/Drawing/GluePointDemo.java                                            |   25 
 odk/examples/DevelopersGuide/Drawing/GraphicExportDemo.java                                        |   14 
 odk/examples/DevelopersGuide/Drawing/Helper.java                                                   |   23 
 odk/examples/DevelopersGuide/Drawing/LayerDemo.java                                                |   15 
 odk/examples/DevelopersGuide/Drawing/ObjectTransformationDemo.java                                 |    9 
 odk/examples/DevelopersGuide/Drawing/Organigram.java                                               |   34 -
 odk/examples/DevelopersGuide/Drawing/PageHelper.java                                               |   57 -
 odk/examples/DevelopersGuide/Drawing/PresentationDemo.java                                         |   28 
 odk/examples/DevelopersGuide/Drawing/ShapeHelper.java                                              |   26 
 odk/examples/DevelopersGuide/Drawing/StyleDemo.java                                                |   35 -
 odk/examples/DevelopersGuide/Drawing/TextDemo.java                                                 |    9 
 odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent.java                                    |   27 
 odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape.java                                   |   76 +-
 odk/examples/DevelopersGuide/GUI/DialogDocument.java                                               |   12 
 odk/examples/DevelopersGuide/GUI/ImageControlSample.java                                           |   12 
 odk/examples/DevelopersGuide/GUI/MessageBox.java                                                   |   29 
 odk/examples/DevelopersGuide/GUI/RoadmapItemStateChangeListener.java                               |    2 
 odk/examples/DevelopersGuide/GUI/SystemDialog.java                                                 |   20 
 odk/examples/DevelopersGuide/GUI/UnoDialogSample.java                                              |  188 +++---
 odk/examples/DevelopersGuide/GUI/UnoDialogSample2.java                                             |   16 
 odk/examples/DevelopersGuide/GUI/UnoMenu.java                                                      |   20 
 odk/examples/DevelopersGuide/GUI/UnoMenu2.java                                                     |    8 
 odk/examples/DevelopersGuide/OfficeDev/Clipboard/Clipboard.java                                    |   27 
 odk/examples/DevelopersGuide/OfficeDev/ContextMenuInterceptor.java                                 |   74 +-
 odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java                    |   64 --
 odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java       |   16 
 odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java            |    2 
 odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_java/FlatXml.java           |    6 
 odk/examples/DevelopersGuide/OfficeDev/Linguistic/LinguisticExamples.java                          |    5 
 odk/examples/DevelopersGuide/OfficeDev/Linguistic/OneInstanceFactory.java                          |    6 
 odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java                               |    6 
 odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java                            |    4 
 odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.java                          |    4 
 odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.java                             |    4 
 odk/examples/DevelopersGuide/OfficeDev/MenuElement.java                                            |    8 
 odk/examples/DevelopersGuide/OfficeDev/Number_Formats.java                                         |   33 -
 odk/examples/DevelopersGuide/OfficeDev/PathSettings/PathSettingsTest.java                          |    2 
 odk/examples/DevelopersGuide/OfficeDev/PathSubstitution/PathSubstitutionTest.java                  |    2 
 odk/examples/DevelopersGuide/OfficeDev/TerminationTest/TerminationTest.java                        |    2 
 odk/examples/DevelopersGuide/ProfUNO/InterprocessConn/ConnectionAwareClient.java                   |   20 
 odk/examples/DevelopersGuide/ProfUNO/InterprocessConn/UrlResolver.java                             |    2 
 odk/examples/DevelopersGuide/ProfUNO/SimpleBootstrap_java/SimpleBootstrap_java.java                |    4 
 odk/examples/DevelopersGuide/ScriptingFramework/SayHello/SayHello/SayHello.java                    |    8 
 odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java  |   15 
 odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.java                               |    4 
 odk/examples/DevelopersGuide/Spreadsheet/GeneralTableSample.java                                   |   43 -
 odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetDocHelper.java                                 |   64 --
 odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetSample.java                                    |  307 +++-------
 odk/examples/DevelopersGuide/Spreadsheet/ViewSample.java                                           |   27 
 odk/examples/DevelopersGuide/Text/TextDocuments.java                                               |  264 +++-----
 odk/examples/java/ConverterServlet/ConverterServlet.java                                           |   28 
 odk/examples/java/DocumentHandling/DocumentConverter.java                                          |   17 
 odk/examples/java/DocumentHandling/DocumentLoader.java                                             |    5 
 odk/examples/java/DocumentHandling/DocumentPrinter.java                                            |    9 
 odk/examples/java/DocumentHandling/DocumentSaver.java                                              |   19 
 odk/examples/java/Drawing/SDraw.java                                                               |   49 -
 odk/examples/java/NotesAccess/NotesAccess.java                                                     |   19 
 odk/examples/java/Spreadsheet/CalcAddins.java                                                      |    4 
 odk/examples/java/Spreadsheet/ChartTypeChange.java                                                 |   65 --
 odk/examples/java/Spreadsheet/EuroAdaption.java                                                    |   46 -
 odk/examples/java/Spreadsheet/SCalc.java                                                           |   53 -
 odk/examples/java/Storage/StorageFunctionality.java                                                |   27 
 odk/examples/java/Storage/Test01.java                                                              |    8 
 odk/examples/java/Storage/Test02.java                                                              |    8 
 odk/examples/java/Storage/Test03.java                                                              |    8 
 odk/examples/java/Storage/Test04.java                                                              |   10 
 odk/examples/java/Storage/Test05.java                                                              |    6 
 odk/examples/java/Storage/Test06.java                                                              |    4 
 odk/examples/java/Storage/Test07.java                                                              |   10 
 odk/examples/java/Storage/Test08.java                                                              |   12 
 odk/examples/java/Storage/Test09.java                                                              |    8 
 odk/examples/java/Storage/TestHelper.java                                                          |   44 -
 odk/examples/java/Text/BookmarkInsertion.java                                                      |   50 -
 odk/examples/java/Text/GraphicsInserter.java                                                       |   27 
 odk/examples/java/Text/HardFormatting.java                                                         |   42 -
 odk/examples/java/Text/SWriter.java                                                                |   42 -
 odk/examples/java/Text/StyleCreation.java                                                          |   34 -
 odk/examples/java/Text/StyleInitialization.java                                                    |   59 -
 odk/examples/java/Text/TextDocumentStructure.java                                                  |   58 -
 odk/examples/java/Text/TextReplace.java                                                            |   33 -
 odk/examples/java/Text/WriterSelector.java                                                         |   48 -
 qadevOOo/tests/java/mod/_regtypeprov/uno/RegistryTypeDescriptionProvider.java                      |   10 
 qadevOOo/tests/java/mod/_remotebridge/uno/various.java                                             |   15 
 qadevOOo/tests/java/mod/_servicemgr/uno/OServiceManager.java                                       |    6 
 qadevOOo/tests/java/mod/_streams/uno/DataInputStream.java                                          |   15 
 qadevOOo/tests/java/mod/_streams/uno/DataOutputStream.java                                         |   16 
 qadevOOo/tests/java/mod/_streams/uno/MarkableInputStream.java                                      |   12 
 qadevOOo/tests/java/mod/_streams/uno/MarkableOutputStream.java                                     |   19 
 qadevOOo/tests/java/mod/_streams/uno/ObjectInputStream.java                                        |   39 -
 qadevOOo/tests/java/mod/_streams/uno/ObjectOutputStream.java                                       |   45 -
 qadevOOo/tests/java/mod/_streams/uno/Pipe.java                                                     |    3 
 qadevOOo/tests/java/mod/_streams/uno/Pump.java                                                     |    6 
 qadevOOo/tests/java/mod/_typemgr/uno/TypeDescriptionManager.java                                   |    7 
 reportbuilder/java/org/libreoffice/report/SDBCReportData.java                                      |   12 
 reportbuilder/java/org/libreoffice/report/SDBCReportDataFactory.java                               |   24 
 reportbuilder/java/org/libreoffice/report/SOImageService.java                                      |    6 
 reportbuilder/java/org/libreoffice/report/StorageRepository.java                                   |   12 
 reportbuilder/java/org/libreoffice/report/pentaho/SOFormulaParser.java                             |    2 
 reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java                          |   16 
 reportdesign/qa/complex/reportdesign/ReportDesignerTest.java                                       |    2 
 scripting/java/com/sun/star/script/framework/io/XInputStreamImpl.java                              |    2 
 scripting/java/org/openoffice/idesupport/ExtensionFinder.java                                      |    2 
 scripting/java/org/openoffice/idesupport/localoffice/LocalOfficeImpl.java                          |    8 
 scripting/workben/ifc/scripting/ScriptingUtils.java                                                |   13 
 scripting/workben/ifc/scripting/SecurityDialogUtil.java                                            |   14 
 scripting/workben/ifc/scripting/_XScriptInfoAccess.java                                            |    3 
 scripting/workben/ifc/scripting/_XScriptInvocation.java                                            |   15 
 scripting/workben/ifc/scripting/_XScriptNameResolver.java                                          |   13 
 scripting/workben/ifc/scripting/_XScriptSecurity.java                                              |   27 
 scripting/workben/ifc/scripting/_XScriptStorageManager.java                                        |    3 
 scripting/workben/installer/IdeVersion.java                                                        |    6 
 scripting/workben/installer/Version.java                                                           |    4 
 scripting/workben/installer/Welcome.java                                                           |    2 
 scripting/workben/mod/_scripting/Dispatch.java                                                     |    9 
 scripting/workben/mod/_scripting/Function.java                                                     |    4 
 scripting/workben/mod/_scripting/FunctionProvider.java                                             |    2 
 scripting/workben/mod/_scripting/ScriptInfo.java                                                   |    7 
 scripting/workben/mod/_scripting/ScriptStorage.java                                                |    3 
 scripting/workben/mod/_scripting/ScriptStorageManager.java                                         |    7 
 sot/qa/complex/olesimplestorage/Test01.java                                                        |    4 
 sw/qa/complex/writer/CheckTable.java                                                               |    3 
 ucb/qa/complex/tdoc/_XChild.java                                                                   |    2 
 ucb/qa/complex/tdoc/_XCommandProcessor.java                                                        |    4 
 ucb/test/com/sun/star/comp/ucb/GlobalTransfer_Test.java                                            |   11 
 unoxml/qa/complex/unoxml/RDFRepositoryTest.java                                                    |    4 
 141 files changed, 1513 insertions(+), 1918 deletions(-)

New commits:
commit 8d87758d65e4a03271f76e354dfc84c1fcd5fe21
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Apr 17 14:59:35 2013 +0200

    Java cleanup, remove the rest of the unnecessary casts
    
    Change-Id: Ia61d250f6b3711abc29569c5ece38a6f87e38daa
    Reviewed-on: https://gerrit.libreoffice.org/3432
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
index 7588355..86d58da 100644
--- a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
+++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
@@ -100,12 +100,12 @@ public class ProtocolHandlerAddon {
 
             if ( object.length > 0 )
             {
-                m_xFrame = ( XFrame ) UnoRuntime.queryInterface(
+                m_xFrame = UnoRuntime.queryInterface(
                     XFrame.class, object[ 0 ] );
             }
 
             // Create the toolkit to have access to it later
-            m_xToolkit = (XToolkit) UnoRuntime.queryInterface(
+            m_xToolkit = UnoRuntime.queryInterface(
                 XToolkit.class,
                 m_xCmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.awt.Toolkit",
                                                                         m_xCmpCtx));
@@ -210,7 +210,7 @@ public class ProtocolHandlerAddon {
                 aDescriptor.Type              = WindowClass.MODALTOP;
                 aDescriptor.WindowServiceName = new String( "infobox" );
                 aDescriptor.ParentIndex       = -1;
-                aDescriptor.Parent            = (XWindowPeer)UnoRuntime.queryInterface(
+                aDescriptor.Parent            = UnoRuntime.queryInterface(
                     XWindowPeer.class, m_xFrame.getContainerWindow());
                 aDescriptor.Bounds            = new Rectangle(0,0,300,200);
                 aDescriptor.WindowAttributes  = WindowAttribute.BORDER |
@@ -219,7 +219,7 @@ public class ProtocolHandlerAddon {
 
                 XWindowPeer xPeer = m_xToolkit.createWindow( aDescriptor );
                 if ( null != xPeer ) {
-                    XMessageBox xMsgBox = (XMessageBox)UnoRuntime.queryInterface(
+                    XMessageBox xMsgBox = UnoRuntime.queryInterface(
                         XMessageBox.class, xPeer);
                     if ( null != xMsgBox )
                     {
diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/TestJavaComponent.java b/odk/examples/DevelopersGuide/Components/JavaComponent/TestJavaComponent.java
index 1474735..489e4c3a 100644
--- a/odk/examples/DevelopersGuide/Components/JavaComponent/TestJavaComponent.java
+++ b/odk/examples/DevelopersGuide/Components/JavaComponent/TestJavaComponent.java
@@ -52,7 +52,7 @@ public class TestJavaComponent
         XMultiComponentFactory serviceManager, Object singleFactory )
         throws com.sun.star.uno.Exception
     {
-        XSet set = (XSet ) UnoRuntime.queryInterface( XSet.class, serviceManager );
+        XSet set = UnoRuntime.queryInterface( XSet.class, serviceManager );
         set.insert( singleFactory );
     }
 
@@ -60,7 +60,7 @@ public class TestJavaComponent
         XMultiComponentFactory serviceManager, Object singleFactory )
         throws com.sun.star.uno.Exception
     {
-        XSet set = (XSet ) UnoRuntime.queryInterface( XSet.class, serviceManager );
+        XSet set = UnoRuntime.queryInterface( XSet.class, serviceManager );
         set.remove( singleFactory );
 
     }
diff --git a/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java b/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java
index 146aef4..513cc1a 100644
--- a/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java
+++ b/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java
@@ -82,7 +82,7 @@ public class DialogComponent {
 
             try {
                 // Create the toolkit to have access to it later
-                m_xToolkit = (XToolkit) UnoRuntime.queryInterface(
+                m_xToolkit = UnoRuntime.queryInterface(
                     XToolkit.class,
                     m_xCmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.awt.Toolkit",
                                                                             m_xCmpCtx));
@@ -113,8 +113,7 @@ public class DialogComponent {
                         "com.sun.star.awt.DialogProvider2", m_xCmpCtx );
                 }
 
-                XDialogProvider2 xDialogProvider = (XDialogProvider2)
-                    UnoRuntime.queryInterface( XDialogProvider2.class, obj );
+                XDialogProvider2 xDialogProvider = UnoRuntime.queryInterface( XDialogProvider2.class, obj );
 
                 XDialog xDialog = xDialogProvider.createDialogWithHandler( DialogURL, this );
                 if( xDialog != null )
@@ -127,13 +126,13 @@ public class DialogComponent {
         }
 
         public void copyText( XDialog xDialog, Object aEventObject ) {
-            XControlContainer xControlContainer = (XControlContainer)UnoRuntime.queryInterface(
+            XControlContainer xControlContainer = UnoRuntime.queryInterface(
                 XControlContainer.class, xDialog );
             String aTextPropertyStr = "Text";
             String aText = "";
             XControl xTextField1Control = xControlContainer.getControl( "TextField1" );
             XControlModel xControlModel1 = xTextField1Control.getModel();
-            XPropertySet xPropertySet1 = (XPropertySet)UnoRuntime.queryInterface(
+            XPropertySet xPropertySet1 = UnoRuntime.queryInterface(
                 XPropertySet.class, xControlModel1 );
             try
             {
@@ -145,7 +144,7 @@ public class DialogComponent {
 
             XControl xTextField2Control = xControlContainer.getControl( "TextField2" );
             XControlModel xControlModel2 = xTextField2Control.getModel();
-            XPropertySet xPropertySet2 = (XPropertySet)UnoRuntime.queryInterface(
+            XPropertySet xPropertySet2 = UnoRuntime.queryInterface(
                 XPropertySet.class, xControlModel2 );
             try
             {
@@ -257,7 +256,7 @@ public class DialogComponent {
                 aDescriptor.Type              = WindowClass.MODALTOP;
                 aDescriptor.WindowServiceName = new String( "infobox" );
                 aDescriptor.ParentIndex       = -1;
-                aDescriptor.Parent            = (XWindowPeer)UnoRuntime.queryInterface(
+                aDescriptor.Parent            = UnoRuntime.queryInterface(
                     XWindowPeer.class, m_xFrame.getContainerWindow());
                 aDescriptor.Bounds            = new Rectangle(0,0,300,200);
                 aDescriptor.WindowAttributes  = WindowAttribute.BORDER |
@@ -266,7 +265,7 @@ public class DialogComponent {
 
                 XWindowPeer xPeer = m_xToolkit.createWindow( aDescriptor );
                 if ( null != xPeer ) {
-                    XMessageBox xMsgBox = (XMessageBox)UnoRuntime.queryInterface(
+                    XMessageBox xMsgBox = UnoRuntime.queryInterface(
                         XMessageBox.class, xPeer);
                     if ( null != xMsgBox )
                     {
diff --git a/odk/examples/DevelopersGuide/Config/ConfigExamples.java b/odk/examples/DevelopersGuide/Config/ConfigExamples.java
index 979075e..0281dca 100644
--- a/odk/examples/DevelopersGuide/Config/ConfigExamples.java
+++ b/odk/examples/DevelopersGuide/Config/ConfigExamples.java
@@ -179,7 +179,7 @@ public class ConfigExamples
         {
             // check the provider implementation
             XServiceInfo xProviderServices =
-                (XServiceInfo) UnoRuntime.queryInterface( XServiceInfo.class, xProvider );
+                UnoRuntime.queryInterface( XServiceInfo.class, xProvider );
 
             if (xProviderServices == null ||
                 !xProviderServices.supportsService("com.sun.star.configuration.ConfigurationProvider"))
@@ -217,10 +217,9 @@ public class ConfigExamples
         final String sProviderService = "com.sun.star.configuration.ConfigurationProvider";
 
         // create the provider and return it as a XMultiServiceFactory
-        XMultiServiceFactory xProvider = (XMultiServiceFactory)
-            UnoRuntime.queryInterface(XMultiServiceFactory.class,
-                mxServiceManager.createInstanceWithContext(sProviderService,
-                                                           mxContext));
+        XMultiServiceFactory xProvider = UnoRuntime.queryInterface(XMultiServiceFactory.class,
+            mxServiceManager.createInstanceWithContext(sProviderService,
+                                                       mxContext));
 
         return xProvider;
     }
@@ -389,7 +388,7 @@ public class ConfigExamples
 
       // accessing a single nested value
         XHierarchicalPropertySet xProperties =
-            (XHierarchicalPropertySet)UnoRuntime.queryInterface(XHierarchicalPropertySet.class, xViewRoot);
+            UnoRuntime.queryInterface(XHierarchicalPropertySet.class, xViewRoot);
 
         Object aVisible = xProperties.getHierarchicalPropertyValue("Option/VisibleGrid");
         options.visible = ((Boolean) aVisible).booleanValue();
@@ -398,7 +397,7 @@ public class ConfigExamples
         Object xSubdivision = xProperties.getHierarchicalPropertyValue("Subdivision");
 
         XMultiPropertySet xSubdivProperties =
-            (XMultiPropertySet)UnoRuntime.queryInterface(XMultiPropertySet.class, xSubdivision);
+            UnoRuntime.queryInterface(XMultiPropertySet.class, xSubdivision);
 
         // variables for multi-element access
         String[] aElementNames = new String[2];
@@ -415,8 +414,7 @@ public class ConfigExamples
         Object xResolution = xProperties.getHierarchicalPropertyValue("Resolution");
 
         XMultiHierarchicalPropertySet xResolutionProperties =
-            (XMultiHierarchicalPropertySet)
-                UnoRuntime.queryInterface(XMultiHierarchicalPropertySet.class, xResolution);
+            UnoRuntime.queryInterface(XMultiHierarchicalPropertySet.class, xResolution);
 
         aElementNames[0] = "XAxis/Metric";
         aElementNames[1] = "YAxis/Metric";
@@ -429,7 +427,7 @@ public class ConfigExamples
       // all options have been retrieved - clean up and return
         // we are done with the view - dispose it
 
-        ((XComponent)UnoRuntime.queryInterface(XComponent.class, xViewRoot)).dispose();
+        UnoRuntime.queryInterface(XComponent.class, xViewRoot).dispose();
 
         return options;
     }
@@ -450,7 +448,7 @@ public class ConfigExamples
     {
         // First process this as an element (preorder traversal)
         XHierarchicalName xElementPath =
-            (XHierarchicalName) UnoRuntime.queryInterface(XHierarchicalName.class, xElement);
+            UnoRuntime.queryInterface(XHierarchicalName.class, xElement);
 
         String sPath = xElementPath.getHierarchicalName();
 
@@ -458,7 +456,7 @@ public class ConfigExamples
 
         // now process this as a container
         XNameAccess xChildAccess =
-            (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xElement);
+            UnoRuntime.queryInterface(XNameAccess.class, xElement);
 
         // get a list of child elements
         String[] aElementNames = xChildAccess.getElementNames();
@@ -472,7 +470,7 @@ public class ConfigExamples
             if ( aAnyConv.isObject(aChild) && !aAnyConv.isArray(aChild) )
             {
                 // then get an interface
-                XInterface xChildElement = (XInterface)UnoRuntime.queryInterface(XInterface.class, aChild);
+                XInterface xChildElement = UnoRuntime.queryInterface(XInterface.class, aChild);
 
                 // and continue processing child elements recursively
                 browseElementRecursively( xChildElement, aProcessor );
@@ -510,7 +508,7 @@ public class ConfigExamples
         //   This assumes that the processor
         //   does not keep a reference to the elements in processStructuralElement
 
-        ((XComponent) UnoRuntime.queryInterface(XComponent.class,xViewRoot)).dispose();
+        UnoRuntime.queryInterface(XComponent.class,xViewRoot).dispose();
         xViewRoot = null;
     }
 
@@ -549,11 +547,11 @@ public class ConfigExamples
                public void processStructuralElement( String sPath_, XInterface xElement_) {
                    // get template information, to detect instances of the 'Filter' template
                    XTemplateInstance xInstance =
-                       ( XTemplateInstance )UnoRuntime.queryInterface( XTemplateInstance .class,xElement_);
+                       UnoRuntime.queryInterface( XTemplateInstance .class,xElement_);
 
                    // only select the Filter entries
                    if (xInstance != null && xInstance.getTemplateName().endsWith("Filter")) {
-                        XNamed xNamed = (XNamed)UnoRuntime.queryInterface(XNamed.class,xElement_);
+                        XNamed xNamed = UnoRuntime.queryInterface(XNamed.class,xElement_);
                         System.out.println("Filter " + xNamed.getName() + " (" + sPath_ + ")");
                    }
                }
@@ -579,8 +577,7 @@ public class ConfigExamples
       // set up the initial values and register listeners
         // get a data access interface, to supply the view with a model
         XMultiHierarchicalPropertySet xProperties =
-            (XMultiHierarchicalPropertySet)
-                UnoRuntime.queryInterface(XMultiHierarchicalPropertySet.class, xViewRoot);
+            UnoRuntime.queryInterface(XMultiHierarchicalPropertySet.class, xViewRoot);
 
         dialog.setModel( xProperties );
 
@@ -589,7 +586,7 @@ public class ConfigExamples
         XChangesListener xListener = dialog.createChangesListener( );
 
         XChangesNotifier xNotifier =
-            (XChangesNotifier)UnoRuntime.queryInterface(XChangesNotifier.class, xViewRoot);
+            UnoRuntime.queryInterface(XChangesNotifier.class, xViewRoot);
 
         xNotifier.addChangesListener( xListener );
 
@@ -600,7 +597,7 @@ public class ConfigExamples
         {
             // changes have been applied to the view here
             XChangesBatch xUpdateControl =
-                (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class,xViewRoot);
+                UnoRuntime.queryInterface(XChangesBatch.class,xViewRoot);
 
             try
             {
@@ -617,7 +614,7 @@ public class ConfigExamples
         xNotifier.removeChangesListener( xListener );
 
         // we are done with the view - dispose it
-        ((XComponent)UnoRuntime.queryInterface(XComponent.class, xViewRoot)).dispose();
+        UnoRuntime.queryInterface(XComponent.class, xViewRoot).dispose();
     }
 
     /** A class that changes some grid options settings
@@ -721,7 +718,7 @@ public class ConfigExamples
             try
             {
                 XHierarchicalPropertySet xHPS =
-                    (XHierarchicalPropertySet)UnoRuntime.queryInterface(XHierarchicalPropertySet.class, mxModel);
+                    UnoRuntime.queryInterface(XHierarchicalPropertySet.class, mxModel);
 
                 final String sSetting = "Option/VisibleGrid";
 
@@ -749,7 +746,7 @@ public class ConfigExamples
         {
             Object xOtherViewRoot = createUpdatableView(xKey);
 
-            XNameReplace aReplace = (XNameReplace)UnoRuntime.queryInterface(XNameReplace.class, xOtherViewRoot);
+            XNameReplace aReplace = UnoRuntime.queryInterface(XNameReplace.class, xOtherViewRoot);
 
             String aItemNames [] = aReplace.getElementNames();
             for (int i=0; i < aItemNames.length; ++i) {
@@ -778,12 +775,12 @@ public class ConfigExamples
 
             // commit the changes
             XChangesBatch xUpdateControl =
-                (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class,xOtherViewRoot);
+                UnoRuntime.queryInterface(XChangesBatch.class,xOtherViewRoot);
 
             xUpdateControl.commitChanges();
 
             // we are done with the view - dispose it
-            ((XComponent)UnoRuntime.queryInterface(XComponent.class, xOtherViewRoot)).dispose();
+            UnoRuntime.queryInterface(XComponent.class, xOtherViewRoot).dispose();
         }
         catch (Exception e)
         {
@@ -805,13 +802,13 @@ public class ConfigExamples
 
      // resetting a single nested value
         XHierarchicalNameAccess xHierarchicalAccess =
-            (XHierarchicalNameAccess)UnoRuntime.queryInterface(XHierarchicalNameAccess.class, xViewRoot);
+            UnoRuntime.queryInterface(XHierarchicalNameAccess.class, xViewRoot);
 
         // get using absolute name
         Object xOptions = xHierarchicalAccess.getByHierarchicalName(cGridOptionsPath + "/Option");
 
         XPropertyState xOptionState =
-            (XPropertyState)UnoRuntime.queryInterface(XPropertyState.class, xOptions);
+            UnoRuntime.queryInterface(XPropertyState.class, xOptions);
 
         xOptionState.setPropertyToDefault("VisibleGrid");
 
@@ -820,9 +817,9 @@ public class ConfigExamples
         Object xResolutionY = xHierarchicalAccess.getByHierarchicalName("Resolution/YAxis");
 
         XPropertyState xResolutionStateX =
-            (XPropertyState)UnoRuntime.queryInterface(XPropertyState.class, xResolutionX);
+            UnoRuntime.queryInterface(XPropertyState.class, xResolutionX);
         XPropertyState xResolutionStateY =
-            (XPropertyState)UnoRuntime.queryInterface(XPropertyState.class, xResolutionY);
+            UnoRuntime.queryInterface(XPropertyState.class, xResolutionY);
 
         xResolutionStateX.setPropertyToDefault("Metric");
         xResolutionStateY.setPropertyToDefault("Metric");
@@ -831,18 +828,18 @@ public class ConfigExamples
         Object xSubdivision = xHierarchicalAccess.getByHierarchicalName("Subdivision");
 
         XMultiPropertyStates xSubdivisionStates =
-            (XMultiPropertyStates)UnoRuntime.queryInterface(XMultiPropertyStates.class, xSubdivision);
+            UnoRuntime.queryInterface(XMultiPropertyStates.class, xSubdivision);
 
         xSubdivisionStates.setAllPropertiesToDefault();
 
         // commit the changes
         XChangesBatch xUpdateControl =
-            (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class,xViewRoot);
+            UnoRuntime.queryInterface(XChangesBatch.class,xViewRoot);
 
         xUpdateControl.commitChanges();
 
        // we are done with the view - dispose it
-        ((XComponent)UnoRuntime.queryInterface(XComponent.class, xViewRoot)).dispose();
+        UnoRuntime.queryInterface(XComponent.class, xViewRoot).dispose();
     }
 
 
@@ -900,7 +897,7 @@ public class ConfigExamples
 
       // set the values
         XPropertySet xDataSourceProperties =
-            (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xDataSource);
+            UnoRuntime.queryInterface(XPropertySet.class, xDataSource);
 
         xDataSourceProperties.setPropertyValue("URL",  sDataSourceURL  );
         xDataSourceProperties.setPropertyValue("User", sUser  );
@@ -923,12 +920,12 @@ public class ConfigExamples
 
         // commit the changes
         XChangesBatch xUpdateControl =
-            (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class,xViewRoot);
+            UnoRuntime.queryInterface(XChangesBatch.class,xViewRoot);
 
         xUpdateControl.commitChanges();
 
         // now clean up
-        ((XComponent) UnoRuntime.queryInterface(XComponent.class, xViewRoot)).dispose();
+        UnoRuntime.queryInterface(XComponent.class, xViewRoot).dispose();
     }
 
     /** This method gets the DataSourceDescription for a data source.
@@ -956,7 +953,7 @@ public class ConfigExamples
             xProvider.createInstanceWithArguments(cUpdatableView, aArguments);
 
         XNameAccess xSetOfDataSources =
-            (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class,xViewRoot);
+            UnoRuntime.queryInterface(XNameAccess.class,xViewRoot);
 
         Object xDataSourceDescriptor = null; // the result
         if ( xSetOfDataSources .hasByName( sDataSourceName ))
@@ -965,8 +962,7 @@ public class ConfigExamples
             try
             {
                 // the view should point to the element directly, so we need to extend the path
-                XHierarchicalName xComposePath = (XHierarchicalName)
-                    UnoRuntime.queryInterface(XHierarchicalName.class, xSetOfDataSources );
+                XHierarchicalName xComposePath = UnoRuntime.queryInterface(XHierarchicalName.class, xSetOfDataSources );
 
                 String sElementPath = xComposePath.composeHierarchicalName( sDataSourceName );
 
@@ -984,7 +980,7 @@ public class ConfigExamples
                 if ( xDataSourceDescriptor != null) // all went fine
                 {
                     // dispose the other view
-                    ((XComponent)UnoRuntime.queryInterface(XComponent.class, xViewRoot)).dispose();
+                    UnoRuntime.queryInterface(XComponent.class, xViewRoot).dispose();
                     xViewRoot = null;
                 }
             }
@@ -1001,11 +997,11 @@ public class ConfigExamples
         {
             // get the container
             XNameContainer xSetUpdate =
-                (XNameContainer)UnoRuntime.queryInterface(XNameContainer.class, xViewRoot);
+                UnoRuntime.queryInterface(XNameContainer.class, xViewRoot);
 
             // create a new detached set element (instance of DataSourceDescription)
             XSingleServiceFactory xElementFactory =
-                (XSingleServiceFactory)UnoRuntime.queryInterface(XSingleServiceFactory.class, xSetUpdate);
+                UnoRuntime.queryInterface(XSingleServiceFactory.class, xSetUpdate);
 
             // the new element is the result !
              xDataSourceDescriptor  = xElementFactory.createInstance();
@@ -1026,17 +1022,16 @@ public class ConfigExamples
 
         // get the settings set as a container
         XNameContainer xSettingsContainer =
-            (XNameContainer) UnoRuntime.queryInterface( XNameContainer.class, xSettingsSet);
+            UnoRuntime.queryInterface( XNameContainer.class, xSettingsSet);
 
         // and get a factory interface for creating the entries
         XSingleServiceFactory xSettingsFactory =
-            (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class, xSettingsSet);
+            UnoRuntime.queryInterface(XSingleServiceFactory.class, xSettingsSet);
 
         // now insert the individual settings
         for (int i = 0; i < aSettings.length; ++i) {
             // create a DataSourceSetting object
-            XPropertySet xSetting = (XPropertySet)
-                UnoRuntime.queryInterface( XPropertySet.class, xSettingsFactory.createInstance() );
+            XPropertySet xSetting = UnoRuntime.queryInterface( XPropertySet.class, xSettingsFactory.createInstance() );
 
             // can set the value before inserting
             xSetting.setPropertyValue( "Value", aSettings[i].Value );
@@ -1061,7 +1056,7 @@ public class ConfigExamples
         do
         {
             XChild xParentAccess =
-                (XChild) UnoRuntime.queryInterface(XChild.class,xResult);
+                UnoRuntime.queryInterface(XChild.class,xResult);
 
             if (xParentAccess != null)
                 xParent = xParentAccess.getParent();
@@ -1082,11 +1077,9 @@ public class ConfigExamples
     void renameSetItem(XNamed xNamedItem, String sNewName)
         throws com.sun.star.uno.Exception
     {
-        XChild xChildItem = (XChild)
-            UnoRuntime.queryInterface(XChild.class, xNamedItem);
+        XChild xChildItem = UnoRuntime.queryInterface(XChild.class, xNamedItem);
 
-        XNameContainer xParentSet = (XNameContainer)
-            UnoRuntime.queryInterface( XNameContainer.class, xChildItem.getParent() );
+        XNameContainer xParentSet = UnoRuntime.queryInterface( XNameContainer.class, xChildItem.getParent() );
 
         String sOldName = xNamedItem.getName();
 
@@ -1099,11 +1092,9 @@ public class ConfigExamples
     void moveSetItem(XChild xChildItem, XNameContainer xNewParent)
         throws com.sun.star.uno.Exception
     {
-        XNamed xNamedItem = (XNamed)
-            UnoRuntime.queryInterface(XNamed.class, xChildItem);
+        XNamed xNamedItem = UnoRuntime.queryInterface(XNamed.class, xChildItem);
 
-        XNameContainer xOldParent = (XNameContainer)
-            UnoRuntime.queryInterface( XNameContainer.class, xChildItem.getParent() );
+        XNameContainer xOldParent = UnoRuntime.queryInterface( XNameContainer.class, xChildItem.getParent() );
 
         String sItemName = xNamedItem.getName();
 
diff --git a/odk/examples/DevelopersGuide/Database/CodeSamples.java b/odk/examples/DevelopersGuide/Database/CodeSamples.java
index 7d4cac1..58458c6 100644
--- a/odk/examples/DevelopersGuide/Database/CodeSamples.java
+++ b/odk/examples/DevelopersGuide/Database/CodeSamples.java
@@ -119,7 +119,7 @@ public class CodeSamples
         {
             System.out.println("Connection was created!");
             // now we dispose the connection to close it
-            XComponent xComponent = (XComponent)UnoRuntime.queryInterface(XComponent.class,con);
+            XComponent xComponent = UnoRuntime.queryInterface(XComponent.class,con);
             if(xComponent != null)
             {
                 // connections must be disposed
@@ -141,7 +141,7 @@ public class CodeSamples
                                            xContext);
         // query for the interface
         com.sun.star.sdbc.XDriverManager xDriverManager;
-        xDriverManager = (XDriverManager)UnoRuntime.queryInterface(XDriverManager.class,driverManager);
+        xDriverManager = UnoRuntime.queryInterface(XDriverManager.class,driverManager);
         if(xDriverManager != null)
         {
             // first create the needed url
@@ -169,7 +169,7 @@ public class CodeSamples
                                            xContext);
         // query for the interface
         com.sun.star.sdbc.XDriver xDriver;
-        xDriver = (XDriver)UnoRuntime.queryInterface(XDriver.class,aDriver);
+        xDriver = UnoRuntime.queryInterface(XDriver.class,aDriver);
         if(xDriver != null)
         {
             // first create the needed url
@@ -191,7 +191,7 @@ public class CodeSamples
     public static void printDataSources() throws com.sun.star.uno.Exception
     {
         // create a DatabaseContext and print all DataSource names
-        XNameAccess xNameAccess = (XNameAccess)UnoRuntime.queryInterface(
+        XNameAccess xNameAccess = UnoRuntime.queryInterface(
             XNameAccess.class,
             xMCF.createInstanceWithContext("com.sun.star.sdb.DatabaseContext",
                                            xContext));
@@ -205,7 +205,7 @@ public class CodeSamples
     {
         XDatabaseMetaData dm = con.getMetaData();
         XResultSet rsTables = dm.getTables(null,"%","SALES",null);
-        XRow       rowTB = (XRow)UnoRuntime.queryInterface(XRow.class, rsTables);
+        XRow       rowTB = UnoRuntime.queryInterface(XRow.class, rsTables);
         while ( rsTables.next() )
         {
             String catalog = rowTB.getString( 1 );
@@ -221,7 +221,7 @@ public class CodeSamples
             System.out.println("Catalog: " + catalog + " Schema: " + schema + " Table: " + table + " Type: " + type);
             System.out.println("------------------ Columns ------------------");
             XResultSet rsColumns = dm.getColumns(catalog,schema,table,"%");
-            XRow       rowCL = (XRow)UnoRuntime.queryInterface(XRow.class, rsColumns);
+            XRow       rowCL = UnoRuntime.queryInterface(XRow.class, rsColumns);
             while ( rsColumns.next() )
             {
                 System.out.println("Column: " + rowCL.getString( 4 ) + " Type: " + rowCL.getInt( 5 ) + " TypeName: " + rowCL.getString( 6 ) );
@@ -264,25 +264,23 @@ public class CodeSamples
     // creates a new query definition
     public static void createQuerydefinition() throws com.sun.star.uno.Exception
     {
-        XNameAccess xNameAccess = (XNameAccess)UnoRuntime.queryInterface(
+        XNameAccess xNameAccess = UnoRuntime.queryInterface(
             XNameAccess.class,
             xMCF.createInstanceWithContext("com.sun.star.sdb.DatabaseContext",
                                            xContext));
         // we use the first datasource
-        XQueryDefinitionsSupplier xQuerySup = (XQueryDefinitionsSupplier)
-                                            UnoRuntime.queryInterface(XQueryDefinitionsSupplier.class,
-                                            xNameAccess.getByName( "Bibliography" ));
+        XQueryDefinitionsSupplier xQuerySup = UnoRuntime.queryInterface(XQueryDefinitionsSupplier.class,
+        xNameAccess.getByName( "Bibliography" ));
         XNameAccess xQDefs = xQuerySup.getQueryDefinitions();
         // create new query definition
-        XSingleServiceFactory xSingleFac =  (XSingleServiceFactory)
-                                            UnoRuntime.queryInterface(XSingleServiceFactory.class, xQDefs);
+        XSingleServiceFactory xSingleFac =  UnoRuntime.queryInterface(XSingleServiceFactory.class, xQDefs);
 
-        XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(
+        XPropertySet xProp = UnoRuntime.queryInterface(
             XPropertySet.class,xSingleFac.createInstance());
         xProp.setPropertyValue("Command","SELECT * FROM biblio");
         xProp.setPropertyValue("EscapeProcessing",new Boolean(true));
 
-        XNameContainer xCont = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, xQDefs);
+        XNameContainer xCont = UnoRuntime.queryInterface(XNameContainer.class, xQDefs);
                 try
                 {
                     if ( xCont.hasByName("Query1") )
@@ -291,29 +289,28 @@ public class CodeSamples
                 catch(com.sun.star.uno.Exception e)
                 {}
         xCont.insertByName("Query1",xProp);
-        XDocumentDataSource xDs = (XDocumentDataSource)UnoRuntime.queryInterface(XDocumentDataSource.class, xQuerySup);
+        XDocumentDataSource xDs = UnoRuntime.queryInterface(XDocumentDataSource.class, xQuerySup);
 
-        XStorable xStore = (XStorable)UnoRuntime.queryInterface(XStorable.class,xDs.getDatabaseDocument());
+        XStorable xStore = UnoRuntime.queryInterface(XStorable.class,xDs.getDatabaseDocument());
         xStore.store();
     }
 
     // prints all column names from Query1
     public static void printQueryColumnNames() throws com.sun.star.uno.Exception
     {
-        XNameAccess xNameAccess = (XNameAccess)UnoRuntime.queryInterface(
+        XNameAccess xNameAccess = UnoRuntime.queryInterface(
             XNameAccess.class,
             xMCF.createInstanceWithContext("com.sun.star.sdb.DatabaseContext",
                                            xContext));
         // we use the first datasource
-        XDataSource xDS = (XDataSource)UnoRuntime.queryInterface(
+        XDataSource xDS = UnoRuntime.queryInterface(
             XDataSource.class, xNameAccess.getByName( "Bibliography" ));
         XConnection con = xDS.getConnection("","");
-        XQueriesSupplier xQuerySup = (XQueriesSupplier)
-                                            UnoRuntime.queryInterface(XQueriesSupplier.class, con);
+        XQueriesSupplier xQuerySup = UnoRuntime.queryInterface(XQueriesSupplier.class, con);
 
         XNameAccess xQDefs = xQuerySup.getQueries();
 
-        XColumnsSupplier xColsSup = (XColumnsSupplier) UnoRuntime.queryInterface(
+        XColumnsSupplier xColsSup = UnoRuntime.queryInterface(
             XColumnsSupplier.class,xQDefs.getByName("Query1"));
         XNameAccess xCols = xColsSup.getColumns();
         String aNames [] = xCols.getElementNames();
diff --git a/odk/examples/DevelopersGuide/Database/OpenQuery.java b/odk/examples/DevelopersGuide/Database/OpenQuery.java
index 765079b..a460b76 100644
--- a/odk/examples/DevelopersGuide/Database/OpenQuery.java
+++ b/odk/examples/DevelopersGuide/Database/OpenQuery.java
@@ -87,11 +87,10 @@ public class OpenQuery {
         Object rowSet = xMCF.createInstanceWithContext(
             "com.sun.star.sdb.RowSet", xContext);
 
-        com.sun.star.sdbc.XRowSet xRowSet = (com.sun.star.sdbc.XRowSet)
-            UnoRuntime.queryInterface(com.sun.star.sdbc.XRowSet.class, rowSet);
+        com.sun.star.sdbc.XRowSet xRowSet = UnoRuntime.queryInterface(com.sun.star.sdbc.XRowSet.class, rowSet);
 
         // set the properties needed to connect to a database
-        XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xRowSet);
+        XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, xRowSet);
 
         // the DataSourceName can be a data source registered with [PRODUCTNAME], among other possibilities
         xProp.setPropertyValue("DataSourceName","Bibliography");
@@ -110,12 +109,11 @@ public class OpenQuery {
 
         // prepare the XRow and XColumnLocate interface for column access
         // XRow gets column values
-        com.sun.star.sdbc.XRow xRow = (com.sun.star.sdbc.XRow)UnoRuntime.queryInterface(
+        com.sun.star.sdbc.XRow xRow = UnoRuntime.queryInterface(
             com.sun.star.sdbc.XRow.class, xRowSet);
         // XColumnLocate finds columns by name
-        com.sun.star.sdbc.XColumnLocate xLoc = (com.sun.star.sdbc.XColumnLocate)
-            UnoRuntime.queryInterface(
-                com.sun.star.sdbc.XColumnLocate.class, xRowSet);
+        com.sun.star.sdbc.XColumnLocate xLoc = UnoRuntime.queryInterface(
+            com.sun.star.sdbc.XColumnLocate.class, xRowSet);
 
         // print output header
         System.out.println("Identifier\tAuthor");
@@ -129,14 +127,12 @@ public class OpenQuery {
         }
 
         // XResultSetUpdate for insertRow handling
-        com.sun.star.sdbc.XResultSetUpdate xResultSetUpdate = (com.sun.star.sdbc.XResultSetUpdate)
-            UnoRuntime.queryInterface(
-                com.sun.star.sdbc.XResultSetUpdate.class, xRowSet);
+        com.sun.star.sdbc.XResultSetUpdate xResultSetUpdate = UnoRuntime.queryInterface(
+            com.sun.star.sdbc.XResultSetUpdate.class, xRowSet);
 
         // XRowUpdate for row updates
-        com.sun.star.sdbc.XRowUpdate xRowUpdate = (com.sun.star.sdbc.XRowUpdate)
-            UnoRuntime.queryInterface(
-                com.sun.star.sdbc.XRowUpdate.class, xRowSet);
+        com.sun.star.sdbc.XRowUpdate xRowUpdate = UnoRuntime.queryInterface(
+            com.sun.star.sdbc.XRowUpdate.class, xRowSet);
 
         // move to insertRow buffer
         xResultSetUpdate.moveToInsertRow();
@@ -149,7 +145,7 @@ public class OpenQuery {
         xResultSetUpdate.insertRow();
 
         // throw away the row set
-        com.sun.star.lang.XComponent xComp = (com.sun.star.lang.XComponent)UnoRuntime.queryInterface(
+        com.sun.star.lang.XComponent xComp = UnoRuntime.queryInterface(
             com.sun.star.lang.XComponent.class, xRowSet);
         xComp.dispose();
     }
diff --git a/odk/examples/DevelopersGuide/Database/RowSet.java b/odk/examples/DevelopersGuide/Database/RowSet.java
index 780aaed..c19dcdc 100644
--- a/odk/examples/DevelopersGuide/Database/RowSet.java
+++ b/odk/examples/DevelopersGuide/Database/RowSet.java
@@ -77,7 +77,7 @@ public class RowSet
     public static void printDataSources() throws com.sun.star.uno.Exception
     {
         // create a DatabaseContext and print all DataSource names
-        XNameAccess xNameAccess = (XNameAccess)UnoRuntime.queryInterface(
+        XNameAccess xNameAccess = UnoRuntime.queryInterface(
             XNameAccess.class,
             xMCF.createInstanceWithContext("com.sun.star.sdb.DatabaseContext",
                                            xContext));
@@ -89,13 +89,13 @@ public class RowSet
     public static void useRowSet() throws com.sun.star.uno.Exception
     {
         // first we create our RowSet object
-        XRowSet xRowRes = (XRowSet)UnoRuntime.queryInterface(
+        XRowSet xRowRes = UnoRuntime.queryInterface(
             XRowSet.class,
             xMCF.createInstanceWithContext("com.sun.star.sdb.RowSet", xContext));
 
         System.out.println("RowSet created!");
         // set the properties needed to connect to a database
-        XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xRowRes);
+        XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,xRowRes);
         xProp.setPropertyValue("DataSourceName","Bibliography");
         xProp.setPropertyValue("Command","biblio");
         xProp.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE));
@@ -104,7 +104,7 @@ public class RowSet
         System.out.println("RowSet executed!");
 
 
-        XComponent xComp = (XComponent)UnoRuntime.queryInterface(XComponent.class,xRowRes);
+        XComponent xComp = UnoRuntime.queryInterface(XComponent.class,xRowRes);
         xComp.dispose();
         System.out.println("RowSet destroyed!");
     }
@@ -112,13 +112,13 @@ public class RowSet
     public static void showRowSetPrivileges() throws com.sun.star.uno.Exception
     {
         // first we create our RowSet object
-        XRowSet xRowRes = (XRowSet)UnoRuntime.queryInterface(
+        XRowSet xRowRes = UnoRuntime.queryInterface(
             XRowSet.class,
             xMCF.createInstanceWithContext("com.sun.star.sdb.RowSet", xContext));
 
         System.out.println("RowSet created!");
         // set the properties needed to connect to a database
-        XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xRowRes);
+        XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,xRowRes);
         xProp.setPropertyValue("DataSourceName","Bibliography");
         xProp.setPropertyValue("Command","biblio");
         xProp.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE));
@@ -138,7 +138,7 @@ public class RowSet
             System.out.println("DELETE");
 
         // now destroy the RowSet
-        XComponent xComp = (XComponent)UnoRuntime.queryInterface(XComponent.class,xRowRes);
+        XComponent xComp = UnoRuntime.queryInterface(XComponent.class,xRowRes);
         xComp.dispose();
         System.out.println("RowSet destroyed!");
     }
@@ -146,13 +146,13 @@ public class RowSet
     public static void showRowSetRowCount() throws com.sun.star.uno.Exception
     {
         // first we create our RowSet object
-        XRowSet xRowRes = (XRowSet)UnoRuntime.queryInterface(
+        XRowSet xRowRes = UnoRuntime.queryInterface(
             XRowSet.class,
             xMCF.createInstanceWithContext("com.sun.star.sdb.RowSet", xContext));
 
         System.out.println("RowSet created!");
         // set the properties needed to connect to a database
-        XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xRowRes);
+        XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,xRowRes);
         xProp.setPropertyValue("DataSourceName","Bibliography");
         xProp.setPropertyValue("Command","biblio");
         xProp.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE));
@@ -163,14 +163,14 @@ public class RowSet
         // now look if the RowCount is already final
         System.out.println("The RowCount is final: " + xProp.getPropertyValue("IsRowCountFinal"));
 
-        XResultSet xRes = (XResultSet)UnoRuntime.queryInterface(XResultSet.class,xRowRes);
+        XResultSet xRes = UnoRuntime.queryInterface(XResultSet.class,xRowRes);
         xRes.last();
 
         System.out.println("The RowCount is final: " + xProp.getPropertyValue("IsRowCountFinal"));
         System.out.println("There are " + xProp.getPropertyValue("RowCount") + " rows!");
 
         // now destroy the RowSet
-        XComponent xComp = (XComponent)UnoRuntime.queryInterface(XComponent.class,xRowRes);
+        XComponent xComp = UnoRuntime.queryInterface(XComponent.class,xRowRes);
         xComp.dispose();
         System.out.println("RowSet destroyed!");
     }
@@ -178,7 +178,7 @@ public class RowSet
     public static void showRowSetEvents() throws com.sun.star.uno.Exception
     {
         // first we create our RowSet object
-        XRowSet xRowRes = (XRowSet)UnoRuntime.queryInterface(
+        XRowSet xRowRes = UnoRuntime.queryInterface(
             XRowSet.class,
             xMCF.createInstanceWithContext("com.sun.star.sdb.RowSet", xContext));
 
@@ -186,12 +186,12 @@ public class RowSet
         // add our Listener
         System.out.println("Append our Listener!");
         RowSetEventListener pRow = new RowSetEventListener();
-        XRowSetApproveBroadcaster xApBroad = (XRowSetApproveBroadcaster)UnoRuntime.queryInterface(XRowSetApproveBroadcaster.class,xRowRes);
+        XRowSetApproveBroadcaster xApBroad = UnoRuntime.queryInterface(XRowSetApproveBroadcaster.class,xRowRes);
         xApBroad.addRowSetApproveListener(pRow);
         xRowRes.addRowSetListener(pRow);
 
         // set the properties needed to connect to a database
-        XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xRowRes);
+        XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,xRowRes);
         xProp.setPropertyValue("DataSourceName","Bibliography");
         xProp.setPropertyValue("Command","biblio");
         xProp.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE));
@@ -200,7 +200,7 @@ public class RowSet
         System.out.println("RowSet executed!");
 
         // do some movements to check if we got all notifications
-        XResultSet xRes = (XResultSet)UnoRuntime.queryInterface(XResultSet.class,xRowRes);
+        XResultSet xRes = UnoRuntime.queryInterface(XResultSet.class,xRowRes);
         System.out.println("beforeFirst");
         xRes.beforeFirst();
         // this should lead to no notifications because
@@ -226,7 +226,7 @@ public class RowSet
         System.out.println("We stand after the last row: " + xRes.isAfterLast());
 
         // now destroy the RowSet
-        XComponent xComp = (XComponent)UnoRuntime.queryInterface(XComponent.class,xRowRes);
+        XComponent xComp = UnoRuntime.queryInterface(XComponent.class,xRowRes);
         xComp.dispose();
         System.out.println("RowSet destroyed!");
     }
diff --git a/odk/examples/DevelopersGuide/Database/Sales.java b/odk/examples/DevelopersGuide/Database/Sales.java
index 7e7c310..c90ae13 100644
--- a/odk/examples/DevelopersGuide/Database/Sales.java
+++ b/odk/examples/DevelopersGuide/Database/Sales.java
@@ -99,7 +99,7 @@ public class Sales
         String query =  "SELECT NAME, PRICE FROM SALES " +
                         "WHERE SALENR = 1";
         XResultSet rs = stmt.executeQuery(query);
-        XRow      row = (XRow)UnoRuntime.queryInterface(XRow.class, rs);
+        XRow      row = UnoRuntime.queryInterface(XRow.class, rs);
         while (rs.next()) {
                 String s = row.getString(1);
                 float  n = row.getFloat(2);
@@ -112,13 +112,13 @@ public class Sales
     {
         // example for a programmatic way to do updates.
         XStatement stmt = con.createStatement();
-        XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,stmt);
+        XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,stmt);
 
         xProp.setPropertyValue("ResultSetType", new java.lang.Integer(ResultSetType.SCROLL_INSENSITIVE));
         xProp.setPropertyValue("ResultSetConcurrency", new java.lang.Integer(ResultSetConcurrency.UPDATABLE));
 
         XResultSet srs = stmt.executeQuery("SELECT NAME, PRICE FROM SALES");
-        XRow       row = (XRow)UnoRuntime.queryInterface(XRow.class,srs);
+        XRow       row = UnoRuntime.queryInterface(XRow.class,srs);
 
         srs.afterLast();
         while (srs.previous()) {
@@ -128,10 +128,10 @@ public class Sales
         }
 
         srs.last();
-        XRowUpdate updateRow = (XRowUpdate)UnoRuntime.queryInterface(XRowUpdate.class,srs);
+        XRowUpdate updateRow = UnoRuntime.queryInterface(XRowUpdate.class,srs);
         updateRow.updateFloat(2, (float)0.69);
 
-        XResultSetUpdate updateRs = ( XResultSetUpdate )UnoRuntime.queryInterface(
+        XResultSetUpdate updateRs = UnoRuntime.queryInterface(
             XResultSetUpdate.class,srs);
         updateRs.updateRow(); // this call updates the data in DBMS
 
@@ -151,15 +151,15 @@ public class Sales
 //                   "VALUES (4, 102, 5, 'FTOP Darjeeling tea', '2002-01-02',150)");
 //
 //      stmt = con.createStatement();
-        XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,stmt);
+        XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,stmt);
         xProp.setPropertyValue("ResultSetType", new java.lang.Integer(ResultSetType.SCROLL_INSENSITIVE));
         xProp.setPropertyValue("ResultSetConcurrency", new java.lang.Integer(ResultSetConcurrency.UPDATABLE));
         XResultSet rs = stmt.executeQuery("SELECT * FROM SALES");
-        XRow       row = (XRow)UnoRuntime.queryInterface(XRow.class,rs);
+        XRow       row = UnoRuntime.queryInterface(XRow.class,rs);
 
         // insert a new row
-        XRowUpdate updateRow = (XRowUpdate)UnoRuntime.queryInterface(XRowUpdate.class,rs);
-        XResultSetUpdate updateRs = ( XResultSetUpdate )UnoRuntime. queryInterface(XResultSetUpdate.class,rs);
+        XRowUpdate updateRow = UnoRuntime.queryInterface(XRowUpdate.class,rs);
+        XResultSetUpdate updateRs = UnoRuntime. queryInterface(XResultSetUpdate.class,rs);
         updateRs.moveToInsertRow();
         updateRow.updateInt(1, 4);
         updateRow.updateInt(2, 102);
@@ -175,13 +175,13 @@ public class Sales
     {
         // example for a programmatic way to do updates.
         XStatement stmt = con.createStatement();
-        XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,stmt);
+        XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,stmt);
         xProp.setPropertyValue("ResultSetType", new java.lang.Integer(ResultSetType.SCROLL_INSENSITIVE));
         xProp.setPropertyValue("ResultSetConcurrency", new java.lang.Integer(ResultSetConcurrency.UPDATABLE));
         XResultSet rs = stmt.executeQuery("SELECT * FROM SALES");
-        XRow       row = (XRow)UnoRuntime.queryInterface(XRow.class,rs);
+        XRow       row = UnoRuntime.queryInterface(XRow.class,rs);
 
-        XResultSetUpdate updateRs = ( XResultSetUpdate )UnoRuntime. queryInterface(XResultSetUpdate.class,rs);
+        XResultSetUpdate updateRs = UnoRuntime. queryInterface(XResultSetUpdate.class,rs);
         // move to the inserted row
         rs.absolute(4);
         updateRs.deleteRow();
@@ -195,17 +195,17 @@ public class Sales
         insertRow();
 
         XStatement stmt = con.createStatement();
-        XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,stmt);
+        XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,stmt);
         xProp.setPropertyValue("ResultSetType", new java.lang.Integer(ResultSetType.SCROLL_INSENSITIVE));
         xProp.setPropertyValue("ResultSetConcurrency", new java.lang.Integer(ResultSetConcurrency.READ_ONLY));
         XResultSet rs = stmt.executeQuery("SELECT NAME, PRICE FROM SALES");
-        XRow       row = (XRow)UnoRuntime.queryInterface(XRow.class, rs);
+        XRow       row = UnoRuntime.queryInterface(XRow.class, rs);
         rs.absolute(4);
         float price1 = row.getFloat(2);
 
         // modifiy the 4 row
-        XRowUpdate updateRow = (XRowUpdate)UnoRuntime.queryInterface(XRowUpdate.class,rs);
-        XResultSetUpdate updateRs = ( XResultSetUpdate )UnoRuntime. queryInterface(XResultSetUpdate.class,rs);
+        XRowUpdate updateRow = UnoRuntime.queryInterface(XRowUpdate.class,rs);
+        XResultSetUpdate updateRs = UnoRuntime. queryInterface(XResultSetUpdate.class,rs);
         updateRow.updateFloat(2, 150);
         updateRs.updateRow();
         // repositioning
@@ -224,12 +224,11 @@ public class Sales
     public void displayColumnNames() throws com.sun.star.uno.Exception
     {
         XStatement stmt = con.createStatement();
-        XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,stmt);
+        XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,stmt);
         xProp.setPropertyValue("ResultSetType", new java.lang.Integer(ResultSetType.SCROLL_INSENSITIVE));
         xProp.setPropertyValue("ResultSetConcurrency", new java.lang.Integer(ResultSetConcurrency.READ_ONLY));
         XResultSet rs = stmt.executeQuery("SELECT NAME, PRICE FROM SALES");
-        XResultSetMetaDataSupplier xRsMetaSup = (XResultSetMetaDataSupplier)
-            UnoRuntime.queryInterface(XResultSetMetaDataSupplier.class,rs);
+        XResultSetMetaDataSupplier xRsMetaSup = UnoRuntime.queryInterface(XResultSetMetaDataSupplier.class,rs);
         XResultSetMetaData xRsMetaData =  xRsMetaSup.getMetaData();
         int nColumnCount =  xRsMetaData.getColumnCount();
         for(int i=1 ; i <= nColumnCount ; ++i)
diff --git a/odk/examples/DevelopersGuide/Database/SalesMan.java b/odk/examples/DevelopersGuide/Database/SalesMan.java
index ee1171a..0eaa3cd 100644
--- a/odk/examples/DevelopersGuide/Database/SalesMan.java
+++ b/odk/examples/DevelopersGuide/Database/SalesMan.java
@@ -96,7 +96,7 @@ public class SalesMan
     {
         XPreparedStatement updateStreet = con.prepareStatement(
             "UPDATE SALESMAN SET STREET = ? WHERE SNR = ?");
-        XParameters setPara = (XParameters)UnoRuntime.queryInterface(XParameters.class,updateStreet);
+        XParameters setPara = UnoRuntime.queryInterface(XParameters.class,updateStreet);
         setPara.setString(1, "34 Main Road");
         setPara.setInt(2, 1);
         updateStreet.executeUpdate();
@@ -124,7 +124,7 @@ public class SalesMan
     {
         XStatement stmt = con.createStatement();
         XResultSet rs   = stmt.executeQuery("SELECT FIRSTNAME, LASTNAME, BIRTHDATE FROM SALESMAN");
-        XRow row = (XRow)UnoRuntime.queryInterface(XRow.class,rs);
+        XRow row = UnoRuntime.queryInterface(XRow.class,rs);
         while ( rs != null && rs.next() ) {
             String fn = row.getString( 1 );
             String ln = row.getString( 2 );
diff --git a/odk/examples/DevelopersGuide/Database/sdbcx.java b/odk/examples/DevelopersGuide/Database/sdbcx.java
index 01677c7..696857b 100644
--- a/odk/examples/DevelopersGuide/Database/sdbcx.java
+++ b/odk/examples/DevelopersGuide/Database/sdbcx.java
@@ -57,7 +57,7 @@ public class sdbcx
                         test.createConnection();
                         test.displayTableProperties();
                         // now we dispose the connection to close it
-                        XComponent xComponent = (XComponent)UnoRuntime.queryInterface(XComponent.class,con);
+                        XComponent xComponent = UnoRuntime.queryInterface(XComponent.class,con);
                         if(xComponent != null)
                         {
                                 xComponent.dispose();
@@ -81,12 +81,12 @@ public class sdbcx
 
         // create a connector, so that it can contact the office
         Object  xUrlResolver  = xLocalServiceManager.createInstance( "com.sun.star.bridge.UnoUrlResolver" );
-        XUnoUrlResolver urlResolver = (XUnoUrlResolver)UnoRuntime.queryInterface(
+        XUnoUrlResolver urlResolver = UnoRuntime.queryInterface(
             XUnoUrlResolver.class, xUrlResolver );
 
         Object rInitialObject = urlResolver.resolve( "uno:" + connectStr + ";urp;StarOffice.NamingService" );
 
-        XNamingService rName = (XNamingService)UnoRuntime.queryInterface(
+        XNamingService rName = UnoRuntime.queryInterface(
             XNamingService.class, rInitialObject );
 
         XMultiServiceFactory xMSF = null;
@@ -94,8 +94,7 @@ public class sdbcx
             System.err.println( "got the remote naming service !" );
             Object rXsmgr = rName.getRegisteredObject("StarOffice.ServiceManager" );
 
-            xMSF = (XMultiServiceFactory)
-                UnoRuntime.queryInterface( XMultiServiceFactory.class, rXsmgr );
+            xMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, rXsmgr );
         }
 
         return ( xMSF );
@@ -113,7 +112,7 @@ public class sdbcx
         Object aDriver = xORB.createInstance("com.sun.star.comp.sdbcx.adabas.ODriver");
         // query for the interface
         com.sun.star.sdbc.XDriver xDriver;
-        xDriver = (XDriver)UnoRuntime.queryInterface(XDriver.class,aDriver);
+        xDriver = UnoRuntime.queryInterface(XDriver.class,aDriver);
         if(xDriver != null)
         {
             // first create the needed url
@@ -132,7 +131,7 @@ public class sdbcx
             {
                 System.out.println("Connection could be created!");
                 // we the XDatabaseDefinitionSupplier interface from the driver to get the XTablesSupplier
-                XDataDefinitionSupplier xDDSup = (XDataDefinitionSupplier)UnoRuntime.queryInterface(
+                XDataDefinitionSupplier xDDSup = UnoRuntime.queryInterface(
                         XDataDefinitionSupplier.class,xDriver);
                 if(xDDSup != null)
                 {
@@ -162,7 +161,7 @@ public class sdbcx
         if(0 != aTableNames.length)
         {
             Object table = xTables.getByName(aTableNames[0]);
-            XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,table);
+            XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,table);
             System.out.println("Name:          " + xProp.getPropertyValue("Name"));
             System.out.println("CatalogName:   " + xProp.getPropertyValue("CatalogName"));
             System.out.println("SchemaName:    " + xProp.getPropertyValue("SchemaName"));
@@ -194,7 +193,7 @@ public class sdbcx
     public static void printKeys(XColumnsSupplier xColumnsSup) throws com.sun.star.uno.Exception,SQLException
     {
         System.out.println("Example printKeys");
-        XKeysSupplier xKeysSup = (XKeysSupplier)UnoRuntime.queryInterface(XKeysSupplier.class,xColumnsSup);
+        XKeysSupplier xKeysSup = UnoRuntime.queryInterface(XKeysSupplier.class,xColumnsSup);
         if(xKeysSup != null)
         {
             System.out.println("--- Keys ---");
@@ -202,9 +201,9 @@ public class sdbcx
             for ( int i =0; i < xKeys.getCount(); i++)
             {
                 Object key = xKeys.getByIndex(i);
-                XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,key);
+                XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,key);
                 System.out.println("    " + xProp.getPropertyValue("Name"));
-                XColumnsSupplier xKeyColumnsSup = ( XColumnsSupplier ) UnoRuntime.queryInterface(XColumnsSupplier.class,xProp);
+                XColumnsSupplier xKeyColumnsSup = UnoRuntime.queryInterface(XColumnsSupplier.class,xProp);
                 printColumns(xKeyColumnsSup);
             }
         }
@@ -216,7 +215,7 @@ public class sdbcx
     public static void printIndexes(XColumnsSupplier xColumnsSup) throws com.sun.star.uno.Exception,SQLException
     {
         System.out.println("Example printIndexes");
-        XIndexesSupplier xIndexesSup = (XIndexesSupplier)UnoRuntime.queryInterface(XIndexesSupplier.class,xColumnsSup);
+        XIndexesSupplier xIndexesSup = UnoRuntime.queryInterface(XIndexesSupplier.class,xColumnsSup);
         if(xIndexesSup != null)
         {
             System.out.println("--- Indexes ---");
@@ -226,7 +225,7 @@ public class sdbcx
             {
                 System.out.println("    " + aIndexNames[i]);
                 Object index = xIndexs.getByName(aIndexNames[i]);
-                XColumnsSupplier xIndexColumnsSup = (XColumnsSupplier)UnoRuntime.queryInterface(XColumnsSupplier.class,index);
+                XColumnsSupplier xIndexColumnsSup = UnoRuntime.queryInterface(XColumnsSupplier.class,index);
                 printColumns(xIndexColumnsSup);
             }
         }
@@ -239,7 +238,7 @@ public class sdbcx
     public static void printColumnProperties(Object column) throws com.sun.star.uno.Exception,SQLException
     {
         System.out.println("Example printColumnProperties");
-        XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,column);
+        XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,column);
         System.out.println("Name:            " + xProp.getPropertyValue("Name"));
         System.out.println("Type:            " + xProp.getPropertyValue("Type"));
         System.out.println("TypeName:        " + xProp.getPropertyValue("TypeName"));
@@ -264,7 +263,7 @@ public class sdbcx
     public static void printIndexProperties(Object index) throws com.sun.star.uno.Exception,SQLException
     {
         System.out.println("Example printIndexProperties");
-        XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,index);
+        XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,index);
         System.out.println("Name:              " + xProp.getPropertyValue("Name"));
         System.out.println("Catalog:           " + xProp.getPropertyValue("Catalog"));
         System.out.println("IsUnique:          " + xProp.getPropertyValue("IsUnique"));
@@ -279,7 +278,7 @@ public class sdbcx
     public static void printKeyProperties(Object key) throws com.sun.star.uno.Exception,SQLException
     {
         System.out.println("Example printKeyProperties");
-        XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,key);
+        XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,key);
         System.out.println("Name:            " + xProp.getPropertyValue("Name"));
         System.out.println("Type:            " + xProp.getPropertyValue("Type"));
         System.out.println("ReferencedTable: " + xProp.getPropertyValue("ReferencedTable"));
@@ -294,7 +293,7 @@ public class sdbcx
     public static void printGroups(XTablesSupplier xTabSup) throws com.sun.star.uno.Exception,SQLException
     {
         System.out.println("Example printGroups");
-        XGroupsSupplier xGroupsSup = (XGroupsSupplier)UnoRuntime.queryInterface(XGroupsSupplier.class,xTabSup);
+        XGroupsSupplier xGroupsSup = UnoRuntime.queryInterface(XGroupsSupplier.class,xTabSup);
         if(xGroupsSup != null)
         {
             // the table must be at least support a XColumnsSupplier interface
@@ -304,10 +303,10 @@ public class sdbcx
             for ( int i =0; i < aGroupNames.length; i++)
             {
                 System.out.println("    " + aGroupNames[i]);
-                XUsersSupplier xUsersSup = (XUsersSupplier)UnoRuntime.queryInterface(XUsersSupplier.class,xGroups.getByName(aGroupNames[i]));
+                XUsersSupplier xUsersSup = UnoRuntime.queryInterface(XUsersSupplier.class,xGroups.getByName(aGroupNames[i]));
                 if(xUsersSup != null)
                 {
-                    XAuthorizable xAuth = (XAuthorizable)UnoRuntime.queryInterface(XAuthorizable.class,xUsersSup);
+                    XAuthorizable xAuth = UnoRuntime.queryInterface(XAuthorizable.class,xUsersSup);
                     // the table must be at least support a XColumnsSupplier interface
                     System.out.println("\t--- Users ---");
                     XNameAccess xUsers = xUsersSup.getUsers();
@@ -328,7 +327,7 @@ public class sdbcx
     public static void createTableSalesMen(XNameAccess xTables) throws com.sun.star.uno.Exception,SQLException
     {
         System.out.println("Example createTableSalesMen");
-        XDataDescriptorFactory xTabFac = (XDataDescriptorFactory)UnoRuntime.queryInterface(XDataDescriptorFactory.class,xTables);
+        XDataDescriptorFactory xTabFac = UnoRuntime.queryInterface(XDataDescriptorFactory.class,xTables);
         if(xTabFac != null)
         {
             // create the new table
@@ -336,9 +335,9 @@ public class sdbcx
             // set the name of the new table
             xTable.setPropertyValue("Name","SALESMAN");
             // append the columns
-            XColumnsSupplier xColumSup = (XColumnsSupplier)UnoRuntime.queryInterface(XColumnsSupplier.class,xTable);
-            XDataDescriptorFactory xColFac = (XDataDescriptorFactory)UnoRuntime.queryInterface(XDataDescriptorFactory.class,xColumSup.getColumns());
-            XAppend xAppend = (XAppend)UnoRuntime.queryInterface(XAppend.class,xColFac);
+            XColumnsSupplier xColumSup = UnoRuntime.queryInterface(XColumnsSupplier.class,xTable);
+            XDataDescriptorFactory xColFac = UnoRuntime.queryInterface(XDataDescriptorFactory.class,xColumSup.getColumns());
+            XAppend xAppend = UnoRuntime.queryInterface(XAppend.class,xColFac);
             // we only need one descriptor
             XPropertySet xCol = xColFac.createDataDescriptor();
             // create first column and append
@@ -374,15 +373,15 @@ public class sdbcx
             xCol.setPropertyValue("Precision",new Integer(10)); // default value integer
             xAppend.appendByDescriptor(xCol);
             // now we create the primary key
-            XKeysSupplier xKeySup = (XKeysSupplier)UnoRuntime.queryInterface(XKeysSupplier.class,xTable);
-            XDataDescriptorFactory xKeyFac = (XDataDescriptorFactory)UnoRuntime.queryInterface(XDataDescriptorFactory.class,xKeySup.getKeys());
-            XAppend xKeyAppend = (XAppend)UnoRuntime.queryInterface(XAppend.class,xKeyFac);
+            XKeysSupplier xKeySup = UnoRuntime.queryInterface(XKeysSupplier.class,xTable);
+            XDataDescriptorFactory xKeyFac = UnoRuntime.queryInterface(XDataDescriptorFactory.class,xKeySup.getKeys());
+            XAppend xKeyAppend = UnoRuntime.queryInterface(XAppend.class,xKeyFac);
             XPropertySet xKey = xKeyFac.createDataDescriptor();
             xKey.setPropertyValue("Type",new Integer(KeyType.PRIMARY));
             // now append the columns to key
-            XColumnsSupplier xKeyColumSup = (XColumnsSupplier)UnoRuntime.queryInterface(XColumnsSupplier.class,xKey);
-            XDataDescriptorFactory xKeyColFac = (XDataDescriptorFactory)UnoRuntime.queryInterface(XDataDescriptorFactory.class,xKeyColumSup.getColumns());
-            XAppend xKeyColAppend = (XAppend)UnoRuntime.queryInterface(XAppend.class,xKeyColFac);
+            XColumnsSupplier xKeyColumSup = UnoRuntime.queryInterface(XColumnsSupplier.class,xKey);
+            XDataDescriptorFactory xKeyColFac = UnoRuntime.queryInterface(XDataDescriptorFactory.class,xKeyColumSup.getColumns());
+            XAppend xKeyColAppend = UnoRuntime.queryInterface(XAppend.class,xKeyColFac);
             // we only need one descriptor
             XPropertySet xKeyCol = xKeyColFac.createDataDescriptor();
             xKeyCol.setPropertyValue("Name","SNR");
@@ -391,7 +390,7 @@ public class sdbcx
             // apend the key
             xKeyAppend.appendByDescriptor(xKey);
             // the last step is to append the new table to the tables collection
-             XAppend xTableAppend = (XAppend)UnoRuntime.queryInterface(XAppend.class,xTabFac);
+             XAppend xTableAppend = UnoRuntime.queryInterface(XAppend.class,xTabFac);
              xTableAppend.appendByDescriptor(xTable);
         }
     }
@@ -403,7 +402,7 @@ public class sdbcx
     public static void createUser(XNameAccess xUsers) throws com.sun.star.uno.Exception,SQLException
     {
         System.out.println("Example createUser");
-        XDataDescriptorFactory xUserFac = (XDataDescriptorFactory)UnoRuntime.queryInterface(XDataDescriptorFactory.class,xUsers);
+        XDataDescriptorFactory xUserFac = UnoRuntime.queryInterface(XDataDescriptorFactory.class,xUsers);
         if(xUserFac != null)
         {
             // create the new table
@@ -411,7 +410,7 @@ public class sdbcx
             // set the name of the new table
             xUser.setPropertyValue("Name","BOSS");
             xUser.setPropertyValue("Password","BOSSWIFENAME");
-            XAppend xAppend = (XAppend)UnoRuntime.queryInterface(XAppend.class,xUserFac);
+            XAppend xAppend = UnoRuntime.queryInterface(XAppend.class,xUserFac);
             xAppend.appendByDescriptor(xUser);
         }
     }
diff --git a/odk/examples/DevelopersGuide/Drawing/ChangeOrderDemo.java b/odk/examples/DevelopersGuide/Drawing/ChangeOrderDemo.java
index fd40735..0518e32 100644
--- a/odk/examples/DevelopersGuide/Drawing/ChangeOrderDemo.java
+++ b/odk/examples/DevelopersGuide/Drawing/ChangeOrderDemo.java
@@ -77,8 +77,7 @@ public class ChangeOrderDemo
 
             // create two rectangles
             XDrawPage xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
-            XShapes xShapes = (XShapes)
-                    UnoRuntime.queryInterface( XShapes.class, xPage );
+            XShapes xShapes = UnoRuntime.queryInterface( XShapes.class, xPage );
 
             XShape xShape1 = ShapeHelper.createShape( xDrawDoc,
                 new Point( 1000, 1000 ), new Size( 5000, 5000 ),
@@ -93,10 +92,8 @@ public class ChangeOrderDemo
             ShapeHelper.addPortion( xShape1, "by changing the ZOrder it lie now on top", true );
             xShapes.add( xShape2 );
 
-            XPropertySet xPropSet1 = (XPropertySet)
-                    UnoRuntime.queryInterface( XPropertySet.class, xShape1 );
-            XPropertySet xPropSet2 = (XPropertySet)
-                    UnoRuntime.queryInterface( XPropertySet.class, xShape2 );
+            XPropertySet xPropSet1 = UnoRuntime.queryInterface( XPropertySet.class, xShape1 );
+            XPropertySet xPropSet2 = UnoRuntime.queryInterface( XPropertySet.class, xShape2 );
 
             int nOrderOfShape1 = ((Integer)xPropSet1.getPropertyValue( "ZOrder" )).intValue();
             int nOrderOfShape2 = ((Integer)xPropSet2.getPropertyValue( "ZOrder" )).intValue();
diff --git a/odk/examples/DevelopersGuide/Drawing/ControlAndSelectDemo.java b/odk/examples/DevelopersGuide/Drawing/ControlAndSelectDemo.java
index 2af75e4..654c3b2 100644
--- a/odk/examples/DevelopersGuide/Drawing/ControlAndSelectDemo.java
+++ b/odk/examples/DevelopersGuide/Drawing/ControlAndSelectDemo.java
@@ -88,46 +88,45 @@ public class ControlAndSelectDemo
                 "private:factory/sdraw", "_blank", 0, pPropValues );
 
             XMultiServiceFactory xFactory =
-                (XMultiServiceFactory )UnoRuntime.queryInterface(
-                    XMultiServiceFactory.class, xComponent );
+                UnoRuntime.queryInterface(
+                        XMultiServiceFactory.class, xComponent );
 
             XDrawPagesSupplier xDrawPagesSupplier =
-                (XDrawPagesSupplier)UnoRuntime.queryInterface(
-                    XDrawPagesSupplier.class, xComponent );
+                UnoRuntime.queryInterface(
+                        XDrawPagesSupplier.class, xComponent );
             XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages();
-            XDrawPage xDrawPage = (XDrawPage)UnoRuntime.queryInterface(
+            XDrawPage xDrawPage = UnoRuntime.queryInterface(
                 XDrawPage.class, xDrawPages.getByIndex( 0 ));
-            XShapes xShapes = (XShapes)UnoRuntime.queryInterface(XShapes.class,
+            XShapes xShapes = UnoRuntime.queryInterface(XShapes.class,
                                                                  xDrawPage );
 
 
             // create and insert the ControlShape
             Object xObj = xFactory.createInstance(
                 "com.sun.star.drawing.ControlShape" );
-            XShape xShape = (XShape)UnoRuntime.queryInterface( XShape.class, xObj );
+            XShape xShape = UnoRuntime.queryInterface( XShape.class, xObj );
             xShape.setPosition( new Point( 1000, 1000 ) );
             xShape.setSize( new Size( 2000, 2000 ) );
             xShapes.add( xShape );
 
             // create and set the control
-            XControlModel xControlModel = (XControlModel)UnoRuntime.queryInterface(
+            XControlModel xControlModel = UnoRuntime.queryInterface(
                 XControlModel.class,
                 xFactory.createInstance( "com.sun.star.form.component.GroupBox" ) );
-            XControlShape xControlShape = (XControlShape)UnoRuntime.queryInterface(
+            XControlShape xControlShape = UnoRuntime.queryInterface(
                 XControlShape.class, xShape );
             xControlShape.setControl( xControlModel );
 
 
             // the following code will demonstrate how to
             // make a selection that contains our new created ControlShape
-            XModel xModel = (XModel)UnoRuntime.queryInterface( XModel.class,
+            XModel xModel = UnoRuntime.queryInterface( XModel.class,
                                                                xComponent );
             XController xController = xModel.getCurrentController();
-            XSelectionSupplier xSelectionSupplier =(XSelectionSupplier)
-                UnoRuntime.queryInterface( XSelectionSupplier.class, xController );
+            XSelectionSupplier xSelectionSupplier =UnoRuntime.queryInterface( XSelectionSupplier.class, xController );
             // take care to use the global service factory only and not the one
             // that is provided by the component if you create the ShapeColletion
-            XShapes xSelection = (XShapes)UnoRuntime.queryInterface( XShapes.class,
+            XShapes xSelection = UnoRuntime.queryInterface( XShapes.class,
                 xOfficeContext.getServiceManager().createInstanceWithContext(
                     "com.sun.star.drawing.ShapeCollection", xOfficeContext ) );
             xSelection.add( xShape );
diff --git a/odk/examples/DevelopersGuide/Drawing/CustomShowDemo.java b/odk/examples/DevelopersGuide/Drawing/CustomShowDemo.java
index 88b0988..322868e 100644
--- a/odk/examples/DevelopersGuide/Drawing/CustomShowDemo.java
+++ b/odk/examples/DevelopersGuide/Drawing/CustomShowDemo.java
@@ -89,11 +89,11 @@ public class CustomShowDemo
             pPropValues[ 0 ].Value = new Boolean( true );
 
             xDrawDoc = Helper.createDocument( xOfficeContext,
-                "private:factory/simpress", "_blank", 0, pPropValues );
+                    "private:factory/simpress", "_blank", 0, pPropValues );
 
             XDrawPagesSupplier xDrawPagesSupplier =
-                (XDrawPagesSupplier)UnoRuntime.queryInterface(
-                    XDrawPagesSupplier.class, xDrawDoc );
+                UnoRuntime.queryInterface(
+                        XDrawPagesSupplier.class, xDrawDoc );
             XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages();
 
             // take care that this document has ten pages
@@ -106,9 +106,9 @@ public class CustomShowDemo
             int i;
             for ( i = 0; i < 10; i++ )
             {
-                XDrawPage xDrawPage = (XDrawPage)UnoRuntime.queryInterface(
+                XDrawPage xDrawPage = UnoRuntime.queryInterface(
                     XDrawPage.class, xDrawPages.getByIndex( i ));
-                XNamed xPageName = (XNamed)UnoRuntime.queryInterface(
+                XNamed xPageName = UnoRuntime.queryInterface(
                     XNamed.class, xDrawPage );
                 xPageName.setName( aNameArray[ i ] );
 
@@ -116,22 +116,19 @@ public class CustomShowDemo
                 XShape xTextObj = ShapeHelper.createShape( xDrawDoc, new Point( 10000, 9000 ),
                     new Size( 10000, 5000 ),
                         "com.sun.star.drawing.TextShape" );
-                XShapes xShapes = (XShapes)
-                        UnoRuntime.queryInterface( XShapes.class, xDrawPage );
+                XShapes xShapes = UnoRuntime.queryInterface( XShapes.class, xDrawPage );
                 xShapes.add( xTextObj );
                 ShapeHelper.addPortion( xTextObj, aNameArray[ i ], true );
             }
 
             /* create two custom shows, one will play slide 6 to 10 and is named "ShortVersion"
                the other one will play slide 2 til 10 and is named "LongVersion" */
-            XCustomPresentationSupplier xCustPresSupplier = (XCustomPresentationSupplier)
-                UnoRuntime.queryInterface( XCustomPresentationSupplier.class, xDrawDoc );
+            XCustomPresentationSupplier xCustPresSupplier = UnoRuntime.queryInterface( XCustomPresentationSupplier.class, xDrawDoc );
 
             /* the following container is a container for further container
                which concludes the list of pages that are to play within a custom show */
             XNameContainer xNameContainer = xCustPresSupplier.getCustomPresentations();
-            XSingleServiceFactory xFactory = (XSingleServiceFactory)
-                UnoRuntime.queryInterface( XSingleServiceFactory.class, xNameContainer );
+            XSingleServiceFactory xFactory = UnoRuntime.queryInterface( XSingleServiceFactory.class, xNameContainer );
 
             Object          xObj;
             XIndexContainer xContainer;
@@ -139,7 +136,7 @@ public class CustomShowDemo
             /* instanciate an IndexContainer that will take
                a list of draw pages for the first custom show */
             xObj = xFactory.createInstance();
-            xContainer = (XIndexContainer)UnoRuntime.queryInterface( XIndexContainer.class, xObj );
+            xContainer = UnoRuntime.queryInterface( XIndexContainer.class, xObj );
             for ( i = 5; i < 10; i++ )
                 xContainer.insertByIndex( xContainer.getCount(), xDrawPages.getByIndex( i ) );
             xNameContainer.insertByName( "ShortVersion", xContainer );
@@ -147,7 +144,7 @@ public class CustomShowDemo
             /* instanciate an IndexContainer that will take
                a list of draw page for the second custom show */
             xObj = xFactory.createInstance();
-            xContainer = (XIndexContainer)UnoRuntime.queryInterface( XIndexContainer.class, xObj );
+            xContainer = UnoRuntime.queryInterface( XIndexContainer.class, xObj );
             for ( i = 1; i < 10; i++ )
                 xContainer.insertByIndex( xContainer.getCount(), xDrawPages.getByIndex( i ) );
             xNameContainer.insertByName( "LongVersion", xContainer );
@@ -155,11 +152,9 @@ public class CustomShowDemo
             /* which custom show is to use
                can been set in the presentation settings */
 
-            XPresentationSupplier xPresSupplier = (XPresentationSupplier)
-                UnoRuntime.queryInterface( XPresentationSupplier.class, xDrawDoc );
+            XPresentationSupplier xPresSupplier = UnoRuntime.queryInterface( XPresentationSupplier.class, xDrawDoc );
             XPresentation xPresentation = xPresSupplier.getPresentation();
-            XPropertySet xPresPropSet = (XPropertySet)
-                UnoRuntime.queryInterface( XPropertySet.class, xPresentation );
+            XPropertySet xPresPropSet = UnoRuntime.queryInterface( XPropertySet.class, xPresentation );
             xPresPropSet.setPropertyValue( "CustomShow", "ShortVersion" );
         }
         catch( Exception ex )
diff --git a/odk/examples/DevelopersGuide/Drawing/DrawViewDemo.java b/odk/examples/DevelopersGuide/Drawing/DrawViewDemo.java
index 41780cf..efea885 100644
--- a/odk/examples/DevelopersGuide/Drawing/DrawViewDemo.java
+++ b/odk/examples/DevelopersGuide/Drawing/DrawViewDemo.java
@@ -88,15 +88,15 @@ public class DrawViewDemo
                                                 sUrl.toString(), "_blank", 0,
                                                 pPropValues );
             XModel xModel =
-                (XModel)UnoRuntime.queryInterface(
-                    XModel.class, xComponent );
+                UnoRuntime.queryInterface(
+                        XModel.class, xComponent );
 
 
             // print all available properties of first view
             System.out.println("*** print all available properties of first view");
             XViewDataSupplier xViewDataSupplier =
-                (XViewDataSupplier)UnoRuntime.queryInterface(
-                    XViewDataSupplier.class, xModel );
+                UnoRuntime.queryInterface(
+                        XViewDataSupplier.class, xModel );
             XIndexAccess xIndexAccess = xViewDataSupplier.getViewData();
             if ( xIndexAccess.getCount() != 0 )
             {
@@ -116,8 +116,8 @@ public class DrawViewDemo
             System.out.println("*** print all properties that are supported by the controller");
             XController xController = xModel.getCurrentController();
             XPropertySet xPropSet =
-                (XPropertySet)UnoRuntime.queryInterface(
-                    XPropertySet.class, xController );
+                UnoRuntime.queryInterface(
+                        XPropertySet.class, xController );
             XPropertySetInfo xPropSetInfo = xPropSet.getPropertySetInfo();
             Property[] aPropSeq = xPropSetInfo.getProperties();
             for( int i = 0; i < aPropSeq.length; i++ )
diff --git a/odk/examples/DevelopersGuide/Drawing/DrawingDemo.java b/odk/examples/DevelopersGuide/Drawing/DrawingDemo.java
index 15cf577..28d9160 100644
--- a/odk/examples/DevelopersGuide/Drawing/DrawingDemo.java
+++ b/odk/examples/DevelopersGuide/Drawing/DrawingDemo.java
@@ -166,7 +166,7 @@ public class DrawingDemo
                 PageHelper.getDrawPageCount( xDrawDoc ) - 1 );
 
             // each drawpage is supporting an XNamed interface
-            XNamed xNamed = (XNamed)UnoRuntime.queryInterface(
+            XNamed xNamed = UnoRuntime.queryInterface(
                 XNamed.class, xLastPage );
 
             // beware, the page must have an unique name
@@ -249,8 +249,7 @@ public class DrawingDemo
                 int nRndObjPosY = aRndGen.nextInt( nHalfHeight - nRndObjHeight )
                     + nHalfHeight;
 
-                XShapes xShapes = (XShapes)
-                    UnoRuntime.queryInterface( XShapes.class, pPages[ i ] );
+                XShapes xShapes = UnoRuntime.queryInterface( XShapes.class, pPages[ i ] );
                 ShapeHelper.createAndInsertShape( xDrawDoc, xShapes,
                     new Point( nRndObjPosX, nRndObjPosY ),
                         new Size( nRndObjWidth, nRndObjHeight ),
@@ -283,16 +282,13 @@ public class DrawingDemo
                 xDrawPage = PageHelper.getMasterPageByIndex( xDrawDoc, 0 );
             else
                 xDrawPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
-            XShapes xShapes = (XShapes)
-                UnoRuntime.queryInterface( XShapes.class, xDrawPage );
+            XShapes xShapes = UnoRuntime.queryInterface( XShapes.class, xDrawPage );
             xShapes.add( xPolyPolygonBezier );
 
-            XPropertySet xShapeProperties = (XPropertySet)
-                UnoRuntime.queryInterface( XPropertySet.class, xPolyPolygonBezier );
+            XPropertySet xShapeProperties = UnoRuntime.queryInterface( XPropertySet.class, xPolyPolygonBezier );
 
             // get pagesize
-            XPropertySet xPageProperties = (XPropertySet)
-                UnoRuntime.queryInterface( XPropertySet.class, xDrawPage );
+            XPropertySet xPageProperties = UnoRuntime.queryInterface( XPropertySet.class, xDrawPage );
             int nPageWidth = ((Integer)xPageProperties.getPropertyValue( "Width" )).intValue() / 2;
             int nPageHeight = ((Integer)xPageProperties.getPropertyValue( "Height" )).intValue() / 2;
 
@@ -369,12 +365,10 @@ public class DrawingDemo
             // before it is possible to insert shapes,
             // the group must have been added to the page
             XDrawPage xDrawPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
-            XShapes xShapes = (XShapes)
-                UnoRuntime.queryInterface( XShapes.class, xDrawPage );
+            XShapes xShapes = UnoRuntime.queryInterface( XShapes.class, xDrawPage );
             xShapes.add( xGroup );
 
-            XShapes xShapesGroup = (XShapes)
-                UnoRuntime.queryInterface( XShapes.class, xGroup );
+            XShapes xShapesGroup = UnoRuntime.queryInterface( XShapes.class, xGroup );
 
             Size aPageSize = PageHelper.getPageSize( xDrawPage );
 
@@ -408,11 +402,9 @@ public class DrawingDemo
         try
         {
             XDrawPage xDrawPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
-            XShapeGrouper xShapeGrouper = (XShapeGrouper)
-                UnoRuntime.queryInterface( XShapeGrouper.class, xDrawPage );
+            XShapeGrouper xShapeGrouper = UnoRuntime.queryInterface( XShapeGrouper.class, xDrawPage );
 
-            XShapes xShapesPage = (XShapes)
-                UnoRuntime.queryInterface( XShapes.class, xDrawPage );
+            XShapes xShapesPage = UnoRuntime.queryInterface( XShapes.class, xDrawPage );
 
             xShapeGrouper.group( xShapesPage );
         }
diff --git a/odk/examples/DevelopersGuide/Drawing/FillAndLineStyleDemo.java b/odk/examples/DevelopersGuide/Drawing/FillAndLineStyleDemo.java
index be32f58..472ae81 100644
--- a/odk/examples/DevelopersGuide/Drawing/FillAndLineStyleDemo.java
+++ b/odk/examples/DevelopersGuide/Drawing/FillAndLineStyleDemo.java
@@ -84,12 +84,10 @@ public class FillAndLineStyleDemo
                     new Size( 15000, 12000 ),
                         "com.sun.star.drawing.RectangleShape" );
 
-            XShapes xShapes = (XShapes)
-                    UnoRuntime.queryInterface( XShapes.class, xPage );
+            XShapes xShapes = UnoRuntime.queryInterface( XShapes.class, xPage );
             xShapes.add( xRectangle );
 
-            XPropertySet xPropSet = (XPropertySet)
-                UnoRuntime.queryInterface( XPropertySet.class, xRectangle );
+            XPropertySet xPropSet = UnoRuntime.queryInterface( XPropertySet.class, xRectangle );
 
             /* apply a gradient fill style that goes from top left to bottom
                right and is changing its color from green to yellow */
diff --git a/odk/examples/DevelopersGuide/Drawing/GluePointDemo.java b/odk/examples/DevelopersGuide/Drawing/GluePointDemo.java
index 4b9b08f..5f1a32e 100644
--- a/odk/examples/DevelopersGuide/Drawing/GluePointDemo.java
+++ b/odk/examples/DevelopersGuide/Drawing/GluePointDemo.java
@@ -84,8 +84,7 @@ public class GluePointDemo
 
 
             XDrawPage xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
-            XShapes xShapes = (XShapes)
-                    UnoRuntime.queryInterface( XShapes.class, xPage );
+            XShapes xShapes = UnoRuntime.queryInterface( XShapes.class, xPage );
 
             // create two rectangles
             XShape xShape1 = ShapeHelper.createShape( xDrawDoc,
@@ -106,8 +105,7 @@ public class GluePointDemo
             xShapes.add( xShape2 );
             xShapes.add( xConnector );
 
-            XPropertySet xConnectorPropSet = (XPropertySet)
-                UnoRuntime.queryInterface( XPropertySet.class, xConnector );
+            XPropertySet xConnectorPropSet = UnoRuntime.queryInterface( XPropertySet.class, xConnector );
 
 //          Index value of 0 : the shape is connected at the top
 //          Index value of 1 : the shape is connected at the left
@@ -140,21 +138,17 @@ public class GluePointDemo
             aGluePoint.Position.Y = 0;
 
             // create and insert a glue point at shape1
-            xGluePointsSupplier = (XGluePointsSupplier)
-                UnoRuntime.queryInterface( XGluePointsSupplier.class, xShape1 );
+            xGluePointsSupplier = UnoRuntime.queryInterface( XGluePointsSupplier.class, xShape1 );
             xIndexContainer = xGluePointsSupplier.getGluePoints();
-            xIdentifierContainer = (XIdentifierContainer)
-                UnoRuntime.queryInterface( XIdentifierContainer.class,
-                                           xIndexContainer );
+            xIdentifierContainer = UnoRuntime.queryInterface( XIdentifierContainer.class,
+                    xIndexContainer );
             int nIndexOfGluePoint1 = xIdentifierContainer.insert( aGluePoint );
 
             // create and insert a glue point at shape2
-            xGluePointsSupplier = (XGluePointsSupplier)
-                UnoRuntime.queryInterface( XGluePointsSupplier.class, xShape2 );
+            xGluePointsSupplier = UnoRuntime.queryInterface( XGluePointsSupplier.class, xShape2 );
             xIndexContainer = xGluePointsSupplier.getGluePoints();
-            xIdentifierContainer = (XIdentifierContainer)
-                UnoRuntime.queryInterface( XIdentifierContainer.class,
-                                           xIndexContainer );
+            xIdentifierContainer = UnoRuntime.queryInterface( XIdentifierContainer.class,
+                    xIndexContainer );
             int nIndexOfGluePoint2 = xIdentifierContainer.insert( aGluePoint );
 
             // create and add a connector
@@ -164,8 +158,7 @@ public class GluePointDemo
                         "com.sun.star.drawing.ConnectorShape" );
             xShapes.add( xConnector2 );
 
-            XPropertySet xConnector2PropSet = (XPropertySet)
-                UnoRuntime.queryInterface( XPropertySet.class, xConnector2 );
+            XPropertySet xConnector2PropSet = UnoRuntime.queryInterface( XPropertySet.class, xConnector2 );
 
             xConnector2PropSet.setPropertyValue( "StartShape", xShape1 );
             xConnector2PropSet.setPropertyValue( "StartGluePointIndex",
diff --git a/odk/examples/DevelopersGuide/Drawing/GraphicExportDemo.java b/odk/examples/DevelopersGuide/Drawing/GraphicExportDemo.java
index 25aa1b3e..dc93c75 100644
--- a/odk/examples/DevelopersGuide/Drawing/GraphicExportDemo.java
+++ b/odk/examples/DevelopersGuide/Drawing/GraphicExportDemo.java
@@ -84,8 +84,7 @@ public class GraphicExportDemo
             Object GraphicExportFilter =
                 xOfficeContext.getServiceManager().createInstanceWithContext(
                     "com.sun.star.drawing.GraphicExportFilter", xOfficeContext);
-            XExporter xExporter = (XExporter)
-                UnoRuntime.queryInterface( XExporter.class, GraphicExportFilter );
+            XExporter xExporter = UnoRuntime.queryInterface( XExporter.class, GraphicExportFilter );
 
             PropertyValue aProps[] = new PropertyValue[2];
             aProps[0] = new PropertyValue();
@@ -110,11 +109,9 @@ public class GraphicExportDemo
             {
                 XDrawPage xPage = PageHelper.getDrawPageByIndex( xComponent,
                                                                  nPageIndex );
-                XComponent xComp = (XComponent)
-                    UnoRuntime.queryInterface( XComponent.class, xPage );
+                XComponent xComp = UnoRuntime.queryInterface( XComponent.class, xPage );
                 xExporter.setSourceDocument( xComp );
-                XFilter xFilter = (XFilter)
-                    UnoRuntime.queryInterface( XFilter.class, xExporter );
+                XFilter xFilter = UnoRuntime.queryInterface( XFilter.class, xExporter );
                 xFilter.filter( aProps );
                 System.out.println( "*** graphics on page \"" + nPageIndex
                                     + "\" from file \"" + args[0]
@@ -127,9 +124,8 @@ public class GraphicExportDemo
 
 
             // close the document
-            com.sun.star.util.XCloseable xCloseable = (com.sun.star.util.XCloseable)
-                UnoRuntime.queryInterface(com.sun.star.util.XCloseable.class,
-                                          xComponent);
+            com.sun.star.util.XCloseable xCloseable = UnoRuntime.queryInterface(com.sun.star.util.XCloseable.class,
+                    xComponent);
 
             if (xCloseable != null )
                 xCloseable.close(false);
diff --git a/odk/examples/DevelopersGuide/Drawing/Helper.java b/odk/examples/DevelopersGuide/Drawing/Helper.java
index efd952a..a232e94 100644
--- a/odk/examples/DevelopersGuide/Drawing/Helper.java
+++ b/odk/examples/DevelopersGuide/Drawing/Helper.java
@@ -35,6 +35,9 @@
 // __________ Imports __________
 
 import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.lang.XComponent;
+import com.sun.star.frame.XComponentLoader;
 
 public class Helper
 {
@@ -44,11 +47,11 @@ public class Helper
      * A new connection is established and the service manger from the running
      * offic eis returned.
      */
-    static public com.sun.star.uno.XComponentContext connect()
+    static public XComponentContext connect()
         throws Exception
     {
         // get the remote office component context
-        com.sun.star.uno.XComponentContext xOfficeContext =
+        XComponentContext xOfficeContext =
             com.sun.star.comp.helper.Bootstrap.bootstrap();
 
         // if connection fails an exception is thrown
@@ -65,15 +68,15 @@ public class Helper
         com.sun.star.beans.PropertyValue[] aArgs )
             throws Exception
     {
-        com.sun.star.lang.XComponent xComponent = null;
-        com.sun.star.frame.XComponentLoader aLoader =
-            (com.sun.star.frame.XComponentLoader)UnoRuntime.queryInterface(
-                com.sun.star.frame.XComponentLoader.class,
-                xOfficeContext.getServiceManager().createInstanceWithContext(
-                    "com.sun.star.frame.Desktop", xOfficeContext));
+        XComponentLoader aLoader =
+            UnoRuntime.queryInterface(
+                    XComponentLoader.class,
+                    xOfficeContext.getServiceManager().createInstanceWithContext(
+                            "com.sun.star.frame.Desktop", xOfficeContext));
 
-        xComponent = (com.sun.star.lang.XComponent)UnoRuntime.queryInterface(
-            com.sun.star.lang.XComponent.class, aLoader.loadComponentFromURL(
+        XComponent xComponent =
+            UnoRuntime.queryInterface(
+            XComponent.class, aLoader.loadComponentFromURL(
                 sURL, sTargetFrame, nSearchFlags, aArgs ) );
 
         if ( xComponent == null )
diff --git a/odk/examples/DevelopersGuide/Drawing/LayerDemo.java b/odk/examples/DevelopersGuide/Drawing/LayerDemo.java
index eec7171..cbf6635 100644
--- a/odk/examples/DevelopersGuide/Drawing/LayerDemo.java
+++ b/odk/examples/DevelopersGuide/Drawing/LayerDemo.java
@@ -84,8 +84,7 @@ public class LayerDemo
 
             // create two rectangles
             XDrawPage xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
-            XShapes xShapes = (XShapes)
-                    UnoRuntime.queryInterface( XShapes.class, xPage );
+            XShapes xShapes = UnoRuntime.queryInterface( XShapes.class, xPage );
 
             XShape xRect1 = ShapeHelper.createShape( xDrawDoc,
                 new Point( 1000, 1000 ), new Size( 5000, 5000 ),
@@ -109,12 +108,10 @@ public class LayerDemo
 
 
             // query for the XLayerManager
-            XLayerSupplier xLayerSupplier = (XLayerSupplier)
-                (XLayerSupplier)UnoRuntime.queryInterface(
+            XLayerSupplier xLayerSupplier = UnoRuntime.queryInterface(
                     XLayerSupplier.class, xDrawDoc );
             XNameAccess xNameAccess = xLayerSupplier.getLayerManager();
-            XLayerManager xLayerManager = (XLayerManager)
-                (XLayerManager)UnoRuntime.queryInterface(
+            XLayerManager xLayerManager = UnoRuntime.queryInterface(
                     XLayerManager.class, xNameAccess );
 
             // create a layer and set its properties
@@ -122,8 +119,7 @@ public class LayerDemo
             XLayer xNotVisibleAndEditable = xLayerManager.insertNewByIndex(
                 xLayerManager.getCount() );
 
-            xLayerPropSet = (XPropertySet)
-                (XPropertySet)UnoRuntime.queryInterface(
+            xLayerPropSet = UnoRuntime.queryInterface(
                     XPropertySet.class, xNotVisibleAndEditable );
             xLayerPropSet.setPropertyValue( "Name", "NotVisibleAndEditable" );
             xLayerPropSet.setPropertyValue( "IsVisible", new Boolean( false ) );
@@ -133,8 +129,7 @@ public class LayerDemo
             XLayer xNotEditable = xLayerManager.insertNewByIndex(
                 xLayerManager.getCount() );
 
-            xLayerPropSet = (XPropertySet)
-                (XPropertySet)UnoRuntime.queryInterface(
+            xLayerPropSet = UnoRuntime.queryInterface(
                     XPropertySet.class, xNotEditable );
             xLayerPropSet.setPropertyValue( "Name", "NotEditable" );
             xLayerPropSet.setPropertyValue( "IsVisible", new Boolean( true ) );
diff --git a/odk/examples/DevelopersGuide/Drawing/ObjectTransformationDemo.java b/odk/examples/DevelopersGuide/Drawing/ObjectTransformationDemo.java
index 4b09ea0..f45326a 100644
--- a/odk/examples/DevelopersGuide/Drawing/ObjectTransformationDemo.java
+++ b/odk/examples/DevelopersGuide/Drawing/ObjectTransformationDemo.java
@@ -77,11 +77,9 @@ public class ObjectTransformationDemo
                 "private:factory/simpress", "_blank", 0, pPropValues );
 
             XDrawPage xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
-            XPropertySet xPagePropSet= (XPropertySet)
-                    UnoRuntime.queryInterface( XPropertySet.class, xPage );
+            XPropertySet xPagePropSet= UnoRuntime.queryInterface( XPropertySet.class, xPage );
 
-            XShapes xShapes = (XShapes)
-                    UnoRuntime.queryInterface( XShapes.class, xPage );
+            XShapes xShapes = UnoRuntime.queryInterface( XShapes.class, xPage );
 
 
             XShape xShape = ShapeHelper.createShape( xDrawDoc,
@@ -89,8 +87,7 @@ public class ObjectTransformationDemo
                     "com.sun.star.drawing.RectangleShape" );
             xShapes.add( xShape );
 
-            XPropertySet xPropSet = (XPropertySet)
-                    UnoRuntime.queryInterface( XPropertySet.class, xShape );
+            XPropertySet xPropSet = UnoRuntime.queryInterface( XPropertySet.class, xShape );
 
             HomogenMatrix3 aHomogenMatrix3 = (HomogenMatrix3)
                 xPropSet.getPropertyValue( "Transformation" );
diff --git a/odk/examples/DevelopersGuide/Drawing/Organigram.java b/odk/examples/DevelopersGuide/Drawing/Organigram.java
index 5b0bdf0..362f38a 100644
--- a/odk/examples/DevelopersGuide/Drawing/Organigram.java
+++ b/odk/examples/DevelopersGuide/Drawing/Organigram.java
@@ -82,8 +82,7 @@ public class Organigram {
 
         Object desktop = xRemoteServiceManager.createInstanceWithContext(
             "com.sun.star.frame.Desktop", xRemoteContext);
-        XComponentLoader xComponentLoader = (XComponentLoader)
-            UnoRuntime.queryInterface(XComponentLoader.class, desktop);
+        XComponentLoader xComponentLoader = UnoRuntime.queryInterface(XComponentLoader.class, desktop);
 
         PropertyValue[] loadProps = new PropertyValue[0];
         XComponent xDrawComponent = xComponentLoader.loadComponentFromURL(
@@ -91,22 +90,21 @@ public class Organigram {
 
         // get draw page by index
         com.sun.star.drawing.XDrawPagesSupplier xDrawPagesSupplier =
-            (com.sun.star.drawing.XDrawPagesSupplier)UnoRuntime.queryInterface(
-                com.sun.star.drawing.XDrawPagesSupplier.class, xDrawComponent );
+            UnoRuntime.queryInterface(
+                    com.sun.star.drawing.XDrawPagesSupplier.class, xDrawComponent );
         com.sun.star.drawing.XDrawPages xDrawPages =
             xDrawPagesSupplier.getDrawPages();
         Object drawPage = xDrawPages.getByIndex(0);
-        com.sun.star.drawing.XDrawPage xDrawPage = (com.sun.star.drawing.XDrawPage)
-            UnoRuntime.queryInterface(com.sun.star.drawing.XDrawPage.class,
-                                      drawPage);
+        com.sun.star.drawing.XDrawPage xDrawPage = UnoRuntime.queryInterface(com.sun.star.drawing.XDrawPage.class,
+                drawPage);
 
         com.sun.star.lang.XMultiServiceFactory xDocumentFactory =
-            (com.sun.star.lang.XMultiServiceFactory)UnoRuntime.queryInterface(
-                com.sun.star.lang.XMultiServiceFactory.class, xDrawComponent);
+            UnoRuntime.queryInterface(
+                    com.sun.star.lang.XMultiServiceFactory.class, xDrawComponent);
 
         com.sun.star.beans.XPropertySet xPageProps =
-            (com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface(
-                com.sun.star.beans.XPropertySet.class, xDrawPage);
+            UnoRuntime.queryInterface(
+                    com.sun.star.beans.XPropertySet.class, xDrawPage);
 
         int pageWidth = AnyConverter.toInt(xPageProps.getPropertyValue("Width"));
         int pageHeight = AnyConverter.toInt(xPageProps.getPropertyValue("Height"));
@@ -144,15 +142,13 @@ public class Organigram {
                          (levelCount[level] - 1) * horSpace) / 2
                          + i * shapeWidth + i * horSpace;
                 Object shape = xDocumentFactory.createInstance("com.sun.star.drawing.RectangleShape");
-                com.sun.star.drawing.XShape xShape = (com.sun.star.drawing.XShape)
-                    UnoRuntime.queryInterface(
+                com.sun.star.drawing.XShape xShape = UnoRuntime.queryInterface(
                         com.sun.star.drawing.XShape.class, shape);
                 xShape.setPosition(new com.sun.star.awt.Point(shapeX, levelY));
                 xShape.setSize(new com.sun.star.awt.Size(shapeWidth, shapeHeight));
                 xDrawPage.add(xShape);
 
-                com.sun.star.text.XText xText = (com.sun.star.text.XText)
-                    UnoRuntime.queryInterface(
+                com.sun.star.text.XText xText = UnoRuntime.queryInterface(
                         com.sun.star.text.XText.class, xShape);
 
                 xText.setString(orgUnits[level][i]);
@@ -164,11 +160,11 @@ public class Organigram {
                 if (level == 1) {
                     Object connector = xDocumentFactory.createInstance("com.sun.star.drawing.ConnectorShape");
                     com.sun.star.beans.XPropertySet xConnectorProps =
-                        (com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface(
-                            com.sun.star.beans.XPropertySet.class, connector);
+                        UnoRuntime.queryInterface(
+                                com.sun.star.beans.XPropertySet.class, connector);
                 com.sun.star.drawing.XShape xConnector =
-                    (com.sun.star.drawing.XShape)UnoRuntime.queryInterface(
-                        com.sun.star.drawing.XShape.class, connector);
+                    UnoRuntime.queryInterface(
+                            com.sun.star.drawing.XShape.class, connector);
                     xDrawPage.add(xConnector);
                     xConnectorProps.setPropertyValue("StartShape", xStartShape);
                     xConnectorProps.setPropertyValue("EndShape", xShape);
diff --git a/odk/examples/DevelopersGuide/Drawing/PageHelper.java b/odk/examples/DevelopersGuide/Drawing/PageHelper.java

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list