Kaydet (Commit) 4c6f4ff6 authored tarafından Stephan Wunderlich's avatar Stephan Wunderlich

CHG: using AnyConverter instead of simple cast

üst d95c5e7c
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScDataPilotTablesObj.java,v $ * $RCSfile: ScDataPilotTablesObj.java,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change:$Date: 2003-01-27 18:16:31 $ * last change:$Date: 2003-02-03 11:01:56 $
* *
* 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;
/** /**
* Test for object which is represented by service * Test for object which is represented by service
* <code>com.sun.star.sheet.DataPilotTables</code>. <p> * <code>com.sun.star.sheet.DataPilotTables</code>. <p>
...@@ -145,8 +148,7 @@ public class ScDataPilotTablesObj extends TestCase { ...@@ -145,8 +148,7 @@ public class ScDataPilotTablesObj extends TestCase {
* @see com.sun.star.sheet.DataPilotTable * @see com.sun.star.sheet.DataPilotTable
* @see com.sun.star.sheet.XDataPilotTablesSupplier * @see com.sun.star.sheet.XDataPilotTablesSupplier
*/ */
public synchronized TestEnvironment createTestEnvironment( protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
TestParameters Param, PrintWriter log) throws StatusException {
Object oInterface = null; Object oInterface = null;
XInterface oObj = null; XInterface oObj = null;
...@@ -165,15 +167,20 @@ public class ScDataPilotTablesObj extends TestCase { ...@@ -165,15 +167,20 @@ public class ScDataPilotTablesObj 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 {
log.println("Filing a table"); log.println("Filing a table");
for (int i = 1; i < 4; i++) { for (int i = 1; i < 4; i++) {
......
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