diff options
Diffstat (limited to 'odk/examples/java/ConverterServlet/ConverterServlet.java')
-rw-r--r-- | odk/examples/java/ConverterServlet/ConverterServlet.java | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/odk/examples/java/ConverterServlet/ConverterServlet.java b/odk/examples/java/ConverterServlet/ConverterServlet.java index 526e9281ef01..2a3688c4ead9 100644 --- a/odk/examples/java/ConverterServlet/ConverterServlet.java +++ b/odk/examples/java/ConverterServlet/ConverterServlet.java @@ -228,9 +228,8 @@ public class ConverterServlet extends HttpServlet { "com.sun.star.bridge.UnoUrlResolver", xcomponentcontext ); // Create a new url resolver - XUnoUrlResolver xurlresolver = ( XUnoUrlResolver ) - UnoRuntime.queryInterface( XUnoUrlResolver.class, - objectUrlResolver ); + XUnoUrlResolver xurlresolver = UnoRuntime.queryInterface( XUnoUrlResolver.class, + objectUrlResolver ); // Resolves an object that is specified as follow: // uno:<connection description>;<protocol description>;<initial object name> @@ -239,29 +238,26 @@ public class ConverterServlet extends HttpServlet { ";urp;StarOffice.ServiceManager" ); // Create a service manager from the initial object - xmulticomponentfactory = ( XMultiComponentFactory ) - UnoRuntime.queryInterface( XMultiComponentFactory.class, objectInitial ); + xmulticomponentfactory = UnoRuntime.queryInterface( XMultiComponentFactory.class, objectInitial ); // Query for the XPropertySet interface. - XPropertySet xpropertysetMultiComponentFactory = ( XPropertySet ) - UnoRuntime.queryInterface( XPropertySet.class, xmulticomponentfactory ); + XPropertySet xpropertysetMultiComponentFactory = UnoRuntime.queryInterface( XPropertySet.class, xmulticomponentfactory ); // Get the default context from the office server. Object objectDefaultContext = xpropertysetMultiComponentFactory.getPropertyValue( "DefaultContext" ); // Query for the interface XComponentContext. - xcomponentcontext = ( XComponentContext ) UnoRuntime.queryInterface( + xcomponentcontext = UnoRuntime.queryInterface( XComponentContext.class, objectDefaultContext ); /* A desktop environment contains tasks with one or more frames in which components can be loaded. Desktop is the environment for components which can instanciate within frames. */ - XComponentLoader xcomponentloader = ( XComponentLoader ) - UnoRuntime.queryInterface( XComponentLoader.class, - xmulticomponentfactory.createInstanceWithContext( - "com.sun.star.frame.Desktop", xcomponentcontext ) ); + XComponentLoader xcomponentloader = UnoRuntime.queryInterface( XComponentLoader.class, + xmulticomponentfactory.createInstanceWithContext( + "com.sun.star.frame.Desktop", xcomponentcontext ) ); // Preparing properties for loading the document PropertyValue propertyvalue[] = new PropertyValue[ 1 ]; @@ -277,8 +273,8 @@ public class ConverterServlet extends HttpServlet { // Getting an object that will offer a simple way to store a document to a URL. XStorable xstorable = - ( XStorable ) UnoRuntime.queryInterface( XStorable.class, - objectDocumentToStore ); + UnoRuntime.queryInterface( XStorable.class, + objectDocumentToStore ); // Preparing properties for converting the document propertyvalue = new PropertyValue[ 2 ]; @@ -302,7 +298,7 @@ public class ConverterServlet extends HttpServlet { // Storing and converting the document xstorable.storeAsURL( stringConvertedFile, propertyvalue ); - XCloseable xcloseable = (XCloseable)UnoRuntime.queryInterface( XCloseable.class,xstorable ); + XCloseable xcloseable = UnoRuntime.queryInterface( XCloseable.class,xstorable ); // Closing the converted document if ( xcloseable != null ) @@ -310,7 +306,7 @@ public class ConverterServlet extends HttpServlet { else { // If Xcloseable is not supported (older versions, // use dispose() for closing the document - XComponent xComponent = ( XComponent ) UnoRuntime.queryInterface( + XComponent xComponent = UnoRuntime.queryInterface( XComponent.class, xstorable ); xComponent.dispose(); } |