summaryrefslogtreecommitdiff
path: root/qadevOOo/tests/java/mod/_xmloff/Impress
diff options
context:
space:
mode:
Diffstat (limited to 'qadevOOo/tests/java/mod/_xmloff/Impress')
-rw-r--r--qadevOOo/tests/java/mod/_xmloff/Impress/XMLContentExporter.java207
-rw-r--r--qadevOOo/tests/java/mod/_xmloff/Impress/XMLContentImporter.java221
-rw-r--r--qadevOOo/tests/java/mod/_xmloff/Impress/XMLExporter.java210
-rw-r--r--qadevOOo/tests/java/mod/_xmloff/Impress/XMLImporter.java180
-rw-r--r--qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaExporter.java206
-rw-r--r--qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaImporter.java189
-rw-r--r--qadevOOo/tests/java/mod/_xmloff/Impress/XMLSettingsExporter.java219
-rw-r--r--qadevOOo/tests/java/mod/_xmloff/Impress/XMLSettingsImporter.java213
-rw-r--r--qadevOOo/tests/java/mod/_xmloff/Impress/XMLStylesExporter.java209
-rw-r--r--qadevOOo/tests/java/mod/_xmloff/Impress/XMLStylesImporter.java202
10 files changed, 2056 insertions, 0 deletions
diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLContentExporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLContentExporter.java
new file mode 100644
index 000000000000..ec6d6104da7a
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLContentExporter.java
@@ -0,0 +1,207 @@
+/*************************************************************************
+ *
+ * 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._xmloff.Impress;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+import util.XMLTools;
+
+import com.sun.star.container.XNamed;
+import com.sun.star.document.XExporter;
+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.Any;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.xml.sax.XDocumentHandler;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.comp.Impress.XMLContentExporter</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li><code>com::sun::star::lang::XInitialization</code></li>
+ * <li><code>com::sun::star::document::ExportFilter</code></li>
+ * <li><code>com::sun::star::document::XFilter</code></li>
+ * <li><code>com::sun::star::document::XExporter</code></li>
+ * <li><code>com::sun::star::beans::XPropertySet</code></li>
+ * </ul>
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.document.ExportFilter
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.document.XExporter
+ * @see com.sun.star.beans.XPropertySet
+ * @see ifc.lang._XInitialization
+ * @see ifc.document._ExportFilter
+ * @see ifc.document._XFilter
+ * @see ifc.document._XExporter
+ * @see ifc.beans._XPropertySet
+ */
+public class XMLContentExporter extends TestCase {
+ XComponent xImpressDoc = null;
+
+ /**
+ * New text document created.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating an impress document" );
+ xImpressDoc = SOF.createImpressDoc(null);;
+ } catch ( Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Document disposed here.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xImpressDoc " );
+ xImpressDoc.dispose();
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.Impress.XMLContentExporter</code> with
+ * argument which is an implementation of <code>XDocumentHandler</code>
+ * and which can check if required tags and character data is
+ * exported. <p>
+ * The impress document is set as a source document for exporter
+ * created. The existing draw page is gotten a new name. This made
+ * for checking if this new name is successfully exported within
+ * the document content.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'MediaDescriptor'</code> for
+ * {@link ifc.document._XFilter} interface </li>
+ * <li> <code>'XFilter.Checker'</code> for
+ * {@link ifc.document._XFilter} interface </li>
+ * <li> <code>'SourceDocument'</code> for
+ * {@link ifc.document._XExporter} interface </li>
+ * </ul>
+ */
+ public synchronized TestEnvironment createTestEnvironment
+ (TestParameters tParam, PrintWriter log ) throws StatusException {
+
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF() ;
+ XInterface oObj = null;
+ final String expPageName = "XMLContentExporter" ;
+
+ FilterChecker filter = new FilterChecker(log);
+ Any arg = new Any(new Type(XDocumentHandler.class),filter);
+
+ try {
+ oObj = (XInterface) xMSF.createInstanceWithArguments(
+ "com.sun.star.comp.Impress.XMLContentExporter",
+ new Object[] {arg});
+ XExporter xEx = (XExporter)
+ UnoRuntime.queryInterface(XExporter.class,oObj);
+ xEx.setSourceDocument(xImpressDoc);
+
+ // assigning a draw page a new name
+ XDrawPagesSupplier xPagesSup = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface
+ (XDrawPagesSupplier.class, xImpressDoc) ;
+ XDrawPages xPages = xPagesSup.getDrawPages() ;
+ XNamed xPageName = (XNamed) UnoRuntime.queryInterface
+ (XNamed.class, xPages.getByIndex(0)) ;
+ xPageName.setName(expPageName) ;
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException("Can't create component.", e) ;
+ }
+
+ // adding tags required to be in XML data exported.
+ filter.addTag(new XMLTools.Tag("office:document-content")) ;
+ filter.addTagEnclosed(new XMLTools.Tag("office:body"),
+ new XMLTools.Tag("office:document-content")) ;
+ filter.addTagEnclosed(
+ new XMLTools.Tag("draw:page", "draw:name", expPageName),
+ new XMLTools.Tag("office:body")) ;
+
+ // create testobject here
+ log.println( "creating a new environment" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("MediaDescriptor", XMLTools.createMediaDescriptor(
+ new String[] {"FilterName"},
+ new Object[] {"simpress: StarOffice XML (Impress)"}));
+ tEnv.addObjRelation("SourceDocument",xImpressDoc);
+ tEnv.addObjRelation("XFilter.Checker", filter) ;
+
+ log.println("Implementation Name: "+util.utils.getImplName(oObj));
+
+ return tEnv;
+
+ }
+
+ /**
+ * This class checks the XML for tags and data required and returns
+ * checking result to <code>XFilter</code> interface test. All
+ * the information about errors occured in XML data is written
+ * to log specified.
+ * @see ifc.document._XFilter
+ */
+ protected class FilterChecker extends XMLTools.XMLChecker
+ implements ifc.document._XFilter.FilterChecker {
+
+ /**
+ * Creates a class which will write information
+ * into log specified.
+ */
+ public FilterChecker(PrintWriter log) {
+ super(log, true) ;
+ }
+ /**
+ * <code>_XFilter.FilterChecker</code> interface method
+ * which returns the result of XML checking.
+ * @return <code>true</code> if the XML data exported was
+ * valid (i.e. all necessary tags and character data exists),
+ * <code>false</code> if some errors occured.
+ */
+ public boolean checkFilter() {
+ return check() ;
+ }
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLContentImporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLContentImporter.java
new file mode 100644
index 000000000000..bb919b651ae0
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLContentImporter.java
@@ -0,0 +1,221 @@
+/*************************************************************************
+ *
+ * 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._xmloff.Impress;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XNamed;
+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.comp.Impress.XMLContentImporter</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li><code>com::sun::star::lang::XInitialization</code></li>
+ * <li><code>com::sun::star::document::XImporter</code></li>
+ * <li><code>com::sun::star::document::XFilter</code></li>
+ * <li><code>com::sun::star::document::ImportFilter</code></li>
+ * <li><code>com::sun::star::beans::XPropertySet</code></li>
+ * <li><code>com::sun::star::xml::sax::XDocumentHandler</code></li>
+ * </ul>
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.document.XImporter
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.document.ImportFilter
+ * @see com.sun.star.beans.XPropertySet
+ * @see com.sun.star.xml.sax.XDocumentHandler
+ * @see ifc.lang._XInitialization
+ * @see ifc.document._XImporter
+ * @see ifc.document._XFilter
+ * @see ifc.document._XExporter
+ * @see ifc.beans._XPropertySet
+ * @see ifc.xml.sax._XDocumentHandler
+ */
+public class XMLContentImporter extends TestCase {
+ XComponent xImpressDoc = null;
+
+ /**
+ * New chart document created.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating an impress document" );
+ xImpressDoc = SOF.createImpressDoc(null);;
+ } catch ( Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing document " );
+ xImpressDoc.dispose();
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.Impress.XMLContentImporter</code><p>
+ *
+ * The chart document is set as a target document for importer.
+ * Imported XML-data contains the tag with a new page which has
+ * some name.
+ * After import page name getting from target document is checked.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'XDocumentHandler.XMLData'</code> for
+ * {@link ifc.xml.sax._XDocumentHandler} interface </li>
+ * <li> <code>'XDocumentHandler.ImportChecker'</code> for
+ * {@link ifc.xml.sax._XDocumentHandler} interface </li>
+ * <li> <code>'TargetDocument'</code> for
+ * {@link ifc.document._XImporter} interface </li>
+ * </ul>
+ */
+ public synchronized TestEnvironment createTestEnvironment
+ (TestParameters tParam,PrintWriter log) throws StatusException {
+
+ XInterface oObj = null;
+ Object oInt = null ;
+ final String impPageName = "XMLImporterPage" ;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF() ;
+
+ try {
+ oInt = xMSF.createInstance
+ ("com.sun.star.comp.Impress.XMLContentImporter") ;
+
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException("Can't create component.", e) ;
+ }
+
+ oObj = (XInterface) oInt ;
+
+ // create testobject here
+ log.println( "creating a new environment for Paragraph object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // adding relation
+ tEnv.addObjRelation("TargetDocument", xImpressDoc) ;
+
+ // adding relation for XDocumentHandler
+ String[][] xml = new String[][] {
+ {"start", "office:document",
+ "xmlns:office", "CDATA", "http://openoffice.org/2000/office",
+ "xmlns:presentation", "CDATA", "http://openoffice.org/2000/presentation",
+ "xmlns:svg", "CDATA", "http://openoffice.org/2000/svg",
+ "xmlns:draw", "CDATA", "http://openoffice.org/2000/drawing",
+ "office:class", "CDATA", "presentation"
+ ,"office:version", "CDATA", "1.0"
+ },
+ {"start", "office:body"},
+ {"start", "draw:page",
+ "draw:name", "CDATA", impPageName,
+ "draw:master-page-name", "CDATA", "Default"
+ },
+ {"start", "presentation:notes"},
+ {"start", "draw:page-thumbnail",
+ "draw:style-name", "CDATA", "gr1",
+ "draw:layer", "CDATA", "layout",
+ "svg:width", "CDATA", "12.768cm",
+ "svg:height", "CDATA", "9.576cm",
+ "svg:x", "CDATA", "4.411cm",
+ "svg:y", "CDATA", "2.794cm",
+ "presentation:class", "CDATA", "page",
+ "draw:page-number", "CDATA", "1"
+ },
+ {"end", "draw:page-thumbnail"},
+ {"start", "draw:text-box",
+ "presentation:style-name", "CDATA", "Default-notes",
+ "draw:layer", "CDATA", "layout",
+ "svg:width", "CDATA", "15.021cm",
+ "svg:height", "CDATA", "10.63cm",
+ "svg:x", "CDATA", "3.292cm",
+ "svg:y", "CDATA", "13.299cm",
+ "presentation:class", "CDATA", "notes",
+ "presentation:placeholder", "CDATA", "true"
+ },
+ {"end", "draw:text-box"},
+ {"end", "presentation:notes"},
+ {"end", "draw:page"},
+ {"end", "office:body"},
+ {"end", "office:document"}} ;
+
+ tEnv.addObjRelation("XDocumentHandler.XMLData", xml) ;
+
+ final PrintWriter logF = log ;
+
+ tEnv.addObjRelation("XDocumentHandler.ImportChecker",
+ new ifc.xml.sax._XDocumentHandler.ImportChecker() {
+ public boolean checkImport() {
+ try {
+ XDrawPagesSupplier xPagesSup = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface
+ (XDrawPagesSupplier.class, xImpressDoc) ;
+ XDrawPages xPages = xPagesSup.getDrawPages() ;
+ XNamed xPageName = (XNamed) UnoRuntime.queryInterface
+ (XNamed.class, xPages.getByIndex(0)) ;
+ String gName = xPageName.getName() ;
+ logF.println("Page name returned = '" + gName + "'") ;
+ return impPageName.equals(gName) ;
+ } catch (com.sun.star.uno.Exception e) {
+ logF.println("Exception occured while checking filter :") ;
+ e.printStackTrace(logF) ;
+ return false ;
+ }
+ }
+ }) ;
+
+ return tEnv;
+ } // finish method getTestEnvironment
+}
+
diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLExporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLExporter.java
new file mode 100644
index 000000000000..cfb3d1117021
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLExporter.java
@@ -0,0 +1,210 @@
+/*************************************************************************
+ *
+ * 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._xmloff.Impress;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+import util.XMLTools;
+
+import com.sun.star.container.XNamed;
+import com.sun.star.document.XExporter;
+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.uno.Any;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.xml.sax.XDocumentHandler;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.comp.Impress.XMLExporter</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li><code>com::sun::star::lang::XInitialization</code></li>
+ * <li><code>com::sun::star::document::ExportFilter</code></li>
+ * <li><code>com::sun::star::document::XFilter</code></li>
+ * <li><code>com::sun::star::document::XExporter</code></li>
+ * <li><code>com::sun::star::beans::XPropertySet</code></li>
+ * </ul>
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.document.ExportFilter
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.document.XExporter
+ * @see com.sun.star.beans.XPropertySet
+ * @see ifc.lang._XInitialization
+ * @see ifc.document._ExportFilter
+ * @see ifc.document._XFilter
+ * @see ifc.document._XExporter
+ * @see ifc.beans._XPropertySet
+ */
+public class XMLExporter extends TestCase {
+ XComponent xImpressDoc = null;
+
+ /**
+ * New impress document created.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating an impress document" );
+ xImpressDoc = SOF.createImpressDoc(null);;
+ } catch ( Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Document disposed here.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xImpressDoc " );
+ xImpressDoc.dispose();
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.Impress.XMLExporter</code> with
+ * argument which is an implementation of <code>XDocumentHandler</code>
+ * and which can check if required tags and character data is
+ * exported. <p>
+ * The impress document is set as a source document for exporter
+ * created. A new draw page with specific name created. This made
+ * for checking if this draw page is successfully exported within
+ * the document.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'MediaDescriptor'</code> for
+ * {@link ifc.document._XFilter} interface </li>
+ * <li> <code>'XFilter.Checker'</code> for
+ * {@link ifc.document._XFilter} interface </li>
+ * <li> <code>'SourceDocument'</code> for
+ * {@link ifc.document._XExporter} interface </li>
+ * </ul>
+ */
+ protected synchronized TestEnvironment createTestEnvironment
+ (TestParameters tParam, PrintWriter log) {
+
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF() ;
+ XInterface oObj = null;
+
+ FilterChecker Filter = new FilterChecker(log);
+ Any arg = new Any(new Type(XDocumentHandler.class), Filter);
+
+ final String NAME = "XMLExporter";
+
+ try {
+ oObj = (XInterface) xMSF.createInstanceWithArguments(
+ "com.sun.star.comp.Impress.XMLExporter", new Object[] {arg});
+
+ //get draw pages
+ XDrawPagesSupplier drawPagesSupplier = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class, xImpressDoc);
+ XDrawPages drawPages = drawPagesSupplier.getDrawPages();
+ //insert new draw page
+ XDrawPage newDrawPage = drawPages.insertNewByIndex(0);
+ //set specific test name
+ XNamed newPageNamed = (XNamed)
+ UnoRuntime.queryInterface(XNamed.class, newDrawPage);
+ newPageNamed.setName(NAME);
+ XExporter xEx = (XExporter)
+ UnoRuntime.queryInterface(XExporter.class,oObj);
+ xEx.setSourceDocument(xImpressDoc);
+
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException("Can't create component.", e) ;
+ }
+
+ // adding tags which must be contained in XML output
+ Filter.addTag( new XMLTools.Tag("office:document") );
+ Filter.addTagEnclosed(
+ new XMLTools.Tag("office:body"),
+ new XMLTools.Tag("office:document") );
+ Filter.addTagEnclosed(
+ new XMLTools.Tag("draw:page", "draw:name", NAME),
+ new XMLTools.Tag("office:body") );
+
+
+ // create testobject here
+ log.println( "creating a new environment" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("MediaDescriptor", XMLTools.createMediaDescriptor(
+ new String[] {"FilterName"},
+ new Object[] {"simpress: StarOffice XML (Impress)"}));
+ tEnv.addObjRelation("SourceDocument",xImpressDoc);
+ tEnv.addObjRelation("XFilter.Checker", Filter) ;
+
+ return tEnv;
+ }
+
+ /**
+ * This class checks the XML for tags and data required and returns
+ * checking result to <code>XFilter</code> interface test. All
+ * the information about errors occured in XML data is written
+ * to log specified.
+ * @see ifc.document._XFilter
+ */
+ protected class FilterChecker extends XMLTools.XMLChecker
+ implements ifc.document._XFilter.FilterChecker {
+
+ /**
+ * Creates a class which will write information
+ * into log specified.
+ */
+ public FilterChecker(PrintWriter log) {
+ super(log, true) ;
+ }
+ /**
+ * <code>_XFilter.FilterChecker</code> interface method
+ * which returns the result of XML checking.
+ * @return <code>true</code> if the XML data exported was
+ * valid (i.e. all necessary tags and character data exists),
+ * <code>false</code> if some errors occured.
+ */
+ public boolean checkFilter() {
+ return check();
+ }
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLImporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLImporter.java
new file mode 100644
index 000000000000..0675533906f1
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLImporter.java
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * 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._xmloff.Impress;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XNameAccess;
+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.comp.Impress.XMLImporter</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li><code>com::sun::star::lang::XInitialization</code></li>
+ * <li><code>com::sun::star::document::XImporter</code></li>
+ * <li><code>com::sun::star::document::XFilter</code></li>
+ * <li><code>com::sun::star::document::ImportFilter</code></li>
+ * <li><code>com::sun::star::beans::XPropertySet</code></li>
+ * <li><code>com::sun::star::xml::sax::XDocumentHandler</code></li>
+ * </ul>
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.document.XImporter
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.document.ImportFilter
+ * @see com.sun.star.beans.XPropertySet
+ * @see com.sun.star.xml.sax.XDocumentHandler
+ * @see ifc.lang._XInitialization
+ * @see ifc.document._XImporter
+ * @see ifc.document._XFilter
+ * @see ifc.document._XExporter
+ * @see ifc.beans._XPropertySet
+ * @see ifc.xml.sax._XDocumentHandler
+ */
+public class XMLImporter extends TestCase {
+ XComponent xImpressDoc = null;
+
+ /**
+ * New impress document created.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating an impress document" );
+ xImpressDoc = SOF.createImpressDoc(null);;
+ } catch ( Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Impress document destroyed.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing document " );
+ xImpressDoc.dispose();
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.Impress.XMLImporter</code><p>
+ *
+ * The impress document is set as a target document for importer.
+ * Imported tags contain page with the specific name.
+ * After import existence of the page with this specific
+ * name is checked in the target document.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'XDocumentHandler.XMLData'</code> for
+ * {@link ifc.xml.sax._XDocumentHandler} interface </li>
+ * <li> <code>'XDocumentHandler.ImportChecker'</code> for
+ * {@link ifc.xml.sax._XDocumentHandler} interface </li>
+ * <li> <code>'TargetDocument'</code> for
+ * {@link ifc.document._XImporter} interface </li>
+ * </ul>
+ */
+ public synchronized TestEnvironment createTestEnvironment
+ (TestParameters tParam, PrintWriter log) throws StatusException {
+
+ XInterface oObj = null;
+ Object oInt = null ;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF() ;
+
+ try {
+ oInt = xMSF.createInstance
+ ("com.sun.star.comp.Impress.XMLImporter") ;
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException("Can't create component.", e) ;
+ }
+
+ oObj = (XInterface) oInt ;
+
+ // create testobject here
+ log.println( "creating a new environment for Paragraph object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // adding relation
+ tEnv.addObjRelation("TargetDocument", xImpressDoc) ;
+
+ final String impName = "XMLImporter";
+ // adding relation for XDocumentHandler
+ String[][] xml = new String[][] {
+ {"start", "office:document",
+ "xmlns:office", "CDATA", "http://openoffice.org/2000/office",
+ "xmlns:draw", "CDATA", "http://openoffice.org/2000/drawing"
+ },
+ {"start", "office:body"},
+ {"start", "draw:page",
+ "draw:name", "CDATA", impName },
+ {"end", "draw:page"},
+ {"end", "office:body"},
+ {"end", "office:document"} };
+
+ tEnv.addObjRelation("XDocumentHandler.XMLData", xml);
+
+ //get draw pages
+ XDrawPagesSupplier drawPagesSupplier = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class, xImpressDoc);
+ XDrawPages drawPages = drawPagesSupplier.getDrawPages();
+ final XNameAccess xNamePages = (XNameAccess)
+ UnoRuntime.queryInterface(XNameAccess.class, drawPages);
+
+ tEnv.addObjRelation("XDocumentHandler.ImportChecker",
+ new ifc.xml.sax._XDocumentHandler.ImportChecker() {
+ public boolean checkImport() {
+ return xNamePages.hasByName(impName);
+ }
+ } );
+
+ return tEnv;
+ } // finish method getTestEnvironment
+}
diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaExporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaExporter.java
new file mode 100644
index 000000000000..a71443adbcc5
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaExporter.java
@@ -0,0 +1,206 @@
+/*************************************************************************
+ *
+ * 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._xmloff.Impress;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+import util.XMLTools;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.document.XDocumentInfoSupplier;
+import com.sun.star.document.XExporter;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.xml.sax.XDocumentHandler;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.comp.Impress.XMLMetaExporter</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li><code>com::sun::star::lang::XInitialization</code></li>
+ * <li><code>com::sun::star::document::ExportFilter</code></li>
+ * <li><code>com::sun::star::document::XFilter</code></li>
+ * <li><code>com::sun::star::document::XExporter</code></li>
+ * <li><code>com::sun::star::beans::XPropertySet</code></li>
+ * </ul>
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.document.ExportFilter
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.document.XExporter
+ * @see com.sun.star.beans.XPropertySet
+ * @see ifc.lang._XInitialization
+ * @see ifc.document._ExportFilter
+ * @see ifc.document._XFilter
+ * @see ifc.document._XExporter
+ * @see ifc.beans._XPropertySet
+ */
+public class XMLMetaExporter extends TestCase {
+ XComponent xImpressDoc = null;
+
+ /**
+ * New impress document created.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating an impress document" );
+ xImpressDoc = SOF.createImpressDoc(null);;
+ } catch ( Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Impress document disposed
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( "disposing xImpressDoc " );
+ xImpressDoc.dispose();
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.Impress.XMLMetaExporter</code> with
+ * argument which is an implementation of <code>XDocumentHandler</code>
+ * and which can check if required tags and character data is
+ * exported. <p>
+ * The impress document is set as a source document for exporter
+ * created. A meta property 'Title' is set to specific value. This made
+ * for checking if this value is successfully exported within
+ * the document meta information.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'MediaDescriptor'</code> for
+ * {@link ifc.document._XFilter} interface </li>
+ * <li> <code>'XFilter.Checker'</code> for
+ * {@link ifc.document._XFilter} interface </li>
+ * <li> <code>'SourceDocument'</code> for
+ * {@link ifc.document._XExporter} interface </li>
+ * </ul>
+ */
+ public synchronized TestEnvironment createTestEnvironment
+ (TestParameters tParam, PrintWriter log) throws StatusException {
+
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF() ;
+ XInterface oObj = null;
+
+ FilterChecker filter = new FilterChecker(log);
+ Any arg = new Any(new Type(XDocumentHandler.class), filter);
+ final String NAME = "XMLMetaExporter";
+
+ try {
+ oObj = (XInterface) xMSF.createInstanceWithArguments(
+ "com.sun.star.comp.Impress.XMLMetaExporter",
+ new Object[]{arg});
+ XExporter xEx = (XExporter)
+ UnoRuntime.queryInterface(XExporter.class,oObj);
+ xEx.setSourceDocument(xImpressDoc);
+
+ //change title name
+ XDocumentInfoSupplier infoSup = (XDocumentInfoSupplier)
+ UnoRuntime.queryInterface
+ (XDocumentInfoSupplier.class, xImpressDoc) ;
+ XPropertySet docInfo = (XPropertySet) UnoRuntime.queryInterface
+ (XPropertySet.class, infoSup.getDocumentInfo()) ;
+ docInfo.setPropertyValue("Title", NAME);
+
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException("Can't create component.", e) ;
+ }
+
+ // Checking tags existance and changed property value
+ filter.addTag(new XMLTools.Tag ("office:document-meta"));
+ filter.addTagEnclosed(
+ new XMLTools.Tag("office:meta"),
+ new XMLTools.Tag("office:document-meta") );
+ filter.addTagEnclosed(
+ new XMLTools.Tag("dc:title"),
+ new XMLTools.Tag("office:meta") );
+ filter.addCharactersEnclosed(
+ NAME,
+ new XMLTools.Tag ("dc:title") );
+
+ // create testobject here
+ log.println( "creating a new environment" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("MediaDescriptor", XMLTools.createMediaDescriptor(
+ new String[] {"FilterName"},
+ new Object[] {"simpress: StarOffice XML (Impress)"}));
+ tEnv.addObjRelation("SourceDocument", xImpressDoc);
+ tEnv.addObjRelation("XFilter.Checker", filter) ;
+ return tEnv;
+ }
+
+ /**
+ * This class checks the XML for tags and data required and returns
+ * checking result to <code>XFilter</code> interface test. All
+ * the information about errors occured in XML data is written
+ * to log specified.
+ * @see ifc.document._XFilter
+ */
+ protected class FilterChecker extends XMLTools.XMLChecker
+ implements ifc.document._XFilter.FilterChecker {
+
+ /**
+ * Creates a class which will write information
+ * into log specified.
+ */
+ public FilterChecker(PrintWriter log) {
+ super(log, true);
+ }
+ /**
+ * <code>_XFilter.FilterChecker</code> interface method
+ * which returns the result of XML checking.
+ * @return <code>true</code> if the XML data exported was
+ * valid (i.e. all necessary tags and character data exists),
+ * <code>false</code> if some errors occured.
+ */
+ public boolean checkFilter() {
+ return check();
+ }
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaImporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaImporter.java
new file mode 100644
index 000000000000..154f1380a9cc
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaImporter.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._xmloff.Impress;
+
+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.document.XDocumentInfoSupplier;
+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.comp.Impress.XMLMetaImporter</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li><code>com::sun::star::lang::XInitialization</code></li>
+ * <li><code>com::sun::star::document::XImporter</code></li>
+ * <li><code>com::sun::star::document::XFilter</code></li>
+ * <li><code>com::sun::star::document::ImportFilter</code></li>
+ * <li><code>com::sun::star::beans::XPropertySet</code></li>
+ * <li><code>com::sun::star::xml::sax::XDocumentHandler</code></li>
+ * </ul>
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.document.XImporter
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.document.ImportFilter
+ * @see com.sun.star.beans.XPropertySet
+ * @see com.sun.star.xml.sax.XDocumentHandler
+ * @see ifc.lang._XInitialization
+ * @see ifc.document._XImporter
+ * @see ifc.document._XFilter
+ * @see ifc.document._XExporter
+ * @see ifc.beans._XPropertySet
+ * @see ifc.xml.sax._XDocumentHandler
+ */
+public class XMLMetaImporter extends TestCase {
+ XComponent xImpressDoc = null;
+
+ /**
+ * New impress document created.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating an impress document" );
+ xImpressDoc = SOF.createImpressDoc(null);;
+ } catch ( Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Impress document destroyed.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing document " );
+ xImpressDoc.dispose();
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.Impress.XMLMetaImporter</code><p>
+ *
+ * The impress document is set as a target document for importer.
+ * Imported XML-data contains only meta tags including title tag
+ * with test title name. After import title name getting from
+ * target document is checked.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'XDocumentHandler.XMLData'</code> for
+ * {@link ifc.xml.sax._XDocumentHandler} interface </li>
+ * <li> <code>'XDocumentHandler.ImportChecker'</code> for
+ * {@link ifc.xml.sax._XDocumentHandler} interface </li>
+ * <li> <code>'TargetDocument'</code> for
+ * {@link ifc.document._XImporter} interface </li>
+ * </ul>
+ */
+ public synchronized TestEnvironment createTestEnvironment
+ (TestParameters tParam,PrintWriter log ) throws StatusException {
+
+ XInterface oObj = null;
+ Object oInt = null ;
+ final String impTitle = "XMLImporter_test" ;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF() ;
+
+ try {
+ oInt = xMSF.createInstance
+ ("com.sun.star.comp.Impress.XMLMetaImporter") ;
+
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException("Can't create component.", e) ;
+ }
+
+ oObj = (XInterface) oInt ;
+
+ // create testobject here
+ log.println( "creating a new environment for Paragraph object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // adding relation
+ tEnv.addObjRelation("TargetDocument", xImpressDoc) ;
+
+ // adding relation for XDocumentHandler
+ String[][] xml = new String[][] {
+ {"start", "office:document-meta" ,
+ "xmlns:office", "CDATA", "http://openoffice.org/2000/office",
+ "xmlns:dc", "CDATA", "http://purl.org/dc/elements/1.1/"},
+ {"start", "office:meta"} ,
+ {"start", "dc:title"},
+ {"chars", impTitle},
+ {"end", "dc:title"},
+ {"end", "office:meta"},
+ {"end", "office:document-meta"}} ;
+
+ tEnv.addObjRelation("XDocumentHandler.XMLData", xml) ;
+
+ XDocumentInfoSupplier infoSup = (XDocumentInfoSupplier)
+ UnoRuntime.queryInterface
+ (XDocumentInfoSupplier.class, xImpressDoc) ;
+ final XPropertySet docInfo = (XPropertySet) UnoRuntime.queryInterface
+ (XPropertySet.class, infoSup.getDocumentInfo()) ;
+ final PrintWriter logF = log ;
+
+ tEnv.addObjRelation("XDocumentHandler.ImportChecker",
+ new ifc.xml.sax._XDocumentHandler.ImportChecker() {
+ public boolean checkImport() {
+ try {
+ String title = (String)
+ docInfo.getPropertyValue("Title") ;
+ logF.println("Title returned = '" + title + "'") ;
+ return impTitle.equals(title) ;
+ } catch (com.sun.star.uno.Exception e) {
+ logF.println("Exception occured while checking filter :") ;
+ e.printStackTrace(logF) ;
+ return false ;
+ }
+ }
+ } );
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+}
diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLSettingsExporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLSettingsExporter.java
new file mode 100644
index 000000000000..31aad6b65034
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLSettingsExporter.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._xmloff.Impress;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+import util.XMLTools;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.document.XExporter;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.xml.sax.XDocumentHandler;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.comp.Impress.XMLSettingsExporter</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li><code>com::sun::star::lang::XInitialization</code></li>
+ * <li><code>com::sun::star::document::ExportFilter</code></li>
+ * <li><code>com::sun::star::document::XFilter</code></li>
+ * <li><code>com::sun::star::document::XExporter</code></li>
+ * <li><code>com::sun::star::beans::XPropertySet</code></li>
+ * </ul>
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.document.ExportFilter
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.document.XExporter
+ * @see com.sun.star.beans.XPropertySet
+ * @see ifc.lang._XInitialization
+ * @see ifc.document._ExportFilter
+ * @see ifc.document._XFilter
+ * @see ifc.document._XExporter
+ * @see ifc.beans._XPropertySet
+ */
+public class XMLSettingsExporter extends TestCase {
+ XComponent xImpressDoc = null;
+
+ /**
+ * New text document created.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating an impress document" );
+ xImpressDoc = SOF.createImpressDoc(null);;
+ } catch ( Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Document disposed here.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xImpressDoc " );
+ xImpressDoc.dispose();
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.Impress.XMLSettingsExporter</code> with
+ * argument which is an implementation of <code>XDocumentHandler</code>
+ * and which can check if required tags and character data is
+ * exported. <p>
+ * The Impress document is set as a source document for exporter
+ * created. Then setting 'IsLayerMode' is changed to a new value.
+ * After this filter checks that value has changed in the XML output.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'MediaDescriptor'</code> for
+ * {@link ifc.document._XFilter} interface </li>
+ * <li> <code>'XFilter.Checker'</code> for
+ * {@link ifc.document._XFilter} interface </li>
+ * <li> <code>'SourceDocument'</code> for
+ * {@link ifc.document._XExporter} interface </li>
+ * </ul>
+ */
+ public synchronized TestEnvironment createTestEnvironment
+ (TestParameters tParam, PrintWriter log ) throws StatusException {
+
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF();
+ XInterface oObj = null;
+ FilterChecker filter = new FilterChecker(log);
+ Any arg = new Any(new Type(XDocumentHandler.class),filter);
+ final boolean NewDataValue;
+
+ try {
+ oObj = (XInterface) xMSF.createInstanceWithArguments(
+ "com.sun.star.comp.Impress.XMLSettingsExporter",
+ new Object[] {arg});
+ XExporter xEx = (XExporter)
+ UnoRuntime.queryInterface(XExporter.class,oObj);
+ xEx.setSourceDocument(xImpressDoc);
+
+ //set some settings
+ XModel xImpressModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xImpressDoc);
+ XController xController = xImpressModel.getCurrentController();
+ XPropertySet xPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xController);
+ NewDataValue = ! ((Boolean) xPropSet.getPropertyValue
+ ("IsLayerMode")).booleanValue();
+ xPropSet.setPropertyValue("IsLayerMode",
+ new Boolean (NewDataValue));
+
+/* XViewDataSupplier xViewDataSupp = (XViewDataSupplier)
+ UnoRuntime.queryInterface(XViewDataSupplier.class, xImpressDoc);
+ XIndexAccess xViewData = xViewDataSupp.getViewData();
+ PropertyValue[] xData = (PropertyValue[]) xViewData.getByIndex(0);
+ NewDataValue = ! ((Boolean) xData[1].Value).booleanValue();
+ xData[1].Value = new Boolean(NewDataValue);
+ XIndexReplace xViewDataReplacable = (XIndexReplace)
+ UnoRuntime.queryInterface(XIndexReplace.class, xViewData);
+ xViewDataReplacable.replaceByIndex(0,xData);
+*/
+
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException("Can't create component.", e) ;
+ }
+
+ // Adding tags for checking existance of head tag and other tags
+ filter.addTagEnclosed(new XMLTools.Tag("office:settings"),
+ new XMLTools.Tag("office:document-settings"));
+ filter.addTagEnclosed(new XMLTools.Tag("config:config-item-set"),
+ new XMLTools.Tag("office:settings"));
+ filter.addTagEnclosed(new XMLTools.Tag("config:config-item-map-indexed"),
+ new XMLTools.Tag("config:config-item-set"));
+ filter.addTagEnclosed(new XMLTools.Tag("config:config-item-map-entry"),
+ new XMLTools.Tag("config:config-item-map-indexed"));
+ filter.addTagEnclosed(new XMLTools.Tag("config:config-item"),
+ new XMLTools.Tag("config:config-item-map-entry"));
+ filter.addCharactersEnclosed(String.valueOf(NewDataValue),
+ new XMLTools.Tag("config:config-item","config:name","IsLayerMode"));
+
+ // create testobject here
+ log.println( "creating a new environment" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("MediaDescriptor", XMLTools.createMediaDescriptor(
+ new String[] {"FilterName"},
+ new Object[] {"simpress: StarOffice XML (Impress)"}));
+ tEnv.addObjRelation("SourceDocument",xImpressDoc);
+ tEnv.addObjRelation("XFilter.Checker", filter);
+ return tEnv;
+ }
+
+ /**
+ * This class checks the XML for tags and data required and returns
+ * checking result to <code>XFilter</code> interface test. All
+ * the information about errors occured in XML data is written
+ * to log specified.
+ * @see ifc.document._XFilter
+ */
+ protected class FilterChecker extends XMLTools.XMLChecker
+ implements ifc.document._XFilter.FilterChecker {
+
+ /**
+ * Creates a class which will write information
+ * into log specified.
+ */
+ public FilterChecker(PrintWriter log) {
+ super(log,false) ;
+ }
+ /**
+ * <code>_XFilter.FilterChecker</code> interface method
+ * which returns the result of XML checking.
+ * @return <code>true</code> if the XML data exported was
+ * valid (i.e. all necessary tags and character data exists),
+ * <code>false</code> if some errors occured.
+ */
+ public boolean checkFilter() {
+ return check();
+ }
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLSettingsImporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLSettingsImporter.java
new file mode 100644
index 000000000000..75d0661630bd
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLSettingsImporter.java
@@ -0,0 +1,213 @@
+/*************************************************************************
+ *
+ * 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._xmloff.Impress;
+
+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.frame.XController;
+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;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.comp.Impress.XMLSettingsImporter</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li><code>com::sun::star::lang::XInitialization</code></li>
+ * <li><code>com::sun::star::document::XImporter</code></li>
+ * <li><code>com::sun::star::document::XFilter</code></li>
+ * <li><code>com::sun::star::document::ImportFilter</code></li>
+ * <li><code>com::sun::star::beans::XPropertySet</code></li>
+ * <li><code>com::sun::star::xml::sax::XDocumentHandler</code></li>
+
+ * </ul>
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.document.XImporter
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.document.ImportFilter
+ * @see com.sun.star.beans.XPropertySet
+ * @see com.sun.star.xml.sax.XDocumentHandler
+ * @see ifc.lang._XInitialization
+ * @see ifc.document._XImporter
+ * @see ifc.document._XFilter
+ * @see ifc.document._XExporter
+ * @see ifc.beans._XPropertySet
+ * @see ifc.xml.sax._XDocumentHandler
+ */
+public class XMLSettingsImporter extends TestCase {
+ XComponent xImpressDoc = null;
+
+ /**
+ * New impress document created.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating an impress document" );
+ xImpressDoc = SOF.createImpressDoc(null);;
+ } catch ( Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Impress document destroyed.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing document " );
+ xImpressDoc.dispose();
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.Impress.XMLStylesImporter</code><p>
+ *
+ * The Impress document is set as a target document for importer.
+ * Value of a property "IsLayerMode" has imported as 'true' to a target
+ * document. After import property value getting from target document
+ * is checked.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'XDocumentHandler.XMLData'</code> for
+ * {@link ifc.xml.sax._XDocumentHandler} interface </li>
+ * <li> <code>'XDocumentHandler.ImportChecker'</code> for
+ * {@link ifc.xml.sax._XDocumentHandler} interface </li>
+ * <li> <code>'TargetDocument'</code> for
+ * {@link ifc.document._XImporter} interface </li>
+ * </ul>
+ */
+ public synchronized TestEnvironment createTestEnvironment
+ (TestParameters tParam, PrintWriter log ) throws StatusException {
+
+ XInterface oObj = null;
+ Object oInt = null ;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF() ;
+
+ try {
+ oInt = xMSF.createInstance
+ ("com.sun.star.comp.Impress.XMLSettingsImporter") ;
+
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException("Can't create component.", e) ;
+ }
+
+ oObj = (XInterface) oInt ;
+
+ // create testobject here
+ log.println( "creating a new environment for Paragraph object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // adding relation
+ tEnv.addObjRelation("TargetDocument", xImpressDoc) ;
+
+ // adding relation for XDocumentHandler
+ String[][] xml = new String[][] {
+ {"start", "office:document-settings",
+ "xmlns:office", "CDATA", "http://openoffice.org/2000/office",
+ "xmlns:xlink", "CDATA", "http://www.w3.org/1999/xlink",
+ "xmlns:presentation", "CDATA",
+ "http://openoffice.org/2000/presentation",
+ "xmlns:config", "CDATA", "http://openoffice.org/2001/config",
+ "office:version", "CDATA", "1.0"},
+ {"start", "office:settings"},
+ {"start", "config:config-item-map-indexed", "config:name",
+ "CDATA", "Views"},
+ {"start", "config:config-item-map-entry"},
+ {"start","config:config-item", "config:name", "CDATA",
+ "IsLayerMode"},
+ {"chars", "true"},
+ {"end", "config:config-item"},
+ {"end", "config:config-item-map-entry"},
+ {"end", "config:config-item-map-indexed"},
+ {"end", "office:settings"},
+ {"end", "office:document-settings"}} ;
+
+ tEnv.addObjRelation("XDocumentHandler.XMLData", xml) ;
+
+ // get property before import
+ XModel xImpressModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xImpressDoc);
+ XController xController = xImpressModel.getCurrentController();
+ final XPropertySet xPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xController);
+ try {
+ log.println("Property \"IsLayerMode\" before import is " +
+ xPropSet.getPropertyValue("IsLayerMode"));
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Can't create component.", e);
+ }
+ final PrintWriter logF = log;
+ tEnv.addObjRelation("XDocumentHandler.ImportChecker",
+ new ifc.xml.sax._XDocumentHandler.ImportChecker() {
+ public boolean checkImport() {
+ Boolean propValue;
+ try {
+ propValue = (Boolean) xPropSet.getPropertyValue
+ ("IsLayerMode");
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(logF);
+ throw new StatusException
+ ("Can't get property value.", e);
+ }
+ logF.println("Property \"IsLayerMode\" after import is "
+ + propValue);
+ if ( propValue.booleanValue() == true ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ });
+
+ return tEnv;
+ } // end of getTestEnvironment
+
+}
diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLStylesExporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLStylesExporter.java
new file mode 100644
index 000000000000..db0b45e3ae8b
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLStylesExporter.java
@@ -0,0 +1,209 @@
+/*************************************************************************
+ *
+ * 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._xmloff.Impress;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+import util.XMLTools;
+
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.document.XExporter;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.style.XStyle;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.xml.sax.XDocumentHandler;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.comp.Impress.XMLStylesExporter</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li><code>com::sun::star::lang::XInitialization</code></li>
+ * <li><code>com::sun::star::document::ExportFilter</code></li>
+ * <li><code>com::sun::star::document::XFilter</code></li>
+ * <li><code>com::sun::star::document::XExporter</code></li>
+ * <li><code>com::sun::star::beans::XPropertySet</code></li>
+ * </ul>
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.document.ExportFilter
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.document.XExporter
+ * @see com.sun.star.beans.XPropertySet
+ * @see ifc.lang._XInitialization
+ * @see ifc.document._ExportFilter
+ * @see ifc.document._XFilter
+ * @see ifc.document._XExporter
+ * @see ifc.beans._XPropertySet
+ */
+public class XMLStylesExporter extends TestCase {
+ XComponent xImpressDoc = null;
+ protected static int counter = 0;
+
+ /**
+ * New spreadsheet document created.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating an impress document" );
+ xImpressDoc = SOF.createImpressDoc(null);;
+ } catch ( Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Spreadsheet document disposed
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xImpressDoc " );
+ xImpressDoc.dispose();
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.Impress.XMLStylesExporter</code> with
+ * argument which is an implementation of <code>XDocumentHandler</code>
+ * and which can check if required tags and character data is
+ * exported. <p>
+ * The Impress document is set as a source document for exporter
+ * created. New style 'NewStyle' added to style family "Graphics".
+ * This made for checking if this style is successfully exported within
+ * the document styles information.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'MediaDescriptor'</code> for
+ * {@link ifc.document._XFilter} interface </li>
+ * <li> <code>'XFilter.Checker'</code> for
+ * {@link ifc.document._XFilter} interface </li>
+ * <li> <code>'SourceDocument'</code> for
+ * {@link ifc.document._XExporter} interface </li>
+ * </ul>
+ */
+ public synchronized TestEnvironment createTestEnvironment
+ (TestParameters tParam, PrintWriter log) throws StatusException {
+
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF() ;
+ XInterface oObj = null;
+ FilterChecker filter = new FilterChecker(log);
+ Any arg = new Any(new Type(XDocumentHandler.class),filter);
+
+ String newName = "NewGraphicsStyle" + counter++;
+ // Adding tags for checking existance of head tag and property value
+ filter.addTag(new XMLTools.Tag("office:document-styles"));
+ filter.addTag(new XMLTools.Tag("office:styles"));
+ filter.addTag(new XMLTools.Tag("style:style","style:name", newName));
+
+ try {
+ oObj = (XInterface) xMSF.createInstanceWithArguments(
+ "com.sun.star.comp.Impress.XMLStylesExporter",
+ new Object[] {arg});
+ XExporter xEx = (XExporter)
+ UnoRuntime.queryInterface(XExporter.class,oObj);
+ xEx.setSourceDocument(xImpressDoc);
+
+ // Obtaining and changing property values
+ XStyleFamiliesSupplier styleSup = (XStyleFamiliesSupplier)
+ UnoRuntime.queryInterface
+ (XStyleFamiliesSupplier.class, xImpressDoc) ;
+ XNameAccess styleFamilies = styleSup.getStyleFamilies();
+ String[] styleFamiliesNames = styleFamilies.getElementNames();
+ XNameContainer StyleFamilyName = (XNameContainer)
+ UnoRuntime.queryInterface(XNameContainer.class,
+ styleFamilies.getByName(styleFamiliesNames[0]));
+ Object SC = SOF.createInstance
+ (xImpressDoc, "com.sun.star.style.Style");
+ XStyle StylePage = (XStyle)
+ UnoRuntime.queryInterface(XStyle.class,SC);
+ StyleFamilyName.insertByName(newName, StylePage);
+
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException("Can't create component.", e) ;
+ }
+
+ // create testobject here
+ log.println( "creating a new environment" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("MediaDescriptor", XMLTools.createMediaDescriptor(
+ new String[] {"FilterName"},
+ new Object[] {"simpress: StarOffice XML (Impress)"}));
+ tEnv.addObjRelation("SourceDocument",xImpressDoc);
+ tEnv.addObjRelation("XFilter.Checker", filter);
+ return tEnv;
+ }
+
+ /**
+ * This class checks the XML for tags and data required and returns
+ * checking result to <code>XFilter</code> interface test. All
+ * the information about errors occured in XML data is written
+ * to log specified.
+ * @see ifc.document._XFilter
+ */
+ protected class FilterChecker extends XMLTools.XMLChecker
+ implements ifc.document._XFilter.FilterChecker {
+
+ /**
+ * Creates a class which will write information
+ * into log specified.
+ */
+ public FilterChecker(PrintWriter log) {
+ super(log, false) ;
+ }
+ /**
+ * <code>_XFilter.FilterChecker</code> interface method
+ * which returns the result of XML checking.
+ * @return <code>true</code> if the XML data exported was
+ * valid (i.e. all necessary tags and character data exists),
+ * <code>false</code> if some errors occured.
+ */
+ public boolean checkFilter() {
+ return check();
+ }
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLStylesImporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLStylesImporter.java
new file mode 100644
index 000000000000..f67141c2e1fd
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLStylesImporter.java
@@ -0,0 +1,202 @@
+/*************************************************************************
+ *
+ * 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._xmloff.Impress;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.comp.Impress.XMLStylesImporter</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li><code>com::sun::star::lang::XInitialization</code></li>
+ * <li><code>com::sun::star::document::XImporter</code></li>
+ * <li><code>com::sun::star::document::XFilter</code></li>
+ * <li><code>com::sun::star::document::ImportFilter</code></li>
+ * <li><code>com::sun::star::beans::XPropertySet</code></li>
+ * <li><code>com::sun::star::xml::sax::XDocumentHandler</code></li>
+
+ * </ul>
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.document.XImporter
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.document.ImportFilter
+ * @see com.sun.star.beans.XPropertySet
+ * @see com.sun.star.xml.sax.XDocumentHandler
+ * @see ifc.lang._XInitialization
+ * @see ifc.document._XImporter
+ * @see ifc.document._XFilter
+ * @see ifc.document._XExporter
+ * @see ifc.beans._XPropertySet
+ * @see ifc.xml.sax._XDocumentHandler
+ */
+public class XMLStylesImporter extends TestCase {
+ XComponent xImpressDoc = null;
+
+ /**
+ * New spreadsheet document created.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating an impress document" );
+ xImpressDoc = SOF.createImpressDoc(null);;
+ } catch ( Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Spreadsheet document destroyed.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing document " );
+ xImpressDoc.dispose();
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.Impress.XMLStylesImporter</code><p>
+ *
+ * The Impress document is set as a target document for importer.
+ * Imported XML-data contains only style tags including tag
+ * with new style name.
+ * After import style names getting from target document is checked.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'XDocumentHandler.XMLData'</code> for
+ * {@link ifc.xml.sax._XDocumentHandler} interface </li>
+ * <li> <code>'XDocumentHandler.ImportChecker'</code> for
+ * {@link ifc.xml.sax._XDocumentHandler} interface </li>
+ * <li> <code>'TargetDocument'</code> for
+ * {@link ifc.document._XImporter} interface </li>
+ * </ul>
+ */
+ public synchronized TestEnvironment createTestEnvironment
+ (TestParameters tParam, PrintWriter log ) throws StatusException {
+
+ XInterface oObj = null;
+ Object oInt = null ;
+ final String impValue = "XMLImporter_test" ;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF() ;
+
+ try {
+ oInt = xMSF.createInstance
+ ("com.sun.star.comp.Impress.XMLStylesImporter") ;
+
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException("Can't create component.", e) ;
+ }
+
+ oObj = (XInterface) oInt ;
+
+ // create testobject here
+ log.println( "creating a new environment for Paragraph object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // adding relation
+ tEnv.addObjRelation("TargetDocument", xImpressDoc) ;
+
+ String[][] xml = new String[][] {
+ {"start", "office:document-styles",
+ "xmlns:office", "CDATA", "http://openoffice.org/2000/office",
+ "xmlns:style", "CDATA", "http://openoffice.org/2000/style",
+ "xmlns:fo", "CDATA", "http://www.w3.org/1999/XSL/Format",
+ "xmlns:table", "CDATA", "http://openoffice.org/2000/table"},
+ {"start", "office:styles"},
+ {"start", "style:style",
+ "style:name", "CDATA", impValue,
+ "style:family", "CDATA", "graphics",
+ "style:parent-style-name", "CDATA", "standard"},
+ {"end", "style:style"},
+ {"end", "office:styles"},
+ {"end", "office:document-styles"}} ;
+
+ // adding relation for XDocumentHandler
+ tEnv.addObjRelation("XDocumentHandler.XMLData", xml) ;
+ XNameAccess styles = null ;
+ try {
+ XStyleFamiliesSupplier sup = (XStyleFamiliesSupplier)
+ UnoRuntime.queryInterface(XStyleFamiliesSupplier.class,
+ xImpressDoc);
+ XNameAccess oStyleFamilies = sup.getStyleFamilies();
+ Object family = oStyleFamilies.getByName("graphics") ;
+ styles = (XNameAccess) UnoRuntime.queryInterface
+ (XNameAccess.class, family) ;
+ log.println("Styles before:") ;
+ String[] names = styles.getElementNames() ;
+ for (int i = 0; i < names.length; i++) {
+ log.println(" " + names[i]) ;
+ }
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ }
+ final XNameAccess stylesF = styles ;
+ final PrintWriter logF = log ;
+ tEnv.addObjRelation("XDocumentHandler.ImportChecker",
+ new ifc.xml.sax._XDocumentHandler.ImportChecker() {
+ public boolean checkImport() {
+ logF.println("Styles after:") ;
+ String[] names = stylesF.getElementNames() ;
+ for (int i = 0; i < names.length; i++) {
+ logF.println(" " + names[i]) ;
+ }
+ return stylesF.hasByName(impValue) ;
+ }
+ }) ;
+
+ return tEnv;
+ } // end of getTestEnvironment
+
+}
+