summaryrefslogtreecommitdiff
path: root/odk
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-04-23 09:01:41 +0200
committerFridrich Strba <fridrich@documentfoundation.org>2013-04-23 10:29:36 +0000
commit68b9fb0aaeff4aef41dfd6989491b522578ca079 (patch)
tree91ce6c4395e11b17c7ca652a66bd8ce905afcd7b /odk
parent4f6adb0585037013241bd59e5c869a261c1f20c1 (diff)
Java cleanup - remove unnecessary casts in the ODK code
Change-Id: I1ab8ad5182444fc3eebd2349135a0240ebbe0fd4 Reviewed-on: https://gerrit.libreoffice.org/3566 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'odk')
-rw-r--r--odk/examples/DevelopersGuide/Forms/ControlLock.java4
-rw-r--r--odk/examples/DevelopersGuide/Forms/DataAwareness.java14
-rw-r--r--odk/examples/DevelopersGuide/Forms/DocumentBasedExample.java5
-rw-r--r--odk/examples/DevelopersGuide/Forms/DocumentHelper.java38
-rw-r--r--odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java14
-rw-r--r--odk/examples/DevelopersGuide/Forms/FLTools.java14
-rw-r--r--odk/examples/DevelopersGuide/Forms/FormLayer.java12
-rw-r--r--odk/examples/DevelopersGuide/Forms/GridFieldValidator.java4
-rw-r--r--odk/examples/DevelopersGuide/Forms/HsqlDatabase.java18
-rw-r--r--odk/examples/DevelopersGuide/Forms/KeyGenerator.java22
-rw-r--r--odk/examples/DevelopersGuide/Forms/RowSet.java10
-rw-r--r--odk/examples/DevelopersGuide/Forms/SalesFilter.java2
-rw-r--r--odk/examples/DevelopersGuide/Forms/SingleControlValidation.java6
-rw-r--r--odk/examples/DevelopersGuide/Forms/SpreadsheetDocument.java10
-rw-r--r--odk/examples/DevelopersGuide/Forms/SpreadsheetValueBinding.java6
-rw-r--r--odk/examples/DevelopersGuide/Forms/SpreadsheetView.java8
-rw-r--r--odk/examples/DevelopersGuide/Forms/UNO.java16
-rw-r--r--odk/examples/DevelopersGuide/Forms/ValueBinding.java6
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java2
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java103
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java4
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/JavaWindowPeerFake.java2
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java4
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java2
-rw-r--r--odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java2
-rw-r--r--odk/examples/DevelopersGuide/UCB/Helper.java14
-rw-r--r--odk/examples/DevelopersGuide/UCB/ResourceCreator.java2
-rw-r--r--odk/examples/java/Inspector/HideableTreeModel.java6
-rw-r--r--odk/examples/java/Inspector/InspectorAddon.java8
-rw-r--r--odk/examples/java/Inspector/InspectorPane.java4
-rw-r--r--odk/examples/java/Inspector/ProtocolHandlerAddon.java8
-rw-r--r--odk/examples/java/Inspector/SourceCodeGenerator.java4
-rw-r--r--odk/examples/java/Inspector/SwingDialogProvider.java2
-rw-r--r--odk/examples/java/Inspector/SwingTreeControlProvider.java2
-rw-r--r--odk/examples/java/Inspector/TDocSupplier.java10
-rw-r--r--odk/examples/java/Inspector/TestInspector.java4
-rw-r--r--odk/examples/java/Inspector/UnoNode.java10
-rw-r--r--odk/examples/java/Inspector/UnoPropertyNode.java2
38 files changed, 200 insertions, 204 deletions
diff --git a/odk/examples/DevelopersGuide/Forms/ControlLock.java b/odk/examples/DevelopersGuide/Forms/ControlLock.java
index a24a28203119..efce0c990462 100644
--- a/odk/examples/DevelopersGuide/Forms/ControlLock.java
+++ b/odk/examples/DevelopersGuide/Forms/ControlLock.java
@@ -65,7 +65,7 @@ class LockControlModels extends ComponentTreeTraversal
if ( !super.shouldStepInto( xContainer ) )
return false; // don't try to be more clever than our base class
- XForm xForm = (XForm)UnoRuntime.queryInterface( XForm.class, xContainer );
+ XForm xForm = UnoRuntime.queryInterface( XForm.class, xContainer );
if ( ( null != xForm ) && ( m_nLevel > 1 ) )
// don't step into sub forms - we only handle the form we were originally
// applied to
@@ -169,7 +169,7 @@ class ControlLock implements XRowSetListener
m_bLockingEnabled = bLock;
// add or remove ourself as listener to get notified of cursor moves
- XRowSet xRowSet = (XRowSet)UnoRuntime.queryInterface(
+ XRowSet xRowSet = UnoRuntime.queryInterface(
XRowSet.class, m_xForm );
if ( m_bLockingEnabled )
{
diff --git a/odk/examples/DevelopersGuide/Forms/DataAwareness.java b/odk/examples/DevelopersGuide/Forms/DataAwareness.java
index a5aa106fb9d2..70323e25a373 100644
--- a/odk/examples/DevelopersGuide/Forms/DataAwareness.java
+++ b/odk/examples/DevelopersGuide/Forms/DataAwareness.java
@@ -76,7 +76,7 @@ class PrintComponentTree extends ComponentTreeTraversal
public void handle( Object aFormComponent ) throws com.sun.star.uno.Exception
{
// the name of the child
- XNamed xName = (XNamed)UnoRuntime.queryInterface( XNamed.class, aFormComponent );
+ XNamed xName = UnoRuntime.queryInterface( XNamed.class, aFormComponent );
// if it's a form control model, check it's type
XPropertySet xProps = UNO.queryPropertySet( aFormComponent );
@@ -183,7 +183,7 @@ public class DataAwareness extends DocumentBasedExample implements XPropertyChan
{
String sObjectName;
- XNamed xNameAcc = (XNamed)UnoRuntime.queryInterface( XNamed.class, xContainer );
+ XNamed xNameAcc = UnoRuntime.queryInterface( XNamed.class, xContainer );
if ( null == xNameAcc )
sObjectName = new String( "<unnamed>" );
else
@@ -244,12 +244,12 @@ public class DataAwareness extends DocumentBasedExample implements XPropertyChan
// get the columns of our master form
- XColumnsSupplier xSuppCols = (XColumnsSupplier)UnoRuntime.queryInterface(
+ XColumnsSupplier xSuppCols = UnoRuntime.queryInterface(
XColumnsSupplier.class, xFormProps );
XNameAccess xCols = xSuppCols.getColumns();
// and update the date column with a NULL value
- XColumnUpdate xDateColumn = (XColumnUpdate)UnoRuntime.queryInterface(
+ XColumnUpdate xDateColumn = UnoRuntime.queryInterface(
XColumnUpdate.class, xCols.getByName( "SALEDATE" ) );
xDateColumn.updateNull();
@@ -644,11 +644,11 @@ public class DataAwareness extends DocumentBasedExample implements XPropertyChan
// the container to insert columns into
XIndexContainer xColumnContainer = UNO.queryIndexContainer( aGridModel );
// the factory for creating column models
- XGridColumnFactory xColumnFactory = (XGridColumnFactory)UnoRuntime.queryInterface(
+ XGridColumnFactory xColumnFactory = UnoRuntime.queryInterface(
XGridColumnFactory.class, aGridModel );
// (let) create the new col
- XInterface xNewCol = (XInterface)xColumnFactory.createColumn( sColumnService );
+ XInterface xNewCol = xColumnFactory.createColumn( sColumnService );
XPropertySet xColProps = UNO.queryPropertySet( xNewCol );
// some props
@@ -913,7 +913,7 @@ public class DataAwareness extends DocumentBasedExample implements XPropertyChan
m_aSalesNameValidator.enableColumnWatch( false );
// remove our own reset listener from the form
- XNameAccess xMasterAsNames = (XNameAccess)UnoRuntime.queryInterface(
+ XNameAccess xMasterAsNames = UnoRuntime.queryInterface(
XNameAccess.class, m_xMasterForm );
XReset xFormReset = UNO.queryReset( xMasterAsNames.getByName( "Sales" ) );
xFormReset.removeResetListener( this );
diff --git a/odk/examples/DevelopersGuide/Forms/DocumentBasedExample.java b/odk/examples/DevelopersGuide/Forms/DocumentBasedExample.java
index 2b10138471e3..456e4125c9d2 100644
--- a/odk/examples/DevelopersGuide/Forms/DocumentBasedExample.java
+++ b/odk/examples/DevelopersGuide/Forms/DocumentBasedExample.java
@@ -159,9 +159,8 @@ public abstract class DocumentBasedExample implements com.sun.star.lang.XEventLi
// close our document
if ( m_document != null )
{
- XCloseable closeDoc = (XCloseable)
- UnoRuntime.queryInterface( XCloseable.class,
- m_document.getDocument() );
+ XCloseable closeDoc = UnoRuntime.queryInterface( XCloseable.class,
+ m_document.getDocument() );
if (closeDoc != null)
closeDoc.close( true );
else
diff --git a/odk/examples/DevelopersGuide/Forms/DocumentHelper.java b/odk/examples/DevelopersGuide/Forms/DocumentHelper.java
index 9132a9c27f0a..b10f52d27440 100644
--- a/odk/examples/DevelopersGuide/Forms/DocumentHelper.java
+++ b/odk/examples/DevelopersGuide/Forms/DocumentHelper.java
@@ -58,7 +58,7 @@ public class DocumentHelper
public DocumentHelper( XComponentContext xContext, XComponent document )
{
m_remoteContext = xContext;
- m_orb = (XMultiServiceFactory)UnoRuntime.queryInterface(
+ m_orb = UnoRuntime.queryInterface(
XMultiServiceFactory.class, m_remoteContext.getServiceManager());
m_documentComponent = document;
}
@@ -66,7 +66,7 @@ public class DocumentHelper
/* ------------------------------------------------------------------ */
protected static XComponent implCreateBlankDocument( XComponentContext xCtx, String factoryURL ) throws com.sun.star.uno.Exception
{
- XComponentLoader aLoader = (XComponentLoader)UnoRuntime.queryInterface(
+ XComponentLoader aLoader = UnoRuntime.queryInterface(
XComponentLoader.class,
xCtx.getServiceManager().createInstanceWithContext(
"com.sun.star.frame.Desktop", xCtx ));
@@ -100,7 +100,7 @@ public class DocumentHelper
public DocumentViewHelper getCurrentView( )
{
// get the model interface for the document
- XModel xDocModel = (XModel)UnoRuntime.queryInterface(XModel.class, m_documentComponent );
+ XModel xDocModel = UnoRuntime.queryInterface(XModel.class, m_documentComponent );
// get the current controller for the document - as a controller is tied to a view,
// this gives us the currently active view for the document.
XController xController = xDocModel.getCurrentController();
@@ -137,7 +137,7 @@ public class DocumentHelper
}
// outta here
- return (XIndexContainer)UnoRuntime.queryInterface( XIndexContainer.class, xNewForm );
+ return UnoRuntime.queryInterface( XIndexContainer.class, xNewForm );
}
/* ------------------------------------------------------------------ */
@@ -152,7 +152,7 @@ public class DocumentHelper
public XIndexContainer createSubForm( Object aParentContainer, String sInitialName )
throws com.sun.star.uno.Exception
{
- XIndexContainer xParentContainer = (XIndexContainer)UnoRuntime.queryInterface(
+ XIndexContainer xParentContainer = UnoRuntime.queryInterface(
XIndexContainer.class, aParentContainer );
return createSubForm( xParentContainer, sInitialName );
}
@@ -169,8 +169,8 @@ public class DocumentHelper
public XIndexContainer createSiblingForm( Object aForm, String sInitialName ) throws com.sun.star.uno.Exception
{
// get the parent
- XChild xAsChild = (XChild)UnoRuntime.queryInterface( XChild.class, aForm );
- XIndexContainer xContainer = (XIndexContainer)UnoRuntime.queryInterface(
+ XChild xAsChild = UnoRuntime.queryInterface( XChild.class, aForm );
+ XIndexContainer xContainer = UnoRuntime.queryInterface(
XIndexContainer.class, xAsChild.getParent() );;
// append a new form to this parent container
return createSubForm( xContainer, sInitialName );
@@ -181,13 +181,13 @@ public class DocumentHelper
*/
static public DocumentHelper getDocumentForComponent( Object aFormComponent, XComponentContext xCtx )
{
- XChild xChild = (XChild)UnoRuntime.queryInterface( XChild.class, aFormComponent );
+ XChild xChild = UnoRuntime.queryInterface( XChild.class, aFormComponent );
XModel xModel = null;
while ( ( null != xChild ) && ( null == xModel ) )
{
XInterface xParent = (XInterface)xChild.getParent();
- xModel = (XModel)UnoRuntime.queryInterface( XModel.class, xParent );
- xChild = (XChild)UnoRuntime.queryInterface( XChild.class, xParent );
+ xModel = UnoRuntime.queryInterface( XModel.class, xParent );
+ xChild = UnoRuntime.queryInterface( XChild.class, xParent );
}
return new DocumentHelper( xCtx, xModel );
@@ -212,7 +212,7 @@ public class DocumentHelper
*/
public DocumentType classify( )
{
- XServiceInfo xSI = (XServiceInfo)UnoRuntime.queryInterface(
+ XServiceInfo xSI = UnoRuntime.queryInterface(
XServiceInfo.class, m_documentComponent );
if ( xSI.supportsService( "com.sun.star.text.TextDocument" ) )
@@ -234,11 +234,11 @@ public class DocumentHelper
*/
protected XDrawPage getDrawPage( int index ) throws com.sun.star.lang.IndexOutOfBoundsException, com.sun.star.lang.WrappedTargetException
{
- XDrawPagesSupplier xSuppPages = (XDrawPagesSupplier)UnoRuntime.queryInterface(
+ XDrawPagesSupplier xSuppPages = UnoRuntime.queryInterface(
XDrawPagesSupplier.class, getDocument() );
XDrawPages xPages = xSuppPages.getDrawPages();
- return (XDrawPage)UnoRuntime.queryInterface( XDrawPage.class, xPages.getByIndex( index ) );
+ return UnoRuntime.queryInterface( XDrawPage.class, xPages.getByIndex( index ) );
}
/* ------------------------------------------------------------------ */
@@ -249,18 +249,18 @@ public class DocumentHelper
XDrawPage xReturn;
// in case of a Writer document, this is rather easy: simply ask the XDrawPageSupplier
- XDrawPageSupplier xSuppPage = (XDrawPageSupplier)UnoRuntime.queryInterface(
+ XDrawPageSupplier xSuppPage = UnoRuntime.queryInterface(
XDrawPageSupplier.class, getDocument() );
if ( null != xSuppPage )
xReturn = xSuppPage.getDrawPage();
else
{ // the model itself is no draw page supplier - okay, it may be a Writer or Calc document
// (or any other multi-page document)
- XDrawPagesSupplier xSuppPages = (XDrawPagesSupplier)UnoRuntime.queryInterface(
+ XDrawPagesSupplier xSuppPages = UnoRuntime.queryInterface(
XDrawPagesSupplier.class, getDocument() );
XDrawPages xPages = xSuppPages.getDrawPages();
- xReturn = (XDrawPage)UnoRuntime.queryInterface( XDrawPage.class, xPages.getByIndex( 0 ) );
+ xReturn = UnoRuntime.queryInterface( XDrawPage.class, xPages.getByIndex( 0 ) );
// Note that this is no really error-proof code: If the document model does not support the
// XDrawPagesSupplier interface, or if the pages collection returned is empty, this will break.
@@ -274,7 +274,7 @@ public class DocumentHelper
*/
protected XNameContainer getFormComponentTreeRoot( ) throws com.sun.star.uno.Exception
{
- XFormsSupplier xSuppForms = (XFormsSupplier)UnoRuntime.queryInterface(
+ XFormsSupplier xSuppForms = UnoRuntime.queryInterface(
XFormsSupplier.class, getMainDrawPage( ) );
XNameContainer xFormsCollection = null;
@@ -290,7 +290,7 @@ public class DocumentHelper
*/
public XInterface createInstance( String serviceSpecifier ) throws com.sun.star.uno.Exception
{
- XMultiServiceFactory xORB = (XMultiServiceFactory)UnoRuntime.queryInterface( XMultiServiceFactory.class,
+ XMultiServiceFactory xORB = UnoRuntime.queryInterface( XMultiServiceFactory.class,
m_documentComponent );
return (XInterface)xORB.createInstance( serviceSpecifier );
}
@@ -300,7 +300,7 @@ public class DocumentHelper
*/
public XInterface createInstanceWithArguments( String serviceSpecifier, Object[] arguments ) throws com.sun.star.uno.Exception
{
- XMultiServiceFactory xORB = (XMultiServiceFactory)UnoRuntime.queryInterface( XMultiServiceFactory.class,
+ XMultiServiceFactory xORB = UnoRuntime.queryInterface( XMultiServiceFactory.class,
m_documentComponent );
return (XInterface) xORB.createInstanceWithArguments( serviceSpecifier, arguments );
}
diff --git a/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java b/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java
index 7b160831b83c..25308ea29cf1 100644
--- a/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java
+++ b/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java
@@ -90,12 +90,12 @@ class DocumentViewHelper
// go get the current view
XController xController = (XController)get( XController.class );
// go get the dispatch provider of it's frame
- XDispatchProvider xProvider = (XDispatchProvider)UnoRuntime.queryInterface(
+ XDispatchProvider xProvider = UnoRuntime.queryInterface(
XDispatchProvider.class, xController.getFrame() );
if ( null != xProvider )
{
// need an URLTransformer
- XURLTransformer xTransformer = (XURLTransformer)UnoRuntime.queryInterface(
+ XURLTransformer xTransformer = UnoRuntime.queryInterface(
XURLTransformer.class, m_orb.createInstance( "com.sun.star.util.URLTransformer" ) );
xTransformer.parseStrict( aURL );
@@ -120,7 +120,7 @@ class DocumentViewHelper
public XFormController getFormController( Object _form )
{
XFormLayerAccess formLayer = (XFormLayerAccess)get( XFormLayerAccess.class );
- return formLayer.getFormController( (XForm)UnoRuntime.queryInterface( XForm.class, _form ) );
+ return formLayer.getFormController( UnoRuntime.queryInterface( XForm.class, _form ) );
}
/* ------------------------------------------------------------------ */
@@ -141,14 +141,14 @@ class DocumentViewHelper
/* ------------------------------------------------------------------ */
public XControl getFormControl( Object aModel ) throws com.sun.star.uno.Exception
{
- XControlModel xModel = (XControlModel)UnoRuntime.queryInterface( XControlModel.class, aModel );
+ XControlModel xModel = UnoRuntime.queryInterface( XControlModel.class, aModel );
return getFormControl( xModel );
}
/* ------------------------------------------------------------------ */
public Object getFormControl( Object aModel, Class aInterfaceClass ) throws com.sun.star.uno.Exception
{
- XControlModel xModel = (XControlModel)UnoRuntime.queryInterface( XControlModel.class, aModel );
+ XControlModel xModel = UnoRuntime.queryInterface( XControlModel.class, aModel );
return UnoRuntime.queryInterface( aInterfaceClass, getFormControl( xModel ) );
}
@@ -179,7 +179,7 @@ class DocumentViewHelper
XControl xControl = getFormControl( xModel );
// the focus can be set to an XWindow only
- XWindow xControlWindow = (XWindow)UnoRuntime.queryInterface( XWindow.class,
+ XWindow xControlWindow = UnoRuntime.queryInterface( XWindow.class,
xControl );
// grab the focus
@@ -202,7 +202,7 @@ class DocumentViewHelper
XPropertySet xControlProps = UNO.queryPropertySet( xForm.getByIndex( i ) );
if ( FormComponentType.FIXEDTEXT != ((Short)xControlProps.getPropertyValue( "ClassId" )).shortValue() )
{
- XControlModel xControlModel = (XControlModel)UnoRuntime.queryInterface(
+ XControlModel xControlModel = UnoRuntime.queryInterface(
XControlModel.class, xControlProps );
// set the focus to this control
grabControlFocus( xControlModel );
diff --git a/odk/examples/DevelopersGuide/Forms/FLTools.java b/odk/examples/DevelopersGuide/Forms/FLTools.java
index 3f87e77e1bd6..143816625e44 100644
--- a/odk/examples/DevelopersGuide/Forms/FLTools.java
+++ b/odk/examples/DevelopersGuide/Forms/FLTools.java
@@ -64,7 +64,7 @@ public class FLTools
URL[] aURL = new URL[] { new URL() };
aURL[0].Complete = sURL;
// need an URLTransformer
- XURLTransformer xTransformer = (XURLTransformer)UnoRuntime.queryInterface(
+ XURLTransformer xTransformer = UnoRuntime.queryInterface(
XURLTransformer.class,
xCtx.getServiceManager().createInstanceWithContext(
"com.sun.star.util.URLTransformer", xCtx ) );
@@ -78,7 +78,7 @@ public class FLTools
*/
public static String getName( Object aFormComponent ) throws com.sun.star.uno.Exception
{
- XNamed xNamed = (XNamed)UnoRuntime.queryInterface( XNamed.class,
+ XNamed xNamed = UnoRuntime.queryInterface( XNamed.class,
aFormComponent );
String sName = "";
if ( null != xNamed )
@@ -130,7 +130,7 @@ public class FLTools
int nIndex = -1;
// norm the element
- XInterface xElement = (XInterface)UnoRuntime.queryInterface(
+ XInterface xElement = UnoRuntime.queryInterface(
XInterface.class, aElement );
// get the container
@@ -142,7 +142,7 @@ public class FLTools
for ( int i = 0; i < nCount; ++i )
{
// compare with the element
- XInterface xCurrent = (XInterface)UnoRuntime.queryInterface(
+ XInterface xCurrent = UnoRuntime.queryInterface(
XInterface.class, xIndexCont.getByIndex( 0 ) );
if ( xCurrent.equals( xElement ) )
{ // found
@@ -161,7 +161,7 @@ public class FLTools
*/
static Object getParent( Object aComponent, Class aInterfaceClass )
{
- XChild xAsChild = (XChild)UnoRuntime.queryInterface( XChild.class, aComponent );
+ XChild xAsChild = UnoRuntime.queryInterface( XChild.class, aComponent );
return UnoRuntime.queryInterface( aInterfaceClass, xAsChild.getParent() );
}
@@ -179,7 +179,7 @@ public class FLTools
*/
static public void disposeComponent( Object xComp ) throws java.lang.RuntimeException
{
- XComponent xComponent = (XComponent)UnoRuntime.queryInterface( XComponent.class,
+ XComponent xComponent = UnoRuntime.queryInterface( XComponent.class,
xComp );
if ( null != xComponent )
xComponent.dispose();
@@ -190,7 +190,7 @@ public class FLTools
*/
static public Object getModel( Object aControl, Class aInterfaceClass )
{
- XControl xControl = (XControl)UnoRuntime.queryInterface(
+ XControl xControl = UnoRuntime.queryInterface(
XControl.class, aControl );
XControlModel xModel = null;
if ( null != xControl )
diff --git a/odk/examples/DevelopersGuide/Forms/FormLayer.java b/odk/examples/DevelopersGuide/Forms/FormLayer.java
index 1436591292a3..e7eb0699347b 100644
--- a/odk/examples/DevelopersGuide/Forms/FormLayer.java
+++ b/odk/examples/DevelopersGuide/Forms/FormLayer.java
@@ -87,9 +87,9 @@ public class FormLayer
int nYPos, int nWidth, int nHeight, XIndexContainer xParentForm ) throws java.lang.Exception
{
// let the document create a shape
- XMultiServiceFactory xDocAsFactory = (XMultiServiceFactory)UnoRuntime.queryInterface(
+ XMultiServiceFactory xDocAsFactory = UnoRuntime.queryInterface(
XMultiServiceFactory.class, m_document.getDocument() );
- XControlShape xShape = (XControlShape)UnoRuntime.queryInterface( XControlShape.class,
+ XControlShape xShape = UnoRuntime.queryInterface( XControlShape.class,
xDocAsFactory.createInstance( "com.sun.star.drawing.ControlShape" ) );
// position and size of the shape
@@ -103,7 +103,7 @@ public class FormLayer
// create the form component (the model of a form control)
String sQualifiedComponentName = "com.sun.star.form.component." + sFormComponentService;
- XControlModel xModel = (XControlModel)UnoRuntime.queryInterface( XControlModel.class,
+ XControlModel xModel = UnoRuntime.queryInterface( XControlModel.class,
m_document.getOrb().createInstance( sQualifiedComponentName ) );
// insert the model into the form component hierarchy, if the caller gave us a location
@@ -118,7 +118,7 @@ public class FormLayer
// add the shape to the shapes collection of the document
XDrawPage pageWhereToInsert = ( m_insertPage != -1 ) ? m_document.getDrawPage( m_insertPage ) : m_document.getMainDrawPage();
- XShapes xDocShapes = (XShapes)UnoRuntime.queryInterface( XShapes.class, pageWhereToInsert );
+ XShapes xDocShapes = UnoRuntime.queryInterface( XShapes.class, pageWhereToInsert );
xDocShapes.add( xShape );
// some initializations which are the same for all controls
@@ -240,7 +240,7 @@ public class FormLayer
*/
public XPropertySet getRadioModelByRefValue( XPropertySet form, String name, String refValue ) throws com.sun.star.uno.Exception, java.lang.Exception
{
- XIndexAccess indexAccess = (XIndexAccess)UnoRuntime.queryInterface( XIndexAccess.class,
+ XIndexAccess indexAccess = UnoRuntime.queryInterface( XIndexAccess.class,
form );
for ( int i=0; i<indexAccess.getCount(); ++i )
@@ -265,7 +265,7 @@ public class FormLayer
*/
public XPropertySet getRadioModelByTag( XPropertySet form, String name, String tag ) throws com.sun.star.uno.Exception, java.lang.Exception
{
- XIndexAccess indexAccess = (XIndexAccess)UnoRuntime.queryInterface( XIndexAccess.class,
+ XIndexAccess indexAccess = UnoRuntime.queryInterface( XIndexAccess.class,
form );
for ( int i=0; i<indexAccess.getCount(); ++i )
diff --git a/odk/examples/DevelopersGuide/Forms/GridFieldValidator.java b/odk/examples/DevelopersGuide/Forms/GridFieldValidator.java
index e32cccc147c2..073289f06bca 100644
--- a/odk/examples/DevelopersGuide/Forms/GridFieldValidator.java
+++ b/odk/examples/DevelopersGuide/Forms/GridFieldValidator.java
@@ -72,7 +72,7 @@ class GridFieldValidator implements XUpdateListener
if ( bEnable == m_bWatching )
return;
- XUpdateBroadcaster xUpdate = (XUpdateBroadcaster)UnoRuntime.queryInterface(
+ XUpdateBroadcaster xUpdate = UnoRuntime.queryInterface(
XUpdateBroadcaster.class, m_xWatchedColumn );
if ( bEnable )
@@ -105,7 +105,7 @@ class GridFieldValidator implements XUpdateListener
);
// instantiate an interaction handler who can handle SQLExceptions
- XInteractionHandler xHandler = (XInteractionHandler)UnoRuntime.queryInterface(
+ XInteractionHandler xHandler = UnoRuntime.queryInterface(
XInteractionHandler.class,
m_xCtx.getServiceManager().createInstanceWithContext(
"com.sun.star.task.InteractionHandler", m_xCtx ) );
diff --git a/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java b/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java
index 01a364c8f3f9..d56501ad9f19 100644
--- a/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java
+++ b/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java
@@ -65,9 +65,9 @@ public class HsqlDatabase
{
m_databaseDocumentFile = _docURL;
- XNameAccess dbContext = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class,
+ XNameAccess dbContext = UnoRuntime.queryInterface( XNameAccess.class,
m_context.getServiceManager().createInstanceWithContext( "com.sun.star.sdb.DatabaseContext", m_context ) );
- XDocumentDataSource dataSource = (XDocumentDataSource)UnoRuntime.queryInterface( XDocumentDataSource.class,
+ XDocumentDataSource dataSource = UnoRuntime.queryInterface( XDocumentDataSource.class,
dbContext.getByName( _docURL ) );
m_databaseDocument = dataSource.getDatabaseDocument();
@@ -81,14 +81,14 @@ public class HsqlDatabase
documentFile.deleteOnExit();
m_databaseDocumentFile = URLHelper.getFileURLFromSystemPath( documentFile );
- m_databaseDocument = (XOfficeDatabaseDocument)UnoRuntime.queryInterface(
+ m_databaseDocument = UnoRuntime.queryInterface(
XOfficeDatabaseDocument.class, m_context.getServiceManager().createInstanceWithContext(
"com.sun.star.sdb.OfficeDatabaseDocument", m_context ) );
- XPropertySet dsProperties = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, m_databaseDocument.getDataSource() );
+ XPropertySet dsProperties = UnoRuntime.queryInterface( XPropertySet.class, m_databaseDocument.getDataSource() );
dsProperties.setPropertyValue("URL", "sdbc:embedded:hsqldb");
- XStorable storable = (XStorable)UnoRuntime.queryInterface( XStorable.class, m_databaseDocument );
+ XStorable storable = UnoRuntime.queryInterface( XStorable.class, m_databaseDocument );
storable.storeAsURL( m_databaseDocumentFile, new PropertyValue[]{} );
}
@@ -120,7 +120,7 @@ public class HsqlDatabase
{
if ( m_databaseDocument != null )
{
- XStorable storeDoc = (XStorable)UnoRuntime.queryInterface( XStorable.class,
+ XStorable storeDoc = UnoRuntime.queryInterface( XStorable.class,
m_databaseDocument );
storeDoc.store();
}
@@ -134,7 +134,7 @@ public class HsqlDatabase
public void close()
{
// close connection
- XCloseable closeConn = (XCloseable)UnoRuntime.queryInterface( XCloseable.class,
+ XCloseable closeConn = UnoRuntime.queryInterface( XCloseable.class,
m_connection );
if ( closeConn != null )
{
@@ -149,7 +149,7 @@ public class HsqlDatabase
m_connection = null;
// close document
- com.sun.star.util.XCloseable closeDoc = (com.sun.star.util.XCloseable)UnoRuntime.queryInterface(
+ com.sun.star.util.XCloseable closeDoc = UnoRuntime.queryInterface(
com.sun.star.util.XCloseable.class, m_databaseDocument );
if ( closeDoc != null )
{
@@ -202,7 +202,7 @@ public class HsqlDatabase
*/
XModel getModel()
{
- return (XModel)UnoRuntime.queryInterface( XModel.class, m_databaseDocument );
+ return UnoRuntime.queryInterface( XModel.class, m_databaseDocument );
}
/** returns the URL of the ODB document represented by this instance
diff --git a/odk/examples/DevelopersGuide/Forms/KeyGenerator.java b/odk/examples/DevelopersGuide/Forms/KeyGenerator.java
index 85a56aca3eeb..d3e74669bcb0 100644
--- a/odk/examples/DevelopersGuide/Forms/KeyGenerator.java
+++ b/odk/examples/DevelopersGuide/Forms/KeyGenerator.java
@@ -64,19 +64,19 @@ class UniqueColumnValue
if ( CommandType.COMMAND == aCommandType.intValue() )
{
// get the connection from the form
- XConnection xFormConn = (XConnection)UnoRuntime.queryInterface( XConnection.class,
+ XConnection xFormConn = UnoRuntime.queryInterface( XConnection.class,
xForm.getPropertyValue( "ActiveConnection" ) );
// and let it create a composer for us
XSQLQueryComposerFactory xComposerFac =
- (XSQLQueryComposerFactory)UnoRuntime.queryInterface(
- XSQLQueryComposerFactory.class, xFormConn );
+ UnoRuntime.queryInterface(
+ XSQLQueryComposerFactory.class, xFormConn );
XSQLQueryComposer xComposer = xComposerFac.createQueryComposer( );
// let this composer analyze the command
xComposer.setQuery( sCommand );
// and ask it for the table(s)
- XTablesSupplier xSuppTables = (XTablesSupplier)UnoRuntime.queryInterface(
+ XTablesSupplier xSuppTables = UnoRuntime.queryInterface(
XTablesSupplier.class, xComposer );
XNameAccess xTables = xSuppTables.getTables();
@@ -126,7 +126,7 @@ class UniqueColumnValue
protected int generatePrimaryKey( XPropertySet xForm, String sFieldName ) throws com.sun.star.uno.Exception
{
// get the current connection of the form
- XConnection xConn = (XConnection)UnoRuntime.queryInterface(
+ XConnection xConn = UnoRuntime.queryInterface(
XConnection.class, xForm.getPropertyValue( "ActiveConnection" ) );
// let it create a new statement
XStatement xStatement = xConn.createStatement();
@@ -141,7 +141,7 @@ class UniqueColumnValue
xResults.next( );
// get the value
- XRow xRow = (XRow)UnoRuntime.queryInterface( XRow.class, xResults );
+ XRow xRow = UnoRuntime.queryInterface( XRow.class, xResults );
int nFreeValue = xRow.getInt( 1 );
// dispose the temporary objects
@@ -165,10 +165,10 @@ class UniqueColumnValue
if ( ResultSetConcurrency.READ_ONLY != aConcurrency.intValue() )
{
// get the column object
- XColumnsSupplier xSuppCols = (XColumnsSupplier)UnoRuntime.queryInterface(
+ XColumnsSupplier xSuppCols = UnoRuntime.queryInterface(
XColumnsSupplier.class, xForm );
XNameAccess xCols = xSuppCols.getColumns();
- XColumnUpdate xCol = (XColumnUpdate)UnoRuntime.queryInterface(
+ XColumnUpdate xCol = UnoRuntime.queryInterface(
XColumnUpdate.class, xCols.getByName( sFieldName ) );
xCol.updateInt( generatePrimaryKey( xForm, sFieldName ) );
@@ -204,7 +204,7 @@ class KeyGeneratorForReset extends UniqueColumnValue implements XResetListener
*/
public void defaultNewRecordFocus( XPropertySet xForm ) throws com.sun.star.uno.Exception
{
- XIndexAccess xFormAsContainer = (XIndexAccess)UnoRuntime.queryInterface(
+ XIndexAccess xFormAsContainer = UnoRuntime.queryInterface(
XIndexAccess.class, xForm );
for ( int i = 0; i<xFormAsContainer.getCount(); ++i )
{
@@ -390,7 +390,7 @@ public class KeyGenerator
XReset xFormReset = UNO.queryReset( m_xForm );
xFormReset.removeResetListener( m_aResetKeyGenerator );
- XRowSetApproveBroadcaster xFormBroadcaster = (XRowSetApproveBroadcaster)UnoRuntime.queryInterface(
+ XRowSetApproveBroadcaster xFormBroadcaster = UnoRuntime.queryInterface(
XRowSetApproveBroadcaster.class, m_xForm );
xFormBroadcaster.removeRowSetApproveListener( m_aUpdateKeyGenerator );
@@ -405,7 +405,7 @@ public class KeyGenerator
// for resets
XReset xFormReset = UNO.queryReset( m_xForm );
// for approving actions
- XRowSetApproveBroadcaster xFormBroadcaster = (XRowSetApproveBroadcaster)UnoRuntime.queryInterface(
+ XRowSetApproveBroadcaster xFormBroadcaster = UnoRuntime.queryInterface(
XRowSetApproveBroadcaster.class, m_xForm );
if ( bGenerateOnReset )
diff --git a/odk/examples/DevelopersGuide/Forms/RowSet.java b/odk/examples/DevelopersGuide/Forms/RowSet.java
index acd56f96abff..b5338810aef2 100644
--- a/odk/examples/DevelopersGuide/Forms/RowSet.java
+++ b/odk/examples/DevelopersGuide/Forms/RowSet.java
@@ -45,14 +45,14 @@ public class RowSet implements XRowSet, XRow
{
try
{
- m_rowSetProps = (XPropertySet)UnoRuntime.queryInterface(
+ m_rowSetProps = UnoRuntime.queryInterface(
XPropertySet.class, _context.getServiceManager().createInstanceWithContext( "com.sun.star.sdb.RowSet", _context ) );
m_rowSetProps.setPropertyValue( "DataSourceName", _dataSource );
m_rowSetProps.setPropertyValue( "CommandType", new Integer( _commandType ) );
m_rowSetProps.setPropertyValue( "Command", _command );
- m_rowSet = (XRowSet)UnoRuntime.queryInterface( XRowSet.class, m_rowSetProps );
- m_row = (XRow)UnoRuntime.queryInterface( XRow.class, m_rowSetProps );
+ m_rowSet = UnoRuntime.queryInterface( XRowSet.class, m_rowSetProps );
+ m_row = UnoRuntime.queryInterface( XRow.class, m_rowSetProps );
}
catch ( Exception e )
{
@@ -64,9 +64,9 @@ public class RowSet implements XRowSet, XRow
// misc
public int getColumnCount()
{
- XColumnsSupplier suppCols = (XColumnsSupplier)UnoRuntime.queryInterface(
+ XColumnsSupplier suppCols = UnoRuntime.queryInterface(
XColumnsSupplier.class, m_rowSet );
- XIndexAccess columns = (XIndexAccess)UnoRuntime.queryInterface(
+ XIndexAccess columns = UnoRuntime.queryInterface(
XIndexAccess.class, suppCols.getColumns() );
return columns.getCount();
}
diff --git a/odk/examples/DevelopersGuide/Forms/SalesFilter.java b/odk/examples/DevelopersGuide/Forms/SalesFilter.java
index 9fc561759633..df7e96aa2d64 100644
--- a/odk/examples/DevelopersGuide/Forms/SalesFilter.java
+++ b/odk/examples/DevelopersGuide/Forms/SalesFilter.java
@@ -433,7 +433,7 @@ class SalesFilter implements XActionListener, XPropertyChangeListener, XResetLis
m_xSalesForm.setPropertyValue( "ApplyFilter", new Boolean( true ) );
// and reload the form
- XLoadable xLoad = (XLoadable)UnoRuntime.queryInterface(
+ XLoadable xLoad = UnoRuntime.queryInterface(
XLoadable.class, m_xSalesForm );
xLoad.reload();
diff --git a/odk/examples/DevelopersGuide/Forms/SingleControlValidation.java b/odk/examples/DevelopersGuide/Forms/SingleControlValidation.java
index 50b59640fae3..c54283470963 100644
--- a/odk/examples/DevelopersGuide/Forms/SingleControlValidation.java
+++ b/odk/examples/DevelopersGuide/Forms/SingleControlValidation.java
@@ -96,7 +96,7 @@ public class SingleControlValidation implements XFormComponentValidityListener
if ( controls[ i ].getPropertySetInfo().hasPropertyByName( "Border" ) )
controls[ i ].setPropertyValue( "Border", new Short( (short)2 ) );
- XValidatableFormComponent xComp = (XValidatableFormComponent)UnoRuntime.queryInterface( XValidatableFormComponent.class,
+ XValidatableFormComponent xComp = UnoRuntime.queryInterface( XValidatableFormComponent.class,
controls[ i ] );
xComp.addFormComponentValidityListener( this );
}
@@ -118,7 +118,7 @@ public class SingleControlValidation implements XFormComponentValidityListener
m_explanationField = m_formLayer.createControlAndShape( "FixedText", columnPos, controlPos, 70, 4, null );
m_explanationField.setPropertyValue( "Label", new String( "" ) );
- XValidatable xValidatable = (XValidatable)UnoRuntime.queryInterface( XValidatable.class, m_inputField );
+ XValidatable xValidatable = UnoRuntime.queryInterface( XValidatable.class, m_inputField );
xValidatable.setValidator( m_validator );
}
catch( java.lang.Exception e )
@@ -144,7 +144,7 @@ public class SingleControlValidation implements XFormComponentValidityListener
{
if ( m_inputField.equals( eventObject.Source ) )
{
- XValidatableFormComponent xComp = (XValidatableFormComponent)UnoRuntime.queryInterface( XValidatableFormComponent.class,
+ XValidatableFormComponent xComp = UnoRuntime.queryInterface( XValidatableFormComponent.class,
eventObject.Source );
// the current value
Object value = xComp.getCurrentValue();
diff --git a/odk/examples/DevelopersGuide/Forms/SpreadsheetDocument.java b/odk/examples/DevelopersGuide/Forms/SpreadsheetDocument.java
index c722bf36a894..1016f49ca970 100644
--- a/odk/examples/DevelopersGuide/Forms/SpreadsheetDocument.java
+++ b/odk/examples/DevelopersGuide/Forms/SpreadsheetDocument.java
@@ -40,13 +40,13 @@ public class SpreadsheetDocument extends DocumentHelper
public XCellRange getSheet( int index ) throws com.sun.star.uno.Exception
{
- XSpreadsheetDocument spreadsheetDoc = (XSpreadsheetDocument)UnoRuntime.queryInterface( XSpreadsheetDocument.class,
+ XSpreadsheetDocument spreadsheetDoc = UnoRuntime.queryInterface( XSpreadsheetDocument.class,
m_documentComponent
);
- XIndexAccess sheets = (XIndexAccess)UnoRuntime.queryInterface( XIndexAccess.class,
+ XIndexAccess sheets = UnoRuntime.queryInterface( XIndexAccess.class,
spreadsheetDoc.getSheets()
);
- return (XCellRange)UnoRuntime.queryInterface( XCellRange.class,
+ return UnoRuntime.queryInterface( XCellRange.class,
sheets.getByIndex( index )
);
}
@@ -74,7 +74,7 @@ public class SpreadsheetDocument extends DocumentHelper
{
CellAddress address = new CellAddress( sheet, column, row );
Object[] initParam = new Object[] { new NamedValue( "BoundCell", address ) };
- cellBinding = (com.sun.star.form.binding.XValueBinding)UnoRuntime.queryInterface(
+ cellBinding = UnoRuntime.queryInterface(
com.sun.star.form.binding.XValueBinding.class,
createInstanceWithArguments(
supportIntegerValues ? "com.sun.star.table.ListPositionCellBinding"
@@ -102,7 +102,7 @@ public class SpreadsheetDocument extends DocumentHelper
CellRangeAddress rangeAddress = new CellRangeAddress( sheet, column,
topRow, column, bottomRow );
Object[] initParam = new Object[] { new NamedValue( "CellRange", rangeAddress ) };
- entrySource = (com.sun.star.form.binding.XListEntrySource)UnoRuntime.queryInterface(
+ entrySource = UnoRuntime.queryInterface(
com.sun.star.form.binding.XListEntrySource.class,
createInstanceWithArguments(
"com.sun.star.table.CellRangeListSource", initParam ) );
diff --git a/odk/examples/DevelopersGuide/Forms/SpreadsheetValueBinding.java b/odk/examples/DevelopersGuide/Forms/SpreadsheetValueBinding.java
index 5b7c1c1b00e3..09233addc5dd 100644
--- a/odk/examples/DevelopersGuide/Forms/SpreadsheetValueBinding.java
+++ b/odk/examples/DevelopersGuide/Forms/SpreadsheetValueBinding.java
@@ -74,7 +74,7 @@ public class SpreadsheetValueBinding extends DocumentBasedExample
listSourceSheet, column, topRow, bottomRow );
// bind it to the list box
- XListEntrySink consumer = (XListEntrySink)UnoRuntime.queryInterface(
+ XListEntrySink consumer = UnoRuntime.queryInterface(
XListEntrySink.class, listBox );
consumer.setListEntrySource( entrySource );
@@ -87,7 +87,7 @@ public class SpreadsheetValueBinding extends DocumentBasedExample
String[] listContent = new String[] { "first", "second", "third", "forth", "fivth" };
for ( short row = topRow; row <= bottomRow; ++row )
{
- XTextRange cellText = (XTextRange)UnoRuntime.queryInterface(
+ XTextRange cellText = UnoRuntime.queryInterface(
XTextRange.class, exchangeSheet.getCellByPosition( column, row ) );
cellText.setString( listContent[row] );
}
@@ -104,7 +104,7 @@ public class SpreadsheetValueBinding extends DocumentBasedExample
/* ------------------------------------------------------------------ */
private void implBind( XPropertySet controlModel, XValueBinding binding ) throws com.sun.star.form.binding.IncompatibleTypesException
{
- XBindableValue bindable = (XBindableValue)UnoRuntime.queryInterface(
+ XBindableValue bindable = UnoRuntime.queryInterface(
XBindableValue.class, controlModel
);
bindable.setValueBinding( binding );
diff --git a/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java b/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java
index 679c520f92c3..21dfb947d048 100644
--- a/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java
+++ b/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java
@@ -43,16 +43,16 @@ public class SpreadsheetView extends DocumentViewHelper
try
{
// get the sheet to activate
- XSpreadsheetDocument doc = (XSpreadsheetDocument)UnoRuntime.queryInterface(
+ XSpreadsheetDocument doc = UnoRuntime.queryInterface(
XSpreadsheetDocument.class, getDocument().getDocument() );
- XIndexAccess sheets = (XIndexAccess)UnoRuntime.queryInterface(
+ XIndexAccess sheets = UnoRuntime.queryInterface(
XIndexAccess.class, doc.getSheets() );
- XSpreadsheet sheet = (XSpreadsheet)UnoRuntime.queryInterface(
+ XSpreadsheet sheet = UnoRuntime.queryInterface(
XSpreadsheet.class, sheets.getByIndex( sheetIndex ) );
// activate
- XSpreadsheetView view = (XSpreadsheetView)UnoRuntime.queryInterface(
+ XSpreadsheetView view = UnoRuntime.queryInterface(
XSpreadsheetView.class, getController() );
view.setActiveSheet( sheet );
}
diff --git a/odk/examples/DevelopersGuide/Forms/UNO.java b/odk/examples/DevelopersGuide/Forms/UNO.java
index 39540613d478..109618ca2b7d 100644
--- a/odk/examples/DevelopersGuide/Forms/UNO.java
+++ b/odk/examples/DevelopersGuide/Forms/UNO.java
@@ -45,37 +45,37 @@ public class UNO
{
public static XPropertySet queryPropertySet( Object aObject )
{
- return (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, aObject );
+ return UnoRuntime.queryInterface( XPropertySet.class, aObject );
}
public static XControlModel queryControlModel( Object aObject )
{
- return (XControlModel)UnoRuntime.queryInterface( XControlModel.class, aObject );
+ return UnoRuntime.queryInterface( XControlModel.class, aObject );
}
public static XIndexContainer queryIndexContainer( Object aObject )
{
- return (XIndexContainer)UnoRuntime.queryInterface( XIndexContainer.class, aObject );
+ return UnoRuntime.queryInterface( XIndexContainer.class, aObject );
}
public static XReset queryReset( Object aObject )
{
- return (XReset)UnoRuntime.queryInterface( XReset.class, aObject );
+ return UnoRuntime.queryInterface( XReset.class, aObject );
}
public static XServiceInfo queryServiceInfo( Object aObject )
{
- return (XServiceInfo)UnoRuntime.queryInterface( XServiceInfo.class, aObject );
+ return UnoRuntime.queryInterface( XServiceInfo.class, aObject );
}
public static XColumn queryColumn( Object aObject )
{
- return (XColumn)UnoRuntime.queryInterface( XColumn.class, aObject );
+ return UnoRuntime.queryInterface( XColumn.class, aObject );
}
public static XComponent queryComponent( Object aObject )
{
- return (XComponent)UnoRuntime.queryInterface( XComponent.class, aObject );
+ return UnoRuntime.queryInterface( XComponent.class, aObject );
}
public static XTablesSupplier queryTablesSupplier( Object aObject )
{
- return (XTablesSupplier)UnoRuntime.queryInterface( XTablesSupplier.class, aObject );
+ return UnoRuntime.queryInterface( XTablesSupplier.class, aObject );
}
/* replace Foo with the identifier of your choice.
diff --git a/odk/examples/DevelopersGuide/Forms/ValueBinding.java b/odk/examples/DevelopersGuide/Forms/ValueBinding.java
index ffb7555eaf5f..3cf649cce543 100644
--- a/odk/examples/DevelopersGuide/Forms/ValueBinding.java
+++ b/odk/examples/DevelopersGuide/Forms/ValueBinding.java
@@ -41,7 +41,7 @@ public class ValueBinding extends DocumentBasedExample
// insert a table with exactly one cell. The content of this table will be synced with
// the content of a form control
- XTextDocument textDoc = (XTextDocument)UnoRuntime.queryInterface( XTextDocument.class, m_document.getDocument() );
+ XTextDocument textDoc = UnoRuntime.queryInterface( XTextDocument.class, m_document.getDocument() );
XText documentText = textDoc.getText();
XTextCursor textCursor = documentText.createTextCursor();
documentText.insertString( textCursor, "Below, there's a table cell, and a text field. ", false );
@@ -49,7 +49,7 @@ public class ValueBinding extends DocumentBasedExample
documentText.insertString( textCursor, "That means that anything you insert into the table cell is reflected in the ", false );
documentText.insertString( textCursor, "text field, and vice versa.\n", false );
- XTextTable table = (XTextTable)UnoRuntime.queryInterface( XTextTable.class,
+ XTextTable table = UnoRuntime.queryInterface( XTextTable.class,
m_document.createInstance( "com.sun.star.text.TextTable" )
);
table.initialize( 1, 1 );
@@ -61,7 +61,7 @@ public class ValueBinding extends DocumentBasedExample
// create a value binding for the first cell of the table
XValueBinding cellBinding = new TableCellTextBinding( table.getCellByName( "A1" ) );
// and bind it to the control
- XBindableValue bindable = (XBindableValue)UnoRuntime.queryInterface(
+ XBindableValue bindable = UnoRuntime.queryInterface(
XBindableValue.class, textControl
);
bindable.setValueBinding( cellBinding );
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java
index c0e165edab7a..70748dfb7e64 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java
@@ -232,7 +232,7 @@ public class DocumentView extends JFrame
maCustomizeView.setFrame(mxFrame);
// be listener for closing the remote target view frame
- com.sun.star.lang.XComponent xBroadcaster = (com.sun.star.lang.XComponent)UnoRuntime.queryInterface(
+ com.sun.star.lang.XComponent xBroadcaster = UnoRuntime.queryInterface(
com.sun.star.lang.XComponent.class,
mxFrame);
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java
index 3fb237ffb20c..9076fcb8b101 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java
@@ -92,10 +92,10 @@ public class FunctionHelper
// Create special service for parsing of given URL.
com.sun.star.util.XURLTransformer xParser =
- (com.sun.star.util.XURLTransformer)UnoRuntime.queryInterface(
- com.sun.star.util.XURLTransformer.class,
- xOfficeCtx.getServiceManager().createInstanceWithContext(
- "com.sun.star.util.URLTransformer", xOfficeCtx));
+ UnoRuntime.queryInterface(
+ com.sun.star.util.XURLTransformer.class,
+ xOfficeCtx.getServiceManager().createInstanceWithContext(
+ "com.sun.star.util.URLTransformer", xOfficeCtx));
// Because it's an in/out parameter we must use an array of URL objects.
com.sun.star.util.URL[] aParseURL = new com.sun.star.util.URL[1];
@@ -146,7 +146,7 @@ public class FunctionHelper
com.sun.star.frame.XFrame xFrame = null;
try{
- xFrame = (com.sun.star.frame.XFrame)UnoRuntime.queryInterface(
+ xFrame = UnoRuntime.queryInterface(
com.sun.star.frame.XFrame.class,
xCtx.getServiceManager().createInstanceWithContext(
"com.sun.star.frame.Task", xCtx));
@@ -155,7 +155,7 @@ public class FunctionHelper
if (xFrame==null)
{
try{
- xFrame = (com.sun.star.frame.XFrame)UnoRuntime.queryInterface(
+ xFrame = UnoRuntime.queryInterface(
com.sun.star.frame.XFrame.class,
xCtx.getServiceManager().createInstanceWithContext(
"com.sun.star.frame.Frame", xCtx));
@@ -213,7 +213,7 @@ public class FunctionHelper
// get access to toolkit of remote office to create the container window of
// new target frame
try{
- xToolkit = (com.sun.star.awt.XToolkit)UnoRuntime.queryInterface(
+ xToolkit = UnoRuntime.queryInterface(
com.sun.star.awt.XToolkit.class,
xCtx.getServiceManager().createInstanceWithContext(
"com.sun.star.awt.Toolkit", xCtx));
@@ -257,8 +257,8 @@ public class FunctionHelper
// the remote office. Means if this java client and the remote office
// use the same display!
com.sun.star.awt.XSystemChildFactory xChildFactory =
- (com.sun.star.awt.XSystemChildFactory)UnoRuntime.queryInterface(
- com.sun.star.awt.XSystemChildFactory.class, xToolkit);
+ UnoRuntime.queryInterface(
+ com.sun.star.awt.XSystemChildFactory.class, xToolkit);
try
{
@@ -266,7 +266,7 @@ public class FunctionHelper
short nSystem = (short)aParentView.getNativeWindowSystemType();
byte[] lProcID = new byte[0];
- xPeer = xChildFactory.createSystemChild((Object)nHandle,
+ xPeer = xChildFactory.createSystemChild(nHandle,
lProcID, nSystem);
if (xPeer==null)
@@ -279,8 +279,8 @@ public class FunctionHelper
JavaWindowPeerFake(aParentView);
com.sun.star.awt.XWindowPeer xParentPeer =
- (com.sun.star.awt.XWindowPeer)UnoRuntime.queryInterface(
- com.sun.star.awt.XWindowPeer.class, aWrapper);
+ UnoRuntime.queryInterface(
+ com.sun.star.awt.XWindowPeer.class, aWrapper);
com.sun.star.awt.WindowDescriptor aDescriptor =
new com.sun.star.awt.WindowDescriptor();
@@ -316,7 +316,7 @@ public class FunctionHelper
// It doesn't matter which way was used to get the window peer.
// Cast it to the right return interface and return it.
- xWindow = (com.sun.star.awt.XWindow)UnoRuntime.queryInterface(
+ xWindow = UnoRuntime.queryInterface(
com.sun.star.awt.XWindow.class,
xPeer);
@@ -370,7 +370,7 @@ public class FunctionHelper
// Insert the new frame in desktop hierarchy.
// Use XFrames interface to do so. It provides access to the child frame container of that instance.
- com.sun.star.frame.XFramesSupplier xTreeRoot = (com.sun.star.frame.XFramesSupplier)UnoRuntime.queryInterface(
+ com.sun.star.frame.XFramesSupplier xTreeRoot = UnoRuntime.queryInterface(
com.sun.star.frame.XFramesSupplier.class,
xCtx.getServiceManager().createInstanceWithContext(
"com.sun.star.frame.Desktop", xCtx));
@@ -395,7 +395,7 @@ public class FunctionHelper
// After the dispose() call forget all references to this frame and let him die.
// If a new exception will occure ... no generell solution exist then.
// Nobody can guarantee if next call will work or not.
- com.sun.star.lang.XComponent xComponent = (com.sun.star.lang.XComponent)UnoRuntime.queryInterface(
+ com.sun.star.lang.XComponent xComponent = UnoRuntime.queryInterface(
com.sun.star.lang.XComponent.class,
xFrame);
xComponent.dispose();
@@ -411,7 +411,7 @@ public class FunctionHelper
// Without the desktop service that wasn't possible. So no further rollbacks must follow.
if(xFrame!=null)
{
- com.sun.star.lang.XComponent xComponent = (com.sun.star.lang.XComponent)UnoRuntime.queryInterface(
+ com.sun.star.lang.XComponent xComponent = UnoRuntime.queryInterface(
com.sun.star.lang.XComponent.class,
xFrame);
xComponent.dispose();
@@ -453,7 +453,7 @@ public class FunctionHelper
try
{
// Query the frame for right interface which provides access to all available dispatch objects.
- com.sun.star.frame.XDispatchProvider xProvider = (com.sun.star.frame.XDispatchProvider)UnoRuntime.queryInterface(
+ com.sun.star.frame.XDispatchProvider xProvider = UnoRuntime.queryInterface(
com.sun.star.frame.XDispatchProvider.class,
xFrame);
@@ -511,7 +511,7 @@ public class FunctionHelper
try
{
// Query the frame for right interface which provides access to all available dispatch objects.
- com.sun.star.frame.XDispatchProvider xProvider = (com.sun.star.frame.XDispatchProvider)UnoRuntime.queryInterface(
+ com.sun.star.frame.XDispatchProvider xProvider = UnoRuntime.queryInterface(
com.sun.star.frame.XDispatchProvider.class,
xFrame);
@@ -519,7 +519,7 @@ public class FunctionHelper
// Force THIS frame as target for following dispatch.
// Attention: The interface XNotifyingDispatch is an optional one!
com.sun.star.frame.XDispatch xDispatcher = xProvider.queryDispatch(aURL,"",0);
- com.sun.star.frame.XNotifyingDispatch xNotifyingDispatcher = (com.sun.star.frame.XNotifyingDispatch)UnoRuntime.queryInterface(
+ com.sun.star.frame.XNotifyingDispatch xNotifyingDispatcher = UnoRuntime.queryInterface(
com.sun.star.frame.XNotifyingDispatch.class,
xDispatcher);
@@ -571,10 +571,10 @@ public class FunctionHelper
// Get access to the global component loader of the office
// for synchronous loading the document.
com.sun.star.frame.XComponentLoader xLoader =
- (com.sun.star.frame.XComponentLoader)UnoRuntime.queryInterface(
- com.sun.star.frame.XComponentLoader.class,
- xCtx.getServiceManager().createInstanceWithContext(
- "com.sun.star.frame.Desktop", xCtx));
+ UnoRuntime.queryInterface(
+ com.sun.star.frame.XComponentLoader.class,
+ xCtx.getServiceManager().createInstanceWithContext(
+ "com.sun.star.frame.Desktop", xCtx));
// Load the document into the target frame by using his name and
// special search flags.
@@ -642,18 +642,18 @@ public class FunctionHelper
// Normaly the application documents (text, spreadsheet ...) do so
// but some other ones (e.g. db components) doesn't do that.
// They can't be save then.
- com.sun.star.frame.XModel xModel = (com.sun.star.frame.XModel)UnoRuntime.queryInterface(
+ com.sun.star.frame.XModel xModel = UnoRuntime.queryInterface(
com.sun.star.frame.XModel.class,
xDocument);
if(xModel!=null)
{
// Check for modifications => break save process if there is nothing to do.
- com.sun.star.util.XModifiable xModified = (com.sun.star.util.XModifiable)UnoRuntime.queryInterface(
+ com.sun.star.util.XModifiable xModified = UnoRuntime.queryInterface(
com.sun.star.util.XModifiable.class,
xModel);
if(xModified.isModified()==true)
{
- com.sun.star.frame.XStorable xStore = (com.sun.star.frame.XStorable)UnoRuntime.queryInterface(
+ com.sun.star.frame.XStorable xStore = UnoRuntime.queryInterface(
com.sun.star.frame.XStorable.class,
xModel);
@@ -703,9 +703,8 @@ public class FunctionHelper
// Well known filter names are used directly. They must exist in current
// office installation. Otherwise this code will fail. But to prevent
// this code against missing filters it check for existing state of it.
- com.sun.star.lang.XServiceInfo xInfo = (com.sun.star.lang.XServiceInfo)
- UnoRuntime.queryInterface(com.sun.star.lang.XServiceInfo.class,
- xDocument);
+ com.sun.star.lang.XServiceInfo xInfo = UnoRuntime.queryInterface(com.sun.star.lang.XServiceInfo.class,
+ xDocument);
if(xInfo!=null)
{
@@ -727,11 +726,10 @@ public class FunctionHelper
OfficeConnect.getOfficeContext();
com.sun.star.container.XNameAccess xFilterContainer =
- (com.sun.star.container.XNameAccess)
UnoRuntime.queryInterface(
- com.sun.star.container.XNameAccess.class,
- xCtx.getServiceManager().createInstanceWithContext(
- "com.sun.star.document.FilterFactory", xCtx));
+ com.sun.star.container.XNameAccess.class,
+ xCtx.getServiceManager().createInstanceWithContext(
+ "com.sun.star.document.FilterFactory", xCtx));
if(xFilterContainer.hasByName(sFilter)==false)
sFilter=null;
@@ -755,8 +753,8 @@ public class FunctionHelper
lProperties[1].Value = Boolean.TRUE;
com.sun.star.frame.XStorable xStore =
- (com.sun.star.frame.XStorable)UnoRuntime.queryInterface(
- com.sun.star.frame.XStorable.class, xDocument);
+ UnoRuntime.queryInterface(
+ com.sun.star.frame.XStorable.class, xDocument);
xStore.storeAsURL(sURL,lProperties);
}
@@ -797,8 +795,8 @@ public class FunctionHelper
{
// Check supported functionality of the document (model or controller).
com.sun.star.frame.XModel xModel =
- (com.sun.star.frame.XModel)UnoRuntime.queryInterface(
- com.sun.star.frame.XModel.class, xDocument);
+ UnoRuntime.queryInterface(
+ com.sun.star.frame.XModel.class, xDocument);
if(xModel!=null)
{
@@ -806,8 +804,8 @@ public class FunctionHelper
// Reset the modify state of it and close it.
// Note: Model can disgree by throwing a veto exception.
com.sun.star.util.XModifiable xModify =
- (com.sun.star.util.XModifiable)UnoRuntime.queryInterface(
- com.sun.star.util.XModifiable.class, xModel);
+ UnoRuntime.queryInterface(
+ com.sun.star.util.XModifiable.class, xModel);
xModify.setModified(false);
xDocument.dispose();
@@ -818,8 +816,8 @@ public class FunctionHelper
// window only. If it's at least a controller - we can try to
// suspend him. But - he can disagree with that!
com.sun.star.frame.XController xController =
- (com.sun.star.frame.XController)UnoRuntime.queryInterface(
- com.sun.star.frame.XController.class, xDocument);
+ UnoRuntime.queryInterface(
+ com.sun.star.frame.XController.class, xDocument);
if(xController!=null)
{
@@ -879,8 +877,8 @@ public class FunctionHelper
// It replace the deprecated XTask::close() and should be preferred ...
// if it can be queried.
com.sun.star.util.XCloseable xCloseable =
- (com.sun.star.util.XCloseable)UnoRuntime.queryInterface(
- com.sun.star.util.XCloseable.class, xFrame);
+ UnoRuntime.queryInterface(
+ com.sun.star.util.XCloseable.class, xFrame);
if (xCloseable!=null)
{
// We deliver the owner ship of this frame not to the (possible)
@@ -899,9 +897,8 @@ public class FunctionHelper
else
{
// OK: the new way isn't possible. Try the old one.
- com.sun.star.frame.XTask xTask = (com.sun.star.frame.XTask)
- UnoRuntime.queryInterface(com.sun.star.frame.XTask.class,
- xFrame);
+ com.sun.star.frame.XTask xTask = UnoRuntime.queryInterface(com.sun.star.frame.XTask.class,
+ xFrame);
if (xTask!=null)
{
// return value doesn't interest here. Because
@@ -946,15 +943,15 @@ public class FunctionHelper
try
{
com.sun.star.frame.XFramesSupplier xSupplier =
- (com.sun.star.frame.XFramesSupplier)UnoRuntime.queryInterface(
- com.sun.star.frame.XFramesSupplier.class,
- xCtx.getServiceManager().createInstanceWithContext(
- "com.sun.star.frame.Desktop", xCtx));
+ UnoRuntime.queryInterface(
+ com.sun.star.frame.XFramesSupplier.class,
+ xCtx.getServiceManager().createInstanceWithContext(
+ "com.sun.star.frame.Desktop", xCtx));
com.sun.star.container.XIndexAccess xContainer =
- (com.sun.star.container.XIndexAccess)UnoRuntime.queryInterface(
- com.sun.star.container.XIndexAccess.class,
- xSupplier.getFrames());
+ UnoRuntime.queryInterface(
+ com.sun.star.container.XIndexAccess.class,
+ xSupplier.getFrames());
int nCount = xContainer.getCount();
for (int i=0; i<nCount; ++i )
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java
index 12ea20173b3a..c9fe4f38c33f 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java
@@ -237,7 +237,7 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener,
Vector<Object> lOutParams = new Vector<Object>();
lOutParams.add(aEvent);
- OnewayExecutor aExecutor = new OnewayExecutor( (IOnewayLink)this ,
+ OnewayExecutor aExecutor = new OnewayExecutor( this ,
OnewayExecutor.REQUEST_FRAMEACTION ,
lOutParams );
aExecutor.start();
@@ -275,7 +275,7 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener,
Vector<Object> lOutParams = OnewayExecutor.encodeDispatch(
lInURL ,
lInArguments );
- OnewayExecutor aExecutor = new OnewayExecutor( (IOnewayLink)this ,
+ OnewayExecutor aExecutor = new OnewayExecutor( this ,
OnewayExecutor.REQUEST_DISPATCH ,
lOutParams );
aExecutor.start();
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/JavaWindowPeerFake.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/JavaWindowPeerFake.java
index 9100f57f8a11..3bc089543687 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/JavaWindowPeerFake.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/JavaWindowPeerFake.java
@@ -57,7 +57,7 @@ class JavaWindowPeerFake implements com.sun.star.awt.XSystemDependentWindowPeer,
{
Object aReturn = null;
if(aSystem==maView.maSystem)
- aReturn = (Object)maView.maHandle;
+ aReturn = maView.maHandle;
return aReturn;
}
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java
index da7f8b7e1973..fd79205cfaa3 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java
@@ -216,7 +216,7 @@ class StatusListener implements com.sun.star.frame.XStatusListener,
Vector<Object> lOutParams = new Vector<Object>();
lOutParams.add(aEvent);
- OnewayExecutor aExecutor = new OnewayExecutor( (IOnewayLink)this ,
+ OnewayExecutor aExecutor = new OnewayExecutor( this ,
OnewayExecutor.REQUEST_FRAMEACTION ,
lOutParams );
aExecutor.start();
@@ -357,7 +357,7 @@ class StatusListener implements com.sun.star.frame.XStatusListener,
if (! bRegister)
return;
- com.sun.star.frame.XDispatchProvider xProvider = (com.sun.star.frame.XDispatchProvider)UnoRuntime.queryInterface(
+ com.sun.star.frame.XDispatchProvider xProvider = UnoRuntime.queryInterface(
com.sun.star.frame.XDispatchProvider.class,
xFrame);
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java
index f1c47bcd38c8..c2fbff2cde91 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java
@@ -205,7 +205,7 @@ public class ViewContainer extends Thread
synchronized(mlListener)
{
try{
- aListener = (IShutdownListener)mlListener.firstElement();
+ aListener = mlListener.firstElement();
} catch(java.util.NoSuchElementException exEmpty) {}
}
if (aListener==null)
diff --git a/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java b/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java
index f33e71d4cfd5..00591ec4bc58 100644
--- a/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java
+++ b/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java
@@ -138,7 +138,7 @@ public class ChildrenRetriever {
// Execute command "open".
set = UnoRuntime.queryInterface(
XDynamicResultSet.class, m_helper.executeCommand( m_content, "open", arg ));
- XResultSet resultSet = ( XResultSet )set.getStaticResultSet();
+ XResultSet resultSet = set.getStaticResultSet();
result = new Vector<Vector<Object>>();
diff --git a/odk/examples/DevelopersGuide/UCB/Helper.java b/odk/examples/DevelopersGuide/UCB/Helper.java
index c203904749bc..7bde0ce47e6e 100644
--- a/odk/examples/DevelopersGuide/UCB/Helper.java
+++ b/odk/examples/DevelopersGuide/UCB/Helper.java
@@ -76,7 +76,7 @@ public class Helper {
System.out.println("Connected to a running office ...");
}
- m_ucb = (XInterface)UnoRuntime.queryInterface(
+ m_ucb = UnoRuntime.queryInterface(
XInterface.class, UniversalContentBroker.create(m_xContext));
}
@@ -103,11 +103,11 @@ public class Helper {
// Obtain required UCB interfaces...
XContentIdentifierFactory idFactory
- = ( XContentIdentifierFactory )UnoRuntime.queryInterface(
- XContentIdentifierFactory.class, m_ucb );
+ = UnoRuntime.queryInterface(
+ XContentIdentifierFactory.class, m_ucb );
XContentProvider provider
- = ( XContentProvider )UnoRuntime.queryInterface(
- XContentProvider.class, m_ucb );
+ = UnoRuntime.queryInterface(
+ XContentProvider.class, m_ucb );
// Create identifier object for given URL.
XContentIdentifier id = idFactory.createContentIdentifier( connectURL );
@@ -152,8 +152,8 @@ public class Helper {
/////////////////////////////////////////////////////////////////////
XCommandProcessor cmdProcessor
- = (XCommandProcessor)UnoRuntime.queryInterface(
- XCommandProcessor.class, ifc );
+ = UnoRuntime.queryInterface(
+ XCommandProcessor.class, ifc );
/////////////////////////////////////////////////////////////////////
// Assemble command to execute.
diff --git a/odk/examples/DevelopersGuide/UCB/ResourceCreator.java b/odk/examples/DevelopersGuide/UCB/ResourceCreator.java
index 4dc1946c752e..c78710881698 100644
--- a/odk/examples/DevelopersGuide/UCB/ResourceCreator.java
+++ b/odk/examples/DevelopersGuide/UCB/ResourceCreator.java
@@ -154,7 +154,7 @@ public class ResourceCreator {
info.Attributes = 0;
// Create new, empty content (execute command "createNewContent").
- XContent newContent = ( XContent )UnoRuntime.queryInterface(
+ XContent newContent = UnoRuntime.queryInterface(
XContent.class,
m_helper.executeCommand( m_content, "createNewContent", info ) );
diff --git a/odk/examples/java/Inspector/HideableTreeModel.java b/odk/examples/java/Inspector/HideableTreeModel.java
index 21732e6776fe..44c208c8be3a 100644
--- a/odk/examples/java/Inspector/HideableTreeModel.java
+++ b/odk/examples/java/Inspector/HideableTreeModel.java
@@ -261,7 +261,7 @@ public class HideableTreeModel implements TreeModel {
if(parent instanceof TreeNode) {
TreeNode p = (TreeNode) parent;
for(int i = 0, j = -1; i < p.getChildCount(); i++) {
- TreeNode pc = (TreeNode)p.getChildAt(i);
+ TreeNode pc = p.getChildAt(i);
if(isNodeVisible(pc)) {
j++;
}
@@ -279,7 +279,7 @@ public class HideableTreeModel implements TreeModel {
if(parent instanceof TreeNode) {
TreeNode p = (TreeNode) parent;
for(int i = 0; i < p.getChildCount(); i++) {
- TreeNode pc = (TreeNode)p.getChildAt(i);
+ TreeNode pc = p.getChildAt(i);
if(isNodeVisible(pc)) {
count++;
}
@@ -297,7 +297,7 @@ public class HideableTreeModel implements TreeModel {
if(isNodeVisible(c)) {
index = 0;
for(int i = 0; i < p.getChildCount(); i++) {
- TreeNode pc = (TreeNode)p.getChildAt(i);
+ TreeNode pc = p.getChildAt(i);
if(pc.equals(c)) {
return index;
}
diff --git a/odk/examples/java/Inspector/InspectorAddon.java b/odk/examples/java/Inspector/InspectorAddon.java
index f7605fd87c6d..d5ec16811fc7 100644
--- a/odk/examples/java/Inspector/InspectorAddon.java
+++ b/odk/examples/java/Inspector/InspectorAddon.java
@@ -93,7 +93,7 @@ public class InspectorAddon {
public void initialize( Object[] object ) throws com.sun.star.uno.Exception {
if ( object.length > 0 ){
- m_xFrame = ( XFrame ) UnoRuntime.queryInterface(XFrame.class, object[ 0 ] );
+ m_xFrame = UnoRuntime.queryInterface(XFrame.class, object[ 0 ] );
}
}
@@ -120,14 +120,14 @@ public class InspectorAddon {
com.sun.star.lang.XMultiComponentFactory xMCF = m_xContext.getServiceManager();
if (xInstInspector == null){
Object obj= xMCF.createInstanceWithContext("org.openoffice.InstanceInspector", m_xContext);
- xInstInspector = (org.openoffice.XInstanceInspector)UnoRuntime.queryInterface(org.openoffice.XInstanceInspector.class, obj);
+ xInstInspector = UnoRuntime.queryInterface(org.openoffice.XInstanceInspector.class, obj);
}
if ((m_xFrame == null) || (xModel == null)){
Object oDesktop = xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", m_xContext);
- m_xFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class, oDesktop);
+ m_xFrame = UnoRuntime.queryInterface(XFrame.class, oDesktop);
oUnoInspectObject = m_xFrame;
}
- XPropertySet xFramePropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, m_xFrame);
+ XPropertySet xFramePropertySet = UnoRuntime.queryInterface(XPropertySet.class, m_xFrame);
String sTitle = (String) xFramePropertySet.getPropertyValue("Title");
String[] sTitleList = sTitle.split(" - ");
if (sTitleList.length > 0){
diff --git a/odk/examples/java/Inspector/InspectorPane.java b/odk/examples/java/Inspector/InspectorPane.java
index 49339402fefd..11640ce874e0 100644
--- a/odk/examples/java/Inspector/InspectorPane.java
+++ b/odk/examples/java/Inspector/InspectorPane.java
@@ -294,7 +294,7 @@ import org.openoffice.XInstanceInspector;
// add all services for the given object to the tree under the node parent
private void addServicesToTreeNode(XUnoNode _oGrandParentNode, Object _oUnoObject) {
try{
- XServiceInfo xServiceInfo = ( XServiceInfo ) UnoRuntime.queryInterface( XServiceInfo.class, _oUnoObject );
+ XServiceInfo xServiceInfo = UnoRuntime.queryInterface( XServiceInfo.class, _oUnoObject );
if ( xServiceInfo != null ){
String[] sSupportedServiceNames = xServiceInfo.getSupportedServiceNames();
for ( int m = 0; m < sSupportedServiceNames.length; m++ ) {
@@ -325,7 +325,7 @@ import org.openoffice.XInstanceInspector;
for ( int n = 0; n < _aProperties.length; n++ ){
Property aProperty = _aProperties[n];
XIntrospectionAccess xIntrospectionAccess = m_oIntrospector.getXIntrospectionAccess(_oUnoParentObject);
- XPropertySet xPropertySet = ( XPropertySet ) UnoRuntime.queryInterface( XPropertySet.class, xIntrospectionAccess.queryAdapter(new Type( XPropertySet.class)));
+ XPropertySet xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, xIntrospectionAccess.queryAdapter(new Type( XPropertySet.class)));
if (xPropertySet != null) {
if (xPropertySet.getPropertySetInfo().hasPropertyByName(aProperty.Name)){
Object objectElement = xPropertySet.getPropertyValue(aProperty.Name);
diff --git a/odk/examples/java/Inspector/ProtocolHandlerAddon.java b/odk/examples/java/Inspector/ProtocolHandlerAddon.java
index e20d3a2b1bcf..00bc253cb703 100644
--- a/odk/examples/java/Inspector/ProtocolHandlerAddon.java
+++ b/odk/examples/java/Inspector/ProtocolHandlerAddon.java
@@ -101,12 +101,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));
@@ -211,7 +211,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 |
@@ -220,7 +220,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/java/Inspector/SourceCodeGenerator.java b/odk/examples/java/Inspector/SourceCodeGenerator.java
index f8de8c2fbab3..5855ed4e2c65 100644
--- a/odk/examples/java/Inspector/SourceCodeGenerator.java
+++ b/odk/examples/java/Inspector/SourceCodeGenerator.java
@@ -364,9 +364,9 @@ public class SourceCodeGenerator {
private class HeaderStatements extends Vector<String> {
public boolean contains(String _oElement){
- String sCompName = (String) _oElement;
+ String sCompName = _oElement;
for (int i = 0; i < this.size(); i++){
- String sElement = (String) this.get(i);
+ String sElement = this.get(i);
if (sElement.equals(sCompName)){
return true;
}
diff --git a/odk/examples/java/Inspector/SwingDialogProvider.java b/odk/examples/java/Inspector/SwingDialogProvider.java
index 51c56fb63e5d..5f5a31b8818d 100644
--- a/odk/examples/java/Inspector/SwingDialogProvider.java
+++ b/odk/examples/java/Inspector/SwingDialogProvider.java
@@ -132,7 +132,7 @@ public class SwingDialogProvider implements XDialogProvider{
if (_nIndex > -1){
JPanel jPnlContainerInspectorPanel = (JPanel) m_jTabbedPane1.getComponentAt(_nIndex);
String sInspectorPanelTitle = m_jTabbedPane1.getTitleAt(_nIndex);
- oInspectorPane = (InspectorPane) m_oInspector.getInspectorPages().get(sInspectorPanelTitle);
+ oInspectorPane = m_oInspector.getInspectorPages().get(sInspectorPanelTitle);
}
return oInspectorPane;
}
diff --git a/odk/examples/java/Inspector/SwingTreeControlProvider.java b/odk/examples/java/Inspector/SwingTreeControlProvider.java
index 8ef3b158f11a..f4eb91945cc3 100644
--- a/odk/examples/java/Inspector/SwingTreeControlProvider.java
+++ b/odk/examples/java/Inspector/SwingTreeControlProvider.java
@@ -397,7 +397,7 @@ public class SwingTreeControlProvider implements XTreeControlProvider{
public XUnoPropertyNode addUnoPropertyNodeWithAttributesDescription(Property _aProperty){
SwingUnoPropertyNode oUnoPropertyNode = new SwingUnoPropertyNode(_aProperty);
XConstantTypeDescription[] xPropertyAttributesTypeDescriptions = Introspector.getIntrospector().getFieldsOfConstantGroup("com.sun.star.beans.PropertyAttribute");
- String sDisplay = Introspector.getIntrospector().getConstantDisplayString((int) _aProperty.Attributes, xPropertyAttributesTypeDescriptions, "Attributes: ");
+ String sDisplay = Introspector.getIntrospector().getConstantDisplayString(_aProperty.Attributes, xPropertyAttributesTypeDescriptions, "Attributes: ");
oUnoPropertyNode.setLabel(sDisplay);
return oUnoPropertyNode;
}
diff --git a/odk/examples/java/Inspector/TDocSupplier.java b/odk/examples/java/Inspector/TDocSupplier.java
index c0afd57170a1..7f34d13de96d 100644
--- a/odk/examples/java/Inspector/TDocSupplier.java
+++ b/odk/examples/java/Inspector/TDocSupplier.java
@@ -78,7 +78,7 @@ public class TDocSupplier {
XRow xRow = getXRowOfTDocUrl(_sTDocUrl, "DocumentModel");
if (xRow != null){
Object oModel = xRow.getObject(1, null);
- XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, oModel);
+ XModel xModel = UnoRuntime.queryInterface(XModel.class, oModel);
return xModel;
}
}catch(Exception exception){
@@ -108,7 +108,7 @@ public class TDocSupplier {
XUniversalContentBroker xUCB = UniversalContentBroker.create( getXComponentContext() );
XContentIdentifier xId = xUCB.createContentIdentifier(_sTDocUrl);
XContent xContent = xUCB.queryContent(xId);
- XCommandProcessor xCmdProcessor = (XCommandProcessor) UnoRuntime.queryInterface(XCommandProcessor.class, xContent);
+ XCommandProcessor xCmdProcessor = UnoRuntime.queryInterface(XCommandProcessor.class, xContent);
Property aProperty = new Property();
aProperty.Name = _sPropertyName; // "DocumentModel"; //DocumentModel
Command aCommand = new Command();
@@ -116,7 +116,7 @@ public class TDocSupplier {
aCommand.Handle = -1; // not available
aCommand.Argument = new Property[]{aProperty};
Object oAny = xCmdProcessor.execute(aCommand, 0, null);
- XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, oAny);
+ XRow xRow = UnoRuntime.queryInterface(XRow.class, oAny);
return xRow;
}catch(Exception exception){
exception.printStackTrace(System.err);
@@ -136,7 +136,7 @@ public class TDocSupplier {
protected String[] getTDocUrls(){
try{
Object oSimpleFileAccess = getXMultiComponentFactory().createInstanceWithContext("com.sun.star.ucb.SimpleFileAccess", getXComponentContext());
- XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, oSimpleFileAccess);
+ XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, oSimpleFileAccess);
String[] sContent = xSimpleFileAccess.getFolderContents("vnd.sun.star.tdoc:/", false);
return sContent;
} catch( Exception e ) {
@@ -152,7 +152,7 @@ public class TDocSupplier {
aPropertyValues[0].Name = "Hidden";
aPropertyValues[0].Value = Boolean.TRUE;
Object oDesktop = getXMultiComponentFactory().createInstanceWithContext("com.sun.star.frame.Desktop", getXComponentContext());
- XComponentLoader xCL = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, oDesktop);
+ XComponentLoader xCL = UnoRuntime.queryInterface(XComponentLoader.class, oDesktop);
return xCL.loadComponentFromURL(_sUrl, "_default", 0, aPropertyValues);
}
catch( Exception exception ) {
diff --git a/odk/examples/java/Inspector/TestInspector.java b/odk/examples/java/Inspector/TestInspector.java
index 6b8758b0728c..bd7a38ed7401 100644
--- a/odk/examples/java/Inspector/TestInspector.java
+++ b/odk/examples/java/Inspector/TestInspector.java
@@ -61,14 +61,14 @@ public class TestInspector {
}
org.openoffice.XInstanceInspector xInstInspector = null;
if (obj != null) {
- xInstInspector = (org.openoffice.XInstanceInspector)UnoRuntime.queryInterface(org.openoffice.XInstanceInspector.class, obj);
+ xInstInspector = UnoRuntime.queryInterface(org.openoffice.XInstanceInspector.class, obj);
}
/* 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. */
- com.sun.star.frame.XComponentLoader xCmpLoader = (com.sun.star.frame.XComponentLoader)UnoRuntime.queryInterface( com.sun.star.frame.XComponentLoader.class,
+ com.sun.star.frame.XComponentLoader xCmpLoader = UnoRuntime.queryInterface( com.sun.star.frame.XComponentLoader.class,
xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", xContext));
// Load a new spreadsheet document, which will be automaticly
diff --git a/odk/examples/java/Inspector/UnoNode.java b/odk/examples/java/Inspector/UnoNode.java
index 9ba110c06c3a..92fef1885aec 100644
--- a/odk/examples/java/Inspector/UnoNode.java
+++ b/odk/examples/java/Inspector/UnoNode.java
@@ -170,7 +170,7 @@ public class UnoNode{
private com.sun.star.util.URL getDispatchURL(String _sURL){
try {
Object oTransformer = getXMultiComponentFactory().createInstanceWithContext("com.sun.star.util.URLTransformer", getXComponentContext());
- XURLTransformer xTransformer = (XURLTransformer) UnoRuntime.queryInterface(XURLTransformer.class, oTransformer);
+ XURLTransformer xTransformer = UnoRuntime.queryInterface(XURLTransformer.class, oTransformer);
com.sun.star.util.URL[] oURL = new com.sun.star.util.URL[1];
oURL[0] = new com.sun.star.util.URL();
oURL[0].Complete = _sURL;
@@ -186,7 +186,7 @@ public class UnoNode{
private XFrame getCurrentFrame(){
try{
Object oDesktop = getXMultiComponentFactory().createInstanceWithContext("com.sun.star.frame.Desktop", getXComponentContext());
- XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, oDesktop);
+ XDesktop xDesktop = UnoRuntime.queryInterface(XDesktop.class, oDesktop);
return xDesktop.getCurrentFrame();
} catch (Exception e) {
e.printStackTrace(System.err);
@@ -198,7 +198,7 @@ public class UnoNode{
try {
com.sun.star.util.URL[] oURLArray = new com.sun.star.util.URL[1];
oURLArray[0] = oURL;
- XDispatchProvider xDispatchProvider = (XDispatchProvider) UnoRuntime.queryInterface(XDispatchProvider.class, getCurrentFrame());
+ XDispatchProvider xDispatchProvider = UnoRuntime.queryInterface(XDispatchProvider.class, getCurrentFrame());
XDispatch xDispatch = xDispatchProvider.queryDispatch(oURLArray[0], "_top", FrameSearchFlag.ALL); // "_self"
return xDispatch;
} catch (Exception e) {
@@ -250,7 +250,7 @@ public class UnoNode{
while (xTDEnumeration.hasMoreElements()) {
XTypeDescription xTD = xTDEnumeration.nextTypeDescription();
if (xTD.getName().equals(_sServiceName)){
- XServiceTypeDescription xServiceTypeDescription = (XServiceTypeDescription) UnoRuntime.queryInterface(XServiceTypeDescription.class, xTD);
+ XServiceTypeDescription xServiceTypeDescription = UnoRuntime.queryInterface(XServiceTypeDescription.class, xTD);
XServiceTypeDescription[] xMandatoryServiceTypeDescriptions = xServiceTypeDescription.getMandatoryServices();
int nlength = xMandatoryServiceTypeDescriptions.length;
sMandatoryServiceNames = new String[nlength];
@@ -414,7 +414,7 @@ public class UnoNode{
public static String getNodeDescription(Object _oUnoObject){
- XServiceInfo xServiceInfo = ( XServiceInfo ) UnoRuntime.queryInterface( XServiceInfo.class, _oUnoObject );
+ XServiceInfo xServiceInfo = UnoRuntime.queryInterface( XServiceInfo.class, _oUnoObject );
if ( xServiceInfo != null ) {
return xServiceInfo.getImplementationName();
}
diff --git a/odk/examples/java/Inspector/UnoPropertyNode.java b/odk/examples/java/Inspector/UnoPropertyNode.java
index 24f7573bbeaf..920300e15546 100644
--- a/odk/examples/java/Inspector/UnoPropertyNode.java
+++ b/odk/examples/java/Inspector/UnoPropertyNode.java
@@ -97,7 +97,7 @@ public class UnoPropertyNode extends UnoNode{
public String getClassName(){
String sClassName = "";
if (m_oUnoObject != null){
- XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, m_oUnoObject);
+ XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, m_oUnoObject);
if (xServiceInfo != null){
String[] sServiceNames = xServiceInfo.getSupportedServiceNames();
for (int i = 0; i < sServiceNames.length; i++){