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

CHG: using AnyConverter instead of simple cast

üst 8405be31
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: SvxDrawPage.java,v $ * $RCSfile: SvxDrawPage.java,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change:$Date: 2003-01-27 18:18:10 $ * last change:$Date: 2003-02-06 10:50:52 $
* *
* 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.InstCreator; ...@@ -80,6 +80,9 @@ import util.InstCreator;
import util.SOfficeFactory; import util.SOfficeFactory;
import util.ShapeDsc; import util.ShapeDsc;
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.drawing.DrawPage</code>. <p> * <code>com.sun.star.drawing.DrawPage</code>. <p>
...@@ -151,7 +154,7 @@ public class SvxDrawPage extends TestCase { ...@@ -151,7 +154,7 @@ public class SvxDrawPage extends TestCase {
*/ */
protected void cleanup( TestParameters tParam, PrintWriter log ) { protected void cleanup( TestParameters tParam, PrintWriter log ) {
log.println( " disposing xSheetDoc " ); log.println( " disposing xSheetDoc " );
//xDoc.dispose(); ((XComponent) UnoRuntime.queryInterface(XComponent.class,xDoc)).dispose();
} }
...@@ -173,9 +176,7 @@ public class SvxDrawPage extends TestCase { ...@@ -173,9 +176,7 @@ public class SvxDrawPage extends TestCase {
* <code>com.sun.star.drawing.Line</code> service </li> * <code>com.sun.star.drawing.Line</code> service </li>
* </ul> * </ul>
*/ */
public TestEnvironment createTestEnvironment( TestParameters tParam, protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
PrintWriter log )
throws StatusException {
XInterface oObj = null; XInterface oObj = null;
XShape oShape = null ; XShape oShape = null ;
...@@ -193,7 +194,8 @@ public class SvxDrawPage extends TestCase { ...@@ -193,7 +194,8 @@ public class SvxDrawPage extends TestCase {
oDP = (XDrawPages) oDPS.getDrawPages(); oDP = (XDrawPages) oDPS.getDrawPages();
oDP.insertNewByIndex(1); oDP.insertNewByIndex(1);
oDP.insertNewByIndex(2); oDP.insertNewByIndex(2);
oObj = (XDrawPage) oDP.getByIndex(0); oObj = (XDrawPage) AnyConverter.toObject(
new Type(XDrawPage.class),oDP.getByIndex(0));
SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF());
...@@ -210,6 +212,10 @@ public class SvxDrawPage extends TestCase { ...@@ -210,6 +212,10 @@ public class SvxDrawPage extends TestCase {
log.println("Couldn't create insance"); log.println("Couldn't create insance");
e.printStackTrace(log); e.printStackTrace(log);
throw new StatusException("Can't create enviroment", e) ; throw new StatusException("Can't create enviroment", e) ;
} catch (com.sun.star.lang.IllegalArgumentException e) {
log.println("Couldn't create insance");
e.printStackTrace(log);
throw new StatusException("Can't create enviroment", e) ;
} }
// create test environment here // create test environment here
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: SwAccessibleFooterView.java,v $ * $RCSfile: SwAccessibleFooterView.java,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change: $Date: 2003-01-27 18:18:45 $ * last change: $Date: 2003-02-06 10:55:02 $
* *
* 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
...@@ -83,6 +83,9 @@ import util.AccessibilityTools; ...@@ -83,6 +83,9 @@ import util.AccessibilityTools;
import util.WriterTools; import util.WriterTools;
import util.utils; import util.utils;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Type;
/** /**
* Test of accessible object for a footer of a text document.<p> * Test of accessible object for a footer of a text document.<p>
* Object implements the following interfaces : * Object implements the following interfaces :
...@@ -122,14 +125,19 @@ public class SwAccessibleFooterView extends TestCase { ...@@ -122,14 +125,19 @@ public class SwAccessibleFooterView extends TestCase {
// obtains style 'Standard' from style family 'PageStyles' // obtains style 'Standard' from style family 'PageStyles'
try { try {
PageStyles = (XNameAccess) StyleFamNames.getByName("PageStyles"); PageStyles = (XNameAccess) AnyConverter.toObject(
StdStyle = (XStyle) PageStyles.getByName("Standard"); new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles"));
StdStyle = (XStyle) AnyConverter.toObject(
new Type(XStyle.class),PageStyles.getByName("Standard"));
} catch ( com.sun.star.lang.WrappedTargetException e ) { } catch ( com.sun.star.lang.WrappedTargetException e ) {
e.printStackTrace(log); e.printStackTrace(log);
throw new StatusException("Error getting style by name!", e); throw new StatusException("Error getting style by name!", e);
} catch ( com.sun.star.container.NoSuchElementException e ) { } catch ( com.sun.star.container.NoSuchElementException e ) {
e.printStackTrace(log); e.printStackTrace(log);
throw new StatusException("Error, no such style name! ", e); throw new StatusException("Error, no such style name! ", e);
} catch ( com.sun.star.lang.IllegalArgumentException e ) {
e.printStackTrace(log);
throw new StatusException("Error getting style by name!", e);
} }
final XPropertySet PropSet = (XPropertySet) final XPropertySet PropSet = (XPropertySet)
......
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