Kaydet (Commit) 124b013b authored tarafından Stephan Wunderlich's avatar Stephan Wunderlich

CHG: using AnyConverter instead of simple cast

üst 74bd8525
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScCellFieldObj.java,v $ * $RCSfile: ScCellFieldObj.java,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change:$Date: 2003-01-27 18:16:40 $ * last change:$Date: 2003-01-31 14:54:08 $
* *
* 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,8 @@ import lib.TestCase; ...@@ -78,6 +78,8 @@ import lib.TestCase;
import lib.TestEnvironment; 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;
/** /**
* Test for object that represents a text field (implements * Test for object that represents a text field (implements
...@@ -181,7 +183,8 @@ public class ScCellFieldObj extends TestCase { ...@@ -181,7 +183,8 @@ public class ScCellFieldObj extends TestCase {
XSpreadsheets oSheets = xSheetDoc.getSheets() ; XSpreadsheets oSheets = xSheetDoc.getSheets() ;
XIndexAccess oIndexSheets = (XIndexAccess) XIndexAccess oIndexSheets = (XIndexAccess)
UnoRuntime.queryInterface(XIndexAccess.class, oSheets); UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
XSpreadsheet oSheet = (XSpreadsheet)oIndexSheets.getByIndex(0); XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject(
new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
XCell oCell = oSheet.getCellByPosition(2,3); XCell oCell = oSheet.getCellByPosition(2,3);
oText = (XText)UnoRuntime.queryInterface(XText.class, oCell); oText = (XText)UnoRuntime.queryInterface(XText.class, oCell);
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScCellFieldsObj.java,v $ * $RCSfile: ScCellFieldsObj.java,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change:$Date: 2003-01-27 18:16:40 $ * last change:$Date: 2003-01-31 14:56:20 $
* *
* 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
...@@ -79,6 +79,8 @@ import lib.TestCase; ...@@ -79,6 +79,8 @@ import lib.TestCase;
import lib.TestEnvironment; 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;
/** /**
* Test for object that represents a colection of text fields * Test for object that represents a colection of text fields
...@@ -159,7 +161,8 @@ public class ScCellFieldsObj extends TestCase { ...@@ -159,7 +161,8 @@ public class ScCellFieldsObj extends TestCase {
XSpreadsheets oSheets = xSheetDoc.getSheets() ; XSpreadsheets oSheets = xSheetDoc.getSheets() ;
XIndexAccess oIndexSheets = (XIndexAccess) XIndexAccess oIndexSheets = (XIndexAccess)
UnoRuntime.queryInterface(XIndexAccess.class, oSheets); UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
XSpreadsheet oSheet = (XSpreadsheet)oIndexSheets.getByIndex(0); XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject(
new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
XCell oCell = oSheet.getCellByPosition(2,3); XCell oCell = oSheet.getCellByPosition(2,3);
oText = (XText)UnoRuntime.queryInterface(XText.class, oCell); oText = (XText)UnoRuntime.queryInterface(XText.class, oCell);
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScCellFormatsEnumeration.java,v $ * $RCSfile: ScCellFormatsEnumeration.java,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change:$Date: 2003-01-27 18:16:39 $ * last change:$Date: 2003-01-31 14:58:51 $
* *
* 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
...@@ -77,6 +77,9 @@ import lib.TestEnvironment; ...@@ -77,6 +77,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;
/** /**
* Test for object which is represented by service * Test for object which is represented by service
* <code>com.sun.star.sheet.CellFormatRangesEnumeration</code>. <p> * <code>com.sun.star.sheet.CellFormatRangesEnumeration</code>. <p>
...@@ -137,8 +140,7 @@ public class ScCellFormatsEnumeration extends TestCase { ...@@ -137,8 +140,7 @@ public class ScCellFormatsEnumeration extends TestCase {
* @see com.sun.star.sheet.XCellFormatRangesSupplier * @see com.sun.star.sheet.XCellFormatRangesSupplier
* @see com.sun.star.container.XEnumerationAccess * @see com.sun.star.container.XEnumerationAccess
*/ */
public synchronized TestEnvironment createTestEnvironment( protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
TestParameters Param, PrintWriter log) throws StatusException {
XInterface oInterface = null; XInterface oInterface = null;
XInterface oObj = null; XInterface oObj = null;
...@@ -152,13 +154,17 @@ public class ScCellFormatsEnumeration extends TestCase { ...@@ -152,13 +154,17 @@ public class ScCellFormatsEnumeration extends TestCase {
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("getting CellFormats"); log.println("getting CellFormats");
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScCellFormatsObj.java,v $ * $RCSfile: ScCellFormatsObj.java,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change:$Date: 2003-01-27 18:16:39 $ * last change:$Date: 2003-01-31 15:01:08 $
* *
* 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;
/** /**
* Test for object which is represented by service * Test for object which is represented by service
* <code>com.sun.star.sheet.CellFormatRanges</code>. <p> * <code>com.sun.star.sheet.CellFormatRanges</code>. <p>
...@@ -129,8 +132,7 @@ public class ScCellFormatsObj extends TestCase { ...@@ -129,8 +132,7 @@ public class ScCellFormatsObj extends TestCase {
* @see com.sun.star.sheet.CellFormatRanges * @see com.sun.star.sheet.CellFormatRanges
* @see com.sun.star.sheet.XCellFormatRangesSupplier * @see com.sun.star.sheet.XCellFormatRangesSupplier
*/ */
public synchronized TestEnvironment createTestEnvironment ( protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
TestParameters Param, PrintWriter log ) throws StatusException {
XInterface oInterface = null; XInterface oInterface = null;
XInterface oObj = null; XInterface oObj = null;
...@@ -143,13 +145,17 @@ public class ScCellFormatsObj extends TestCase { ...@@ -143,13 +145,17 @@ public class ScCellFormatsObj 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("getting CellFormats"); log.println("getting CellFormats");
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScCellObj.java,v $ * $RCSfile: ScCellObj.java,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change:$Date: 2003-01-27 18:16:39 $ * last change:$Date: 2003-01-31 15:04:32 $
* *
* 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 util.DefaultDsc; ...@@ -80,6 +80,9 @@ import util.DefaultDsc;
import util.InstCreator; import util.InstCreator;
import util.SOfficeFactory; import util.SOfficeFactory;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Type;
/** /**
* Test for object which is represented by service * Test for object which is represented by service
* <code>com.sun.star.sheet.SheetCell</code>. <p> * <code>com.sun.star.sheet.SheetCell</code>. <p>
...@@ -178,7 +181,8 @@ public class ScCellObj extends TestCase { ...@@ -178,7 +181,8 @@ public class ScCellObj extends TestCase {
XSpreadsheets oSheets = xSheetDoc.getSheets() ; XSpreadsheets oSheets = xSheetDoc.getSheets() ;
XIndexAccess oIndexSheets = (XIndexAccess) XIndexAccess oIndexSheets = (XIndexAccess)
UnoRuntime.queryInterface(XIndexAccess.class, oSheets); 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") ; log.println("Getting a cell from sheet") ;
oObj = oSheet.getCellByPosition(2, 3) ; oObj = oSheet.getCellByPosition(2, 3) ;
...@@ -190,6 +194,10 @@ public class ScCellObj extends TestCase { ...@@ -190,6 +194,10 @@ public class ScCellObj extends TestCase {
e.printStackTrace(log); e.printStackTrace(log);
throw new StatusException( throw new StatusException(
"Error getting cell object from spreadsheet document", e); "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);
} }
log.println( "creating a new environment for ScCellObj object" ); log.println( "creating a new environment for ScCellObj object" );
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScCellRangeObj.java,v $ * $RCSfile: ScCellRangeObj.java,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change:$Date: 2003-01-27 18:16:38 $ * last change:$Date: 2003-01-31 15:08:08 $
* *
* 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;
/** /**
* Test for object which is represented by service * Test for object which is represented by service
* <code>com.sun.star.sheet.SheetCellRange</code>. <p> * <code>com.sun.star.sheet.SheetCellRange</code>. <p>
...@@ -181,8 +184,9 @@ public class ScCellRangeObj extends TestCase { ...@@ -181,8 +184,9 @@ public class ScCellRangeObj extends TestCase {
XSpreadsheet oSheet = null; XSpreadsheet oSheet = null;
try { try {
oSheet = (XSpreadsheet) oSheet = (XSpreadsheet) AnyConverter.toObject(
oNames.getByName(oNames.getElementNames()[0]); new Type(XSpreadsheet.class),
oNames.getByName(oNames.getElementNames()[0]));
oObj = oSheet.getCellRangeByPosition( 0, 0, 3, 4 ); oObj = oSheet.getCellRangeByPosition( 0, 0, 3, 4 );
} catch(com.sun.star.lang.WrappedTargetException e) { } catch(com.sun.star.lang.WrappedTargetException e) {
...@@ -197,6 +201,10 @@ public class ScCellRangeObj extends TestCase { ...@@ -197,6 +201,10 @@ public class ScCellRangeObj extends TestCase {
e.printStackTrace(log); e.printStackTrace(log);
throw new StatusException( throw new StatusException(
"Error getting cell object from spreadsheet document", e); "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);
} }
TestEnvironment tEnv = new TestEnvironment( oObj ); TestEnvironment tEnv = new TestEnvironment( oObj );
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScCellRangesObj.java,v $ * $RCSfile: ScCellRangesObj.java,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change:$Date: 2003-01-27 18:16:38 $ * last change:$Date: 2003-01-31 15:12:26 $
* *
* 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
...@@ -77,6 +77,9 @@ import lib.TestEnvironment; ...@@ -77,6 +77,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;
/** /**
* Test for object which is represented by service * Test for object which is represented by service
* <code>com.sun.star.sheet.SheetCellRanges</code>. <p> * <code>com.sun.star.sheet.SheetCellRanges</code>. <p>
...@@ -192,7 +195,8 @@ public class ScCellRangesObj extends TestCase { ...@@ -192,7 +195,8 @@ public class ScCellRangesObj extends TestCase {
UnoRuntime.queryInterface (XIndexAccess.class, oSheets); UnoRuntime.queryInterface (XIndexAccess.class, oSheets);
XSpreadsheet oSheet = null; XSpreadsheet oSheet = null;
try { try {
oSheet = (XSpreadsheet) oIndSheets.getByIndex(0); oSheet = (XSpreadsheet) AnyConverter.toObject(
new Type(XSpreadsheet.class), oIndSheets.getByIndex(0));
XNameContainer oRanges = (XNameContainer) XNameContainer oRanges = (XNameContainer)
UnoRuntime.queryInterface(XNameContainer.class, oObj); UnoRuntime.queryInterface(XNameContainer.class, oObj);
...@@ -245,7 +249,10 @@ public class ScCellRangesObj extends TestCase { ...@@ -245,7 +249,10 @@ public class ScCellRangesObj extends TestCase {
// INSTANCEn : _XNameContainer; _XNameReplace // INSTANCEn : _XNameContainer; _XNameReplace
log.println( "adding INSTANCEn as mod relation to environment" ); log.println( "adding INSTANCEn as mod relation to environment" );
int THRCNT = Integer.parseInt((String)Param.get("THRCNT")); int THRCNT = 1;
if ((String)Param.get("THRCNT") != null) {
THRCNT= Integer.parseInt((String)Param.get("THRCNT"));
}
int a = 0; int a = 0;
int b = 0; int b = 0;
for (int n = 1; n < (THRCNT + 1) ; n++) { for (int n = 1; n < (THRCNT + 1) ; n++) {
......
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