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 @@
*
* $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
* 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_CellAnnotationsEnumeration extends TestCase {
XSpreadsheetDocument xSheetDoc = null;
......@@ -122,13 +125,17 @@ public class ScIndexEnumeration_CellAnnotationsEnumeration 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");
......
......@@ -2,9 +2,9 @@
*
* $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
* either of the following licenses
......@@ -76,6 +76,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_CellAreaLinksEnumeration extends TestCase {
XSpreadsheetDocument xSheetDoc = null;
......@@ -118,7 +121,8 @@ public class ScIndexEnumeration_CellAreaLinksEnumeration extends TestCase {
// creation of testobject here
XPropertySet props = (XPropertySet)UnoRuntime.queryInterface
(XPropertySet.class, xSheetDoc);
oObj = (XInterface) props.getPropertyValue("AreaLinks") ;
oObj = (XInterface) AnyConverter.toObject(
new Type(XInterface.class),props.getPropertyValue("AreaLinks")) ;
XAreaLinks links = null ;
// adding one link into collection (for best testing)
......@@ -138,13 +142,17 @@ public class ScIndexEnumeration_CellAreaLinksEnumeration extends TestCase {
tEnv.addObjRelation("ENUM",ea);
} catch (com.sun.star.beans.UnknownPropertyException e) {
log.println ("Exception occured while creating test Object.") ;
e.printStackTrace(log) ;
throw new StatusException("Couldn't create test object", e);
log.println ("Exception occured while creating test Object.") ;
e.printStackTrace(log) ;
throw new StatusException("Couldn't create test object", e);
} catch (com.sun.star.lang.WrappedTargetException e) {
log.println ("Exception occured while creating test Object.") ;
e.printStackTrace(log) ;
throw new StatusException("Couldn't create test object", e);
log.println ("Exception occured while creating test Object.") ;
e.printStackTrace(log) ;
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 ;
......
......@@ -2,9 +2,9 @@
*
* $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
* either of the following licenses
......@@ -81,6 +81,9 @@ import lib.TestParameters;
import util.SOfficeFactory;
import util.utils;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Type;
public class ScIndexEnumeration_DDELinksEnumeration extends TestCase {
XSpreadsheetDocument xSheetDoc = null;
XComponent oDoc = null;
......@@ -161,13 +164,17 @@ public class ScIndexEnumeration_DDELinksEnumeration 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);
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);
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");
......@@ -191,7 +198,8 @@ public class ScIndexEnumeration_DDELinksEnumeration extends TestCase {
// Getting named ranges.
XPropertySet docProps = (XPropertySet)
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 - " +
((oObj == null) ? "FAILED" : "OK"));
} catch (com.sun.star.lang.WrappedTargetException e) {
......@@ -202,6 +210,10 @@ public class ScIndexEnumeration_DDELinksEnumeration 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) ;
}
XEnumerationAccess ea = (XEnumerationAccess)
......
......@@ -2,9 +2,9 @@
*
* $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
* either of the following licenses
......@@ -81,6 +81,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_DataPilotFieldsEnumeration extends TestCase {
XSpreadsheetDocument xSheetDoc = null;
......@@ -130,13 +133,17 @@ public class ScIndexEnumeration_DataPilotFieldsEnumeration 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);
}
try {
......
......@@ -2,9 +2,9 @@
*
* $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
* either of the following licenses
......@@ -81,6 +81,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_DataPilotTablesEnumeration extends TestCase {
XSpreadsheetDocument xSheetDoc = null;
......@@ -130,13 +133,17 @@ public class ScIndexEnumeration_DataPilotTablesEnumeration 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);
}
try {
......
......@@ -2,9 +2,9 @@
*
* $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
* either of the following licenses
......@@ -76,6 +76,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_DatabaseRangesEnumeration extends TestCase {
XSpreadsheetDocument xSheetDoc = null;
......@@ -122,8 +125,9 @@ public class ScIndexEnumeration_DatabaseRangesEnumeration extends TestCase {
XDatabaseRanges dbRanges = null;
try {
dbRanges = (XDatabaseRanges)
docProps.getPropertyValue("DatabaseRanges");
dbRanges = (XDatabaseRanges) AnyConverter.toObject(
new Type(XDatabaseRanges.class),
docProps.getPropertyValue("DatabaseRanges"));
} catch (com.sun.star.lang.WrappedTargetException e) {
e.printStackTrace(log) ;
throw new StatusException(
......@@ -132,6 +136,10 @@ public class ScIndexEnumeration_DatabaseRangesEnumeration 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) ;
}
log.println("Adding at least one element for ElementAccess interface");
......
......@@ -2,9 +2,9 @@
*
* $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
* 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_NamedRangesEnumeration extends TestCase {
XSpreadsheetDocument xSheetDoc = null;
......@@ -124,13 +127,17 @@ public class ScIndexEnumeration_NamedRangesEnumeration extends TestCase {
XIndexAccess oIndexSheets = (XIndexAccess)
UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
try {
oSheet = (XSpreadsheet) oIndexSheets.getByIndex(0);
oSheet = (XSpreadsheet) AnyConverter.toObject(
new Type(XSpreadsheet.class),oIndexSheets.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);
}
// 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