Kaydet (Commit) 0105ee23 authored tarafından Stephan Wunderlich's avatar Stephan Wunderlich

CHG: using AnyConverter instead of simple cast

üst 05a3fdd0
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScIndexEnumeration_CellAnnotationsEnumeration.java,v $ * $RCSfile: ScIndexEnumeration_CellAnnotationsEnumeration.java,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change:$Date: 2003-01-27 18:16:27 $ * last change:$Date: 2003-02-03 12:49:07 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -78,6 +78,9 @@ import lib.TestEnvironment; ...@@ -78,6 +78,9 @@ import lib.TestEnvironment;
import lib.TestParameters; import lib.TestParameters;
import util.SOfficeFactory; import util.SOfficeFactory;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Type;
public class ScIndexEnumeration_CellAnnotationsEnumeration extends TestCase { public class ScIndexEnumeration_CellAnnotationsEnumeration extends TestCase {
XSpreadsheetDocument xSheetDoc = null; XSpreadsheetDocument xSheetDoc = null;
...@@ -122,13 +125,17 @@ public class ScIndexEnumeration_CellAnnotationsEnumeration extends TestCase { ...@@ -122,13 +125,17 @@ public class ScIndexEnumeration_CellAnnotationsEnumeration extends TestCase {
XIndexAccess oIndexAccess = (XIndexAccess) XIndexAccess oIndexAccess = (XIndexAccess)
UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
try { try {
oSheet = (XSpreadsheet)oIndexAccess.getByIndex(0); oSheet = (XSpreadsheet) AnyConverter.toObject(
new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
} catch (com.sun.star.lang.WrappedTargetException e) { } catch (com.sun.star.lang.WrappedTargetException e) {
e.printStackTrace(log); e.printStackTrace(log);
throw new StatusException( "Couldn't get a spreadsheet", e); throw new StatusException( "Couldn't get a spreadsheet", e);
} catch (com.sun.star.lang.IndexOutOfBoundsException e) { } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
e.printStackTrace(log); e.printStackTrace(log);
throw new StatusException( "Couldn't get a spreadsheet", e); 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"); log.println("filling some cells");
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScIndexEnumeration_CellAreaLinksEnumeration.java,v $ * $RCSfile: ScIndexEnumeration_CellAreaLinksEnumeration.java,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change:$Date: 2003-01-27 18:16:27 $ * last change:$Date: 2003-02-03 12:52:33 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -76,6 +76,9 @@ import lib.TestEnvironment; ...@@ -76,6 +76,9 @@ import lib.TestEnvironment;
import lib.TestParameters; import lib.TestParameters;
import util.SOfficeFactory; import util.SOfficeFactory;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Type;
public class ScIndexEnumeration_CellAreaLinksEnumeration extends TestCase { public class ScIndexEnumeration_CellAreaLinksEnumeration extends TestCase {
XSpreadsheetDocument xSheetDoc = null; XSpreadsheetDocument xSheetDoc = null;
...@@ -118,7 +121,8 @@ public class ScIndexEnumeration_CellAreaLinksEnumeration extends TestCase { ...@@ -118,7 +121,8 @@ public class ScIndexEnumeration_CellAreaLinksEnumeration extends TestCase {
// creation of testobject here // creation of testobject here
XPropertySet props = (XPropertySet)UnoRuntime.queryInterface XPropertySet props = (XPropertySet)UnoRuntime.queryInterface
(XPropertySet.class, xSheetDoc); (XPropertySet.class, xSheetDoc);
oObj = (XInterface) props.getPropertyValue("AreaLinks") ; oObj = (XInterface) AnyConverter.toObject(
new Type(XInterface.class),props.getPropertyValue("AreaLinks")) ;
XAreaLinks links = null ; XAreaLinks links = null ;
// adding one link into collection (for best testing) // adding one link into collection (for best testing)
...@@ -145,6 +149,10 @@ public class ScIndexEnumeration_CellAreaLinksEnumeration extends TestCase { ...@@ -145,6 +149,10 @@ public class ScIndexEnumeration_CellAreaLinksEnumeration extends TestCase {
log.println ("Exception occured while creating test Object.") ; log.println ("Exception occured while creating test Object.") ;
e.printStackTrace(log) ; e.printStackTrace(log) ;
throw new StatusException("Couldn't create test object", e); throw new StatusException("Couldn't create test object", e);
} catch (com.sun.star.lang.IllegalArgumentException e) {
log.println ("Exception occured while creating test Object.") ;
e.printStackTrace(log) ;
throw new StatusException("Couldn't create test object", e);
} }
return tEnv ; return tEnv ;
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScIndexEnumeration_DDELinksEnumeration.java,v $ * $RCSfile: ScIndexEnumeration_DDELinksEnumeration.java,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change:$Date: 2003-01-27 18:16:26 $ * last change:$Date: 2003-02-03 12:56:10 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -81,6 +81,9 @@ import lib.TestParameters; ...@@ -81,6 +81,9 @@ import lib.TestParameters;
import util.SOfficeFactory; import util.SOfficeFactory;
import util.utils; import util.utils;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Type;
public class ScIndexEnumeration_DDELinksEnumeration extends TestCase { public class ScIndexEnumeration_DDELinksEnumeration extends TestCase {
XSpreadsheetDocument xSheetDoc = null; XSpreadsheetDocument xSheetDoc = null;
XComponent oDoc = null; XComponent oDoc = null;
...@@ -161,13 +164,17 @@ public class ScIndexEnumeration_DDELinksEnumeration extends TestCase { ...@@ -161,13 +164,17 @@ public class ScIndexEnumeration_DDELinksEnumeration extends TestCase {
XIndexAccess oIndexAccess = (XIndexAccess) XIndexAccess oIndexAccess = (XIndexAccess)
UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
try { try {
oSheet = (XSpreadsheet)oIndexAccess.getByIndex(0); oSheet = (XSpreadsheet) AnyConverter.toObject(
new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
} catch (com.sun.star.lang.WrappedTargetException e) { } catch (com.sun.star.lang.WrappedTargetException e) {
e.printStackTrace(log); e.printStackTrace(log);
throw new StatusException("Couldn't get a spreadsheet", e); throw new StatusException( "Couldn't get a spreadsheet", e);
} catch (com.sun.star.lang.IndexOutOfBoundsException e) { } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
e.printStackTrace(log); e.printStackTrace(log);
throw new StatusException("Couldn't get a spreadsheet", e); 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);
} }
testdoc = utils.getFullTestDocName("ScDDELinksObj.sdc"); testdoc = utils.getFullTestDocName("ScDDELinksObj.sdc");
...@@ -191,7 +198,8 @@ public class ScIndexEnumeration_DDELinksEnumeration extends TestCase { ...@@ -191,7 +198,8 @@ public class ScIndexEnumeration_DDELinksEnumeration extends TestCase {
// Getting named ranges. // Getting named ranges.
XPropertySet docProps = (XPropertySet) XPropertySet docProps = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc);
oObj = (XInterface)docProps.getPropertyValue("DDELinks"); oObj = (XInterface)AnyConverter.toObject(
new Type(XInterface.class),docProps.getPropertyValue("DDELinks"));
log.println("Creating object - " + log.println("Creating object - " +
((oObj == null) ? "FAILED" : "OK")); ((oObj == null) ? "FAILED" : "OK"));
} catch (com.sun.star.lang.WrappedTargetException e) { } catch (com.sun.star.lang.WrappedTargetException e) {
...@@ -202,6 +210,10 @@ public class ScIndexEnumeration_DDELinksEnumeration extends TestCase { ...@@ -202,6 +210,10 @@ public class ScIndexEnumeration_DDELinksEnumeration extends TestCase {
e.printStackTrace(log) ; e.printStackTrace(log) ;
throw new StatusException( throw new StatusException(
"Error getting test object from spreadsheet document", e) ; "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) ;
} }
XEnumerationAccess ea = (XEnumerationAccess) XEnumerationAccess ea = (XEnumerationAccess)
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScIndexEnumeration_DataPilotFieldsEnumeration.java,v $ * $RCSfile: ScIndexEnumeration_DataPilotFieldsEnumeration.java,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change:$Date: 2003-01-27 18:16:26 $ * last change:$Date: 2003-02-03 12:58:58 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -81,6 +81,9 @@ import lib.TestEnvironment; ...@@ -81,6 +81,9 @@ import lib.TestEnvironment;
import lib.TestParameters; import lib.TestParameters;
import util.SOfficeFactory; import util.SOfficeFactory;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Type;
public class ScIndexEnumeration_DataPilotFieldsEnumeration extends TestCase { public class ScIndexEnumeration_DataPilotFieldsEnumeration extends TestCase {
XSpreadsheetDocument xSheetDoc = null; XSpreadsheetDocument xSheetDoc = null;
...@@ -130,13 +133,17 @@ public class ScIndexEnumeration_DataPilotFieldsEnumeration extends TestCase { ...@@ -130,13 +133,17 @@ public class ScIndexEnumeration_DataPilotFieldsEnumeration extends TestCase {
XIndexAccess oIndexAccess = (XIndexAccess) XIndexAccess oIndexAccess = (XIndexAccess)
UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
try { try {
oSheet = (XSpreadsheet)oIndexAccess.getByIndex(0); oSheet = (XSpreadsheet) AnyConverter.toObject(
new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
} catch (com.sun.star.lang.WrappedTargetException e) { } catch (com.sun.star.lang.WrappedTargetException e) {
e.printStackTrace(log); e.printStackTrace(log);
throw new StatusException( "Couldn't get a spreadsheet", e); throw new StatusException( "Couldn't get a spreadsheet", e);
} catch (com.sun.star.lang.IndexOutOfBoundsException e) { } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
e.printStackTrace(log); e.printStackTrace(log);
throw new StatusException( "Couldn't get a spreadsheet", e); 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);
} }
try { try {
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScIndexEnumeration_DataPilotTablesEnumeration.java,v $ * $RCSfile: ScIndexEnumeration_DataPilotTablesEnumeration.java,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change:$Date: 2003-01-27 18:16:26 $ * last change:$Date: 2003-02-03 13:01:15 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -81,6 +81,9 @@ import lib.TestEnvironment; ...@@ -81,6 +81,9 @@ import lib.TestEnvironment;
import lib.TestParameters; import lib.TestParameters;
import util.SOfficeFactory; import util.SOfficeFactory;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Type;
public class ScIndexEnumeration_DataPilotTablesEnumeration extends TestCase { public class ScIndexEnumeration_DataPilotTablesEnumeration extends TestCase {
XSpreadsheetDocument xSheetDoc = null; XSpreadsheetDocument xSheetDoc = null;
...@@ -130,13 +133,17 @@ public class ScIndexEnumeration_DataPilotTablesEnumeration extends TestCase { ...@@ -130,13 +133,17 @@ public class ScIndexEnumeration_DataPilotTablesEnumeration extends TestCase {
XIndexAccess oIndexAccess = (XIndexAccess) XIndexAccess oIndexAccess = (XIndexAccess)
UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
try { try {
oSheet = (XSpreadsheet)oIndexAccess.getByIndex(0); oSheet = (XSpreadsheet) AnyConverter.toObject(
new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
} catch (com.sun.star.lang.WrappedTargetException e) { } catch (com.sun.star.lang.WrappedTargetException e) {
e.printStackTrace(log); e.printStackTrace(log);
throw new StatusException( "Couldn't get a spreadsheet", e); throw new StatusException( "Couldn't get a spreadsheet", e);
} catch (com.sun.star.lang.IndexOutOfBoundsException e) { } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
e.printStackTrace(log); e.printStackTrace(log);
throw new StatusException( "Couldn't get a spreadsheet", e); 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);
} }
try { try {
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScIndexEnumeration_DatabaseRangesEnumeration.java,v $ * $RCSfile: ScIndexEnumeration_DatabaseRangesEnumeration.java,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change:$Date: 2003-01-27 18:16:25 $ * last change:$Date: 2003-02-03 13:04:09 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -76,6 +76,9 @@ import lib.TestEnvironment; ...@@ -76,6 +76,9 @@ import lib.TestEnvironment;
import lib.TestParameters; import lib.TestParameters;
import util.SOfficeFactory; import util.SOfficeFactory;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Type;
public class ScIndexEnumeration_DatabaseRangesEnumeration extends TestCase { public class ScIndexEnumeration_DatabaseRangesEnumeration extends TestCase {
XSpreadsheetDocument xSheetDoc = null; XSpreadsheetDocument xSheetDoc = null;
...@@ -122,8 +125,9 @@ public class ScIndexEnumeration_DatabaseRangesEnumeration extends TestCase { ...@@ -122,8 +125,9 @@ public class ScIndexEnumeration_DatabaseRangesEnumeration extends TestCase {
XDatabaseRanges dbRanges = null; XDatabaseRanges dbRanges = null;
try { try {
dbRanges = (XDatabaseRanges) dbRanges = (XDatabaseRanges) AnyConverter.toObject(
docProps.getPropertyValue("DatabaseRanges"); new Type(XDatabaseRanges.class),
docProps.getPropertyValue("DatabaseRanges"));
} catch (com.sun.star.lang.WrappedTargetException e) { } catch (com.sun.star.lang.WrappedTargetException e) {
e.printStackTrace(log) ; e.printStackTrace(log) ;
throw new StatusException( throw new StatusException(
...@@ -132,6 +136,10 @@ public class ScIndexEnumeration_DatabaseRangesEnumeration extends TestCase { ...@@ -132,6 +136,10 @@ public class ScIndexEnumeration_DatabaseRangesEnumeration extends TestCase {
e.printStackTrace(log) ; e.printStackTrace(log) ;
throw new StatusException( throw new StatusException(
"Error getting test object from spreadsheet document",e) ; "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) ;
} }
log.println("Adding at least one element for ElementAccess interface"); log.println("Adding at least one element for ElementAccess interface");
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScIndexEnumeration_NamedRangesEnumeration.java,v $ * $RCSfile: ScIndexEnumeration_NamedRangesEnumeration.java,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change:$Date: 2003-01-27 18:16:24 $ * last change:$Date: 2003-02-03 13:07:24 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -80,6 +80,9 @@ import lib.TestEnvironment; ...@@ -80,6 +80,9 @@ import lib.TestEnvironment;
import lib.TestParameters; import lib.TestParameters;
import util.SOfficeFactory; import util.SOfficeFactory;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Type;
public class ScIndexEnumeration_NamedRangesEnumeration extends TestCase { public class ScIndexEnumeration_NamedRangesEnumeration extends TestCase {
XSpreadsheetDocument xSheetDoc = null; XSpreadsheetDocument xSheetDoc = null;
...@@ -124,13 +127,17 @@ public class ScIndexEnumeration_NamedRangesEnumeration extends TestCase { ...@@ -124,13 +127,17 @@ public class ScIndexEnumeration_NamedRangesEnumeration extends TestCase {
XIndexAccess oIndexSheets = (XIndexAccess) XIndexAccess oIndexSheets = (XIndexAccess)
UnoRuntime.queryInterface(XIndexAccess.class, oSheets); UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
try { try {
oSheet = (XSpreadsheet) oIndexSheets.getByIndex(0); oSheet = (XSpreadsheet) AnyConverter.toObject(
new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
} catch (com.sun.star.lang.WrappedTargetException e) { } catch (com.sun.star.lang.WrappedTargetException e) {
e.printStackTrace(log); e.printStackTrace(log);
throw new StatusException( "Couldn't get a spreadsheet", e); throw new StatusException( "Couldn't get a spreadsheet", e);
} catch (com.sun.star.lang.IndexOutOfBoundsException e) { } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
e.printStackTrace(log); e.printStackTrace(log);
throw new StatusException( "Couldn't get a spreadsheet", e); 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);
} }
// Getting named ranges. // Getting named ranges.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment