summaryrefslogtreecommitdiff
path: root/qadevOOo/tests/java/mod/_sd
diff options
context:
space:
mode:
Diffstat (limited to 'qadevOOo/tests/java/mod/_sd')
-rw-r--r--qadevOOo/tests/java/mod/_sd/AccessibleDrawDocumentView.java183
-rw-r--r--qadevOOo/tests/java/mod/_sd/AccessibleOutlineView.java182
-rw-r--r--qadevOOo/tests/java/mod/_sd/AccessibleSlideView.java191
-rw-r--r--qadevOOo/tests/java/mod/_sd/DrawController_DrawView.java303
-rw-r--r--qadevOOo/tests/java/mod/_sd/DrawController_HandoutView.java337
-rw-r--r--qadevOOo/tests/java/mod/_sd/DrawController_NotesView.java334
-rw-r--r--qadevOOo/tests/java/mod/_sd/DrawController_OutlineView.java334
-rw-r--r--qadevOOo/tests/java/mod/_sd/DrawController_PresentationView.java334
-rw-r--r--qadevOOo/tests/java/mod/_sd/SdDocLinkTargets.java111
-rw-r--r--qadevOOo/tests/java/mod/_sd/SdDrawPage.java216
-rw-r--r--qadevOOo/tests/java/mod/_sd/SdDrawPagesAccess.java129
-rw-r--r--qadevOOo/tests/java/mod/_sd/SdGenericDrawPage.java189
-rw-r--r--qadevOOo/tests/java/mod/_sd/SdLayer.java139
-rw-r--r--qadevOOo/tests/java/mod/_sd/SdLayerManager.java171
-rw-r--r--qadevOOo/tests/java/mod/_sd/SdMasterPage.java194
-rw-r--r--qadevOOo/tests/java/mod/_sd/SdMasterPagesAccess.java122
-rw-r--r--qadevOOo/tests/java/mod/_sd/SdPageLinkTargets.java153
-rw-r--r--qadevOOo/tests/java/mod/_sd/SdUnoDrawView.java299
-rw-r--r--qadevOOo/tests/java/mod/_sd/SdUnoOutlineView.java246
-rw-r--r--qadevOOo/tests/java/mod/_sd/SdUnoPresView.java301
-rw-r--r--qadevOOo/tests/java/mod/_sd/SdUnoSlideView.java222
-rw-r--r--qadevOOo/tests/java/mod/_sd/SdXCustomPresentation.java243
-rw-r--r--qadevOOo/tests/java/mod/_sd/SdXCustomPresentationAccess.java212
-rw-r--r--qadevOOo/tests/java/mod/_sd/SdXImpressDocument.java199
-rw-r--r--qadevOOo/tests/java/mod/_sd/SdXPresentation.java164
-rw-r--r--qadevOOo/tests/java/mod/_sd/SdXShape.java219
-rw-r--r--qadevOOo/tests/java/mod/_sd/package.html6
27 files changed, 5733 insertions, 0 deletions
diff --git a/qadevOOo/tests/java/mod/_sd/AccessibleDrawDocumentView.java b/qadevOOo/tests/java/mod/_sd/AccessibleDrawDocumentView.java
new file mode 100644
index 000000000000..b6f6bc4c881d
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/AccessibleDrawDocumentView.java
@@ -0,0 +1,183 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.DrawTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.XWindow;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.drawing.XDrawView;
+import com.sun.star.drawing.XShape;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class AccessibleDrawDocumentView extends TestCase {
+
+ XComponent xDrawDoc;
+
+ /**
+ * Called to create an instance of <code>TestEnvironment</code> with an
+ * object to test and related objects. Subclasses should implement this
+ * method to provide the implementation and related objects. The method is
+ * called from <code>getTestEnvironment()</code>.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see TestEnvironment
+ * @see #getTestEnvironment()
+ */
+ protected TestEnvironment createTestEnvironment
+ (TestParameters Param, PrintWriter log) {
+ XInterface oObj = null;
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ // get the drawpage of drawing here
+ log.println( "getting Drawpage" );
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class, xDrawDoc);
+ XDrawPages oDPn = oDPS.getDrawPages();
+ final XDrawPage fDP2 = oDPn.insertNewByIndex(1);
+ XIndexAccess oDPi = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oDPn);
+ XDrawPage oDP = null;
+ try {
+ oDP = (XDrawPage) AnyConverter.toObject(
+ new Type(XDrawPage.class),oDPi.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get by index", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get by index", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get by index", e);
+ }
+
+ //get a Shape
+ log.println( "inserting a Shape" );
+ XShape oShape = SOF.createShape(xDrawDoc, 5000, 3500, 7500, 5000, "Rectangle");
+ DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape);
+
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xDrawDoc);
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XWindow xWindow = at.getCurrentWindow (
+ (XMultiServiceFactory)Param.getMSF(),aModel);
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ //com.sun.star.accessibility.AccessibleRole
+ at.getAccessibleObjectForRole(xRoot, AccessibleRole.DOCUMENT);
+
+ oObj = AccessibilityTools.SearchedContext;
+
+ log.println("ImplementationName "+utils.getImplName(oObj));
+
+ at.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ final XDrawView xView = (XDrawView) UnoRuntime.queryInterface
+ (XDrawView.class, aModel.getCurrentController()) ;
+ final XDrawPage fDP1 = oDP;
+
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
+ public void fireEvent() {
+ xView.setCurrentPage(fDP2);
+ xView.setCurrentPage(fDP1);
+ }
+ });
+
+ return tEnv;
+
+ }
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes Impress documents.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing Draw document");
+ util.DesktopTools.closeDoc(xDrawDoc);;
+ }
+
+ /**
+ * Called while the <code>TestCase</code> initialization. In the
+ * implementation does nothing. Subclasses can override to initialize
+ * objects shared among all <code>TestEnvironment</code>s.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see #initializeTestCase()
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println( "creating a draw document" );
+ xDrawDoc = SOF.createDrawDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't create document", e);
+ }
+ }
+
+}
diff --git a/qadevOOo/tests/java/mod/_sd/AccessibleOutlineView.java b/qadevOOo/tests/java/mod/_sd/AccessibleOutlineView.java
new file mode 100644
index 000000000000..a486bada5987
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/AccessibleOutlineView.java
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.XWindow;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.URL;
+import com.sun.star.util.XURLTransformer;
+
+public class AccessibleOutlineView extends TestCase {
+
+ XModel aModel = null;
+ XComponent xImpressDoc = null;
+
+ /**
+ * Called to create an instance of <code>TestEnvironment</code> with an
+ * object to test and related objects. Subclasses should implement this
+ * method to provide the implementation and related objects. The method is
+ * called from <code>getTestEnvironment()</code>.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see TestEnvironment
+ * @see #getTestEnvironment()
+ */
+ protected TestEnvironment createTestEnvironment
+ (TestParameters Param, PrintWriter log) {
+ XInterface oObj = null;
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XWindow xWindow = at.getCurrentWindow (
+ (XMultiServiceFactory)Param.getMSF(),aModel);
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ at.getAccessibleObjectForRole(xRoot, AccessibleRole.DOCUMENT);
+
+ oObj = AccessibilityTools.SearchedContext;
+
+ log.println("ImplementationName "+utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class, aModel);
+ final XDrawPages oDPn = oDPS.getDrawPages();
+
+ tEnv.addObjRelation("EventMsg","Inserting a drawpage via API has no "+
+ "effect to the outline view #101050# \r\n"+
+ "Therefore the listener isn't called");
+
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
+ public void fireEvent() {
+ oDPn.insertNewByIndex(1);
+ }
+ });
+
+ return tEnv;
+
+ }
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes Impress documents.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log ) {
+ log.println("disposing Impress document");
+ util.DesktopTools.closeDoc(xImpressDoc);;
+ }
+
+ /**
+ * Called while the <code>TestCase</code> initialization. In the
+ * implementation does nothing. Subclasses can override to initialize
+ * objects shared among all <code>TestEnvironment</code>s.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see #initializeTestCase()
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println( "creating a impress document" );
+ xImpressDoc = SOF.createImpressDoc(null);
+ shortWait();
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xImpressDoc);
+
+ XInterface oObj = aModel.getCurrentController();
+
+ //Change to Outline view
+ try {
+ String aSlotID = "slot:27010";
+ XDispatchProvider xDispProv = (XDispatchProvider)
+ UnoRuntime.queryInterface( XDispatchProvider.class, oObj );
+ XURLTransformer xParser = (com.sun.star.util.XURLTransformer)
+ UnoRuntime.queryInterface(XURLTransformer.class,
+ ((XMultiServiceFactory)Param.getMSF()).
+ createInstance("com.sun.star.util.URLTransformer"));
+ // Because it's an in/out parameter we must use an array of URL objects.
+ URL[] aParseURL = new URL[1];
+ aParseURL[0] = new URL();
+ aParseURL[0].Complete = aSlotID;
+ xParser.parseStrict(aParseURL);
+ URL aURL = aParseURL[0];
+ XDispatch xDispatcher = xDispProv.queryDispatch( aURL,"",0);
+ if( xDispatcher != null )
+ xDispatcher.dispatch( aURL, null );
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't change mode");
+ }
+ shortWait();
+ }
+
+ private void shortWait() {
+ try {
+ Thread.sleep(2000) ;
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e) ;
+ }
+ }
+}
+
diff --git a/qadevOOo/tests/java/mod/_sd/AccessibleSlideView.java b/qadevOOo/tests/java/mod/_sd/AccessibleSlideView.java
new file mode 100644
index 000000000000..31c00288a561
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/AccessibleSlideView.java
@@ -0,0 +1,191 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.XWindow;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.URL;
+import com.sun.star.util.XURLTransformer;
+
+public class AccessibleSlideView extends TestCase {
+
+ XModel aModel = null;
+ XComponent xImpressDoc = null;
+
+ /**
+ * Called to create an instance of <code>TestEnvironment</code> with an
+ * object to test and related objects. Subclasses should implement this
+ * method to provide the implementation and related objects. The method is
+ * called from <code>getTestEnvironment()</code>.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see TestEnvironment
+ * @see #getTestEnvironment()
+ */
+ protected TestEnvironment createTestEnvironment
+ (TestParameters Param, PrintWriter log) {
+ XInterface oObj = null;
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class, aModel);
+ XDrawPages oDPn = oDPS.getDrawPages();
+
+ oDPn.insertNewByIndex(0);
+
+ shortWait();
+
+ XWindow xWindow = at.getCurrentWindow (
+ (XMultiServiceFactory)Param.getMSF(),aModel);
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ at.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
+
+ at.getAccessibleObjectForRole(xRoot, AccessibleRole.DOCUMENT);
+
+ oObj = AccessibilityTools.SearchedContext;
+
+ System.out.println("ImplementationName "+utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ //util.dbg.printInterfaces(oObj);
+ log.println("Implementationname: "+util.utils.getImplName(oObj));
+
+ final XDrawPages DrawPages = oDPn;
+
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
+ public void fireEvent() {
+ DrawPages.insertNewByIndex(2);
+ }
+ });
+
+ return tEnv;
+
+ }
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes Impress documents.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log ) {
+ log.println("disposing impress document");
+ util.DesktopTools.closeDoc(xImpressDoc);;
+ }
+
+ /**
+ * Called while the <code>TestCase</code> initialization. In the
+ * implementation does nothing. Subclasses can override to initialize
+ * objects shared among all <code>TestEnvironment</code>s.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see #initializeTestCase()
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println( "creating a impress document" );
+ xImpressDoc = SOF.createImpressDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ shortWait();
+
+ aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xImpressDoc);
+
+ //Change to Outline view
+ try {
+ String aSlotID = "slot:27011";
+ XDispatchProvider xDispProv = (XDispatchProvider)
+ UnoRuntime.queryInterface( XDispatchProvider.class,
+ aModel.getCurrentController() );
+ XURLTransformer xParser = (com.sun.star.util.XURLTransformer)
+ UnoRuntime.queryInterface(XURLTransformer.class,
+ ((XMultiServiceFactory)Param.getMSF()).
+ createInstance("com.sun.star.util.URLTransformer"));
+ // Because it's an in/out parameter we must use an array of URL objects.
+ URL[] aParseURL = new URL[1];
+ aParseURL[0] = new URL();
+ aParseURL[0].Complete = aSlotID;
+ xParser.parseStrict(aParseURL);
+ URL aURL = aParseURL[0];
+ XDispatch xDispatcher = xDispProv.queryDispatch( aURL,"",0);
+ if( xDispatcher != null )
+ xDispatcher.dispatch( aURL, null );
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't change mode");
+ }
+
+ shortWait();
+
+ }
+
+ private void shortWait() {
+ try {
+ Thread.sleep(2000) ;
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e) ;
+ }
+ }
+}
+
diff --git a/qadevOOo/tests/java/mod/_sd/DrawController_DrawView.java b/qadevOOo/tests/java/mod/_sd/DrawController_DrawView.java
new file mode 100644
index 000000000000..be510ff1f98c
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/DrawController_DrawView.java
@@ -0,0 +1,303 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+import java.util.Comparator;
+
+import lib.Status;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.DesktopTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.awt.XWindow;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.drawing.XShape;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.XModifiable;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.drawing.DrawingDocumentDrawView</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::drawing::DrawingDocumentDrawView</code></li>
+* <li> <code>com::sun::star::lang::XComponent</code></li>
+* <li> <code>com::sun::star::lang::XServiceInfo</code></li>
+* <li> <code>com::sun::star::frame::XController</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::view::XSelectionSupplier</code></li>
+* <li> <code>com::sun::star::drawing::XDrawView</code></li>
+* </ul>
+* @see com.sun.star.drawing.DrawingDocumentDrawView
+* @see com.sun.star.lang.XComponent
+* @see com.sun.star.lang.XServiceInfo
+* @see com.sun.star.frame.XController
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.view.XSelectionSupplier
+* @see com.sun.star.drawing.XDrawView
+* @see ifc.drawing._DrawingDocumentDrawView
+* @see ifc.lang._XComponent
+* @see ifc.lang._XServiceInfo
+* @see ifc.frame._XController
+* @see ifc.beans._XPropertySet
+* @see ifc.view._XSelectionSupplier
+* @see ifc.drawing._XDrawView
+*/
+public class DrawController_DrawView extends TestCase {
+ static XComponent xDrawDoc;
+ static XComponent xSecondDrawDoc;
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes Impress documents.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing impress documents");
+ util.DesktopTools.closeDoc(xDrawDoc);
+ util.DesktopTools.closeDoc(xSecondDrawDoc);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates two impress documents. After creating
+ * of the documents makes short
+ * wait to allow frames to be loaded. Retrieves
+ * the collection of the draw pages
+ * from the first document and takes one of them. Inserts some shapes to the
+ * retrieved draw page. Obtains a current controller from the first document
+ * using the interface <code>XModel</code>. The obtained controller is the
+ * instance of the service
+ * <code>com.sun.star.drawing.DrawingDocumentDrawView</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'Pages'</code> for
+ * {@link ifc.drawing._XDrawView}(the retrieved collection of the draw
+ * pages) </li>
+ * <li> <code>'FirstModel'</code> for
+ * {@link ifc.frame._XController}(the interface <code>XModel</code> of
+ * the first created document) </li>
+ * <li> <code>'Frame'</code> for
+ * {@link ifc.frame._XController}(the frame of the created
+ * document) </li>
+ * <li> <code>'SecondModel'</code> for
+ * {@link ifc.frame._XController}(the interface <code>XModel</code> of
+ * the second created document) </li>
+ * <li> <code>'SecondController'</code> for
+ * {@link ifc.frame._XController}(the current controller of the second
+ * created document) </li>
+ * <li> <code>'DrawPage'</code> for
+ * {@link ifc.drawing.DrawingDocumentDrawView}(the draw page which will
+ * be new current page) </li>
+ * </ul>
+ * @see com.sun.star.frame.XModel
+ * @see com.sun.star.drawing.DrawingDocumentDrawView
+ */
+ protected synchronized TestEnvironment createTestEnvironment
+ (TestParameters Param, PrintWriter log) {
+
+ log.println( "creating a test environment" );
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println( "creating two impress documents" );
+ xDrawDoc = SOF.createDrawDoc(null);
+ shortWait();
+ xSecondDrawDoc = SOF.createDrawDoc(null);
+ shortWait();
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ // get the drawpage of drawing here
+ log.println( "getting Drawpage" );
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class, xDrawDoc);
+ XDrawPages the_pages = oDPS.getDrawPages();
+ XIndexAccess oDPi = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class,the_pages);
+
+ XDrawPage oDrawPage = null;
+ try {
+ oDrawPage = (XDrawPage) AnyConverter.toObject(
+ new Type(XDrawPage.class),oDPi.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ }
+
+ //put something on the drawpage
+ log.println( "inserting some Shapes" );
+ XShapes oShapes = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class, oDrawPage);
+ XShape shape1 = SOF.createShape(
+ xDrawDoc, 3000, 4500, 15000, 1000, "Ellipse");
+ XShape shape2 = SOF.createShape(
+ xDrawDoc, 5000, 3500, 7500, 5000, "Rectangle");
+ XShape shape3 = SOF.createShape(
+ xDrawDoc, 3000, 500, 5000, 1000, "Line");
+ oShapes.add(shape1);
+ oShapes.add(shape2);
+ oShapes.add(shape3);
+ shortWait();
+
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xDrawDoc);
+
+ XInterface oObj = aModel.getCurrentController();
+
+ XModel aModel2 = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSecondDrawDoc);
+ XController aController2 = aModel2.getCurrentController();
+
+ XWindow anotherWindow = (XWindow) UnoRuntime.queryInterface(
+ XWindow.class, aController2);
+
+ log.println( "creating a new environment for impress view object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ if (anotherWindow != null) {
+ tEnv.addObjRelation("XWindow.AnotherWindow",anotherWindow);
+ }
+
+ Object oShapeCol1 = null;
+ Object oShapeCol2 = null;
+ try {
+ oShapeCol1 = ((XMultiServiceFactory)Param.getMSF()).
+ createInstance("com.sun.star.drawing.ShapeCollection");
+ oShapeCol2 = ((XMultiServiceFactory)Param.getMSF()).
+ createInstance("com.sun.star.drawing.ShapeCollection");
+ } catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException(Status.failed("Couldn't create instance"));
+ }
+
+ XShapes xShapes1 = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class, oShapeCol1);
+ XShapes xShapes2 = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class, oShapeCol2);
+ xShapes1.add(shape2);
+ xShapes1.add(shape3);
+ xShapes2.add(shape1);
+ shortWait();
+
+
+ tEnv.addObjRelation("Selections", new Object[] {
+ oDrawPage, oShapeCol1, oShapeCol2});
+ tEnv.addObjRelation("Comparer", new Comparator() {
+ public int compare(Object o1, Object o2) {
+ XIndexAccess indAc1 = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, o1);
+ XIndexAccess indAc2 = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, o2);
+ if (indAc1 == null || indAc2 == null) return -1;
+ if (indAc1.getCount() == indAc2.getCount()) {
+ return 0;
+ }
+ return 1;
+ }
+ public boolean equals(Object obj) {
+ return compare(this, obj) == 0;
+ } });
+
+
+
+ tEnv.addObjRelation("Pages", the_pages);
+
+ //Adding ObjRelations for XController
+ tEnv.addObjRelation("FirstModel", aModel);
+
+ tEnv.addObjRelation("XUserInputInterception.XModel", aModel);
+
+ XFrame the_frame = aController2.getFrame();
+ tEnv.addObjRelation("Frame", the_frame);
+
+ //Adding ObjRelations for XController
+ tEnv.addObjRelation("SecondModel", aModel2);
+
+ tEnv.addObjRelation("SecondController", aController2);
+ tEnv.addObjRelation("XDispatchProvider.URL",
+ "slot:27009");
+
+ //Adding relations for DrawingDocumentDrawView
+ XDrawPage new_page = the_pages.insertNewByIndex(1);
+ tEnv.addObjRelation("DrawPage", new_page);
+
+ log.println("Implementation Name: "+utils.getImplName(oObj));
+
+ XModifiable modify = (XModifiable)
+ UnoRuntime.queryInterface(XModifiable.class,xDrawDoc);
+
+ tEnv.addObjRelation("Modifiable",modify);
+
+ tEnv.addObjRelation("XComponent.DisposeThis", xDrawDoc);
+
+ return tEnv;
+
+ } // finish method getTestEnvironment
+
+ private void shortWait() {
+ try {
+ Thread.sleep(1000) ;
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e) ;
+ }
+ }
+
+
+}
+
diff --git a/qadevOOo/tests/java/mod/_sd/DrawController_HandoutView.java b/qadevOOo/tests/java/mod/_sd/DrawController_HandoutView.java
new file mode 100644
index 000000000000..40244836da1e
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/DrawController_HandoutView.java
@@ -0,0 +1,337 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+import java.util.Comparator;
+
+import lib.Status;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.DesktopTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.awt.XWindow;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.drawing.XShape;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.XModifiable;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.drawing.DrawingDocumentDrawView</code>. <p>
+* The view was switched to <b>HandoutMode</b>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::drawing::DrawingDocumentDrawView</code></li>
+* <li> <code>com::sun::star::lang::XComponent</code></li>
+* <li> <code>com::sun::star::lang::XServiceInfo</code></li>
+* <li> <code>com::sun::star::frame::XController</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::view::XSelectionSupplier</code></li>
+* <li> <code>com::sun::star::drawing::XDrawView</code></li>
+* </ul>
+* @see com.sun.star.drawing.DrawingDocumentDrawView
+* @see com.sun.star.lang.XComponent
+* @see com.sun.star.lang.XServiceInfo
+* @see com.sun.star.frame.XController
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.view.XSelectionSupplier
+* @see com.sun.star.drawing.XDrawView
+* @see ifc.drawing._DrawingDocumentDrawView
+* @see ifc.lang._XComponent
+* @see ifc.lang._XServiceInfo
+* @see ifc.frame._XController
+* @see ifc.beans._XPropertySet
+* @see ifc.view._XSelectionSupplier
+* @see ifc.drawing._XDrawView
+*/
+public class DrawController_HandoutView extends TestCase {
+ static XDesktop the_Desk;
+ static XComponent xDrawDoc;
+ static XComponent xSecondDrawDoc;
+
+ /**
+ * Creates the instance of the service
+ * <code>com.sun.star.frame.Desktop</code>.
+ * @see com.sun.star.frame.Desktop
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ the_Desk = (XDesktop)
+ UnoRuntime.queryInterface(
+ XDesktop.class, DesktopTools.createDesktop(
+ (XMultiServiceFactory)Param.getMSF()) );
+ }
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes Impress documents.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing impress documents");
+ util.DesktopTools.closeDoc(xDrawDoc);
+ util.DesktopTools.closeDoc(xSecondDrawDoc);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates two impress documents. After creating
+ * of the documents makes short
+ * wait to allow frames to be loaded. Retrieves
+ * the collection of the draw pages
+ * from the first document and takes one of them. Inserts some shapes to the
+ * retrieved draw page.
+ * Switch to the <b>HandoutMode</b>.
+ * Obtains a current controller from the first document
+ * using the interface <code>XModel</code>. The obtained controller is the
+ * instance of the service
+ * <code>com.sun.star.drawing.DrawingDocumentDrawView</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'Pages'</code> for
+ * {@link ifc.drawing._XDrawView}(the retrieved collection of the draw
+ * pages) </li>
+ * <li> <code>'FirstModel'</code> for
+ * {@link ifc.frame._XController}(the interface <code>XModel</code> of
+ * the first created document) </li>
+ * <li> <code>'Frame'</code> for
+ * {@link ifc.frame._XController}(the frame of the created
+ * document) </li>
+ * <li> <code>'SecondModel'</code> for
+ * {@link ifc.frame._XController}(the interface <code>XModel</code> of
+ * the second created document) </li>
+ * <li> <code>'SecondController'</code> for
+ * {@link ifc.frame._XController}(the current controller of the second
+ * created document) </li>
+ * <li> <code>'DrawPage'</code> for
+ * {@link ifc.drawing.DrawingDocumentDrawView}(the draw page which will
+ * be new current page) </li>
+ * </ul>
+ * @see com.sun.star.frame.XModel
+ * @see com.sun.star.drawing.DrawingDocumentDrawView
+ */
+ protected synchronized TestEnvironment createTestEnvironment
+ (TestParameters Param, PrintWriter log) {
+
+ log.println( "creating a test environment" );
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)Param.getMSF();
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(xMSF);
+
+ try {
+ log.println( "creating two impress documents" );
+ xSecondDrawDoc = SOF.createImpressDoc(null);
+ shortWait();
+ xDrawDoc = SOF.createImpressDoc(null);
+ shortWait();
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ // get the drawpage of drawing here
+ log.println( "getting Drawpage" );
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class, xDrawDoc);
+ XDrawPages the_pages = oDPS.getDrawPages();
+ for (int i = 1; i < 10; i++){
+ the_pages.insertNewByIndex(i);
+ }
+ XIndexAccess oDPi = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class,the_pages);
+
+ XDrawPage oDrawPage = null;
+ try {
+ oDrawPage = (XDrawPage) AnyConverter.toObject(
+ new Type(XDrawPage.class),oDPi.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ }
+
+ //put something on the drawpage
+ log.println( "inserting some Shapes" );
+ XShapes oShapes = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class, oDrawPage);
+ XShape shape1 = SOF.createShape(
+ xDrawDoc, 3000, 4500, 15000, 1000, "Ellipse");
+ XShape shape2 = SOF.createShape(
+ xDrawDoc, 5000, 3500, 7500, 5000, "Rectangle");
+ XShape shape3 = SOF.createShape(
+ xDrawDoc, 3000, 500, 5000, 1000, "Line");
+ oShapes.add(shape1);
+ oShapes.add(shape2);
+ oShapes.add(shape3);
+ shortWait();
+
+ log.println("switch to HandoutView...");
+ try{
+ utils.dispatchURL(xMSF, xDrawDoc, ".uno:HandoutMode");
+ } catch (Exception e){
+ e.printStackTrace(log);
+ throw new StatusException(Status.failed(e.toString()));
+ }
+
+ utils.shortWait(500);
+
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xDrawDoc);
+
+ XInterface oObj = aModel.getCurrentController();
+
+ log.println("bring first document to front...");
+ DesktopTools.bringWindowToFront(aModel);
+
+ XModel aModel2 = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSecondDrawDoc);
+
+ XWindow anotherWindow = (XWindow) UnoRuntime.queryInterface(
+ XWindow.class,aModel2.getCurrentController());
+
+ log.println( "creating a new environment for impress view object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ if (anotherWindow != null) {
+ tEnv.addObjRelation("XWindow.AnotherWindow",anotherWindow);
+ }
+
+ Object oShapeCol1 = null;
+ Object oShapeCol2 = null;
+ try {
+ oShapeCol1 = xMSF.
+ createInstance("com.sun.star.drawing.ShapeCollection");
+ oShapeCol2 = xMSF.
+ createInstance("com.sun.star.drawing.ShapeCollection");
+ } catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException(Status.failed("Couldn't create instance"));
+ }
+
+ XShapes xShapes1 = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class, oShapeCol1);
+ XShapes xShapes2 = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class, oShapeCol2);
+ xShapes1.add(shape2);
+ xShapes1.add(shape3);
+ xShapes2.add(shape1);
+ shortWait();
+
+ tEnv.addObjRelation("Selections", new Object[] {
+ oDrawPage, oShapeCol1, oShapeCol2});
+ tEnv.addObjRelation("Comparer", new Comparator() {
+ public int compare(Object o1, Object o2) {
+ XIndexAccess indAc1 = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, o1);
+ XIndexAccess indAc2 = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, o2);
+ if (indAc1 == null || indAc2 == null) return -1;
+ if (indAc1.getCount() == indAc2.getCount()) {
+ return 0;
+ }
+ return 1;
+ }
+ public boolean equals(Object obj) {
+ return compare(this, obj) == 0;
+ } });
+
+
+
+ tEnv.addObjRelation("Pages", the_pages);
+
+ //Adding ObjRelations for XController
+ tEnv.addObjRelation("FirstModel", aModel);
+
+ tEnv.addObjRelation("XUserInputInterception.XModel", aModel);
+
+ XFrame the_frame = the_Desk.getCurrentFrame();
+ tEnv.addObjRelation("Frame", the_frame);
+
+ aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSecondDrawDoc);
+ //Adding ObjRelations for XController
+ tEnv.addObjRelation("SecondModel", aModel);
+
+ XController secondController = aModel.getCurrentController();
+ tEnv.addObjRelation("SecondController", secondController);
+ tEnv.addObjRelation("XDispatchProvider.URL",
+ "slot:27009");
+
+ //Adding relations for DrawingDocumentDrawView
+ XDrawPage new_page = the_pages.insertNewByIndex(1);
+ tEnv.addObjRelation("DrawPage", new_page);
+
+ log.println("Implementation Name: "+utils.getImplName(oObj));
+
+ XModifiable modify = (XModifiable)
+ UnoRuntime.queryInterface(XModifiable.class,xDrawDoc);
+
+ tEnv.addObjRelation("Modifiable",modify);
+
+ tEnv.addObjRelation("XComponent.DisposeThis", xDrawDoc);
+
+
+ return tEnv;
+
+ } // finish method getTestEnvironment
+
+ private void shortWait() {
+ try {
+ Thread.sleep(1000) ;
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e) ;
+ }
+ }
+
+
+}
+
diff --git a/qadevOOo/tests/java/mod/_sd/DrawController_NotesView.java b/qadevOOo/tests/java/mod/_sd/DrawController_NotesView.java
new file mode 100644
index 000000000000..73445b3d33c7
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/DrawController_NotesView.java
@@ -0,0 +1,334 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+import java.util.Comparator;
+
+import lib.Status;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.DesktopTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.awt.XWindow;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.drawing.XShape;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.XModifiable;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.drawing.DrawingDocumentDrawView</code>. <p>
+* The view was switched to <b>NotesMode</b>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::drawing::DrawingDocumentDrawView</code></li>
+* <li> <code>com::sun::star::lang::XComponent</code></li>
+* <li> <code>com::sun::star::lang::XServiceInfo</code></li>
+* <li> <code>com::sun::star::frame::XController</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::view::XSelectionSupplier</code></li>
+* <li> <code>com::sun::star::drawing::XDrawView</code></li>
+* </ul>
+* @see com.sun.star.drawing.DrawingDocumentDrawView
+* @see com.sun.star.lang.XComponent
+* @see com.sun.star.lang.XServiceInfo
+* @see com.sun.star.frame.XController
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.view.XSelectionSupplier
+* @see com.sun.star.drawing.XDrawView
+* @see ifc.drawing._DrawingDocumentDrawView
+* @see ifc.lang._XComponent
+* @see ifc.lang._XServiceInfo
+* @see ifc.frame._XController
+* @see ifc.beans._XPropertySet
+* @see ifc.view._XSelectionSupplier
+* @see ifc.drawing._XDrawView
+*/
+public class DrawController_NotesView extends TestCase {
+ static XDesktop the_Desk;
+ static XComponent xDrawDoc;
+ static XComponent xSecondDrawDoc;
+
+ /**
+ * Creates the instance of the service
+ * <code>com.sun.star.frame.Desktop</code>.
+ * @see com.sun.star.frame.Desktop
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ the_Desk = (XDesktop)
+ UnoRuntime.queryInterface(
+ XDesktop.class, DesktopTools.createDesktop(
+ (XMultiServiceFactory)Param.getMSF()) );
+ }
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes Impress documents.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing impress documents");
+ util.DesktopTools.closeDoc(xDrawDoc);
+ util.DesktopTools.closeDoc(xSecondDrawDoc);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates two impress documents. After creating
+ * of the documents makes short
+ * wait to allow frames to be loaded. Retrieves
+ * the collection of the draw pages
+ * from the first document and takes one of them. Inserts some shapes to the
+ * retrieved draw page.
+ * Switch to the <b>NotesMode</b>.
+ * Obtains a current controller from the first document
+ * using the interface <code>XModel</code>. The obtained controller is the
+ * instance of the service
+ * <code>com.sun.star.drawing.DrawingDocumentDrawView</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'Pages'</code> for
+ * {@link ifc.drawing._XDrawView}(the retrieved collection of the draw
+ * pages) </li>
+ * <li> <code>'FirstModel'</code> for
+ * {@link ifc.frame._XController}(the interface <code>XModel</code> of
+ * the first created document) </li>
+ * <li> <code>'Frame'</code> for
+ * {@link ifc.frame._XController}(the frame of the created
+ * document) </li>
+ * <li> <code>'SecondModel'</code> for
+ * {@link ifc.frame._XController}(the interface <code>XModel</code> of
+ * the second created document) </li>
+ * <li> <code>'SecondController'</code> for
+ * {@link ifc.frame._XController}(the current controller of the second
+ * created document) </li>
+ * <li> <code>'DrawPage'</code> for
+ * {@link ifc.drawing.DrawingDocumentDrawView}(the draw page which will
+ * be new current page) </li>
+ * </ul>
+ * @see com.sun.star.frame.XModel
+ * @see com.sun.star.drawing.DrawingDocumentDrawView
+ */
+ protected synchronized TestEnvironment createTestEnvironment
+ (TestParameters Param, PrintWriter log) {
+
+ log.println( "creating a test environment" );
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)Param.getMSF();
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(xMSF);
+
+ try {
+ log.println( "creating two impress documents" );
+ xSecondDrawDoc = SOF.createImpressDoc(null);
+ shortWait();
+ xDrawDoc = SOF.createImpressDoc(null);
+ shortWait();
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ // get the drawpage of drawing here
+ log.println( "getting Drawpage" );
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class, xDrawDoc);
+ XDrawPages the_pages = oDPS.getDrawPages();
+ XIndexAccess oDPi = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class,the_pages);
+
+ XDrawPage oDrawPage = null;
+ try {
+ oDrawPage = (XDrawPage) AnyConverter.toObject(
+ new Type(XDrawPage.class),oDPi.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ }
+
+ //put something on the drawpage
+ log.println( "inserting some Shapes" );
+ XShapes oShapes = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class, oDrawPage);
+ XShape shape1 = SOF.createShape(
+ xDrawDoc, 3000, 4500, 15000, 1000, "Ellipse");
+ XShape shape2 = SOF.createShape(
+ xDrawDoc, 5000, 3500, 7500, 5000, "Rectangle");
+ XShape shape3 = SOF.createShape(
+ xDrawDoc, 3000, 500, 5000, 1000, "Line");
+ oShapes.add(shape1);
+ oShapes.add(shape2);
+ oShapes.add(shape3);
+ shortWait();
+
+ log.println("switch to HandoutView...");
+ try{
+ utils.dispatchURL(xMSF, xDrawDoc, ".uno:NotesMode");
+ } catch (Exception e){
+ e.printStackTrace(log);
+ throw new StatusException(Status.failed(e.toString()));
+ }
+
+ utils.shortWait(500);
+
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xDrawDoc);
+
+ XInterface oObj = aModel.getCurrentController();
+
+ log.println("bring first document to front...");
+ DesktopTools.bringWindowToFront(aModel);
+
+ XModel aModel2 = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSecondDrawDoc);
+
+ XWindow anotherWindow = (XWindow) UnoRuntime.queryInterface(
+ XWindow.class,aModel2.getCurrentController());
+
+ log.println( "creating a new environment for impress view object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ if (anotherWindow != null) {
+ tEnv.addObjRelation("XWindow.AnotherWindow",anotherWindow);
+ }
+
+ Object oShapeCol1 = null;
+ Object oShapeCol2 = null;
+ try {
+ oShapeCol1 = xMSF.
+ createInstance("com.sun.star.drawing.ShapeCollection");
+ oShapeCol2 = xMSF.
+ createInstance("com.sun.star.drawing.ShapeCollection");
+ } catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException(Status.failed("Couldn't create instance"));
+ }
+
+ XShapes xShapes1 = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class, oShapeCol1);
+ XShapes xShapes2 = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class, oShapeCol2);
+ xShapes1.add(shape2);
+ xShapes1.add(shape3);
+ xShapes2.add(shape1);
+ shortWait();
+
+ tEnv.addObjRelation("Selections", new Object[] {
+ oDrawPage, oShapeCol1, oShapeCol2});
+ tEnv.addObjRelation("Comparer", new Comparator() {
+ public int compare(Object o1, Object o2) {
+ XIndexAccess indAc1 = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, o1);
+ XIndexAccess indAc2 = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, o2);
+ if (indAc1 == null || indAc2 == null) return -1;
+ if (indAc1.getCount() == indAc2.getCount()) {
+ return 0;
+ }
+ return 1;
+ }
+ public boolean equals(Object obj) {
+ return compare(this, obj) == 0;
+ } });
+
+
+
+ tEnv.addObjRelation("Pages", the_pages);
+
+ //Adding ObjRelations for XController
+ tEnv.addObjRelation("FirstModel", aModel);
+
+ tEnv.addObjRelation("XUserInputInterception.XModel", aModel);
+
+ XFrame the_frame = the_Desk.getCurrentFrame();
+ tEnv.addObjRelation("Frame", the_frame);
+
+ aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSecondDrawDoc);
+ //Adding ObjRelations for XController
+ tEnv.addObjRelation("SecondModel", aModel);
+
+ XController secondController = aModel.getCurrentController();
+ tEnv.addObjRelation("SecondController", secondController);
+ tEnv.addObjRelation("XDispatchProvider.URL",
+ "slot:27009");
+
+ //Adding relations for DrawingDocumentDrawView
+ XDrawPage new_page = the_pages.insertNewByIndex(1);
+ tEnv.addObjRelation("DrawPage", new_page);
+
+ log.println("Implementation Name: "+utils.getImplName(oObj));
+
+ XModifiable modify = (XModifiable)
+ UnoRuntime.queryInterface(XModifiable.class,xDrawDoc);
+
+ tEnv.addObjRelation("Modifiable",modify);
+
+ tEnv.addObjRelation("XComponent.DisposeThis", xDrawDoc);
+
+
+ return tEnv;
+
+ } // finish method getTestEnvironment
+
+ private void shortWait() {
+ try {
+ Thread.sleep(1000) ;
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e) ;
+ }
+ }
+
+
+}
+
diff --git a/qadevOOo/tests/java/mod/_sd/DrawController_OutlineView.java b/qadevOOo/tests/java/mod/_sd/DrawController_OutlineView.java
new file mode 100644
index 000000000000..a6398884c7f6
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/DrawController_OutlineView.java
@@ -0,0 +1,334 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+import java.util.Comparator;
+
+import lib.Status;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.DesktopTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.awt.XWindow;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.drawing.XShape;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.XModifiable;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.drawing.DrawingDocumentDrawView</code>. <p>
+* The view was switched to <b>OutlineMode</b>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::drawing::DrawingDocumentDrawView</code></li>
+* <li> <code>com::sun::star::lang::XComponent</code></li>
+* <li> <code>com::sun::star::lang::XServiceInfo</code></li>
+* <li> <code>com::sun::star::frame::XController</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::view::XSelectionSupplier</code></li>
+* <li> <code>com::sun::star::drawing::XDrawView</code></li>
+* </ul>
+* @see com.sun.star.drawing.DrawingDocumentDrawView
+* @see com.sun.star.lang.XComponent
+* @see com.sun.star.lang.XServiceInfo
+* @see com.sun.star.frame.XController
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.view.XSelectionSupplier
+* @see com.sun.star.drawing.XDrawView
+* @see ifc.drawing._DrawingDocumentDrawView
+* @see ifc.lang._XComponent
+* @see ifc.lang._XServiceInfo
+* @see ifc.frame._XController
+* @see ifc.beans._XPropertySet
+* @see ifc.view._XSelectionSupplier
+* @see ifc.drawing._XDrawView
+*/
+public class DrawController_OutlineView extends TestCase {
+ static XDesktop the_Desk;
+ static XComponent xDrawDoc;
+ static XComponent xSecondDrawDoc;
+
+ /**
+ * Creates the instance of the service
+ * <code>com.sun.star.frame.Desktop</code>.
+ * @see com.sun.star.frame.Desktop
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ the_Desk = (XDesktop)
+ UnoRuntime.queryInterface(
+ XDesktop.class, DesktopTools.createDesktop(
+ (XMultiServiceFactory)Param.getMSF()) );
+ }
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes Impress documents.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing impress documents");
+ util.DesktopTools.closeDoc(xDrawDoc);
+ util.DesktopTools.closeDoc(xSecondDrawDoc);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates two impress documents. After creating
+ * of the documents makes short
+ * wait to allow frames to be loaded. Retrieves
+ * the collection of the draw pages
+ * from the first document and takes one of them. Inserts some shapes to the
+ * retrieved draw page.
+ * Switch to the <b>OutlineMode</b>.
+ * Obtains a current controller from the first document
+ * using the interface <code>XModel</code>. The obtained controller is the
+ * instance of the service
+ * <code>com.sun.star.drawing.DrawingDocumentDrawView</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'Pages'</code> for
+ * {@link ifc.drawing._XDrawView}(the retrieved collection of the draw
+ * pages) </li>
+ * <li> <code>'FirstModel'</code> for
+ * {@link ifc.frame._XController}(the interface <code>XModel</code> of
+ * the first created document) </li>
+ * <li> <code>'Frame'</code> for
+ * {@link ifc.frame._XController}(the frame of the created
+ * document) </li>
+ * <li> <code>'SecondModel'</code> for
+ * {@link ifc.frame._XController}(the interface <code>XModel</code> of
+ * the second created document) </li>
+ * <li> <code>'SecondController'</code> for
+ * {@link ifc.frame._XController}(the current controller of the second
+ * created document) </li>
+ * <li> <code>'DrawPage'</code> for
+ * {@link ifc.drawing.DrawingDocumentDrawView}(the draw page which will
+ * be new current page) </li>
+ * </ul>
+ * @see com.sun.star.frame.XModel
+ * @see com.sun.star.drawing.DrawingDocumentDrawView
+ */
+ protected synchronized TestEnvironment createTestEnvironment
+ (TestParameters Param, PrintWriter log) {
+
+ log.println( "creating a test environment" );
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)Param.getMSF();
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(xMSF);
+
+ try {
+ log.println( "creating two impress documents" );
+ xSecondDrawDoc = SOF.createImpressDoc(null);
+ shortWait();
+ xDrawDoc = SOF.createImpressDoc(null);
+ shortWait();
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ // get the drawpage of drawing here
+ log.println( "getting Drawpage" );
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class, xDrawDoc);
+ XDrawPages the_pages = oDPS.getDrawPages();
+ XIndexAccess oDPi = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class,the_pages);
+
+ XDrawPage oDrawPage = null;
+ try {
+ oDrawPage = (XDrawPage) AnyConverter.toObject(
+ new Type(XDrawPage.class),oDPi.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ }
+
+ //put something on the drawpage
+ log.println( "inserting some Shapes" );
+ XShapes oShapes = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class, oDrawPage);
+ XShape shape1 = SOF.createShape(
+ xDrawDoc, 3000, 4500, 15000, 1000, "Ellipse");
+ XShape shape2 = SOF.createShape(
+ xDrawDoc, 5000, 3500, 7500, 5000, "Rectangle");
+ XShape shape3 = SOF.createShape(
+ xDrawDoc, 3000, 500, 5000, 1000, "Line");
+ oShapes.add(shape1);
+ oShapes.add(shape2);
+ oShapes.add(shape3);
+ shortWait();
+
+ log.println("switch to HandoutView...");
+ try{
+ utils.dispatchURL(xMSF, xDrawDoc, ".uno:OutlineMode");
+ } catch (Exception e){
+ e.printStackTrace(log);
+ throw new StatusException(Status.failed(e.toString()));
+ }
+
+ utils.shortWait(500);
+
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xDrawDoc);
+
+ XInterface oObj = aModel.getCurrentController();
+
+ log.println("bring first document to front...");
+ DesktopTools.bringWindowToFront(aModel);
+
+ XModel aModel2 = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSecondDrawDoc);
+
+ XWindow anotherWindow = (XWindow) UnoRuntime.queryInterface(
+ XWindow.class,aModel2.getCurrentController());
+
+ log.println( "creating a new environment for impress view object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ if (anotherWindow != null) {
+ tEnv.addObjRelation("XWindow.AnotherWindow",anotherWindow);
+ }
+
+ Object oShapeCol1 = null;
+ Object oShapeCol2 = null;
+ try {
+ oShapeCol1 = xMSF.
+ createInstance("com.sun.star.drawing.ShapeCollection");
+ oShapeCol2 = xMSF.
+ createInstance("com.sun.star.drawing.ShapeCollection");
+ } catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException(Status.failed("Couldn't create instance"));
+ }
+
+ XShapes xShapes1 = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class, oShapeCol1);
+ XShapes xShapes2 = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class, oShapeCol2);
+ xShapes1.add(shape2);
+ xShapes1.add(shape3);
+ xShapes2.add(shape1);
+ shortWait();
+
+ tEnv.addObjRelation("Selections", new Object[] {
+ oDrawPage, oShapeCol1, oShapeCol2});
+ tEnv.addObjRelation("Comparer", new Comparator() {
+ public int compare(Object o1, Object o2) {
+ XIndexAccess indAc1 = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, o1);
+ XIndexAccess indAc2 = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, o2);
+ if (indAc1 == null || indAc2 == null) return -1;
+ if (indAc1.getCount() == indAc2.getCount()) {
+ return 0;
+ }
+ return 1;
+ }
+ public boolean equals(Object obj) {
+ return compare(this, obj) == 0;
+ } });
+
+
+
+ tEnv.addObjRelation("Pages", the_pages);
+
+ //Adding ObjRelations for XController
+ tEnv.addObjRelation("FirstModel", aModel);
+
+ tEnv.addObjRelation("XUserInputInterception.XModel", aModel);
+
+ XFrame the_frame = the_Desk.getCurrentFrame();
+ tEnv.addObjRelation("Frame", the_frame);
+
+ aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSecondDrawDoc);
+ //Adding ObjRelations for XController
+ tEnv.addObjRelation("SecondModel", aModel);
+
+ XController secondController = aModel.getCurrentController();
+ tEnv.addObjRelation("SecondController", secondController);
+ tEnv.addObjRelation("XDispatchProvider.URL",
+ "slot:27009");
+
+ //Adding relations for DrawingDocumentDrawView
+ XDrawPage new_page = the_pages.insertNewByIndex(1);
+ tEnv.addObjRelation("DrawPage", new_page);
+
+ log.println("Implementation Name: "+utils.getImplName(oObj));
+
+ XModifiable modify = (XModifiable)
+ UnoRuntime.queryInterface(XModifiable.class,xDrawDoc);
+
+ tEnv.addObjRelation("Modifiable",modify);
+
+ tEnv.addObjRelation("XComponent.DisposeThis", xDrawDoc);
+
+
+ return tEnv;
+
+ } // finish method getTestEnvironment
+
+ private void shortWait() {
+ try {
+ Thread.sleep(1000) ;
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e) ;
+ }
+ }
+
+
+}
+
diff --git a/qadevOOo/tests/java/mod/_sd/DrawController_PresentationView.java b/qadevOOo/tests/java/mod/_sd/DrawController_PresentationView.java
new file mode 100644
index 000000000000..ad4634cc7324
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/DrawController_PresentationView.java
@@ -0,0 +1,334 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+import java.util.Comparator;
+
+import lib.Status;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.DesktopTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.awt.XWindow;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.drawing.XShape;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.XModifiable;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.drawing.DrawingDocumentDrawView</code>. <p>
+* The view was switched to <b>DiaMode</b>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::drawing::DrawingDocumentDrawView</code></li>
+* <li> <code>com::sun::star::lang::XComponent</code></li>
+* <li> <code>com::sun::star::lang::XServiceInfo</code></li>
+* <li> <code>com::sun::star::frame::XController</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::view::XSelectionSupplier</code></li>
+* <li> <code>com::sun::star::drawing::XDrawView</code></li>
+* </ul>
+* @see com.sun.star.drawing.DrawingDocumentDrawView
+* @see com.sun.star.lang.XComponent
+* @see com.sun.star.lang.XServiceInfo
+* @see com.sun.star.frame.XController
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.view.XSelectionSupplier
+* @see com.sun.star.drawing.XDrawView
+* @see ifc.drawing._DrawingDocumentDrawView
+* @see ifc.lang._XComponent
+* @see ifc.lang._XServiceInfo
+* @see ifc.frame._XController
+* @see ifc.beans._XPropertySet
+* @see ifc.view._XSelectionSupplier
+* @see ifc.drawing._XDrawView
+*/
+public class DrawController_PresentationView extends TestCase {
+ static XDesktop the_Desk;
+ static XComponent xDrawDoc;
+ static XComponent xSecondDrawDoc;
+
+ /**
+ * Creates the instance of the service
+ * <code>com.sun.star.frame.Desktop</code>.
+ * @see com.sun.star.frame.Desktop
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ the_Desk = (XDesktop)
+ UnoRuntime.queryInterface(
+ XDesktop.class, DesktopTools.createDesktop(
+ (XMultiServiceFactory)Param.getMSF()) );
+ }
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes Impress documents.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing impress documents");
+ util.DesktopTools.closeDoc(xDrawDoc);
+ util.DesktopTools.closeDoc(xSecondDrawDoc);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates two impress documents. After creating
+ * of the documents makes short
+ * wait to allow frames to be loaded. Retrieves
+ * the collection of the draw pages
+ * from the first document and takes one of them. Inserts some shapes to the
+ * retrieved draw page.
+ * Switch to the <b>DiaMode</b>.
+ * Obtains a current controller from the first document
+ * using the interface <code>XModel</code>. The obtained controller is the
+ * instance of the service
+ * <code>com.sun.star.drawing.DrawingDocumentDrawView</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'Pages'</code> for
+ * {@link ifc.drawing._XDrawView}(the retrieved collection of the draw
+ * pages) </li>
+ * <li> <code>'FirstModel'</code> for
+ * {@link ifc.frame._XController}(the interface <code>XModel</code> of
+ * the first created document) </li>
+ * <li> <code>'Frame'</code> for
+ * {@link ifc.frame._XController}(the frame of the created
+ * document) </li>
+ * <li> <code>'SecondModel'</code> for
+ * {@link ifc.frame._XController}(the interface <code>XModel</code> of
+ * the second created document) </li>
+ * <li> <code>'SecondController'</code> for
+ * {@link ifc.frame._XController}(the current controller of the second
+ * created document) </li>
+ * <li> <code>'DrawPage'</code> for
+ * {@link ifc.drawing.DrawingDocumentDrawView}(the draw page which will
+ * be new current page) </li>
+ * </ul>
+ * @see com.sun.star.frame.XModel
+ * @see com.sun.star.drawing.DrawingDocumentDrawView
+ */
+ protected synchronized TestEnvironment createTestEnvironment
+ (TestParameters Param, PrintWriter log) {
+
+ log.println( "creating a test environment" );
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)Param.getMSF();
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(xMSF);
+
+ try {
+ log.println( "creating two impress documents" );
+ xSecondDrawDoc = SOF.createImpressDoc(null);
+ shortWait();
+ xDrawDoc = SOF.createImpressDoc(null);
+ shortWait();
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ // get the drawpage of drawing here
+ log.println( "getting Drawpage" );
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class, xDrawDoc);
+ XDrawPages the_pages = oDPS.getDrawPages();
+ XIndexAccess oDPi = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class,the_pages);
+
+ XDrawPage oDrawPage = null;
+ try {
+ oDrawPage = (XDrawPage) AnyConverter.toObject(
+ new Type(XDrawPage.class),oDPi.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ }
+
+ //put something on the drawpage
+ log.println( "inserting some Shapes" );
+ XShapes oShapes = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class, oDrawPage);
+ XShape shape1 = SOF.createShape(
+ xDrawDoc, 3000, 4500, 15000, 1000, "Ellipse");
+ XShape shape2 = SOF.createShape(
+ xDrawDoc, 5000, 3500, 7500, 5000, "Rectangle");
+ XShape shape3 = SOF.createShape(
+ xDrawDoc, 3000, 500, 5000, 1000, "Line");
+ oShapes.add(shape1);
+ oShapes.add(shape2);
+ oShapes.add(shape3);
+ shortWait();
+
+ log.println("switch to PresentationView...");
+ try{
+ utils.dispatchURL(xMSF, xDrawDoc, ".uno:DiaMode");
+ } catch (Exception e){
+ e.printStackTrace(log);
+ throw new StatusException(Status.failed(e.toString()));
+ }
+
+ utils.shortWait(500);
+
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xDrawDoc);
+
+ XInterface oObj = aModel.getCurrentController();
+
+ log.println("bring first document to front...");
+ DesktopTools.bringWindowToFront(aModel);
+
+ XModel aModel2 = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSecondDrawDoc);
+
+ XWindow anotherWindow = (XWindow) UnoRuntime.queryInterface(
+ XWindow.class,aModel2.getCurrentController());
+
+ log.println( "creating a new environment for impress view object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ if (anotherWindow != null) {
+ tEnv.addObjRelation("XWindow.AnotherWindow",anotherWindow);
+ }
+
+ Object oShapeCol1 = null;
+ Object oShapeCol2 = null;
+ try {
+ oShapeCol1 = xMSF.
+ createInstance("com.sun.star.drawing.ShapeCollection");
+ oShapeCol2 = xMSF.
+ createInstance("com.sun.star.drawing.ShapeCollection");
+ } catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException(Status.failed("Couldn't create instance"));
+ }
+
+ XShapes xShapes1 = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class, oShapeCol1);
+ XShapes xShapes2 = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class, oShapeCol2);
+ xShapes1.add(shape2);
+ xShapes1.add(shape3);
+ xShapes2.add(shape1);
+ shortWait();
+
+ tEnv.addObjRelation("Selections", new Object[] {
+ oDrawPage, oShapeCol1, oShapeCol2});
+ tEnv.addObjRelation("Comparer", new Comparator() {
+ public int compare(Object o1, Object o2) {
+ XIndexAccess indAc1 = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, o1);
+ XIndexAccess indAc2 = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, o2);
+ if (indAc1 == null || indAc2 == null) return -1;
+ if (indAc1.getCount() == indAc2.getCount()) {
+ return 0;
+ }
+ return 1;
+ }
+ public boolean equals(Object obj) {
+ return compare(this, obj) == 0;
+ } });
+
+
+
+ tEnv.addObjRelation("Pages", the_pages);
+
+ //Adding ObjRelations for XController
+ tEnv.addObjRelation("FirstModel", aModel);
+
+ tEnv.addObjRelation("XUserInputInterception.XModel", aModel);
+
+ XFrame the_frame = the_Desk.getCurrentFrame();
+ tEnv.addObjRelation("Frame", the_frame);
+
+ aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSecondDrawDoc);
+ //Adding ObjRelations for XController
+ tEnv.addObjRelation("SecondModel", aModel);
+
+ XController secondController = aModel.getCurrentController();
+ tEnv.addObjRelation("SecondController", secondController);
+ tEnv.addObjRelation("XDispatchProvider.URL",
+ "slot:27009");
+
+ //Adding relations for DrawingDocumentDrawView
+ XDrawPage new_page = the_pages.insertNewByIndex(1);
+ tEnv.addObjRelation("DrawPage", new_page);
+
+ log.println("Implementation Name: "+utils.getImplName(oObj));
+
+ XModifiable modify = (XModifiable)
+ UnoRuntime.queryInterface(XModifiable.class,xDrawDoc);
+
+ tEnv.addObjRelation("Modifiable",modify);
+
+ tEnv.addObjRelation("XComponent.DisposeThis", xDrawDoc);
+
+
+ return tEnv;
+
+ } // finish method getTestEnvironment
+
+ private void shortWait() {
+ try {
+ Thread.sleep(1000) ;
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e) ;
+ }
+ }
+
+
+}
+
diff --git a/qadevOOo/tests/java/mod/_sd/SdDocLinkTargets.java b/qadevOOo/tests/java/mod/_sd/SdDocLinkTargets.java
new file mode 100644
index 000000000000..2ba3b56430dd
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/SdDocLinkTargets.java
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.document.XLinkTargetSupplier;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.document.LinkTargets</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNameAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* </ul>
+* @see com.sun.star.document.LinkTargets
+* @see com.sun.star.container.XNameAccess
+* @see com.sun.star.container.XElementAccess
+* @see ifc.container._XNameAccess
+* @see ifc.container._XElementAccess
+*/
+public class SdDocLinkTargets extends TestCase {
+ XComponent xDrawDoc;
+
+ /**
+ * Creates Drawing document.
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println( "creating a draw document" );
+ xDrawDoc = SOF.createDrawDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Drawing document.
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing xDrawDoc");
+ util.DesktopTools.closeDoc(xDrawDoc);;
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the possible links to childrens of the drawing document using
+ * the interface <code>XLinkTargetSupplier</code>. The retrieved collection
+ * is the instance of the service <code>com.sun.star.document.LinkTargets</code>.
+ * @see com.sun.star.document.XLinkTargetSupplier
+ * @see com.sun.star.document.LinkTargets
+ */
+ public TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) throws StatusException {
+
+ // get the Links here
+ log.println( "getting Links" );
+ XLinkTargetSupplier oLTS = (XLinkTargetSupplier)
+ UnoRuntime.queryInterface(XLinkTargetSupplier.class,xDrawDoc);
+ XInterface oObj = oLTS.getLinks();
+
+ log.println( "creating a new environment for drawpage object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ return tEnv;
+ } // finish method createTestEnvironment
+
+} // finish class SdDocLinkTargets
+
diff --git a/qadevOOo/tests/java/mod/_sd/SdDrawPage.java b/qadevOOo/tests/java/mod/_sd/SdDrawPage.java
new file mode 100644
index 000000000000..1cd742919727
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/SdDrawPage.java
@@ -0,0 +1,216 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.FormTools;
+import util.InstCreator;
+import util.SOfficeFactory;
+import util.ShapeDsc;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.drawing.XControlShape;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.drawing.XMasterPagesSupplier;
+import com.sun.star.drawing.XShape;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.drawing.DrawPage</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::drawing::GenericDrawPage</code></li>
+* <li> <code>com::sun::star::drawing::XShapeBinder</code></li>
+* <li> <code>com::sun::star::drawing::XShapeGrouper</code></li>
+* <li> <code>com::sun::star::drawing::XShapes</code></li>
+* <li> <code>com::sun::star::lang::XServiceInfo</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::drawing::XMasterPageTarget</code></li>
+* <li> <code>com::sun::star::container::XNamed</code></li>
+* <li> <code>com::sun::star::drawing::XShapeCombiner</code></li>
+* </ul>
+* @see com.sun.star.drawing.DrawPage
+* @see com.sun.star.drawing.GenericDrawPage
+* @see com.sun.star.drawing.XShapeBinder
+* @see com.sun.star.drawing.XShapeGrouper
+* @see com.sun.star.drawing.XShapes
+* @see com.sun.star.lang.XServiceInfo
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.container.XIndexAccess
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.drawing.XMasterPageTarget
+* @see com.sun.star.container.XNamed
+* @see com.sun.star.drawing.XShapeCombiner
+* @see ifc.drawing._GenericDrawPage
+* @see ifc.drawing._XShapeBinder
+* @see ifc.drawing._XShapeGrouper
+* @see ifc.drawing._XShapes
+* @see ifc.lang._XServiceInfo
+* @see ifc.beans._XPropertySet
+* @see ifc.container._XIndexAccess
+* @see ifc.container._XElementAccess
+* @see ifc.drawing._XMasterPageTarget
+* @see ifc.container._XNamed
+* @see ifc.drawing._XShapeCombiner
+*/
+public class SdDrawPage extends TestCase {
+ XComponent xDrawDoc;
+
+ /**
+ * Creates Drawing document.
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println( "creating a draw document" );
+ xDrawDoc = SOF.createDrawDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Drawing document.
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing xDrawDoc");
+ util.DesktopTools.closeDoc(xDrawDoc);;
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the collection of the draw pages from the drawing document using
+ * the interface <code>XDrawPagesSupplier</code> and take one of them.
+ * The retrieved draw page is the instance of the service
+ * <code>com.sun.star.drawing.DrawPage</code>. Inserts some shapes
+ * into the draw page. Obtains the MasterPages collection. Creates
+ * the rectangle shape.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'Shape'</code> for
+ * {@link ifc.drawing._XShapes}( the created rectangle shape )</li>
+ * <li> <code>'DrawPage'</code> for
+ * {@link ifc.drawing._XShapeBinder}, {@link ifc.drawing._XShapeGrouper},
+ * {@link ifc.drawing._XShapeCombiner}( the retrieved draw page )</li>
+ * <li> <code>'MasterPageSupplier'</code> for
+ * {@link ifc.drawing._XMasterPageTarget}(the obtained master pages
+ * collection)</li>
+ * </ul>
+ * @see com.sun.star.drawing.DrawPage
+ * @see com.sun.star.drawing.XDrawPagesSupplier
+ */
+ protected synchronized TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ // get the drawpage of drawing here
+ log.println( "getting Drawpage" );
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class, xDrawDoc);
+ XDrawPages oDPn = oDPS.getDrawPages();
+ XIndexAccess oDPi = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class,oDPn);
+ try {
+ oObj = (XDrawPage) AnyConverter.toObject(
+ new Type(XDrawPage.class),oDPi.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't get DrawPage", e );
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't get DrawPage", e );
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't get DrawPage", e );
+ }
+
+ //put something on the drawpage
+ log.println( "inserting some Shapes" );
+ XShapes oShapes = (XShapes) UnoRuntime.queryInterface
+ (XShapes.class,oObj);
+ oShapes.add(SOF.createShape
+ (xDrawDoc, 2000, 1500, 1000, 1000, "Line"));
+ oShapes.add(SOF.createShape
+ (xDrawDoc, 3000, 4500, 15000, 1000, "Ellipse"));
+ oShapes.add(SOF.createShape
+ (xDrawDoc, 5000, 3500, 7500, 5000, "Rectangle"));
+
+ //get the XMasterPagesSupplier
+ log.println("get XMasterPagesSupplier");
+ XMasterPagesSupplier oMPS = (XMasterPagesSupplier)
+ UnoRuntime.queryInterface(XMasterPagesSupplier.class, xDrawDoc);
+ XDrawPages oGroup = oMPS.getMasterPages();
+
+ log.println( "creating a new environment for drawpage object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ XControlShape aShape = FormTools.createControlShape(
+ xDrawDoc,3000,4500,15000,10000,"CommandButton");
+
+ oShapes.add((XShape) aShape);
+
+ ShapeDsc sDsc = new ShapeDsc(5000, 3500, 7500, 10000, "Rectangle");
+ log.println( "adding Shape as mod relation to environment" );
+ tEnv.addObjRelation("Shape", new InstCreator( xDrawDoc, sDsc));
+ tEnv.addObjRelation("DrawPage", oObj);
+ tEnv.addObjRelation("MasterPageSupplier",oGroup);
+
+ return tEnv;
+ } // finish method createTestEnvironment
+
+} // finish class SdDrawPage
+
diff --git a/qadevOOo/tests/java/mod/_sd/SdDrawPagesAccess.java b/qadevOOo/tests/java/mod/_sd/SdDrawPagesAccess.java
new file mode 100644
index 000000000000..f994b318b2be
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/SdDrawPagesAccess.java
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.drawing.DrawPages</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::drawing::XDrawPageExpander</code></li>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* <li> <code>com::sun::star::drawing::XDrawPageSummarizer</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::drawing::XDrawPages</code></li>
+* </ul>
+* @see com.sun.star.drawing.DrawPages
+* @see com.sun.star.drawing.XDrawPageExpander
+* @see com.sun.star.container.XIndexAccess
+* @see com.sun.star.drawing.XDrawPageSummarizer
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.drawing.XDrawPages
+* @see ifc.drawing._XDrawPageExpander
+* @see ifc.container._XIndexAccess
+* @see ifc.drawing._XDrawPageSummarizer
+* @see ifc.container._XElementAccess
+* @see ifc.drawing._XDrawPages
+*/
+public class SdDrawPagesAccess extends TestCase {
+ XComponent xDrawDoc;
+
+ /**
+ * Creates Drawing document.
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println( "creating a draw document" );
+ xDrawDoc = SOF.createDrawDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Drawing document.
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing xDrawDoc");
+ util.DesktopTools.closeDoc(xDrawDoc);;
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the collection of the draw pages from the drawing document using
+ * the interface <code>XDrawPagesSupplier</code>. Inserts two new draw pages.
+ * The retrieved collection is the instance of the service
+ * <code>com.sun.star.drawing.DrawPages</code>.
+ * @see com.sun.star.drawing.DrawPages
+ */
+ public synchronized TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) throws StatusException {
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ // get the drawpage of drawing here
+ log.println( "getting Drawpages" );
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class, xDrawDoc);
+ XDrawPages oDP = (XDrawPages) oDPS.getDrawPages();
+ oDP.insertNewByIndex(1);
+ oDP.insertNewByIndex(2);
+ XInterface oObj = oDP;
+
+ log.println( "creating a new environment for drawpage object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ return tEnv;
+ } // finish method createTestEnvironment
+
+
+} // finish class SdDrawPagesAccess
+
diff --git a/qadevOOo/tests/java/mod/_sd/SdGenericDrawPage.java b/qadevOOo/tests/java/mod/_sd/SdGenericDrawPage.java
new file mode 100644
index 000000000000..e0a1344435a9
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/SdGenericDrawPage.java
@@ -0,0 +1,189 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.InstCreator;
+import util.SOfficeFactory;
+import util.ShapeDsc;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.drawing.GenericDrawPage</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::drawing::GenericDrawPage</code></li>
+* <li> <code>com::sun::star::drawing::XShapeBinder</code></li>
+* <li> <code>com::sun::star::drawing::XShapeGrouper</code></li>
+* <li> <code>com::sun::star::drawing::XShapes</code></li>
+* <li> <code>com::sun::star::lang::XServiceInfo</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::drawing::XShapeCombiner</code></li>
+* <li> <code>com::sun::star::container::XNamed</code></li>
+* </ul>
+* @see com.sun.star.drawing.GenericDrawPage
+* @see com.sun.star.drawing.XShapeBinder
+* @see com.sun.star.drawing.XShapeGrouper
+* @see com.sun.star.drawing.XShapes
+* @see com.sun.star.lang.XServiceInfo
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.container.XIndexAccess
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.drawing.XShapeCombiner
+* @see com.sun.star.container.XNamed
+* @see ifc.drawing._GenericDrawPage
+* @see ifc.drawing._XShapeBinder
+* @see ifc.drawing._XShapeGrouper
+* @see ifc.drawing._XShapes
+* @see ifc.lang._XServiceInfo
+* @see ifc.beans._XPropertySet
+* @see ifc.container._XIndexAccess
+* @see ifc.container._XElementAccess
+* @see ifc.drawing._XShapeCombiner
+* @see ifc.container._XNamed
+*/
+public class SdGenericDrawPage extends TestCase {
+ XComponent xDrawDoc;
+
+ /**
+ * Creates Drawing document.
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println( "creating a draw document" );
+ xDrawDoc = SOF.createDrawDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Drawing document.
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing xDrawDoc");
+ util.DesktopTools.closeDoc(xDrawDoc);;
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the collection of the draw pages from the drawing document using
+ * the interface <code>XDrawPagesSupplier</code> and take one of them.
+ * The retrieved draw page is the instance of the service
+ * <code>com.sun.star.drawing.DrawPage</code>. Inserts some shapes
+ * into the draw page. Creates the rectangle shape.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'Shape'</code> for
+ * {@link ifc.drawing._XShapes}( the created rectangle shape )</li>
+ * <li> <code>'DrawPage'</code> for
+ * {@link ifc.drawing._XShapeBinder}, {@link ifc.drawing._XShapeGrouper},
+ * {@link ifc.drawing._XShapeCombiner}( the retrieved draw page )</li>
+ * </ul>
+ * @see com.sun.star.drawing.DrawPage
+ * @see com.sun.star.drawing.XDrawPagesSupplier
+ */
+ protected synchronized TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+ XShapes oShapes = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ // get the drawpage of drawing here
+ log.println( "getting Drawpage" );
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class,xDrawDoc);
+ XDrawPages oDPn = oDPS.getDrawPages();
+ XIndexAccess oDPi = (XIndexAccess) UnoRuntime.queryInterface
+ (XIndexAccess.class,oDPn);
+ try {
+ oObj = (XDrawPage) AnyConverter.toObject(
+ new Type(XDrawPage.class),oDPi.getByIndex(0));
+ } catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ }
+
+ //put something on the drawpage
+ log.println( "inserting some Shapes" );
+ oShapes = (XShapes) UnoRuntime.queryInterface(XShapes.class,oObj);
+ oShapes.add(SOF.createShape
+ (xDrawDoc, 2000, 1500, 1000, 1000, "Line"));
+ oShapes.add(SOF.createShape
+ (xDrawDoc, 3000, 4500, 15000, 1000, "Ellipse"));
+ oShapes.add(SOF.createShape
+ (xDrawDoc, 5000, 3500, 7500, 5000, "Rectangle"));
+
+ log.println( "creating a new environment for drawpage object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ ShapeDsc sDsc = new ShapeDsc(5000, 3500, 7500, 10000, "Rectangle");
+ log.println( "adding Shape as mod relation to environment" );
+ tEnv.addObjRelation("Shape", new InstCreator( xDrawDoc, sDsc));
+
+ // adding relation for XShapeGrouper
+ tEnv.addObjRelation("DrawPage", oObj);
+
+ return tEnv;
+ } // finish method createTestEnvironment
+
+
+} // finish class SdGenericDrawPage
+
diff --git a/qadevOOo/tests/java/mod/_sd/SdLayer.java b/qadevOOo/tests/java/mod/_sd/SdLayer.java
new file mode 100644
index 000000000000..7407a20ba17c
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/SdLayer.java
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.drawing.XLayer;
+import com.sun.star.drawing.XLayerManager;
+import com.sun.star.drawing.XLayerSupplier;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.drawing.Layer</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::drawing::Layer</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* </ul>
+* @see com.sun.star.drawing.Layer
+* @see com.sun.star.beans.XPropertySet
+* @see ifc.drawing._Layer
+* @see ifc.beans._XPropertySet
+*/
+public class SdLayer extends TestCase {
+ XComponent xDrawDoc;
+
+ /**
+ * Creates Drawing document.
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println( "creating a draw document" );
+ xDrawDoc = SOF.createDrawDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Drawing document.
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing xDrawDoc");
+ util.DesktopTools.closeDoc(xDrawDoc);;
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the layer manager from the document and takes one of the layer.
+ * The obtained layer is the instance of the service
+ * <code>com.sun.star.drawing.Layer</code>.
+ * @see com.sun.star.drawing.Layer
+ */
+ protected synchronized TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+ XLayerManager oLM = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ // get the drawpage of drawing here
+ log.println( "getting LayerManager" );
+ XLayerSupplier oLS = (XLayerSupplier)
+ UnoRuntime.queryInterface(XLayerSupplier.class, xDrawDoc);
+ XNameAccess oNA = oLS.getLayerManager();
+ oLM = (XLayerManager)
+ UnoRuntime.queryInterface(XLayerManager.class, oNA);
+ XIndexAccess oIA = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class,oLM);
+ log.println( "getting LayerManager" );
+ try {
+ oObj = (XLayer) AnyConverter.toObject(
+ new Type(XLayer.class),oIA.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get by index", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get by index", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get by index", e);
+ }
+
+ log.println( "creating a new environment for drawpage object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ return tEnv;
+ } // finish method createTestEnvironment
+
+} // finish class SdLayer
+
diff --git a/qadevOOo/tests/java/mod/_sd/SdLayerManager.java b/qadevOOo/tests/java/mod/_sd/SdLayerManager.java
new file mode 100644
index 000000000000..cf8a0644ce8a
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/SdLayerManager.java
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.InstCreator;
+import util.SOfficeFactory;
+import util.ShapeDsc;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.drawing.XLayerSupplier;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.drawing.LayerManager</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::drawing::XLayerManager</code></li>
+* <li> <code>com::sun::star::container::XNameAccess</code></li>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* </ul>
+* @see com.sun.star.drawing.LayerManager
+* @see com.sun.star.drawing.XLayerManager
+* @see com.sun.star.container.XNameAccess
+* @see com.sun.star.container.XIndexAccess
+* @see com.sun.star.container.XElementAccess
+* @see ifc.drawing._XLayerManager
+* @see ifc.container._XNameAccess
+* @see ifc.container._XIndexAccess
+* @see ifc.container._XElementAccess
+*/
+public class SdLayerManager extends TestCase {
+ XComponent xDrawDoc;
+
+ /**
+ * Creates Drawing document.
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println("creating a draw document");
+ xDrawDoc = SOF.createDrawDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Drawing document.
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing xDrawDoc");
+ util.DesktopTools.closeDoc(xDrawDoc);;
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the layer manager using the interface <code>XLayerSupplier</code>.
+ * The manager is the instance of the service
+ * <code>com.sun.star.drawing.LayerManager</code>. Creates a rectangle shape.
+ * Retrieves the collection of the draw pages and take one of them.
+ * <ul>
+ * <li> <code>'Shape'</code> for
+ * {@link ifc.drawing._XLayerManager}(the created shape)</li>
+ * <li> <code>'Shapes'</code> for
+ * {@link ifc.drawing._XLayerManager}(the shape collection of
+ * the retrived draw page)</li>
+ * </ul>
+ * @see com.sun.star.drawing.XLayerSupplier
+ * @see com.sun.star.drawing.LayerManager
+ */
+ protected synchronized TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) {
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ // create testobject here
+ XLayerSupplier oLS = (XLayerSupplier)
+ UnoRuntime.queryInterface(XLayerSupplier.class, xDrawDoc);
+ XInterface oObj = oLS.getLayerManager();
+
+ log.println( "creating a new environment for XLayerManager object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ ShapeDsc sDsc = new ShapeDsc(5000, 3500, 7500, 10000, "Rectangle");
+ log.println( "adding Shape as mod relation to environment" );
+ tEnv.addObjRelation("Shape", new InstCreator(xDrawDoc, sDsc));
+
+
+ // get the drawpage of drawing here
+ log.println( "getting Drawpage" );
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class,xDrawDoc);
+ XDrawPages oDPn = oDPS.getDrawPages();
+ XIndexAccess oDPi = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class,oDPn);
+
+ XDrawPage oDP = null;
+ try {
+ oDP = (XDrawPage) AnyConverter.toObject(
+ new Type(XDrawPage.class),oDPi.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get by index", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get by index", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get by index", e);
+ }
+
+ XShapes oShapes = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class, oDP);
+
+ log.println( "adding Shapes as mod relation to environment" );
+ tEnv.addObjRelation("Shapes", oShapes);
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+} // finish class SdLayerManager
+
diff --git a/qadevOOo/tests/java/mod/_sd/SdMasterPage.java b/qadevOOo/tests/java/mod/_sd/SdMasterPage.java
new file mode 100644
index 000000000000..20cfce2a5da7
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/SdMasterPage.java
@@ -0,0 +1,194 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.InstCreator;
+import util.SOfficeFactory;
+import util.ShapeDsc;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XMasterPagesSupplier;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.drawing.MasterPage</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::drawing::GenericDrawPage</code></li>
+* <li> <code>com::sun::star::drawing::XShapeBinder</code></li>
+* <li> <code>com::sun::star::drawing::XShapeGrouper</code></li>
+* <li> <code>com::sun::star::drawing::XShapes</code></li>
+* <li> <code>com::sun::star::lang::XServiceInfo</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::drawing::XShapeCombiner</code></li>
+* <li> <code>com::sun::star::container::XNamed</code></li>
+* </ul>
+* @see com.sun.star.drawing.MasterPage
+* @see com.sun.star.drawing.GenericDrawPage
+* @see com.sun.star.drawing.XShapeBinder
+* @see com.sun.star.drawing.XShapeGrouper
+* @see com.sun.star.drawing.XShapes
+* @see com.sun.star.lang.XServiceInfo
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.container.XIndexAccess
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.drawing.XShapeCombiner
+* @see com.sun.star.container.XNamed
+* @see ifc.drawing._GenericDrawPage
+* @see ifc.drawing._XShapeBinder
+* @see ifc.drawing._XShapeGrouper
+* @see ifc.drawing._XShapes
+* @see ifc.lang._XServiceInfo
+* @see ifc.beans._XPropertySet
+* @see ifc.container._XIndexAccess
+* @see ifc.container._XElementAccess
+* @see ifc.drawing._XShapeCombiner
+* @see ifc.container._XNamed
+*/
+public class SdMasterPage extends TestCase {
+ XComponent xDrawDoc;
+
+ /**
+ * Creates Drawing document.
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println( "creating a draw document" );
+ xDrawDoc = SOF.createDrawDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Drawing document.
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing xDrawDoc");
+ util.DesktopTools.closeDoc(xDrawDoc);;
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the collection of the master pages from the document using the
+ * interface <code>XMasterPagesSupplier</code> and takes
+ * one of them. Inserts some shapes into the document. Creates a rectangle
+ * shape. The retrieved master page is the instance of the service
+ * <code>com.sun.star.drawing.MasterPage</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'DrawPage'</code> for
+ * {@link ifc.drawing._XShapeBinder}, {@link ifc.drawing._XShapeGrouper},
+ * {@link ifc.drawing._XShapeCombiner}( the draw page of the retrieved
+ * master page)</li>
+ * <li> <code>'Shape'</code> for
+ * {@link ifc.drawing._XShapes}(the created rectangle shape)</li>
+ * </ul>
+ * @see com.sun.star.drawing.XMasterPagesSupplier
+ */
+ protected TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) {
+
+ log.println( "creating a test environment" );
+
+ // get the MasterPages here
+ log.println( "getting MasterPages" );
+ XMasterPagesSupplier oMPS = (XMasterPagesSupplier)
+ UnoRuntime.queryInterface(XMasterPagesSupplier.class, xDrawDoc);
+ XDrawPages oMPn = oMPS.getMasterPages();
+ XIndexAccess oMPi = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oMPn);
+
+ log.println( "getting MasterPage" );
+ XInterface oObj = null;
+ try {
+ oObj = (XDrawPage) AnyConverter.toObject(
+ new Type(XDrawPage.class),oMPi.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get MasterPage by index", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get MasterPage by index", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get MasterPage by index", e);
+ }
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ //put something on the masterpage
+ log.println( "inserting some Shapes" );
+ XShapes oShapes = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class, oObj);
+ oShapes.add(SOF.createShape(xDrawDoc, 2000, 1500, 1000, 1000, "Line"));
+ oShapes.add(SOF.createShape
+ (xDrawDoc, 3000, 4500, 15000, 1000, "Ellipse"));
+ oShapes.add(SOF.createShape
+ (xDrawDoc, 5000, 3500, 7500, 5000, "Rectangle"));
+
+ log.println( "creating a new environment for MasterPage object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ log.println( "adding DrawPage as mod relation to environment" );
+ tEnv.addObjRelation("DrawPage", oObj);
+
+ ShapeDsc sDsc = new ShapeDsc(5000, 3500, 7500, 10000, "Rectangle");
+ log.println( "adding Shape as mod relation to environment" );
+ tEnv.addObjRelation("Shape", new InstCreator( xDrawDoc, sDsc));
+
+ return tEnv;
+ } // finish method createTestEnvironment
+
+} // finish class SdMasterPage
+
diff --git a/qadevOOo/tests/java/mod/_sd/SdMasterPagesAccess.java b/qadevOOo/tests/java/mod/_sd/SdMasterPagesAccess.java
new file mode 100644
index 000000000000..a0eb65b9301a
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/SdMasterPagesAccess.java
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XMasterPagesSupplier;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.drawing.MasterPages</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::drawing::XDrawPages</code></li>
+* </ul>
+* @see com.sun.star.drawing.MasterPages
+* @see com.sun.star.container.XIndexAccess
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.drawing.XDrawPages
+* @see ifc.container._XIndexAccess
+* @see ifc.container._XElementAccess
+* @see ifc.drawing._XDrawPages
+*/
+public class SdMasterPagesAccess extends TestCase {
+ XComponent xDrawDoc;
+
+ /**
+ * Creates Drawing document.
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println( "creating a draw document" );
+ xDrawDoc = SOF.createDrawDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Drawing document.
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing xDrawDoc");
+ util.DesktopTools.closeDoc(xDrawDoc);;
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the collection of the master pages from the document using the
+ * interface <code>XMasterPagesSupplier</code>. Inserts two new draw pages.
+ * The retrieved collection is the instance of the service
+ * <code>com.sun.star.drawing.MasterPages</code>.
+ * @see com.sun.star.drawing.XMasterPagesSupplier
+ * @see com.sun.star.drawing.MasterPages
+ */
+ public synchronized TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) throws StatusException {
+
+ log.println( "creating a test environment" );
+
+ // get the MasterPages here
+ log.println( "getting MasterPages" );
+ XMasterPagesSupplier oMPS = (XMasterPagesSupplier)
+ UnoRuntime.queryInterface( XMasterPagesSupplier.class, xDrawDoc);
+ XDrawPages oMP = oMPS.getMasterPages();
+ log.println( "insert MasterPages" );
+ oMP.insertNewByIndex(1);
+ oMP.insertNewByIndex(2);
+ XInterface oObj = oMP;
+
+ log.println( "creating a new environment for MasterPagesAccess object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ return tEnv;
+ } // finish method createTestEnvironment
+
+} // finish class SdMasterPagesAccess
+
diff --git a/qadevOOo/tests/java/mod/_sd/SdPageLinkTargets.java b/qadevOOo/tests/java/mod/_sd/SdPageLinkTargets.java
new file mode 100644
index 000000000000..1cb240b76de7
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/SdPageLinkTargets.java
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.DrawTools;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.document.XLinkTargetSupplier;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XShape;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.document.LinkTargets</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNameAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* </ul>
+* @see com.sun.star.document.LinkTargets
+* @see com.sun.star.container.XNameAccess
+* @see com.sun.star.container.XElementAccess
+* @see ifc.container._XNameAccess
+* @see ifc.container._XElementAccess
+*/
+public class SdPageLinkTargets extends TestCase {
+ XComponent xDrawDoc;
+
+ /**
+ * Creates Drawing document.
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println( "creating a draw document" );
+ xDrawDoc = SOF.createDrawDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Drawing document.
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing xDrawDoc");
+ util.DesktopTools.closeDoc(xDrawDoc);;
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the collection of draw pages and take one of them.
+ * Obtains the collection of possible links using the interface
+ * <code>XLinkTargetSupplier</code>. The obtained collection is
+ * the instance of the service <code>com.sun.star.document.LinkTargets</code>.
+ * Inserts some shapes into the document.
+ * @see com.sun.star.document.XLinkTargetSupplier
+ * @see com.sun.star.document.LinkTargets
+ */
+ public synchronized TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) throws StatusException {
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ // create testobject here
+ XDrawPage the_page = DrawTools.getDrawPage(xDrawDoc, 0);
+ XLinkTargetSupplier oLTS = (XLinkTargetSupplier)
+ UnoRuntime.queryInterface(XLinkTargetSupplier.class, the_page);
+ XInterface oObj = oLTS.getLinks();
+
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+ log.println( "inserting some Shapes" );
+ XShapes oShapes = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class,the_page);
+ XShape oShape =
+ SOF.createShape(xDrawDoc, 15000, 13500, 5000, 5000, "OLE2");
+ oShapes.add(oShape);
+
+ XPropertySet shape_props = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class,oShape);
+
+ log.println("Inserting a Chart");
+
+ try {
+ shape_props.
+ setPropertyValue("CLSID","12DCAE26-281F-416F-a234-c3086127382e");
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't change property", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't change property", e);
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't change property", e);
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't change property", e);
+ }
+
+ log.println( "creating a new environment for LinkTargets object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ return tEnv;
+ } // finish method createTestEnvironment
+
+} // finish class SdPageLinkTargets
+
diff --git a/qadevOOo/tests/java/mod/_sd/SdUnoDrawView.java b/qadevOOo/tests/java/mod/_sd/SdUnoDrawView.java
new file mode 100644
index 000000000000..0d01141653af
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/SdUnoDrawView.java
@@ -0,0 +1,299 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+import java.util.Comparator;
+
+import lib.Status;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.DesktopTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.awt.XWindow;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.drawing.XShape;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.XModifiable;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.drawing.DrawingDocumentDrawView</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::drawing::DrawingDocumentDrawView</code></li>
+* <li> <code>com::sun::star::lang::XComponent</code></li>
+* <li> <code>com::sun::star::lang::XServiceInfo</code></li>
+* <li> <code>com::sun::star::frame::XController</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::view::XSelectionSupplier</code></li>
+* <li> <code>com::sun::star::drawing::XDrawView</code></li>
+* </ul>
+* @see com.sun.star.drawing.DrawingDocumentDrawView
+* @see com.sun.star.lang.XComponent
+* @see com.sun.star.lang.XServiceInfo
+* @see com.sun.star.frame.XController
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.view.XSelectionSupplier
+* @see com.sun.star.drawing.XDrawView
+* @see ifc.drawing._DrawingDocumentDrawView
+* @see ifc.lang._XComponent
+* @see ifc.lang._XServiceInfo
+* @see ifc.frame._XController
+* @see ifc.beans._XPropertySet
+* @see ifc.view._XSelectionSupplier
+* @see ifc.drawing._XDrawView
+*/
+public class SdUnoDrawView extends TestCase {
+ static XDesktop the_Desk;
+ static XComponent xDrawDoc;
+ static XComponent xSecondDrawDoc;
+
+ /**
+ * Creates the instance of the service
+ * <code>com.sun.star.frame.Desktop</code>.
+ * @see com.sun.star.frame.Desktop
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ the_Desk = (XDesktop)
+ UnoRuntime.queryInterface(
+ XDesktop.class, DesktopTools.createDesktop(
+ (XMultiServiceFactory)Param.getMSF()) );
+ }
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes Impress documents.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing draw documents");
+ util.DesktopTools.closeDoc(xDrawDoc);
+ util.DesktopTools.closeDoc(xSecondDrawDoc);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates two impress documents. After creating
+ * of the documents makes short
+ * wait to allow frames to be loaded. Retrieves
+ * the collection of the draw pages
+ * from the first document and takes one of them. Inserts some shapes to the
+ * retrieved draw page. Obtains a current controller from the first document
+ * using the interface <code>XModel</code>. The obtained controller is the
+ * instance of the service
+ * <code>com.sun.star.drawing.DrawingDocumentDrawView</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'Pages'</code> for
+ * {@link ifc.drawing._XDrawView}(the retrieved collection of the draw
+ * pages) </li>
+ * <li> <code>'FirstModel'</code> for
+ * {@link ifc.frame._XController}(the interface <code>XModel</code> of
+ * the first created document) </li>
+ * <li> <code>'Frame'</code> for
+ * {@link ifc.frame._XController}(the frame of the created
+ * document) </li>
+ * <li> <code>'SecondModel'</code> for
+ * {@link ifc.frame._XController}(the interface <code>XModel</code> of
+ * the second created document) </li>
+ * <li> <code>'SecondController'</code> for
+ * {@link ifc.frame._XController}(the current controller of the second
+ * created document) </li>
+ * <li> <code>'DrawPage'</code> for
+ * {@link ifc.drawing.DrawingDocumentDrawView}(the draw page which will
+ * be new current page) </li>
+ * </ul>
+ * @see com.sun.star.frame.XModel
+ * @see com.sun.star.drawing.DrawingDocumentDrawView
+ */
+ public synchronized lib.TestEnvironment createTestEnvironment
+ (TestParameters Param, PrintWriter log) {
+
+ log.println( "creating a test environment" );
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println( "creating two draw documents" );
+ xDrawDoc = SOF.createDrawDoc(null);
+ shortWait();
+ xSecondDrawDoc = SOF.createDrawDoc(null);
+ shortWait();
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ // get the drawpage of drawing here
+ log.println( "getting Drawpage" );
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class, xDrawDoc);
+ XDrawPages the_pages = oDPS.getDrawPages();
+ XIndexAccess oDPi = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class,the_pages);
+
+ XDrawPage oDrawPage = null;
+ try {
+ oDrawPage = (XDrawPage) AnyConverter.toObject(
+ new Type(XDrawPage.class),oDPi.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ }
+
+ //put something on the drawpage
+ log.println( "inserting some Shapes" );
+ XShapes oShapes = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class, oDrawPage);
+ XShape shape1 = SOF.createShape(
+ xDrawDoc, 3000, 4500, 15000, 1000, "Ellipse");
+ XShape shape2 = SOF.createShape(
+ xDrawDoc, 5000, 3500, 7500, 5000, "Rectangle");
+ XShape shape3 = SOF.createShape(
+ xDrawDoc, 3000, 500, 5000, 1000, "Line");
+ oShapes.add(shape1);
+ oShapes.add(shape2);
+ oShapes.add(shape3);
+ shortWait();
+
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xDrawDoc);
+
+ XInterface oObj = aModel.getCurrentController();
+
+ XModel aModel2 = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSecondDrawDoc);
+
+ XWindow anotherWindow = (XWindow) UnoRuntime.queryInterface(
+ XWindow.class,aModel2.getCurrentController());
+
+ log.println( "creating a new environment for impress view object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ if (anotherWindow != null) {
+ tEnv.addObjRelation("XWindow.AnotherWindow",anotherWindow);
+ }
+
+
+ tEnv.addObjRelation("Selections", new Object[] {
+ shape1, shape2, shape3});
+
+
+ tEnv.addObjRelation("Pages", the_pages);
+
+ //Adding ObjRelations for XController
+ tEnv.addObjRelation("FirstModel", aModel);
+
+ tEnv.addObjRelation("XUserInputInterception.XModel", aModel);
+
+ XFrame the_frame = the_Desk.getCurrentFrame();
+ tEnv.addObjRelation("Frame", the_frame);
+
+ aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSecondDrawDoc);
+ //Adding ObjRelations for XController
+ tEnv.addObjRelation("SecondModel", aModel);
+
+ XController secondController = aModel.getCurrentController();
+ tEnv.addObjRelation("SecondController", secondController);
+ tEnv.addObjRelation("XDispatchProvider.URL",
+ "slot:27009");
+
+ //Adding relations for DrawingDocumentDrawView
+ XDrawPage new_page = the_pages.insertNewByIndex(1);
+ tEnv.addObjRelation("DrawPage", new_page);
+
+ log.println("Implementation Name: "+utils.getImplName(oObj));
+
+ XModifiable modify = (XModifiable)
+ UnoRuntime.queryInterface(XModifiable.class,xDrawDoc);
+
+ tEnv.addObjRelation("Modifiable",modify);
+
+ tEnv.addObjRelation("XComponent.DisposeThis", xDrawDoc);
+
+ tEnv.addObjRelation("Comparer", new Comparator() {
+ public int compare(Object o1, Object o2) {
+ XIndexAccess indAc1 = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, o1);
+ XIndexAccess indAc2 = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, o2);
+ if (indAc1 == null || indAc2 == null) return -1;
+ if (indAc1.getCount() == indAc2.getCount()) {
+ return 0;
+ }
+ return 1;
+ }
+ public boolean equals(Object obj) {
+ return compare(this, obj) == 0;
+ } });
+
+
+ return tEnv;
+
+ } // finish method getTestEnvironment
+
+ private void shortWait() {
+ try {
+ Thread.sleep(1000) ;
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e) ;
+ }
+ }
+
+
+} // finish class SdUnoDrawView
+
diff --git a/qadevOOo/tests/java/mod/_sd/SdUnoOutlineView.java b/qadevOOo/tests/java/mod/_sd/SdUnoOutlineView.java
new file mode 100644
index 000000000000..73ff1f41799f
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/SdUnoOutlineView.java
@@ -0,0 +1,246 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.DesktopTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.awt.XWindow;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.URL;
+import com.sun.star.util.XURLTransformer;
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.present.OutlineView</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::lang::XComponent</code></li>
+* <li> <code>com::sun::star::lang::XServiceInfo</code></li>
+* <li> <code>com::sun::star::frame::XController</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::presentation::OutlineView</code></li>
+* <li> <code>com::sun::star::frame::XDispatchProvider</code></li>
+* <li> <code>com::sun::star::awt::XWindow</code></li>
+* </ul>
+* @see com.sun.star.lang.XComponent
+* @see com.sun.star.lang.XServiceInfo
+* @see com.sun.star.frame.XController
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.presentation.OutlineView
+* @see com.sun.star.awt.XWindow
+* @see com.sun.star.frame.XDispatchProvider
+* @see ifc.lang._XComponent
+* @see ifc.lang._XServiceInfo
+* @see ifc.frame._XController
+* @see ifc.beans._XPropertySet
+* @see ifc.awt._XWindow
+* @see ifc.presentation._OutlineView
+* @see ifc.frame._XDispatchProvider
+*/
+public class SdUnoOutlineView extends TestCase {
+ XDesktop the_Desk;
+ XComponent xImpressDoc;
+ XComponent xSecondDrawDoc;
+
+ /**
+ * Creates the instance of the service <code>com.sun.star.frame.Desktop</code>.
+ * @see com.sun.star.frame.Desktop
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ the_Desk = (XDesktop)
+ UnoRuntime.queryInterface(
+ XDesktop.class, DesktopTools.createDesktop(
+ (XMultiServiceFactory)Param.getMSF()) );
+ }
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes Impress documents.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing impress documents");
+ util.DesktopTools.closeDoc(xImpressDoc);;
+ util.DesktopTools.closeDoc(xSecondDrawDoc);;
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates two impress documents. After creating of the documents makes short
+ * wait to allow frames to be loaded. Retrieves the collection of the draw pages
+ * from the first document and takes one of them. Inserts some shapes to the
+ * retrieved draw page. Obtains a current controller from the first document
+ * using the interface <code>XModel</code>. The obtained controller is the
+ * instance of the service <code>com.sun.star.presentation.OutlineView</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'FirstModel'</code> for
+ * {@link ifc.frame._XController}(the interface <code>XModel</code> of
+ * the first created document) </li>
+ * <li> <code>'Frame'</code> for
+ * {@link ifc.frame._XController}(the frame of the created
+ * document) </li>
+ * <li> <code>'SecondModel'</code> for
+ * {@link ifc.frame._XController}(the interface <code>XModel</code> of
+ * the second created document) </li>
+ * <li> <code>'SecondController'</code> for
+ * {@link ifc.frame._XController}(the current controller of the second
+ * created document) </li>
+ * </ul>
+ * @see com.sun.star.frame.XModel
+ */
+ protected synchronized TestEnvironment createTestEnvironment
+ (TestParameters Param, PrintWriter log) {
+
+ log.println( "creating a test environment" );
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println( "creating a impress document" );
+ xImpressDoc = SOF.createImpressDoc(null);
+ shortWait();
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class, xImpressDoc);
+ XDrawPages the_pages = oDPS.getDrawPages();
+ XIndexAccess oDPi = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class,the_pages);
+
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xImpressDoc);
+
+ XInterface oObj = aModel.getCurrentController();
+
+ //Change to Outline view
+ try {
+ String aSlotID = "slot:27010";
+ XDispatchProvider xDispProv = (XDispatchProvider)
+ UnoRuntime.queryInterface( XDispatchProvider.class, oObj );
+ XURLTransformer xParser = (com.sun.star.util.XURLTransformer)
+ UnoRuntime.queryInterface(XURLTransformer.class,
+ ((XMultiServiceFactory)Param.getMSF()).createInstance("com.sun.star.util.URLTransformer"));
+ // Because it's an in/out parameter we must use an array of URL objects.
+ URL[] aParseURL = new URL[1];
+ aParseURL[0] = new URL();
+ aParseURL[0].Complete = aSlotID;
+ xParser.parseStrict(aParseURL);
+ URL aURL = aParseURL[0];
+ XDispatch xDispatcher = xDispProv.queryDispatch( aURL,"",0);
+ if( xDispatcher != null )
+ xDispatcher.dispatch( aURL, null );
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't change mode");
+ }
+
+ try {
+ log.println( "creating a second impress document" );
+ xSecondDrawDoc = SOF.createImpressDoc(null);
+ shortWait();
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ XModel aModel2 = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSecondDrawDoc);
+
+ XWindow anotherWindow = (XWindow) UnoRuntime.queryInterface(
+ XWindow.class,aModel2.getCurrentController());
+
+ oObj = aModel.getCurrentController();
+
+
+ log.println( "creating a new environment for impress view object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ if (anotherWindow != null) {
+ tEnv.addObjRelation("XWindow.AnotherWindow", anotherWindow);
+ }
+
+ //Adding ObjRelations for XController
+ tEnv.addObjRelation("FirstModel", aModel);
+
+ tEnv.addObjRelation("XUserInputInterception.XModel", aModel);
+
+ XFrame the_frame = the_Desk.getCurrentFrame();
+ tEnv.addObjRelation("Frame", the_frame);
+
+ aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSecondDrawDoc);
+ //Adding ObjRelations for XController
+ tEnv.addObjRelation("SecondModel", aModel);
+
+ XController secondController = aModel.getCurrentController();
+ tEnv.addObjRelation("SecondController", secondController);
+ tEnv.addObjRelation("XDispatchProvider.URL",
+ "slot:27069");
+
+ log.println("Implementation Name: " + utils.getImplName(oObj));
+
+ return tEnv;
+
+ } // finish method getTestEnvironment
+
+ private void shortWait() {
+ try {
+ Thread.sleep(5000) ;
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e) ;
+ }
+ }
+
+
+} // finish class SdUnoOutlineView
+
diff --git a/qadevOOo/tests/java/mod/_sd/SdUnoPresView.java b/qadevOOo/tests/java/mod/_sd/SdUnoPresView.java
new file mode 100644
index 000000000000..47a46180ba03
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/SdUnoPresView.java
@@ -0,0 +1,301 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+import java.util.Comparator;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.DesktopTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.awt.XWindow;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.drawing.XShape;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.XModifiable;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.drawing.DrawingDocumentDrawView</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::drawing::DrawingDocumentDrawView</code></li>
+* <li> <code>com::sun::star::lang::XComponent</code></li>
+* <li> <code>com::sun::star::lang::XServiceInfo</code></li>
+* <li> <code>com::sun::star::frame::XController</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::view::XSelectionSupplier</code></li>
+* <li> <code>com::sun::star::drawing::XDrawView</code></li>
+* </ul>
+* @see com.sun.star.drawing.DrawingDocumentDrawView
+* @see com.sun.star.lang.XComponent
+* @see com.sun.star.lang.XServiceInfo
+* @see com.sun.star.frame.XController
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.view.XSelectionSupplier
+* @see com.sun.star.drawing.XDrawView
+* @see ifc.drawing._DrawingDocumentDrawView
+* @see ifc.lang._XComponent
+* @see ifc.lang._XServiceInfo
+* @see ifc.frame._XController
+* @see ifc.beans._XPropertySet
+* @see ifc.view._XSelectionSupplier
+* @see ifc.drawing._XDrawView
+*/
+public class SdUnoPresView extends TestCase {
+ static XDesktop the_Desk;
+ static XComponent xImpressDoc;
+ static XComponent xSecondDrawDoc;
+
+ /**
+ * Creates the instance of the service <code>com.sun.star.frame.Desktop</code>.
+ * @see com.sun.star.frame.Desktop
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ the_Desk = (XDesktop)
+ UnoRuntime.queryInterface(
+ XDesktop.class, DesktopTools.createDesktop(
+ (XMultiServiceFactory)Param.getMSF()) );
+ }
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes Impress documents.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing impress documents");
+ util.DesktopTools.closeDoc(xImpressDoc);;
+ util.DesktopTools.closeDoc(xSecondDrawDoc);;
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates two impress documents. After creating of the documents makes short
+ * wait to allow frames to be loaded. Retrieves the collection of the draw pages
+ * from the first document and takes one of them. Inserts some shapes to the
+ * retrieved draw page. Obtains a current controller from the first document
+ * using the interface <code>XModel</code>. The obtained controller is the
+ * instance of the service
+ * <code>com.sun.star.drawing.DrawingDocumentDrawView</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'First'</code> for
+ * {@link ifc.view._XSelectionSupplier}(the first created shape) </li>
+ * <li> <code>'Second'</code> for
+ * {@link ifc.view._XSelectionSupplier}(the second created shape) </li>
+ * <li> <code>'Pages'</code> for
+ * {@link ifc.drawing._XDrawView}(the retrieved collection of the draw
+ * pages) </li>
+ * <li> <code>'FirstModel'</code> for
+ * {@link ifc.frame._XController}(the interface <code>XModel</code> of
+ * the first created document) </li>
+ * <li> <code>'Frame'</code> for
+ * {@link ifc.frame._XController}(the frame of the created
+ * document) </li>
+ * <li> <code>'SecondModel'</code> for
+ * {@link ifc.frame._XController}(the interface <code>XModel</code> of
+ * the second created document) </li>
+ * <li> <code>'SecondController'</code> for
+ * {@link ifc.frame._XController}(the current controller of the second
+ * created document) </li>
+ * </ul>
+ * @see com.sun.star.frame.XModel
+ * @see com.sun.star.drawing.DrawingDocumentDrawView
+ */
+ protected synchronized TestEnvironment createTestEnvironment
+ (TestParameters Param, PrintWriter log) {
+
+ log.println( "creating a test environment" );
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println( "creating two impress documents" );
+ xImpressDoc = SOF.createImpressDoc(null);
+ xSecondDrawDoc = SOF.createImpressDoc(null);
+ shortWait();
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ // get the drawpage of drawing here
+ log.println( "getting Drawpage" );
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class, xImpressDoc);
+ XDrawPages the_pages = oDPS.getDrawPages();
+ XIndexAccess oDPi = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class,the_pages);
+
+ XDrawPage oDrawPage = null;
+ XDrawPage secondDrawPage = null;
+ try {
+ oDrawPage = (XDrawPage) AnyConverter.toObject(
+ new Type(XDrawPage.class),oDPi.getByIndex(0));
+ the_pages.insertNewByIndex(0);
+ the_pages.insertNewByIndex(0);
+ the_pages.insertNewByIndex(0);
+ the_pages.insertNewByIndex(0);
+ secondDrawPage = (XDrawPage) AnyConverter.toObject(
+ new Type(XDrawPage.class),oDPi.getByIndex(3));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get DrawPage", e);
+ }
+
+ //put something on the drawpage
+ log.println( "inserting some Shapes" );
+ XShapes oShapes = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class, oDrawPage);
+ XShape shape1 = SOF.createShape(
+ xImpressDoc, 5000, 3500, 7500, 5000, "Rectangle");
+ oShapes.add(shape1);
+
+ oShapes = (XShapes)
+ UnoRuntime.queryInterface(XShapes.class, secondDrawPage);
+ shape1 = SOF.createShape(
+ xImpressDoc, 3000, 4500, 15000, 1000, "Ellipse");
+ oShapes.add(shape1);
+
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xImpressDoc);
+
+ XInterface oObj = aModel.getCurrentController();
+
+ XModel aModel2 = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSecondDrawDoc);
+
+ XWindow anotherWindow = (XWindow) UnoRuntime.queryInterface(
+ XWindow.class,aModel2.getCurrentController());
+
+ log.println( "creating a new environment for impress view object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ if (anotherWindow != null) {
+ tEnv.addObjRelation("XWindow.AnotherWindow",anotherWindow);
+ }
+
+ tEnv.addObjRelation("Selections", new Object[] {
+ oDrawPage, secondDrawPage});
+
+ tEnv.addObjRelation("Comparer", new Comparator() {
+ public int compare(Object o1, Object o2) {
+ XIndexAccess indAc1 = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, o1);
+ XIndexAccess indAc2 = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, o2);
+ if (indAc1 == null || indAc2 == null) return -1;
+ if (indAc1.getCount() == indAc2.getCount()) {
+ return 0;
+ }
+ return 1;
+ }
+ public boolean equals(Object obj) {
+ return compare(this, obj) == 0;
+ } });
+
+ tEnv.addObjRelation("FirstPage", oDrawPage);
+ tEnv.addObjRelation("SecondPage", secondDrawPage);
+
+ //tEnv.addObjRelation("First", shape1);
+ //tEnv.addObjRelation("Second", shape2);
+
+ tEnv.addObjRelation("Pages", the_pages);
+
+ //Adding ObjRelations for XController
+ tEnv.addObjRelation("FirstModel", aModel);
+
+ tEnv.addObjRelation("XUserInputInterception.XModel", aModel);
+
+ XFrame the_frame = the_Desk.getCurrentFrame();
+ tEnv.addObjRelation("Frame", the_frame);
+
+ aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSecondDrawDoc);
+ //Adding ObjRelations for XController
+ tEnv.addObjRelation("SecondModel", aModel);
+
+ XController secondController = aModel.getCurrentController();
+ tEnv.addObjRelation("SecondController", secondController);
+ tEnv.addObjRelation("XDispatchProvider.URL",
+ "slot:27010");
+
+ log.println("Implementation Name: "+utils.getImplName(oObj));
+
+ XModifiable modify = (XModifiable)
+ UnoRuntime.queryInterface(XModifiable.class,xImpressDoc);
+
+ tEnv.addObjRelation("Modifiable",modify);
+
+
+ tEnv.addObjRelation("XComponent.DisposeThis", xImpressDoc);
+
+ return tEnv;
+
+ } // finish method getTestEnvironment
+
+ private void shortWait() {
+ try {
+ Thread.sleep(5000) ;
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e) ;
+ }
+ }
+
+
+} // finish class SdUnoDrawView
+
diff --git a/qadevOOo/tests/java/mod/_sd/SdUnoSlideView.java b/qadevOOo/tests/java/mod/_sd/SdUnoSlideView.java
new file mode 100644
index 000000000000..03849535157b
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/SdUnoSlideView.java
@@ -0,0 +1,222 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import com.sun.star.drawing.XDrawPages;
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.DesktopTools;
+import util.DrawTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.awt.XWindow;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.URL;
+import com.sun.star.util.XURLTransformer;
+
+public class SdUnoSlideView extends TestCase {
+ XDesktop the_Desk;
+ XComponent xImpressDoc;
+ XComponent xSecondDrawDoc;
+
+ /**
+ * Creates the instance of the service <code>com.sun.star.frame.Desktop</code>.
+ * @see com.sun.star.frame.Desktop
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ the_Desk = (XDesktop)
+ UnoRuntime.queryInterface(
+ XDesktop.class, DesktopTools.createDesktop(
+ (XMultiServiceFactory)Param.getMSF()) );
+ }
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes Impress documents.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing impress documents");
+ util.DesktopTools.closeDoc(xImpressDoc);;
+ util.DesktopTools.closeDoc(xSecondDrawDoc);;
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates two impress documents. After creating of the documents makes short
+ * wait to allow frames to be loaded. Retrieves the collection of the draw pages
+ * from the first document and takes one of them. Inserts some shapes to the
+ * retrieved draw page. Obtains a current controller from the first document
+ * using the interface <code>XModel</code>. The obtained controller is the
+ * instance of the service <code>com.sun.star.presentation.OutlineView</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'FirstModel'</code> for
+ * {@link ifc.frame._XController}(the interface <code>XModel</code> of
+ * the first created document) </li>
+ * <li> <code>'Frame'</code> for
+ * {@link ifc.frame._XController}(the frame of the created
+ * document) </li>
+ * <li> <code>'SecondModel'</code> for
+ * {@link ifc.frame._XController}(the interface <code>XModel</code> of
+ * the second created document) </li>
+ * <li> <code>'SecondController'</code> for
+ * {@link ifc.frame._XController}(the current controller of the second
+ * created document) </li>
+ * </ul>
+ * @see com.sun.star.frame.XModel
+ */
+ protected synchronized TestEnvironment createTestEnvironment
+ (TestParameters Param, PrintWriter log) {
+
+ log.println( "creating a test environment" );
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF());
+ XDrawPages xDP = null;
+ try {
+ log.println( "creating a impress document" );
+ xImpressDoc = SOF.createImpressDoc(null);
+ shortWait();
+ xDP = DrawTools.getDrawPages(xImpressDoc);
+ xDP.insertNewByIndex(0);
+ xDP.insertNewByIndex(0);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xImpressDoc);
+
+ XInterface oObj = aModel.getCurrentController();
+
+ //Change to Slide view
+ try {
+ String aSlotID = "slot:27011";
+ XDispatchProvider xDispProv = (XDispatchProvider)
+ UnoRuntime.queryInterface( XDispatchProvider.class, oObj );
+ XURLTransformer xParser = (com.sun.star.util.XURLTransformer)
+ UnoRuntime.queryInterface(XURLTransformer.class,
+ ((XMultiServiceFactory)Param.getMSF()).createInstance("com.sun.star.util.URLTransformer"));
+ // Because it's an in/out parameter we must use an array of URL objects.
+ URL[] aParseURL = new URL[1];
+ aParseURL[0] = new URL();
+ aParseURL[0].Complete = aSlotID;
+ xParser.parseStrict(aParseURL);
+ URL aURL = aParseURL[0];
+ XDispatch xDispatcher = xDispProv.queryDispatch( aURL,"",0);
+ if( xDispatcher != null )
+ xDispatcher.dispatch( aURL, null );
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't change to slide view");
+ }
+
+ try {
+ log.println( "creating a second impress document" );
+ xSecondDrawDoc = SOF.createImpressDoc(null);
+ shortWait();
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ XModel aModel2 = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSecondDrawDoc);
+
+ XWindow anotherWindow = (XWindow) UnoRuntime.queryInterface(
+ XWindow.class,aModel2.getCurrentController());
+
+ oObj = aModel.getCurrentController();
+
+ log.println( "creating a new environment for slide view object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ if (anotherWindow != null) {
+ tEnv.addObjRelation("XWindow.AnotherWindow", anotherWindow);
+ }
+
+ //Adding ObjRelations for XController
+ tEnv.addObjRelation("FirstModel", aModel);
+
+ XFrame the_frame = the_Desk.getCurrentFrame();
+ tEnv.addObjRelation("Frame", the_frame);
+
+ //Adding ObjRelations for XController
+ tEnv.addObjRelation("SecondModel", aModel2);
+
+ XController secondController = aModel2.getCurrentController();
+ tEnv.addObjRelation("SecondController", secondController);
+ tEnv.addObjRelation("XDispatchProvider.URL",
+ "slot:27069");
+
+ tEnv.addObjRelation("XUserInputInterception.XModel", aModel);
+
+ //creating obj-relation for the XSelectionSupplier
+ try {
+ Object[] selections =
+ new Object[]{xDP.getByIndex(0),xDP.getByIndex(1),xDP.getByIndex(2)};
+ tEnv.addObjRelation("Selections", selections);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ }
+ log.println("Implementation Name: " + utils.getImplName(oObj));
+
+ return tEnv;
+
+ } // finish method getTestEnvironment
+
+ private void shortWait() {
+ try {
+ Thread.sleep(1000) ;
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e) ;
+ }
+ }
+
+
+} // finish class SdUnoOutlineView
+
diff --git a/qadevOOo/tests/java/mod/_sd/SdXCustomPresentation.java b/qadevOOo/tests/java/mod/_sd/SdXCustomPresentation.java
new file mode 100644
index 000000000000..b26ae478216c
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/SdXCustomPresentation.java
@@ -0,0 +1,243 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XIndexContainer;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.presentation.XCustomPresentationSupplier;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.presentation.CustomPresentation</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNamed</code></li>
+* <li> <code>com::sun::star::container::XIndexContainer</code></li>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::container::XIndexReplace</code></li>
+* </ul>
+* @see com.sun.star.presentation.CustomPresentation
+* @see com.sun.star.container.XNamed
+* @see com.sun.star.container.XIndexContainer
+* @see com.sun.star.container.XIndexAccess
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.container.XIndexReplace
+* @see ifc.container._XNamed
+* @see ifc.container._XIndexContainer
+* @see ifc.container._XIndexAccess
+* @see ifc.container._XElementAccess
+* @see ifc.container._XIndexReplace
+*/
+public class SdXCustomPresentation extends TestCase {
+ XComponent xImpressDoc;
+
+ /**
+ * Creates Impress document.
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println( "creating a draw document" );
+ xImpressDoc = SOF.createImpressDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Impress document.
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing xImpressDoc");
+ util.DesktopTools.closeDoc(xImpressDoc);;
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the collection of the CustomPresentation from the document
+ * using the interface <code>XCustomPresentationSupplier</code>. Creates and
+ * inserts new instance of the presentation to the collection. The created
+ * instance is the instance of the service
+ * <code>com.sun.star.presentation.CustomPresentation</code>. Obtains
+ * the collection of draw pages from the document and takes one of them.
+ * Inserts the obtained draw page to the created instance. Inserts some new
+ * draw pages.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'XIndexContainerINDEX'</code> for
+ * {@link ifc.container._XIndexContainer}(the string representation of
+ * the zero)</li>
+ * <li> <code>'INSTANCE1', ..., 'INSTANCEN'</code> for
+ * {@link ifc.container._XIndexContainer}(the new inserted draw pages)</li>
+ * </ul>
+ * @see com.sun.star.presentation.XCustomPresentationSupplier
+ * @see com.sun.star.presentation.CustomPresentation
+ */
+ protected TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) {
+
+
+ log.println( "creating a test environment" );
+
+ log.println( "get presentation" );
+ XCustomPresentationSupplier oPS = (XCustomPresentationSupplier)
+ UnoRuntime.queryInterface(
+ XCustomPresentationSupplier.class, xImpressDoc);
+ XInterface oObj = oPS.getCustomPresentations();
+
+ XSingleServiceFactory oSingleMSF = (XSingleServiceFactory)
+ UnoRuntime.queryInterface(XSingleServiceFactory.class, oObj);
+
+ XInterface oInstance = null;
+ try {
+ oInstance = (XInterface) oSingleMSF.createInstance();
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create instance", e);
+ }
+
+ XNameContainer aContainer = (XNameContainer)
+ UnoRuntime.queryInterface(XNameContainer.class, oObj);
+
+ try {
+ aContainer.insertByName("FirstPresentation", oInstance);
+ } catch (com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Could't insert Presentation", e);
+ } catch (com.sun.star.container.ElementExistException e){
+ e.printStackTrace(log);
+ throw new StatusException("Could't insert Presentation", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e){
+ e.printStackTrace(log);
+ throw new StatusException("Could't insert Presentation", e);
+ }
+
+ // get the drawpage of drawing here
+ log.println( "getting Drawpage" );
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class, xImpressDoc);
+ XDrawPages oDPn = oDPS.getDrawPages();
+ XIndexAccess oDPi = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oDPn);
+
+ XDrawPage oDrawPage = null;
+ try {
+ oDrawPage = (XDrawPage) AnyConverter.toObject(
+ new Type(XDrawPage.class),oDPi.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by index", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by index", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by index", e);
+ }
+
+ XIndexContainer aIContainer = (XIndexContainer)
+ UnoRuntime.queryInterface(XIndexContainer.class,oInstance);
+
+ try {
+ aIContainer.insertByIndex(0, oDrawPage);
+ } catch (com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Could't insert DrawPage", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e){
+ e.printStackTrace(log);
+ throw new StatusException("Could't insert DrawPage", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Could't insert DrawPage", e);
+ }
+
+ log.println( "creating a new environment for XPresentation object" );
+ TestEnvironment tEnv = new TestEnvironment( oInstance );
+
+ int THRCNT=1;
+ if ((String)Param.get("THRCNT") != null) {
+ THRCNT = Integer.parseInt((String)Param.get("THRCNT"));
+ }
+
+ // INDEX : _XNameContainer
+ log.println( "adding XIndexContainerINDEX as mod relation to environment" );
+ tEnv.addObjRelation("XIndexContainerINDEX", "0");
+
+ // INSTANCEn : _XNameContainer; _XNameReplace
+ log.println( "adding INSTANCEn as mod relation to environment" );
+ try {
+ for (int n = 1; n < (2*THRCNT+1) ;n++ ) {
+ log.println( "adding INSTANCE" + n
+ +" as mod relation to environment" );
+ oDPn.insertNewByIndex(0);
+ oDrawPage = (XDrawPage) AnyConverter.toObject(
+ new Type(XDrawPage.class),oDPi.getByIndex(0));
+ tEnv.addObjRelation("INSTANCE" + n, oDrawPage);
+ }
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Could't adding INSTANCEn", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Could't adding INSTANCEn", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Could't adding INSTANCEn", e);
+ }
+
+ return tEnv;
+
+ } // finish method getTestEnvironment
+
+} // finish class SdXCustomPresentation
diff --git a/qadevOOo/tests/java/mod/_sd/SdXCustomPresentationAccess.java b/qadevOOo/tests/java/mod/_sd/SdXCustomPresentationAccess.java
new file mode 100644
index 000000000000..9118dbb337d9
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/SdXCustomPresentationAccess.java
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XNameContainer;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.presentation.XCustomPresentationSupplier;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.presentation.CustomPresentationAccess</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNameAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::container::XNameReplace</code></li>
+* <li> <code>com::sun::star::lang::XSingleServiceFactory</code></li>
+* <li> <code>com::sun::star::container::XNameContainer</code></li>
+* </ul>
+* @see com.sun.star.presentation.CustomPresentationAccess
+* @see com.sun.star.container.XNameAccess
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.container.XNameReplace
+* @see com.sun.star.lang.XSingleServiceFactory
+* @see com.sun.star.container.XNameContainer
+* @see ifc.container._XNameAccess
+* @see ifc.container._XElementAccess
+* @see ifc.container._XNameReplace
+* @see ifc.lang._XSingleServiceFactory
+* @see ifc.container._XNameContainer
+*/
+public class SdXCustomPresentationAccess extends TestCase {
+ XComponent xImpressDoc;
+
+ /**
+ * Creates Impress document.
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println( "creating a draw document" );
+ xImpressDoc = SOF.createImpressDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Impress document.
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing xImpressDoc");
+ util.DesktopTools.closeDoc(xImpressDoc);;
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the collection of the CustomPresentation from the document
+ * using the interface <code>XCustomPresentationSupplier</code>.
+ * The retrieved collection is the instance of the servcie
+ * <code>com.sun.star.presentation.CustomPresentationAccess</code>.
+ * Creates two new instances of the custom presentation using the interface
+ * <code>XSingleServiceFactory</code>. Inserts one of them to the
+ * retrieved collection. Creates and inserts several instances of
+ * the presentation.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'SecondInstance'</code> for
+ * {@link ifc.container._XNameContainer}(the second created instance
+ * of the custom presentation)</li>
+ * <li> <code>'XNameContainerINDEX'</code> for
+ * {@link ifc.container._XNameContainer}(the number of current running
+ * threads)</li>
+ * <li> <code>'INSTANCE1', ..., 'INSTANCEN'</code> for
+ * {@link ifc.container._XNameReplace},
+ * {@link ifc.container._XNameContainer}(the created instances of
+ * the presentation)</li>
+ * </ul>
+ * @see com.sun.star.presentation.XCustomPresentationSupplier
+ * @see com.sun.star.lang.XSingleServiceFactory
+ * @see com.sun.star.presentation.CustomPresentationAccess
+ */
+ public TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) throws StatusException {
+
+
+ log.println( "creating a test environment" );
+
+ log.println( "get presentation" );
+ XCustomPresentationSupplier oPS = (XCustomPresentationSupplier)
+ UnoRuntime.queryInterface(
+ XCustomPresentationSupplier.class, xImpressDoc);
+ XInterface oObj = oPS.getCustomPresentations();
+
+
+ XSingleServiceFactory oSingleMSF = (XSingleServiceFactory)
+ UnoRuntime.queryInterface(XSingleServiceFactory.class, oObj);
+
+ XInterface oInstance = null;
+ XInterface oSecondInstance = null;
+ try{
+ oInstance = (XInterface) oSingleMSF.createInstance();
+ oSecondInstance = (XInterface) oSingleMSF.createInstance();
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create instance", e);
+ }
+
+ XNameContainer aContainer = (XNameContainer)
+ UnoRuntime.queryInterface(XNameContainer.class, oObj);
+
+ if (aContainer.hasByName("FirstPresentation")) {
+ try {
+ aContainer.removeByName("FirstPresentation");
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Exception while removing instance", e);
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Exception while removing instance", e);
+ }
+ }
+
+ try {
+ aContainer.insertByName("FirstPresentation",oInstance);
+ } catch (com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Could't insert Instance", e);
+ } catch (com.sun.star.container.ElementExistException e){
+ e.printStackTrace(log);
+ throw new StatusException("Could't insert Instance", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e){
+ e.printStackTrace(log);
+ throw new StatusException("Could't insert Instance", e);
+ }
+
+ log.println( "creating a new environment for XPresentation object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // adding an instance for insertByName ('XNameContainer')
+ tEnv.addObjRelation("SecondInstance", oSecondInstance);
+
+ int THRCNT = 1;
+ if ((String)Param.get("THRCNT") != null) {
+ THRCNT = Integer.parseInt((String)Param.get("THRCNT"));
+ }
+
+ // INDEX : _XNameContainer
+ log.println( "adding XNameContainerINDEX as mod relation to environment" );
+ tEnv.addObjRelation("XNameContainerINDEX",
+ (new Integer(THRCNT)).toString());
+
+ // INSTANCEn : _XNameContainer; _XNameReplace
+ log.println( "adding INSTANCEn as mod relation to environment" );
+ try {
+ for (int n = 1; n < (2*THRCNT+1) ;n++ ) {
+ log.println( "adding INSTANCE" + n
+ +" as mod relation to environment" );
+ oInstance = (XInterface) oSingleMSF.createInstance();
+ tEnv.addObjRelation("INSTANCE" + n, oInstance);
+ }
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Could't adding INSTANCEn: " + e);
+ }
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+} // finish class SdXCustomPresentationAccess
+
diff --git a/qadevOOo/tests/java/mod/_sd/SdXImpressDocument.java b/qadevOOo/tests/java/mod/_sd/SdXImpressDocument.java
new file mode 100644
index 000000000000..6e7652e13afd
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/SdXImpressDocument.java
@@ -0,0 +1,199 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sd;
+
+import com.sun.star.beans.PropertyVetoException;
+import com.sun.star.beans.UnknownPropertyException;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.drawing.XShape;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.view.XSelectionSupplier;
+import ifc.view._XPrintJobBroadcaster;
+import java.io.File;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+
+import util.DrawTools;
+import util.SOfficeFactory;
+import util.utils;
+
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.presentation.PresentationDocument</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li> <code>com::sun::star::lang::XMultiServiceFactory</code></li>
+ * <li> <code>com::sun::star::drawing::XMasterPagesSupplier</code></li>
+ * <li> <code>com::sun::star::presentation::XCustomPresentationSupplier</code></li>
+ * <li> <code>com::sun::star::document::XLinkTargetSupplier</code></li>
+ * <li> <code>com::sun::star::beans::XPropertySet</code></li>
+ * <li> <code>com::sun::star::drawing::XLayerSupplier</code></li>
+ * <li> <code>com::sun::star::presentation::XPresentationSupplier</code></li>
+ * <li> <code>com::sun::star::style::XStyleFamiliesSupplier</code></li>
+ * <li> <code>com::sun::star::drawing::DrawingDocument</code></li>
+ * <li> <code>com::sun::star::drawing::XDrawPageDuplicator</code></li>
+ * <li> <code>com::sun::star::drawing::XDrawPagesSupplier</code></li>
+ * </ul>
+ * @see com.sun.star.presentation.PresentationDocument
+ * @see com.sun.star.lang.XMultiServiceFactory
+ * @see com.sun.star.drawing.XMasterPagesSupplier
+ * @see com.sun.star.presentation.XCustomPresentationSupplier
+ * @see com.sun.star.document.XLinkTargetSupplier
+ * @see com.sun.star.beans.XPropertySet
+ * @see com.sun.star.drawing.XLayerSupplier
+ * @see com.sun.star.presentation.XPresentationSupplier
+ * @see com.sun.star.style.XStyleFamiliesSupplier
+ * @see com.sun.star.drawing.DrawingDocument
+ * @see com.sun.star.drawing.XDrawPageDuplicator
+ * @see com.sun.star.drawing.XDrawPagesSupplier
+ * @see ifc.lang._XMultiServiceFactory
+ * @see ifc.drawing._XMasterPagesSupplier
+ * @see ifc.presentation._XCustomPresentationSupplier
+ * @see ifc.document._XLinkTargetSupplier
+ * @see ifc.beans._XPropertySet
+ * @see ifc.drawing._XLayerSupplier
+ * @see ifc.presentation._XPresentationSupplier
+ * @see ifc.style._XStyleFamiliesSupplier
+ * @see ifc.drawing._DrawingDocument
+ * @see ifc.drawing._XDrawPageDuplicator
+ * @see ifc.drawing._XDrawPagesSupplier
+ */
+public class SdXImpressDocument extends TestCase {
+ XComponent xImpressDoc;
+ XComponent xImpressDoc2;
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes Impress document.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup(TestParameters Param, PrintWriter log) {
+ log.println("disposing xImpressDoc");
+ util.DesktopTools.closeDoc(xImpressDoc);;
+ util.DesktopTools.closeDoc(xImpressDoc2);;
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates new impress document that is the instance of the service
+ * <code>com.sun.star.presentation.PresentationDocument</code>.
+ * @see com.sun.star.presentation.PresentationDocument
+ */
+ public synchronized TestEnvironment createTestEnvironment(TestParameters Param,
+ PrintWriter log)
+ throws StatusException {
+ log.println("creating a test environment");
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory) Param.getMSF());
+
+ try {
+ log.println("creating two impress documents");
+ xImpressDoc2 = SOF.createImpressDoc(null);
+ xImpressDoc = SOF.createImpressDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create documents", e);
+ }
+
+ XModel xModel1 = (XModel) UnoRuntime.queryInterface(XModel.class,
+ xImpressDoc);
+ XModel xModel2 = (XModel) UnoRuntime.queryInterface(XModel.class,
+ xImpressDoc2);
+
+ XController cont1 = xModel1.getCurrentController();
+ XController cont2 = xModel2.getCurrentController();
+
+ cont1.getFrame().setName("cont1");
+ cont2.getFrame().setName("cont2");
+
+ XSelectionSupplier sel = (XSelectionSupplier) UnoRuntime.queryInterface(
+ XSelectionSupplier.class, cont1);
+
+ XShape aShape = SOF.createShape(xImpressDoc, 5000, 3500, 7500, 5000,
+ "Rectangle");
+
+
+ XPropertySet xShapeProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, aShape);
+
+ try {
+ xShapeProps.setPropertyValue("FillStyle", com.sun.star.drawing.FillStyle.SOLID);
+ xShapeProps.setPropertyValue("FillTransparence", new Integer(50));
+ } catch (UnknownPropertyException ex) {
+ ex.printStackTrace(log);
+ throw new StatusException("Couldn't make shape transparent", ex);
+ } catch (PropertyVetoException ex) {
+ ex.printStackTrace(log);
+ throw new StatusException("Couldn't make shape transparent", ex);
+ } catch (com.sun.star.lang.IllegalArgumentException ex) {
+ ex.printStackTrace(log);
+ throw new StatusException("Couldn't make shape transparent", ex);
+ } catch (WrappedTargetException ex) {
+ ex.printStackTrace(log);
+ throw new StatusException("Couldn't make shape transparent", ex);
+ }
+
+ DrawTools.getDrawPage(xImpressDoc, 0).add(aShape);
+
+ log.println("creating a new environment for drawpage object");
+
+ TestEnvironment tEnv = new TestEnvironment(xImpressDoc);
+
+ log.println("adding Controller as ObjRelation for XModel");
+ tEnv.addObjRelation("CONT2", cont2);
+
+ log.println("Adding SelectionSupplier and Shape to select for XModel");
+ tEnv.addObjRelation("SELSUPP", sel);
+ tEnv.addObjRelation("TOSELECT", aShape);
+
+ // create object relation for XPrintJobBroadcaster
+ String fileName = utils.getOfficeTempDirSys((XMultiServiceFactory) Param.getMSF())+"printfile.prt" ;
+ File f = new File(fileName);
+ if (f.exists()) {
+ f.delete();
+ }
+ _XPrintJobBroadcaster.MyPrintJobListener listener = new _XPrintJobBroadcaster.MyPrintJobListener(xImpressDoc, fileName);
+ tEnv.addObjRelation("XPrintJobBroadcaster.XPrintJobListener", listener);
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+} // finish class SdDrawPage
diff --git a/qadevOOo/tests/java/mod/_sd/SdXPresentation.java b/qadevOOo/tests/java/mod/_sd/SdXPresentation.java
new file mode 100644
index 000000000000..ab0f673fb471
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/SdXPresentation.java
@@ -0,0 +1,164 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XNameContainer;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.presentation.XCustomPresentationSupplier;
+import com.sun.star.presentation.XPresentationSupplier;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.presentation.Presentation</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::presentation::Presentation</code></li>
+* <li> <code>com::sun::star::presentation::XPresentation</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* </ul>
+* @see com.sun.star.presentation.Presentation
+* @see com.sun.star.presentation.XPresentation
+* @see com.sun.star.beans.XPropertySet
+* @see ifc.presentation._Presentation
+* @see ifc.presentation._XPresentation
+* @see ifc.beans._XPropertySet
+*/
+public class SdXPresentation extends TestCase {
+ XComponent xImpressDoc;
+
+ /**
+ * Creates Impress document.
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println( "creating a draw document" );
+ xImpressDoc = SOF.createImpressDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Impress document.
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing xImpressDoc");
+ util.DesktopTools.closeDoc(xImpressDoc);;
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the presentation from the document using the interface
+ * <code>XPresentationSupplier</code>. The retrieved presentation is the
+ * instance of the service <code>com.sun.star.presentation.Presentation</code>.
+ * Retrieves the collection of the customized presentations from the document
+ * using the interface <code>XCustomPresentationSupplier</code>.
+ * Creates and inserts two new instances of presentation to the retrieved
+ * collection.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'Presentation'</code> for
+ * {@link ifc.presentation._Presentation}(the retrieved presentation)</li>
+ * </ul>
+ * @see com.sun.star.presentation.XCustomPresentationSupplier
+ * @see com.sun.star.presentation.Presentation
+ * @see com.sun.star.presentation.XCustomPresentationSupplier
+ */
+ public TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) throws StatusException {
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ log.println( "get presentation" );
+ XPresentationSupplier oPS = (XPresentationSupplier)
+ UnoRuntime.queryInterface(XPresentationSupplier.class, xImpressDoc);
+ XInterface oObj = oPS.getPresentation();
+
+ log.println( "get custom presentation" );
+ XCustomPresentationSupplier oCPS = (XCustomPresentationSupplier)
+ UnoRuntime.queryInterface(
+ XCustomPresentationSupplier.class, xImpressDoc);
+ XNameContainer xCP = oCPS.getCustomPresentations();
+
+ XInterface oInstance = null;
+ XInterface oInstance2 = null;
+
+ XSingleServiceFactory oSingleMSF = (XSingleServiceFactory)
+ UnoRuntime.queryInterface(XSingleServiceFactory.class, xCP);
+
+ try{
+ oInstance = (XInterface) oSingleMSF.createInstance();
+ oInstance2 = (XInterface) oSingleMSF.createInstance();
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create instance", e);
+ }
+
+ try {
+ xCP.insertByName("FirstPresentation",oInstance);
+ xCP.insertByName("SecondPresentation", oInstance2);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Could't insert Instance", e);
+ } catch (com.sun.star.container.ElementExistException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Could't insert Instance", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Could't insert Instance", e);
+ }
+
+ log.println( "creating a new environment for XPresentation object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("Presentation",oObj);
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+} // finish class SdPresentation
+
diff --git a/qadevOOo/tests/java/mod/_sd/SdXShape.java b/qadevOOo/tests/java/mod/_sd/SdXShape.java
new file mode 100644
index 000000000000..4fc52490c97b
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/SdXShape.java
@@ -0,0 +1,219 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sd;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.drawing.XShape;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.style.XStyle;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.drawing.Shape</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::lang::XComponent</code></li>
+* <li> <code>com::sun::star::drawing::XShape</code></li>
+* <li> <code>com::sun::star::drawing::XShapeDescriptor</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::drawing::Shape</code></li>
+* </ul>
+* @see com.sun.star.lang.XComponent
+* @see com.sun.star.drawing.XShape
+* @see com.sun.star.drawing.XShapeDescriptor
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.drawing.Shape
+* @see ifc.lang._XComponent
+* @see ifc.drawing._XShape
+* @see ifc.drawing._XShapeDescriptor
+* @see ifc.beans._XPropertySet
+* @see ifc.drawing._Shape
+*/
+public class SdXShape extends TestCase {
+ XComponent xDrawDoc;
+
+ /**
+ * Creates Drawing document.
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println( "creating a draw document" );
+ xDrawDoc = SOF.createDrawDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Drawing document.
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println("disposing xDrawDoc");
+ util.DesktopTools.closeDoc(xDrawDoc);;
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the collection of the draw pages from the drawing document using
+ * the interface <code>XDrawPagesSupplier</code>. Creates a rectangle shape
+ * that is the instance of the service <code>com.sun.star.drawing.Shape</code>.
+ * Creates and adds several new rectangle shapes and one ellipse shape to
+ * the retrieved draw page. Sets and gets some properties of the created
+ * rectangle shape.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'Style1'</code> for
+ * {@link ifc.drawing._XShapeDescriptor}, {@link ifc.drawing._XShape}
+ * (the value of the property 'Style' that was retrived from the created
+ * rectangle shape) </li>
+ * <li> <code>'Style2'</code> for
+ * {@link ifc.drawing._XShapeDescriptor}, {@link ifc.drawing._XShape}
+ * (the value of the property 'Style' that was retrived from the created
+ * ellipse shape) </li>
+ * </ul>
+ * @see com.sun.star.drawing.XDrawPagesSupplier
+ * @see com.sun.star.drawing.Shape
+ */
+ protected synchronized TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) {
+
+ log.println( "creating a test environment" );
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)Param.getMSF());
+
+ // get the drawpage of drawing here
+ log.println( "getting Drawpage" );
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class, xDrawDoc);
+ XDrawPages oDPn = oDPS.getDrawPages();
+ XIndexAccess oDPi = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oDPn);
+ XDrawPage oDP = null;
+ try {
+ oDP = (XDrawPage) AnyConverter.toObject(
+ new Type(XDrawPage.class),oDPi.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get by index", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get by index", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace( log );
+ throw new StatusException("Couldn't get by index", e);
+ }
+
+ //get a Shape
+ log.println( "getting Shape" );
+ XShapes oShapes = (XShapes) UnoRuntime.queryInterface
+ (XShapes.class, oDP);
+ XInterface oObj = SOF.createShape
+ (xDrawDoc, 5000, 3500, 7500, 5000, "Rectangle");
+ for (int i=0; i < 10; i++) {
+ oShapes.add(
+ SOF.createShape(xDrawDoc,
+ 5000, 3500, 7510 + 10 * i, 5010 + 10 * i, "Rectangle"));
+ }
+ XShape oShape = SOF.createShape
+ (xDrawDoc, 3000, 4500, 15000, 1000, "Ellipse");
+ oShapes.add((XShape) oObj);
+ oShapes.add((XShape) oShape);
+
+ log.println( "creating a new environment for XShape object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ log.println( "adding two style as ObjRelation for ShapeDescriptor" );
+ XPropertySet oShapeProps = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, oObj);
+ XStyle aStyle = null;
+ try {
+ aStyle = (XStyle) AnyConverter.toObject(
+ new Type(XStyle.class),oShapeProps.getPropertyValue("Style"));
+ oShapeProps.setPropertyValue("ZOrder", new Integer(1));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't set or get property value", e);
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't set or get property value", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't set or get property value", e);
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't set or get property value", e);
+ }
+
+ tEnv.addObjRelation("Style1", aStyle);
+ oShapeProps = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, oShape);
+ try {
+ aStyle = (XStyle) AnyConverter.toObject(
+ new Type(XStyle.class),oShapeProps.getPropertyValue("Style"));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get property value", e);
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get property value", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get property value", e);
+ }
+
+ tEnv.addObjRelation("Style2", aStyle);
+
+ return tEnv;
+ } // finish method createTestEnvironment
+
+} // finish class SdXShape
diff --git a/qadevOOo/tests/java/mod/_sd/package.html b/qadevOOo/tests/java/mod/_sd/package.html
new file mode 100644
index 000000000000..000df01c68d4
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sd/package.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML>
+<BODY>
+<P>Containes all test cases for the module 'sd'.</P>
+</BODY>
+</HTML> \ No newline at end of file