diff options
author | Noel Grandin <noel@peralex.com> | 2013-04-17 13:54:28 +0200 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2013-04-19 07:51:41 +0000 |
commit | d62425cc27e04a3237cfec2ea2663b8b11284ec8 (patch) | |
tree | bc96f74a3460377c4d368ba2d3cbd56b2e8baa89 /forms/qa | |
parent | a79d43dcd7989ee927de1b8c69ebc2981cc7166e (diff) |
Java cleanup, remove unnecessary casts
Change-Id: Id12089bc7df16631737e6acaee0973fb91dd953f
Reviewed-on: https://gerrit.libreoffice.org/3431
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'forms/qa')
18 files changed, 111 insertions, 111 deletions
diff --git a/forms/qa/integration/forms/CellBinding.java b/forms/qa/integration/forms/CellBinding.java index 7dc9408c011e..f7fcb3457df0 100644 --- a/forms/qa/integration/forms/CellBinding.java +++ b/forms/qa/integration/forms/CellBinding.java @@ -80,7 +80,7 @@ public class CellBinding extends complexlib.ComplexTestCase // close our document if ( m_document != null ) { - XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class, + XCloseable closeDoc = UnoRuntime.queryInterface( XCloseable.class, m_document.getDocument() ); closeDoc.close( true ); } @@ -385,7 +385,7 @@ public class CellBinding extends complexlib.ComplexTestCase */ private boolean verifyVoidCell( short col, short row, String failErrorMessage ) throws com.sun.star.uno.Exception { - XCellRangeData cell = (XCellRangeData)UnoRuntime.queryInterface( XCellRangeData.class, + XCellRangeData cell = UnoRuntime.queryInterface( XCellRangeData.class, m_document.getSheet( 0 ).getCellByPosition( col, row ) ); Object cellContent = cell.getDataArray()[0][0]; @@ -402,7 +402,7 @@ public class CellBinding extends complexlib.ComplexTestCase */ private boolean verifyNumericCellContent( short col, short row, double value, String failErrorMessage ) throws com.sun.star.uno.Exception { - XCell cell = (XCell)UnoRuntime.queryInterface( XCell.class, + XCell cell = UnoRuntime.queryInterface( XCell.class, m_document.getSheet( 0 ).getCellByPosition( col, row ) ); if ( cell.getValue() != value ) @@ -418,7 +418,7 @@ public class CellBinding extends complexlib.ComplexTestCase */ private boolean verifyStringCellContent( short col, short row, String text, String failErrorMessage ) throws com.sun.star.uno.Exception { - XTextRange cell = (XTextRange)UnoRuntime.queryInterface( XTextRange.class, + XTextRange cell = UnoRuntime.queryInterface( XTextRange.class, m_document.getSheet( 0 ).getCellByPosition( col, row ) ); if ( !cell.getString().equals( text ) ) @@ -434,7 +434,7 @@ public class CellBinding extends complexlib.ComplexTestCase */ private void setCellText( short col, short row, String text ) throws com.sun.star.uno.Exception { - XTextRange cell = (XTextRange)UnoRuntime.queryInterface( XTextRange.class, + XTextRange cell = UnoRuntime.queryInterface( XTextRange.class, m_document.getSheet( 0 ).getCellByPosition( col, row ) ); cell.setString( text ); @@ -445,7 +445,7 @@ public class CellBinding extends complexlib.ComplexTestCase */ private void setCellValue( short col, short row, double value ) throws com.sun.star.uno.Exception { - XCell cell = (XCell)UnoRuntime.queryInterface( XCell.class, + XCell cell = UnoRuntime.queryInterface( XCell.class, m_document.getSheet( 0 ).getCellByPosition( col, row ) ); cell.setValue( value ); @@ -458,7 +458,7 @@ public class CellBinding extends complexlib.ComplexTestCase { // as long as #i29130# is not fixed, we do not set the cell to "empty", but to // an invalid formular, which serves well for our purpose - XCellRangeFormula cell = (XCellRangeFormula)UnoRuntime.queryInterface( XCellRangeFormula.class, + XCellRangeFormula cell = UnoRuntime.queryInterface( XCellRangeFormula.class, m_document.getSheet( 0 ).getCellByPosition( col, row ) ); String[][] args = new String[][] { new String[] { "=INVALID_FUNCTION()" } }; @@ -471,7 +471,7 @@ public class CellBinding extends complexlib.ComplexTestCase */ private void bindToCell( XPropertySet controlModel, short column, short row, String _bindingServiceName ) throws com.sun.star.uno.Exception { - XBindableValue bindableModel = (XBindableValue)UnoRuntime.queryInterface( XBindableValue.class, + XBindableValue bindableModel = UnoRuntime.queryInterface( XBindableValue.class, controlModel ); @@ -484,7 +484,7 @@ public class CellBinding extends complexlib.ComplexTestCase parameters[0].Name = "BoundCell"; parameters[0].Value = address; - XValueBinding cellBinding = (XValueBinding)UnoRuntime.queryInterface( XValueBinding.class, + XValueBinding cellBinding = UnoRuntime.queryInterface( XValueBinding.class, m_document.createInstanceWithArguments( _bindingServiceName, parameters ) ); @@ -504,13 +504,13 @@ public class CellBinding extends complexlib.ComplexTestCase */ private void setListSource( XPropertySet _listSink, short _sourceCol, short _rowStart, short _rowEnd ) throws com.sun.star.uno.Exception { - CellRangeAddress listSourceAddress = new CellRangeAddress( (short)0, (int)_sourceCol, (int)_rowStart, (int)_sourceCol, (int)_rowEnd ); + CellRangeAddress listSourceAddress = new CellRangeAddress( (short)0, _sourceCol, _rowStart, _sourceCol, _rowEnd ); NamedValue addressParameter = new NamedValue( "CellRange", listSourceAddress ); - XListEntrySource listSource = (XListEntrySource)UnoRuntime.queryInterface( XListEntrySource.class, + XListEntrySource listSource = UnoRuntime.queryInterface( XListEntrySource.class, m_document.createInstanceWithArguments( "com.sun.star.table.CellRangeListSource", new NamedValue[]{ addressParameter } ) ); - XListEntrySink listSink = (XListEntrySink)UnoRuntime.queryInterface( XListEntrySink.class, + XListEntrySink listSink = UnoRuntime.queryInterface( XListEntrySink.class, _listSink ); listSink.setListEntrySource( listSource ); } @@ -520,10 +520,10 @@ public class CellBinding extends complexlib.ComplexTestCase */ private void simulateUserRadioCheck( XPropertySet radioModel ) throws com.sun.star.uno.Exception { - XAccessible accessible = (XAccessible)UnoRuntime.queryInterface( + XAccessible accessible = UnoRuntime.queryInterface( XAccessible.class, m_document.getCurrentView().getControl( radioModel ) ); - XAccessibleValue xValue = (XAccessibleValue)UnoRuntime.queryInterface( + XAccessibleValue xValue = UnoRuntime.queryInterface( XAccessibleValue.class, accessible.getAccessibleContext() ); Integer newValue = new Integer( 1 ); @@ -535,10 +535,10 @@ public class CellBinding extends complexlib.ComplexTestCase */ private void simulateUserCheckBoxCheck( XPropertySet checkBox, short state ) throws com.sun.star.uno.Exception { - XAccessible accessible = (XAccessible)UnoRuntime.queryInterface( + XAccessible accessible = UnoRuntime.queryInterface( XAccessible.class, m_document.getCurrentView().getControl( checkBox ) ); - XAccessibleValue xValue = (XAccessibleValue)UnoRuntime.queryInterface( + XAccessibleValue xValue = UnoRuntime.queryInterface( XAccessibleValue.class, accessible.getAccessibleContext() ); xValue.setCurrentValue( new Short( state ) ); @@ -549,7 +549,7 @@ public class CellBinding extends complexlib.ComplexTestCase */ private void simulateUserListBoxSelection( XPropertySet _listBox, String _selectEntry ) throws com.sun.star.uno.Exception { - XListBox listBoxControl = (XListBox)UnoRuntime.queryInterface( + XListBox listBoxControl = UnoRuntime.queryInterface( XListBox.class, m_document.getCurrentView().getControl( _listBox ) ); listBoxControl.selectItem( _selectEntry, true ); } @@ -559,14 +559,14 @@ public class CellBinding extends complexlib.ComplexTestCase */ private void simulateUserTextInput( XPropertySet controlModel, String text ) throws com.sun.star.uno.Exception { - XAccessible accessible = (XAccessible)UnoRuntime.queryInterface( + XAccessible accessible = UnoRuntime.queryInterface( XAccessible.class, m_document.getCurrentView().getControl( controlModel ) ); XAccessibleContext context = accessible.getAccessibleContext(); - XServiceInfo si = (XServiceInfo)UnoRuntime.queryInterface( XServiceInfo.class, + XServiceInfo si = UnoRuntime.queryInterface( XServiceInfo.class, accessible.getAccessibleContext() ); - XAccessibleEditableText textAccess = (XAccessibleEditableText)UnoRuntime.queryInterface( + XAccessibleEditableText textAccess = UnoRuntime.queryInterface( XAccessibleEditableText.class, accessible.getAccessibleContext() ); textAccess.setText( text ); diff --git a/forms/qa/integration/forms/ControlValidation.java b/forms/qa/integration/forms/ControlValidation.java index 384238710d9a..55718f71adc1 100644 --- a/forms/qa/integration/forms/ControlValidation.java +++ b/forms/qa/integration/forms/ControlValidation.java @@ -87,7 +87,7 @@ public class ControlValidation extends complexlib.ComplexTestCase implements com // close our document if ( m_document != null ) { - XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class, + XCloseable closeDoc = UnoRuntime.queryInterface( XCloseable.class, m_document.getDocument() ); closeDoc.close( true ); } diff --git a/forms/qa/integration/forms/DocumentHelper.java b/forms/qa/integration/forms/DocumentHelper.java index 1aeefb454207..a26434b1931c 100644 --- a/forms/qa/integration/forms/DocumentHelper.java +++ b/forms/qa/integration/forms/DocumentHelper.java @@ -67,7 +67,7 @@ public class DocumentHelper /* ------------------------------------------------------------------ */ protected static XComponent implLoadAsComponent( XMultiServiceFactory orb, String documentOrFactoryURL, final PropertyValue[] i_args ) throws com.sun.star.uno.Exception { - XComponentLoader aLoader = (XComponentLoader)UnoRuntime.queryInterface( + XComponentLoader aLoader = UnoRuntime.queryInterface( XComponentLoader.class, orb.createInstance( "com.sun.star.frame.Desktop" ) ); @@ -89,7 +89,7 @@ public class DocumentHelper { XComponent document = implLoadAsComponent( orb, documentOrFactoryURL, i_args ); - XServiceInfo xSI = (XServiceInfo)UnoRuntime.queryInterface( XServiceInfo.class, + XServiceInfo xSI = UnoRuntime.queryInterface( XServiceInfo.class, document ); if ( xSI.supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) ) return new SpreadsheetDocument( orb, document ); @@ -157,7 +157,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(); @@ -188,7 +188,7 @@ public class DocumentHelper getCurrentView().dispatch( ".uno:Reload" ); - m_documentComponent = (XComponent)UnoRuntime.queryInterface( XComponent.class, + m_documentComponent = UnoRuntime.queryInterface( XComponent.class, frame.getController().getModel() ); XModel newModel = getCurrentView().getController().getModel(); @@ -222,7 +222,7 @@ public class DocumentHelper } // outta here - return (XIndexContainer)UnoRuntime.queryInterface( XIndexContainer.class, xNewForm ); + return UnoRuntime.queryInterface( XIndexContainer.class, xNewForm ); } /* ------------------------------------------------------------------ */ @@ -237,7 +237,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 ); } @@ -265,13 +265,13 @@ public class DocumentHelper */ static public DocumentHelper getDocumentForComponent( Object aFormComponent, XMultiServiceFactory orb ) { - 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( orb, xModel ); @@ -298,7 +298,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" ) ) @@ -321,11 +321,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 ) ); } /* ------------------------------------------------------------------ */ @@ -336,18 +336,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. @@ -361,7 +361,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; @@ -377,7 +377,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 ); } @@ -387,7 +387,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/forms/qa/integration/forms/DocumentViewHelper.java b/forms/qa/integration/forms/DocumentViewHelper.java index 9226afdc2e55..66d8f0bf667a 100644 --- a/forms/qa/integration/forms/DocumentViewHelper.java +++ b/forms/qa/integration/forms/DocumentViewHelper.java @@ -94,12 +94,12 @@ public class DocumentViewHelper // go get the current view XController xController = (XController)query( 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 ); @@ -155,14 +155,14 @@ public class DocumentViewHelper /* ------------------------------------------------------------------ */ public XControl getControl( Object aModel ) throws com.sun.star.uno.Exception { - XControlModel xModel = (XControlModel)UnoRuntime.queryInterface( XControlModel.class, aModel ); + XControlModel xModel = UnoRuntime.queryInterface( XControlModel.class, aModel ); return getControl( xModel ); } /* ------------------------------------------------------------------ */ public Object getControl( 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, getControl( xModel ) ); } @@ -206,7 +206,7 @@ public class DocumentViewHelper XControl xControl = getControl( 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 @@ -229,7 +229,7 @@ public class DocumentViewHelper XPropertySet xControlProps = dbfTools.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/forms/qa/integration/forms/FormComponent.java b/forms/qa/integration/forms/FormComponent.java index 1b9cf212b869..f19ceea87b9d 100644 --- a/forms/qa/integration/forms/FormComponent.java +++ b/forms/qa/integration/forms/FormComponent.java @@ -47,16 +47,16 @@ public class FormComponent /* ------------------------------------------------------------------ */ public FormComponent( XDrawPage drawPage ) { - XFormsSupplier supp = (XFormsSupplier)UnoRuntime.queryInterface( + XFormsSupplier supp = UnoRuntime.queryInterface( XFormsSupplier.class, drawPage ); m_component = supp.getForms(); m_nameAccess = (XNameAccess)m_component; - m_indexAccess = (XIndexAccess)UnoRuntime.queryInterface( + m_indexAccess = UnoRuntime.queryInterface( XIndexAccess.class, m_component ); - m_child = (XChild)UnoRuntime.queryInterface( + m_child = UnoRuntime.queryInterface( XChild.class, m_component ); - m_named = (XNamed)UnoRuntime.queryInterface( + m_named = UnoRuntime.queryInterface( XNamed.class, m_component ); } @@ -64,13 +64,13 @@ public class FormComponent public FormComponent( Object element ) { m_component = element; - m_nameAccess = (XNameAccess)UnoRuntime.queryInterface( + m_nameAccess = UnoRuntime.queryInterface( XNameAccess.class, m_component ); - m_indexAccess = (XIndexAccess)UnoRuntime.queryInterface( + m_indexAccess = UnoRuntime.queryInterface( XIndexAccess.class, m_component ); - m_child = (XChild)UnoRuntime.queryInterface( + m_child = UnoRuntime.queryInterface( XChild.class, m_component ); - m_named = (XNamed)UnoRuntime.queryInterface( + m_named = UnoRuntime.queryInterface( XNamed.class, m_component ); } @@ -179,7 +179,7 @@ public class FormComponent /* ------------------------------------------------------------------ */ public String getImplementationName() { - XServiceInfo si = (XServiceInfo)UnoRuntime.queryInterface( + XServiceInfo si = UnoRuntime.queryInterface( XServiceInfo.class, m_component ); if ( si != null ) return si.getImplementationName(); diff --git a/forms/qa/integration/forms/FormControlTest.java b/forms/qa/integration/forms/FormControlTest.java index 488c3877a077..8d4ee1e84670 100644 --- a/forms/qa/integration/forms/FormControlTest.java +++ b/forms/qa/integration/forms/FormControlTest.java @@ -453,7 +453,7 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE // close our document if ( m_document != null ) { - XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class, + XCloseable closeDoc = UnoRuntime.queryInterface( XCloseable.class, m_document.getDocument() ); closeDoc.close( true ); } @@ -465,9 +465,9 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE { m_orb = (XMultiServiceFactory)param.getMSF(); - XNameAccess databaseContext = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class, + XNameAccess databaseContext = UnoRuntime.queryInterface( XNameAccess.class, m_orb.createInstance( "com.sun.star.sdb.DatabaseContext" ) ); - XNamingService namingService = (XNamingService)UnoRuntime.queryInterface( XNamingService.class, + XNamingService namingService = UnoRuntime.queryInterface( XNamingService.class, databaseContext ); // revoke the data source, if it previously existed @@ -479,11 +479,11 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE String documentURL = m_databaseDocument.getDocumentURL(); namingService.registerObject( m_dataSourceName, databaseContext.getByName( documentURL ) ); - m_dataSource = (XDataSource)UnoRuntime.queryInterface( XDataSource.class, + m_dataSource = UnoRuntime.queryInterface( XDataSource.class, databaseContext.getByName( m_dataSourceName ) ); m_dataSourceProps = dbfTools.queryPropertySet( m_dataSource ); - XPropertySet dataSourceSettings = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, + XPropertySet dataSourceSettings = UnoRuntime.queryInterface( XPropertySet.class, m_dataSourceProps.getPropertyValue( "Settings" ) ); dataSourceSettings.setPropertyValue( "FormsCheckRequiredFields", new Boolean( false ) ); @@ -495,9 +495,9 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE */ private XPropertySet getControlModel( String name ) throws com.sun.star.uno.Exception, java.lang.Exception { - XNameAccess nameAccess = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class, + XNameAccess nameAccess = UnoRuntime.queryInterface( XNameAccess.class, m_masterForm ); - return (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, + return UnoRuntime.queryInterface( XPropertySet.class, nameAccess.getByName( name ) ); } @@ -547,7 +547,7 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE m_document.getCurrentView( ).toggleFormDesignMode( ); m_masterFormController = m_document.getCurrentView().getFormController( m_masterForm ); - XSQLErrorBroadcaster errorBroadcaster = (XSQLErrorBroadcaster)UnoRuntime.queryInterface( XSQLErrorBroadcaster.class, + XSQLErrorBroadcaster errorBroadcaster = UnoRuntime.queryInterface( XSQLErrorBroadcaster.class, m_masterFormController ); errorBroadcaster.addSQLErrorListener( this ); @@ -796,21 +796,21 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE /* ------------------------------------------------------------------ */ private void moveToInsertRow() throws com.sun.star.uno.Exception, java.lang.Exception { - XResultSetUpdate xResultSet = (XResultSetUpdate)UnoRuntime.queryInterface( XResultSetUpdate.class, m_masterForm ); + XResultSetUpdate xResultSet = UnoRuntime.queryInterface( XResultSetUpdate.class, m_masterForm ); xResultSet.moveToInsertRow( ); } /* ------------------------------------------------------------------ */ private void moveToFirst() throws com.sun.star.uno.Exception, java.lang.Exception { - XResultSet xResultSet = (XResultSet)UnoRuntime.queryInterface( XResultSet.class, m_masterForm ); + XResultSet xResultSet = UnoRuntime.queryInterface( XResultSet.class, m_masterForm ); xResultSet.first( ); } /* ------------------------------------------------------------------ */ private void moveToNext() throws com.sun.star.uno.Exception, java.lang.Exception { - XResultSet xResultSet = (XResultSet)UnoRuntime.queryInterface( XResultSet.class, m_masterForm ); + XResultSet xResultSet = UnoRuntime.queryInterface( XResultSet.class, m_masterForm ); xResultSet.next( ); } @@ -823,7 +823,7 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE URL[] url = new URL[] { new URL() }; url[0].Complete = slotURL; - XURLTransformer xTransformer = (XURLTransformer)UnoRuntime.queryInterface( + XURLTransformer xTransformer = UnoRuntime.queryInterface( XURLTransformer.class, m_orb.createInstance( "com.sun.star.util.URLTransformer" ) ); xTransformer.parseStrict( url ); @@ -913,7 +913,7 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE XPropertySet xImageModel = getControlModel( "f_blob" ); // check if the image control properly says that there currently is no image on the first record - XImageProducerSupplier xSuppProducer = (XImageProducerSupplier)UnoRuntime.queryInterface( XImageProducerSupplier.class, + XImageProducerSupplier xSuppProducer = UnoRuntime.queryInterface( XImageProducerSupplier.class, xImageModel ); XImageProducer xProducer = xSuppProducer.getImageProducer(); diff --git a/forms/qa/integration/forms/FormLayer.java b/forms/qa/integration/forms/FormLayer.java index 09ac58d637e0..080d6873e5fd 100644 --- a/forms/qa/integration/forms/FormLayer.java +++ b/forms/qa/integration/forms/FormLayer.java @@ -310,15 +310,15 @@ public class FormLayer */ public XPropertySet getControlModel( int[] _accessPath ) throws com.sun.star.uno.Exception { - XIndexAccess indexAcc = (XIndexAccess)UnoRuntime.queryInterface( XIndexAccess.class, + XIndexAccess indexAcc = UnoRuntime.queryInterface( XIndexAccess.class, m_document.getFormComponentTreeRoot() ); XPropertySet controlModel = null; int i=0; while ( ( indexAcc != null ) && ( i < _accessPath.length ) ) { - controlModel = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, + controlModel = UnoRuntime.queryInterface( XPropertySet.class, indexAcc.getByIndex( _accessPath[i] ) ); - indexAcc = (XIndexAccess)UnoRuntime.queryInterface( XIndexAccess.class, + indexAcc = UnoRuntime.queryInterface( XIndexAccess.class, controlModel ); ++i; } @@ -335,9 +335,9 @@ public class FormLayer int i=0; while ( ( nameAcc != null ) && ( i < _accessPath.length ) ) { - controlModel = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, + controlModel = UnoRuntime.queryInterface( XPropertySet.class, nameAcc.getByName( _accessPath[i] ) ); - nameAcc = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class, + nameAcc = UnoRuntime.queryInterface( XNameAccess.class, controlModel ); ++i; } diff --git a/forms/qa/integration/forms/ListSelection.java b/forms/qa/integration/forms/ListSelection.java index a7a03889ad4a..5d080cb7691c 100644 --- a/forms/qa/integration/forms/ListSelection.java +++ b/forms/qa/integration/forms/ListSelection.java @@ -100,12 +100,12 @@ public class ListSelection extends integration.forms.TestCase XSpreadsheet activeSheet = view.getActiveSheet(); // Accessibility access to the list box control in this sheet - XAccessible accessibleListBox = (XAccessible)UnoRuntime.queryInterface( + XAccessible accessibleListBox = UnoRuntime.queryInterface( XAccessible.class, getListBoxControl( activeSheet ) ); XAccessibleContext context = accessibleListBox.getAccessibleContext(); // the first "accessible child" of a list box is its list - XAccessibleSelection accessibleList = (XAccessibleSelection)UnoRuntime.queryInterface( + XAccessibleSelection accessibleList = UnoRuntime.queryInterface( XAccessibleSelection.class, context.getAccessibleChild( 1 ) ); int selectPosition = generator.nextInt( 5 ); @@ -120,7 +120,7 @@ public class ListSelection extends integration.forms.TestCase } catch( java.lang.InterruptedException e ) { } - XNamed sheetName = (XNamed)UnoRuntime.queryInterface( XNamed.class, view.getActiveSheet() ); + XNamed sheetName = UnoRuntime.queryInterface( XNamed.class, view.getActiveSheet() ); assure( "sheet was not selected as expected!", sheetName.getName().equals( selectSheetName ) ); } } @@ -137,7 +137,7 @@ public class ListSelection extends integration.forms.TestCase try { XPropertySet docProps = dbfTools.queryPropertySet( m_document.getDocument() ); - XLibraryContainer basicLibs = (XLibraryContainer)UnoRuntime.queryInterface( + XLibraryContainer basicLibs = UnoRuntime.queryInterface( XLibraryContainer.class, docProps.getPropertyValue( "BasicLibraries" ) ); XNameContainer basicLib = basicLibs.createLibrary( "default" ); @@ -184,7 +184,7 @@ public class ListSelection extends integration.forms.TestCase { XIndexContainer parentForm = (XIndexContainer)dbfTools.getParent( controlModel, XIndexContainer.class ); - XEventAttacherManager manager = (XEventAttacherManager)UnoRuntime.queryInterface( + XEventAttacherManager manager = UnoRuntime.queryInterface( XEventAttacherManager.class, parentForm ); int containerPosition = -1; @@ -230,7 +230,7 @@ public class ListSelection extends integration.forms.TestCase String[] newSheetNames = new String[] { "first", "second", "third", "forth", "fifth" }; // give the first one the right name - XNamed sheet = (XNamed)UnoRuntime.queryInterface( XNamed.class, + XNamed sheet = UnoRuntime.queryInterface( XNamed.class, sheets.getByName( sheetNames[ 0 ] ) ); sheet.setName( newSheetNames[ 0 ] ); @@ -274,7 +274,7 @@ public class ListSelection extends integration.forms.TestCase /* ------------------------------------------------------------------ */ protected XControlModel getListBoxModel( XSpreadsheet sheet ) { - XDrawPageSupplier suppPage = (XDrawPageSupplier)UnoRuntime.queryInterface( + XDrawPageSupplier suppPage = UnoRuntime.queryInterface( XDrawPageSupplier.class, sheet ); FormComponent formsRoot = new FormComponent( suppPage.getDrawPage() ); XControlModel listBoxModel = (XControlModel)formsRoot.getByIndex( 0 ). @@ -285,7 +285,7 @@ public class ListSelection extends integration.forms.TestCase /* ------------------------------------------------------------------ */ protected XListBox getListBoxControl( XSpreadsheet sheet ) throws com.sun.star.uno.Exception { - return (XListBox)UnoRuntime.queryInterface( + return UnoRuntime.queryInterface( XListBox.class, m_document.getCurrentView().getControl( getListBoxModel( sheet ) ) ); } } diff --git a/forms/qa/integration/forms/RadioButtons.java b/forms/qa/integration/forms/RadioButtons.java index e883f8a6ef08..b2c641caad73 100644 --- a/forms/qa/integration/forms/RadioButtons.java +++ b/forms/qa/integration/forms/RadioButtons.java @@ -255,7 +255,7 @@ public class RadioButtons extends complexlib.ComplexTestCase // close our document if ( m_document != null ) { - XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class, + XCloseable closeDoc = UnoRuntime.queryInterface( XCloseable.class, m_document.getDocument() ); closeDoc.close( true ); } @@ -295,7 +295,7 @@ public class RadioButtons extends complexlib.ComplexTestCase { XPropertySet xRadio = getRadioModel( groupName, refValue, form ); - XRadioButton radioButton = (XRadioButton)UnoRuntime.queryInterface( + XRadioButton radioButton = UnoRuntime.queryInterface( XRadioButton.class, m_document.getCurrentView().getControl( xRadio ) ); radioButton.setState( true ); } diff --git a/forms/qa/integration/forms/SingleControlValidation.java b/forms/qa/integration/forms/SingleControlValidation.java index ac54510f6357..05b3fa9e0afa 100644 --- a/forms/qa/integration/forms/SingleControlValidation.java +++ b/forms/qa/integration/forms/SingleControlValidation.java @@ -100,7 +100,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 ); } @@ -122,7 +122,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 ) @@ -148,7 +148,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/forms/qa/integration/forms/SpreadsheetDocument.java b/forms/qa/integration/forms/SpreadsheetDocument.java index cd653a773231..e6c7f920d3c2 100644 --- a/forms/qa/integration/forms/SpreadsheetDocument.java +++ b/forms/qa/integration/forms/SpreadsheetDocument.java @@ -49,7 +49,7 @@ public class SpreadsheetDocument extends DocumentHelper */ public XSpreadsheets getSheets() throws com.sun.star.uno.Exception { - XSpreadsheetDocument spreadsheetDoc = (XSpreadsheetDocument)UnoRuntime.queryInterface( XSpreadsheetDocument.class, + XSpreadsheetDocument spreadsheetDoc = UnoRuntime.queryInterface( XSpreadsheetDocument.class, getDocument() ); return spreadsheetDoc.getSheets(); @@ -60,10 +60,10 @@ public class SpreadsheetDocument extends DocumentHelper */ public XCellRange getSheet( int index ) throws com.sun.star.uno.Exception { - XIndexAccess sheets = (XIndexAccess)UnoRuntime.queryInterface( XIndexAccess.class, + XIndexAccess sheets = UnoRuntime.queryInterface( XIndexAccess.class, getSheets() ); - return (XCellRange)UnoRuntime.queryInterface( XCellRange.class, + return UnoRuntime.queryInterface( XCellRange.class, sheets.getByIndex( index ) ); } @@ -94,7 +94,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" @@ -123,7 +123,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/forms/qa/integration/forms/SpreadsheetView.java b/forms/qa/integration/forms/SpreadsheetView.java index fd958d5d478f..dbc05d82b73d 100644 --- a/forms/qa/integration/forms/SpreadsheetView.java +++ b/forms/qa/integration/forms/SpreadsheetView.java @@ -47,16 +47,16 @@ public class SpreadsheetView extends integration.forms.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/forms/qa/integration/forms/TableCellTextBinding.java b/forms/qa/integration/forms/TableCellTextBinding.java index 04f2434cb0ce..40a5d698617b 100644 --- a/forms/qa/integration/forms/TableCellTextBinding.java +++ b/forms/qa/integration/forms/TableCellTextBinding.java @@ -53,7 +53,7 @@ public class TableCellTextBinding /** Creates a new instance of TableCellTextBinding */ public TableCellTextBinding( XCell cell ) { - m_cellText = (XTextRange)UnoRuntime.queryInterface( XTextRange.class, cell ); + m_cellText = UnoRuntime.queryInterface( XTextRange.class, cell ); m_newCellText = new String(); m_listeners = new java.util.LinkedList(); diff --git a/forms/qa/integration/forms/ValueBinding.java b/forms/qa/integration/forms/ValueBinding.java index 33773a0c7c5a..2f4d58aee133 100644 --- a/forms/qa/integration/forms/ValueBinding.java +++ b/forms/qa/integration/forms/ValueBinding.java @@ -82,11 +82,11 @@ public class ValueBinding extends integration.forms.TestCase // 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(); - 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 ); @@ -98,7 +98,7 @@ public class ValueBinding extends integration.forms.TestCase // 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/forms/qa/integration/forms/XMLFormSettings.java b/forms/qa/integration/forms/XMLFormSettings.java index 70f9d279412f..16e766ceac25 100644 --- a/forms/qa/integration/forms/XMLFormSettings.java +++ b/forms/qa/integration/forms/XMLFormSettings.java @@ -101,7 +101,7 @@ public class XMLFormSettings extends complexlib.ComplexTestCase File tempFile = File.createTempFile( "xmlforms", ".odt" ); tempFile.deleteOnExit(); String fileURL = tempFile.toURI().toURL().toExternalForm(); - XStorable store = (XStorable)UnoRuntime.queryInterface( XStorable.class, + XStorable store = UnoRuntime.queryInterface( XStorable.class, m_document.getDocument() ); store.storeAsURL( fileURL, new PropertyValue[] {} ); assure( "document still modified after saving it", !m_document.isModified() ); @@ -118,7 +118,7 @@ public class XMLFormSettings extends complexlib.ComplexTestCase { if ( m_document != null ) { - XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class, + XCloseable closeDoc = UnoRuntime.queryInterface( XCloseable.class, m_document.getDocument() ); closeDoc.close( true ); } @@ -127,9 +127,9 @@ public class XMLFormSettings extends complexlib.ComplexTestCase /* ------------------------------------------------------------------ */ private static void impl_bind( XPropertySet _control, XPropertySet _binding ) throws IncompatibleTypesException { - XBindableValue bindableControl = (XBindableValue)UnoRuntime.queryInterface( + XBindableValue bindableControl = UnoRuntime.queryInterface( XBindableValue.class, _control ); - XValueBinding binding = (XValueBinding)UnoRuntime.queryInterface( + XValueBinding binding = UnoRuntime.queryInterface( XValueBinding.class, _binding ); bindableControl.setValueBinding( binding ); } @@ -209,7 +209,7 @@ public class XMLFormSettings extends complexlib.ComplexTestCase */ private void impl_storeDocument() throws IOException { - XStorable store = (XStorable)UnoRuntime.queryInterface( XStorable.class, + XStorable store = UnoRuntime.queryInterface( XStorable.class, m_document.getDocument() ); store.store(); assure( "document still modified after saving it", !m_document.isModified() ); diff --git a/forms/qa/org/openoffice/complex/forms/tools/ResultSet.java b/forms/qa/org/openoffice/complex/forms/tools/ResultSet.java index 04a84fd8a8ce..7f87db745387 100644 --- a/forms/qa/org/openoffice/complex/forms/tools/ResultSet.java +++ b/forms/qa/org/openoffice/complex/forms/tools/ResultSet.java @@ -39,8 +39,8 @@ public class ResultSet implements XResultSet, XRow public ResultSet( final Object _resultSet ) { - m_resultSet = (XResultSet)UnoRuntime.queryInterface( XResultSet.class, _resultSet ); - m_row = (XRow)UnoRuntime.queryInterface( XRow.class, _resultSet ); + m_resultSet = UnoRuntime.queryInterface( XResultSet.class, _resultSet ); + m_row = UnoRuntime.queryInterface( XRow.class, _resultSet ); } public diff --git a/forms/qa/org/openoffice/xforms/Model.java b/forms/qa/org/openoffice/xforms/Model.java index e8d1361ab506..d0af835e8053 100644 --- a/forms/qa/org/openoffice/xforms/Model.java +++ b/forms/qa/org/openoffice/xforms/Model.java @@ -32,9 +32,9 @@ public class Model protected Model( Object _model ) { - m_model = (XModel)UnoRuntime.queryInterface( XModel.class, _model ); - m_modelProps = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, _model ); - m_helper = (XFormsUIHelper1)UnoRuntime.queryInterface( XFormsUIHelper1.class, + m_model = UnoRuntime.queryInterface( XModel.class, _model ); + m_modelProps = UnoRuntime.queryInterface( XPropertySet.class, _model ); + m_helper = UnoRuntime.queryInterface( XFormsUIHelper1.class, m_model ); } diff --git a/forms/qa/org/openoffice/xforms/XMLDocument.java b/forms/qa/org/openoffice/xforms/XMLDocument.java index 80d9764d249d..339f14a564e6 100644 --- a/forms/qa/org/openoffice/xforms/XMLDocument.java +++ b/forms/qa/org/openoffice/xforms/XMLDocument.java @@ -52,7 +52,7 @@ public class XMLDocument extends integration.forms.DocumentHelper /* ------------------------------------------------------------------ */ private void impl_initialize( XComponent _document ) { - m_formsSupplier = (XFormsSupplier)UnoRuntime.queryInterface( XFormsSupplier.class, + m_formsSupplier = UnoRuntime.queryInterface( XFormsSupplier.class, _document ); if ( m_formsSupplier == null ) @@ -86,10 +86,10 @@ public class XMLDocument extends integration.forms.DocumentHelper XModel newModel = null; try { - newModel = (XModel) UnoRuntime.queryInterface( XModel.class, + newModel = UnoRuntime.queryInterface( XModel.class, getOrb().createInstance( "com.sun.star.xforms.Model" ) ); newModel.setID(_modelName); - XFormsUIHelper1 modelHelper = (XFormsUIHelper1) UnoRuntime.queryInterface( + XFormsUIHelper1 modelHelper = UnoRuntime.queryInterface( XFormsUIHelper1.class, newModel ); modelHelper.newInstance( "Instance 1", new String(), true ); newModel.initialize(); |