diff options
author | Stephan Wunderlich <sw@openoffice.org> | 2003-01-31 13:01:05 +0000 |
---|---|---|
committer | Stephan Wunderlich <sw@openoffice.org> | 2003-01-31 13:01:05 +0000 |
commit | 3a5eadba4146a43fbc6ae122c055b9f7b942b671 (patch) | |
tree | 56ec86777e6bfcf0b504a30f204c0a8c0b3e3857 /qadevOOo/tests/java/mod/_sc | |
parent | af2992bb4c8acc46e81f2d0ee0614c2627a02d76 (diff) |
CHG: using AnyConverter instead of simple cast
Diffstat (limited to 'qadevOOo/tests/java/mod/_sc')
5 files changed, 53 insertions, 20 deletions
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewHeaderCell.java b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewHeaderCell.java index 896f8fc2fca7..5644a71bb989 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewHeaderCell.java +++ b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewHeaderCell.java @@ -2,9 +2,9 @@ * * $RCSfile: ScAccessiblePreviewHeaderCell.java,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change:$Date: 2003-01-27 18:16:44 $ + * last change:$Date: 2003-01-31 13:47:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -96,6 +96,9 @@ import com.sun.star.sheet.XHeaderFooterContent; import com.sun.star.style.XStyle; import com.sun.star.text.XText; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; + /** * Object implements the following interfaces: * <ul> @@ -183,7 +186,8 @@ public class ScAccessiblePreviewHeaderCell extends TestCase { XSpreadsheets oSheets = xSheetDoc.getSheets() ; XIndexAccess oIndexSheets = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - XSpreadsheet oSheet = (XSpreadsheet) oIndexSheets.getByIndex(0); + XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); log.println("Getting a cell from sheet") ; xCell = oSheet.getCellByPosition(0, 0); @@ -195,6 +199,10 @@ public class ScAccessiblePreviewHeaderCell extends TestCase { e.printStackTrace(log); throw new StatusException( "Error getting cell object from spreadsheet document", e); + } catch (com.sun.star.lang.IllegalArgumentException e) { + e.printStackTrace(log); + throw new StatusException( + "Error getting cell object from spreadsheet document", e); } xCell.setFormula("Value"); diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java index 27ced391e782..4db9a950c86d 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java +++ b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java @@ -2,9 +2,9 @@ * * $RCSfile: ScAccessiblePreviewTable.java,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change:$Date: 2003-01-27 18:16:44 $ + * last change:$Date: 2003-01-31 13:50:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -88,6 +88,9 @@ import com.sun.star.container.XIndexAccess; import com.sun.star.sheet.XSpreadsheet; import com.sun.star.table.XCell; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; + /** * Object implements the following interfaces: * <ul> @@ -158,7 +161,8 @@ public class ScAccessiblePreviewTable extends TestCase { XSpreadsheets oSheets = xSheetDoc.getSheets() ; XIndexAccess oIndexSheets = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - XSpreadsheet oSheet = (XSpreadsheet) oIndexSheets.getByIndex(0); + XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); log.println("Getting a cell from sheet") ; xCell = oSheet.getCellByPosition(0, 0); @@ -170,6 +174,10 @@ public class ScAccessiblePreviewTable extends TestCase { e.printStackTrace(log); throw new StatusException( "Error getting cell object from spreadsheet document", e); + } catch (com.sun.star.lang.IllegalArgumentException e) { + e.printStackTrace(log); + throw new StatusException( + "Error getting cell object from spreadsheet document", e); } xCell.setFormula("Value"); diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessibleSpreadsheet.java b/qadevOOo/tests/java/mod/_sc/ScAccessibleSpreadsheet.java index ecbb0ffaab06..40d7d676f2e1 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAccessibleSpreadsheet.java +++ b/qadevOOo/tests/java/mod/_sc/ScAccessibleSpreadsheet.java @@ -2,9 +2,9 @@ * * $RCSfile: ScAccessibleSpreadsheet.java,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change:$Date: 2003-01-27 18:16:44 $ + * last change:$Date: 2003-01-31 13:54:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -82,6 +82,8 @@ import com.sun.star.sheet.XSpreadsheets; import com.sun.star.sheet.XSpreadsheet; import com.sun.star.table.XCell; import com.sun.star.container.XIndexAccess; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; /** * Test for accessible object of spreadsheet document.<p> @@ -167,7 +169,8 @@ public class ScAccessibleSpreadsheet extends TestCase { XSpreadsheets oSheets = xSheetDoc.getSheets() ; XIndexAccess oIndexSheets = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - XSpreadsheet oSheet = (XSpreadsheet) oIndexSheets.getByIndex(0); + XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); xCell = oSheet.getCellByPosition(5, 5) ; xCell.setFormula(text); } catch(com.sun.star.lang.WrappedTargetException e) { @@ -176,6 +179,9 @@ public class ScAccessibleSpreadsheet extends TestCase { } catch(com.sun.star.lang.IndexOutOfBoundsException e) { log.println("Exception ceating relation :"); e.printStackTrace(log); + } catch(com.sun.star.lang.IllegalArgumentException e) { + log.println("Exception ceating relation :"); + e.printStackTrace(log); } final XCell fCell = xCell ; diff --git a/qadevOOo/tests/java/mod/_sc/ScAnnotationObj.java b/qadevOOo/tests/java/mod/_sc/ScAnnotationObj.java index 7c96424e9d44..5e37ec0c5687 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAnnotationObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScAnnotationObj.java @@ -2,9 +2,9 @@ * * $RCSfile: ScAnnotationObj.java,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change:$Date: 2003-01-27 18:16:43 $ + * last change:$Date: 2003-01-31 13:58:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,6 +79,8 @@ import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; import util.SOfficeFactory; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; /** * Test for object which represents some text annotation @@ -170,8 +172,8 @@ public class ScAnnotationObj extends TestCase { UnoRuntime.queryInterface(XIndexAccess.class, oSheets); XCell oCell = null; try { - XSpreadsheet oSheet = (XSpreadsheet) - XAccess.getByIndex(cellPos.Sheet); + XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),XAccess.getByIndex(cellPos.Sheet)); XCellRange oCRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, oSheet); oCell = oCRange.getCellByPosition(cellPos.Column, cellPos.Row); @@ -183,6 +185,10 @@ public class ScAnnotationObj extends TestCase { e.printStackTrace(log); throw new StatusException( "Error getting test object from spreadsheet document",e); + } catch(com.sun.star.lang.IllegalArgumentException e) { + e.printStackTrace(log); + throw new StatusException( + "Error getting test object from spreadsheet document",e); } XSheetAnnotationAnchor oAnnoA = (XSheetAnnotationAnchor) diff --git a/qadevOOo/tests/java/mod/_sc/ScAnnotationsObj.java b/qadevOOo/tests/java/mod/_sc/ScAnnotationsObj.java index 392374d282a9..141e54cfa6ca 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAnnotationsObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScAnnotationsObj.java @@ -2,9 +2,9 @@ * * $RCSfile: ScAnnotationsObj.java,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change:$Date: 2003-01-27 18:16:43 $ + * last change:$Date: 2003-01-31 14:01:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,6 +80,8 @@ import lib.TestCase; import lib.TestEnvironment; import lib.TestParameters; import util.SOfficeFactory; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; /** * Test for object which represents a collection of annotations @@ -138,9 +140,7 @@ public class ScAnnotationsObj extends TestCase { * of annotations is retrieved using spreadsheet's * <code>com.sun.star.sheet.XSheetAnnotationsSupplier</code> interface. */ - public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log ) - throws StatusException { + protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { XInterface oInterface = null; XInterface oObj = null; @@ -162,8 +162,9 @@ public class ScAnnotationsObj extends TestCase { XCell oCell = null; XSpreadsheet oSheet = null; try { - oSheet = (XSpreadsheet) - oNames.getByName(oNames.getElementNames()[0]); + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class), + oNames.getByName(oNames.getElementNames()[0])); // adding an annotation... XCellRange oCRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, oSheet); @@ -180,6 +181,10 @@ public class ScAnnotationsObj extends TestCase { e.printStackTrace(log) ; throw new StatusException( "Error getting test object from spreadsheet document",e) ; + } catch (com.sun.star.lang.IllegalArgumentException e) { + e.printStackTrace(log) ; + throw new StatusException( + "Error getting test object from spreadsheet document",e) ; } XSheetAnnotationAnchor oAnnoA = (XSheetAnnotationAnchor) |