From 73ddcdc680e269b1e372d5002e2409fd5feedebc Mon Sep 17 00:00:00 2001 From: Stephan Wunderlich Date: Mon, 3 Feb 2003 12:35:34 +0000 Subject: CHG: using AnyConverter instead of simple cast --- .../mod/_sc/ScIndexEnumeration_ScenariosEnumeration.java | 13 ++++++++++--- .../ScIndexEnumeration_SheetCellRangesEnumeration.java | 10 +++++++--- .../mod/_sc/ScIndexEnumeration_SheetLinksEnumeration.java | 15 +++++++++++---- ...cIndexEnumeration_SpreadsheetViewPanesEnumeration.java | 13 ++++++++++--- 4 files changed, 38 insertions(+), 13 deletions(-) (limited to 'qadevOOo/tests/java') diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_ScenariosEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_ScenariosEnumeration.java index 18b2768cbd8c..186ec02c365f 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_ScenariosEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_ScenariosEnumeration.java @@ -2,9 +2,9 @@ * * $RCSfile: ScIndexEnumeration_ScenariosEnumeration.java,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change:$Date: 2003-01-27 18:16:24 $ + * last change:$Date: 2003-02-03 13:27:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,6 +80,9 @@ import lib.TestEnvironment; import lib.TestParameters; import util.SOfficeFactory; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; + public class ScIndexEnumeration_ScenariosEnumeration extends TestCase { public XSpreadsheetDocument xSpreadsheetDoc; @@ -118,13 +121,17 @@ public class ScIndexEnumeration_ScenariosEnumeration extends TestCase { XIndexAccess oIndexAccess = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); try { - oSheet = (XSpreadsheet)oIndexAccess.getByIndex(0); + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); } catch (com.sun.star.lang.WrappedTargetException e) { e.printStackTrace(log); throw new StatusException( "Couldn't get a spreadsheet", e); } catch (com.sun.star.lang.IndexOutOfBoundsException e) { e.printStackTrace(log); throw new StatusException( "Couldn't get a spreadsheet", e); + } catch (com.sun.star.lang.IllegalArgumentException e) { + e.printStackTrace(log); + throw new StatusException( "Couldn't get a spreadsheet", e); } log.println("filling some cells"); diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetCellRangesEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetCellRangesEnumeration.java index 246690960b7f..9c6152f5ed99 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetCellRangesEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetCellRangesEnumeration.java @@ -2,9 +2,9 @@ * * $RCSfile: ScIndexEnumeration_SheetCellRangesEnumeration.java,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change:$Date: 2003-01-27 18:16:23 $ + * last change:$Date: 2003-02-03 13:30:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,6 +78,9 @@ import lib.TestEnvironment; import lib.TestParameters; import util.SOfficeFactory; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; + public class ScIndexEnumeration_SheetCellRangesEnumeration extends TestCase { XSpreadsheetDocument xSheetDoc = null; @@ -134,7 +137,8 @@ public class ScIndexEnumeration_SheetCellRangesEnumeration extends TestCase { UnoRuntime.queryInterface (XIndexAccess.class, oSheets); XSpreadsheet oSheet = null; try { - oSheet = (XSpreadsheet) oIndSheets.getByIndex(0); + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndSheets.getByIndex(0)); XNameContainer oRanges = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oObj); diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetLinksEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetLinksEnumeration.java index fc63436ca344..fb3e73bdbe34 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetLinksEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetLinksEnumeration.java @@ -2,9 +2,9 @@ * * $RCSfile: ScIndexEnumeration_SheetLinksEnumeration.java,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change:$Date: 2003-01-27 18:16:23 $ + * last change:$Date: 2003-02-03 13:32:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,6 +78,9 @@ import lib.TestEnvironment; import lib.TestParameters; import util.SOfficeFactory; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; + public class ScIndexEnumeration_SheetLinksEnumeration extends TestCase { XSpreadsheetDocument xSheetDoc = null; @@ -119,16 +122,20 @@ public class ScIndexEnumeration_SheetLinksEnumeration extends TestCase { log.println("Getting test object ") ; XSpreadsheets oSheets = xSheetDoc.getSheets() ; - XIndexAccess oIndexSheets = (XIndexAccess) + XIndexAccess oIndexAccess = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, oSheets); try { - oSheet = (XSpreadsheet) oIndexSheets.getByIndex(0); + oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0)); } catch (com.sun.star.lang.WrappedTargetException e) { e.printStackTrace(log); throw new StatusException( "Couldn't get a spreadsheet", e); } catch (com.sun.star.lang.IndexOutOfBoundsException e) { e.printStackTrace(log); throw new StatusException( "Couldn't get a spreadsheet", e); + } catch (com.sun.star.lang.IllegalArgumentException e) { + e.printStackTrace(log); + throw new StatusException( "Couldn't get a spreadsheet", e); } XSheetLinkable SL = (XSheetLinkable) diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SpreadsheetViewPanesEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SpreadsheetViewPanesEnumeration.java index 6bc034aa7b46..56d80ffaf6d3 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SpreadsheetViewPanesEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SpreadsheetViewPanesEnumeration.java @@ -2,9 +2,9 @@ * * $RCSfile: ScIndexEnumeration_SpreadsheetViewPanesEnumeration.java,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change:$Date: 2003-01-27 18:16:22 $ + * last change:$Date: 2003-02-03 13:35:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,6 +78,9 @@ import lib.TestEnvironment; import lib.TestParameters; import util.SOfficeFactory; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; + public class ScIndexEnumeration_SpreadsheetViewPanesEnumeration extends TestCase { private XSpreadsheetDocument xSpreadsheetDoc; private SOfficeFactory SOF; @@ -117,13 +120,17 @@ public class ScIndexEnumeration_SpreadsheetViewPanesEnumeration extends TestCase XIndexAccess xIA = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xc); try { - oObj = (XInterface)xIA.getByIndex(0); + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class),xIA.getByIndex(0)); } catch (com.sun.star.lang.WrappedTargetException e) { e.printStackTrace(log); throw new StatusException("Couldn't get by index", e); } catch (com.sun.star.lang.IndexOutOfBoundsException e) { e.printStackTrace(log); throw new StatusException("Couldn't get by index", e); + } catch (com.sun.star.lang.IllegalArgumentException e) { + e.printStackTrace(log); + throw new StatusException("Couldn't get by index", e); } XEnumerationAccess ea = (XEnumerationAccess) -- cgit