Index: testuno/.externalToolBuilders/Classpath Builder.launch
===================================================================
--- testuno/.externalToolBuilders/Classpath Builder.launch (revision 1378452)
+++ testuno/.externalToolBuilders/Classpath Builder.launch (working copy)
@@ -1,22 +1,22 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: testuno/source/testcase/uno/sw/table/tableBorderSpacingtoContent.java
===================================================================
--- testuno/source/testcase/uno/sw/table/tableBorderSpacingtoContent.java (revision 0)
+++ testuno/source/testcase/uno/sw/table/tableBorderSpacingtoContent.java (working copy)
@@ -0,0 +1,126 @@
+package testcase.uno.sw.table;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openoffice.test.common.FileUtil;
+import org.openoffice.test.common.Testspace;
+import org.openoffice.test.uno.UnoApp;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.text.*;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.frame.XStorable;
+
+
+public class tableBorderSpacingtoContent {
+
+ private static final UnoApp app = new UnoApp();
+ private XTextDocument xTextDocument=null;
+ private XMultiServiceFactory xWriterFactory=null;
+ private XText xText=null;
+ @Before
+ public void setUp() throws Exception {
+ app.start();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ app.close();
+ }
+ /*
+ * test table border spacing to content
+ * 1.new a text document and create a table
+ * 2.set table border spacing to content
+ * 3.save to odt/doc,close it and reopen new saved document
+ * 4.check the table border spacing to content
+ */
+ @Test
+ public void testtableBorderSpacingtoContent() throws Exception {
+ xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+ xText=xTextDocument.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ // get internal service factory of the document
+ xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ // Create a new table from the document's factory
+ XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
+ xText.insertTextContent(xTextCursor,xTable,false);
+ String[] cellName=xTable.getCellNames();
+ int i=0;
+ while(cellName[i] != null)
+ {
+ XPropertySet xCursorProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable.getCellByName(cellName[i]));
+ xCursorProps.setPropertyValue("LeftBorderDistance",499);
+ xCursorProps.setPropertyValue("RightBorderDistance",499);
+ xCursorProps.setPropertyValue("TopBorderDistance",499);
+ xCursorProps.setPropertyValue("BottomBorderDistance",499);
+ i++;
+ if(i==4)break;
+ }
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the odt document and assert table border spacing to content
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
+ XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
+ Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
+ XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
+ String[] cellName_assert_odt=xTable_Assert_odt.getCellNames();
+ int j=0;
+ while(cellName_assert_odt[j] != null)
+ {
+ XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt.getCellByName(cellName_assert_odt[j]));
+ assertEquals("assert table border spacing to content",499,xCursorProps_assert_odt.getPropertyValue("LeftBorderDistance"));
+ assertEquals("assert table border spacing to content",499,xCursorProps_assert_odt.getPropertyValue("RightBorderDistance"));
+ assertEquals("assert table border spacing to content",499,xCursorProps_assert_odt.getPropertyValue("TopBorderDistance"));
+ assertEquals("assert table border spacing to content",499,xCursorProps_assert_odt.getPropertyValue("BottomBorderDistance"));
+ j++;
+ if(j==4)break;
+ }
+
+ //reopen the doc document and assert table border spacing to content
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
+ XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
+ Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
+ XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
+ String[] cellName_assert_doc=xTable_Assert_doc.getCellNames();
+ int k=0;
+ while(cellName_assert_doc[k] != null)
+ {
+ XPropertySet xCursorProps_assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc.getCellByName(cellName_assert_doc[k]));
+ assertEquals("assert table border spacing to content",499,xCursorProps_assert_doc.getPropertyValue("LeftBorderDistance"));
+ assertEquals("assert table border spacing to content",499,xCursorProps_assert_doc.getPropertyValue("RightBorderDistance"));
+ assertEquals("assert table border spacing to content",499,xCursorProps_assert_doc.getPropertyValue("TopBorderDistance"));
+ assertEquals("assert table border spacing to content",499,xCursorProps_assert_doc.getPropertyValue("BottomBorderDistance"));
+ k++;
+ if(k==4)break;
+ }
+ }
+}
+
Index: testuno/source/testcase/uno/sw/table/tableCellProtect.java
===================================================================
--- testuno/source/testcase/uno/sw/table/tableCellProtect.java (revision 0)
+++ testuno/source/testcase/uno/sw/table/tableCellProtect.java (working copy)
@@ -0,0 +1,118 @@
+package testcase.uno.sw.table;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.openoffice.test.common.FileUtil;
+import org.openoffice.test.common.Testspace;
+import org.openoffice.test.uno.UnoApp;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.text.*;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.frame.XStorable;
+
+
+public class tableCellProtect {
+
+ private static final UnoApp app = new UnoApp();
+ private XTextDocument xTextDocument=null;
+ private XMultiServiceFactory xWriterFactory=null;
+ private XText xText=null;
+ @Before
+ public void setUp() throws Exception {
+ app.start();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ app.close();
+ }
+ /*
+ * test table border spacing to content
+ * 1.new a text document and create a table
+ * 2.set table cell protect
+ * 3.save to odt/doc,close it and reopen new saved document
+ * 4.check the table cell protect setting
+ */
+ @Test@Ignore //bug120745_table cell protect effect lost when save to doc.
+ public void testtableBorderSpacingtoContent() throws Exception {
+ xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+ xText=xTextDocument.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ // get internal service factory of the document
+ xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ // Create a new table from the document's factory
+ XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
+ xText.insertTextContent(xTextCursor,xTable,false);
+ String[] cellName=xTable.getCellNames();
+ int i=0;
+ while(cellName[i] != null)
+ {
+ XPropertySet xCursorProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable.getCellByName(cellName[i]));
+ xCursorProps.setPropertyValue("IsProtected",true);
+ i++;
+ if(i==4)break;
+ }
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the odt document and assert table border spacing to content
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
+ XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
+ Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
+ XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
+ String[] cellName_assert_odt=xTable_Assert_odt.getCellNames();
+ int j=0;
+ while(cellName_assert_odt[j] != null)
+ {
+ XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt.getCellByName(cellName_assert_odt[j]));
+ assertEquals("assert table cell proptext",true,xCursorProps_assert_odt.getPropertyValue("IsProtected"));
+ j++;
+ if(j==4)break;
+ }
+
+ //reopen the doc document and assert table border spacing to content
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
+ XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
+ Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
+ XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
+ String[] cellName_assert_doc=xTable_Assert_doc.getCellNames();
+ int k=0;
+ while(cellName_assert_doc[k] != null)
+ {
+ XPropertySet xCursorProps_assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc.getCellByName(cellName_assert_doc[k]));
+ assertEquals("assert table cell proptext",true,xCursorProps_assert_doc.getPropertyValue("IsProtected"));
+ k++;
+ if(k==4)break;
+ }
+ }
+}
+
Index: testuno/source/testcase/uno/sw/table/TableInsertBreak.java
===================================================================
--- testuno/source/testcase/uno/sw/table/TableInsertBreak.java (revision 0)
+++ testuno/source/testcase/uno/sw/table/TableInsertBreak.java (working copy)
@@ -0,0 +1,807 @@
+package testcase.uno.sw.table;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.openoffice.test.common.FileUtil;
+import org.openoffice.test.common.Testspace;
+import org.openoffice.test.uno.UnoApp;
+import com.sun.star.text.*;
+import com.sun.star.beans.*;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.frame.XStorable;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+
+public class TableInsertBreak {
+ private static final UnoApp app = new UnoApp();
+ private XTextDocument xTextDocument=null;
+ private XMultiServiceFactory xWriterFactory=null;
+ private XText xText=null;
+
+ @Before
+ public void setUp() throws Exception {
+ app.start();
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ app.close();
+ }
+ @Test@Ignore //bug120719
+ public void InsertPage_BeforeBreak_Split_KeepTogether() throws Exception {
+
+ xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+ xText=xTextDocument.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ // get internal service factory of the document
+ xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ // Create a new table from the document's factory
+ XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
+ xText.insertTextContent(xTextCursor,xTable,false);
+ //insert page break for table
+ XPropertySet xCursorProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable);
+ assertEquals("assert default split",true,xCursorProps.getPropertyValue("Split"));
+ assertEquals("assert default keep_together",false,xCursorProps.getPropertyValue("KeepTogether"));
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("Split",false);
+ xCursorProps.setPropertyValue("KeepTogether",true);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
+ XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
+ Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
+ XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
+ //verify paragraph break
+ assertEquals("assert table break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert table split",false,xCursorProps_Assert_odt.getPropertyValue("Split"));
+ assertEquals("assert table keep_tpgether",true,xCursorProps_Assert_odt.getPropertyValue("KeepTogether"));
+
+ //reopen the doc document and assert table break
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
+ XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
+ Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
+ XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
+ //verify paragraph background color
+ assertEquals("assert table break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert table split",false,xCursorProps_Assert_doc.getPropertyValue("Split"));
+ assertEquals("assert table keep_together",true,xCursorProps_Assert_doc.getPropertyValue("KeepTogether"));
+ }
+ @Test@Ignore //bug 120719
+ public void InsertPage_AfterBreak() throws Exception {
+
+ xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+ xText=xTextDocument.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ // get internal service factory of the document
+ xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ // Create a new table from the document's factory
+ XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
+ xText.insertTextContent(xTextCursor,xTable,false);
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
+ //set table break type
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_AFTER);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
+ XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
+ Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
+ XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_AFTER,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+
+ //reopen the doc document and assert table break
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
+ XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
+ Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
+ XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_AFTER,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ }
+ @Test@Ignore //bug 120719
+ public void InsertColumn_BeforeBreak() throws Exception {
+
+ xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+ xText=xTextDocument.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ // get internal service factory of the document
+ xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ // Create a new table from the document's factory
+ XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
+ xText.insertTextContent(xTextCursor,xTable,false);
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.COLUMN_BEFORE);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
+ XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
+ Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
+ XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.COLUMN_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+
+ //reopen the doc document and assert table break
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
+ XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
+ Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
+ XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.COLUMN_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ }
+ @Test@Ignore //bug 120719
+ public void InsertColumn_AfterBreak() throws Exception {
+
+ xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+ xText=xTextDocument.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ // get internal service factory of the document
+ xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ // Create a new table from the document's factory
+ XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
+ xText.insertTextContent(xTextCursor,xTable,false);
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.COLUMN_AFTER);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
+ XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
+ Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
+ XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.COLUMN_AFTER,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+
+ //reopen the doc document and assert table break
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
+ XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
+ Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
+ XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
+ //verify table break
+ assertEquals("assert table break",com.sun.star.style.BreakType.COLUMN_AFTER,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ }
+ @Test@Ignore //bug120721
+ public void InsertPage_Endnote_BeforeBreak() throws Exception {
+
+ xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+ xText=xTextDocument.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ // get internal service factory of the document
+ xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ // Create a new table from the document's factory
+ XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
+ xText.insertTextContent(xTextCursor,xTable,false);
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("PageDescName","Endnote");
+ xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
+ XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
+ Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
+ XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Endnote",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
+ //reopen the doc document and assert table break
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
+ XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
+ Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
+ XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
+ //verify paragraph background color
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Endnote",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
+ }
+
+ @Test@Ignore //bug120721
+ public void InsertPage_Envelop_BeforeBreak() throws Exception {
+
+ xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+ xText=xTextDocument.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ // get internal service factory of the document
+ xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ // Create a new table from the document's factory
+ XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
+ xText.insertTextContent(xTextCursor,xTable,false);
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("PageDescName","Envelope");
+ xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
+ XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
+ Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
+ XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Envelope",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
+ //reopen the doc document and assert table break
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
+ XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
+ Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
+ XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
+ //verify paragraph background color
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Envelope",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
+ }
+
+ @Test
+ public void InsertPage_Firstpage_BeforeBreak() throws Exception {
+
+ xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+ xText=xTextDocument.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ // get internal service factory of the document
+ xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ // Create a new table from the document's factory
+ XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
+ xText.insertTextContent(xTextCursor,xTable,false);
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("PageDescName","First Page");
+ xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
+ XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
+ Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
+ XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","First Page",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
+ //reopen the doc document and assert table break
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
+ XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
+ Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
+ XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
+ //verify paragraph background color
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","First Page",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
+ }
+ @Test@Ignore //bug120721
+ public void InsertPage_Footnote_BeforeBreak() throws Exception {
+
+ xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+ xText=xTextDocument.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ // get internal service factory of the document
+ xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ // Create a new table from the document's factory
+ XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
+ xText.insertTextContent(xTextCursor,xTable,false);
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("PageDescName","Footnote");
+ xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
+ XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
+ Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
+ XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Footnote",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
+ //reopen the doc document and assert table break
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
+ XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
+ Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
+ XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
+ //verify paragraph background color
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Footnote",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
+ }
+ @Test@Ignore //bug120721
+ public void InsertPage_HTML_BeforeBreak() throws Exception {
+
+ xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+ xText=xTextDocument.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ // get internal service factory of the document
+ xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ // Create a new table from the document's factory
+ XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
+ xText.insertTextContent(xTextCursor,xTable,false);
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("PageDescName","HTML");
+ xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
+ XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
+ Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
+ XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","HTML",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
+ //reopen the doc document and assert table break
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
+ XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
+ Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
+ XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
+ //verify paragraph background color
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","HTML",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
+ }
+ @Test@Ignore //bug120721
+ public void InsertPage_Index_BeforeBreak() throws Exception {
+
+ xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+ xText=xTextDocument.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ // get internal service factory of the document
+ xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ // Create a new table from the document's factory
+ XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
+ xText.insertTextContent(xTextCursor,xTable,false);
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("PageDescName","Index");
+ xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
+ XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
+ Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
+ XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Index",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
+ //reopen the doc document and assert table break
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
+ XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
+ Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
+ XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
+ //verify paragraph background color
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Index",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
+ }
+ @Test@Ignore //bug120721
+ public void InsertPage_Landscape_BeforeBreak() throws Exception {
+
+ xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+ xText=xTextDocument.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ // get internal service factory of the document
+ xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ // Create a new table from the document's factory
+ XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
+ xText.insertTextContent(xTextCursor,xTable,false);
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("PageDescName","Landscape");
+ xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
+ XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
+ Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
+ XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Landscape",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
+ //reopen the doc document and assert table break
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
+ XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
+ Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
+ XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
+ //verify paragraph background color
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Landscape",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
+ }
+ @Test@Ignore //bug120721
+ public void InsertPage_LeftPage_BeforeBreak() throws Exception {
+
+ xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+ xText=xTextDocument.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ // get internal service factory of the document
+ xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ // Create a new table from the document's factory
+ XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
+ xText.insertTextContent(xTextCursor,xTable,false);
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("PageDescName","Left Page");
+ xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
+ XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
+ Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
+ XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Left Page",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
+ //reopen the doc document and assert table break
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
+ XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
+ Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
+ XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
+ //verify paragraph background color
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Left Page",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
+ }
+ @Test@Ignore //bug120721
+ public void InsertPage_RightPage_BeforeBreak() throws Exception {
+
+ xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+ xText=xTextDocument.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ // get internal service factory of the document
+ xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ // Create a new table from the document's factory
+ XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
+ xText.insertTextContent(xTextCursor,xTable,false);
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("PageDescName","Right Page");
+ xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
+ XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
+ Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
+ XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Right Page",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
+ //reopen the doc document and assert table break
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
+ XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
+ Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
+ XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
+ //verify paragraph background color
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Right Page",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
+ }
+}
Index: testuno/source/testcase/uno/sw/table/tableName.java
===================================================================
--- testuno/source/testcase/uno/sw/table/tableName.java (revision 0)
+++ testuno/source/testcase/uno/sw/table/tableName.java (working copy)
@@ -0,0 +1,99 @@
+package testcase.uno.sw.table;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.openoffice.test.common.FileUtil;
+import org.openoffice.test.common.Testspace;
+import org.openoffice.test.uno.UnoApp;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.text.*;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNamed;
+import com.sun.star.frame.XStorable;
+
+
+public class tableName {
+
+ private static final UnoApp app = new UnoApp();
+ private XTextDocument xTextDocument=null;
+ private XMultiServiceFactory xWriterFactory=null;
+ private XText xText=null;
+ @Before
+ public void setUp() throws Exception {
+ app.start();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ app.close();
+ }
+ /*
+ * test table border spacing to content
+ * 1.new a text document and create a table
+ * 2.set table name
+ * 3.save to odt/doc,close it and reopen new saved document
+ * 4.check the table name
+ */
+ @Test@Ignore //bug120739_the table name change to default name when save to doc.
+ public void testtableName() throws Exception {
+ xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+ xText=xTextDocument.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ // get internal service factory of the document
+ xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ // Create a new table from the document's factory
+ XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
+ xText.insertTextContent(xTextCursor,xTable,false);
+ XNamed tableName=(XNamed)UnoRuntime.queryInterface(XNamed.class, xTable);
+ assertEquals("assert default table name","Table1",tableName.getName());
+ tableName.setName("test_TableExample");
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the odt document and assert table border spacing to content
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
+ XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
+ Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
+ XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
+ XNamed tableName_odt=(XNamed)UnoRuntime.queryInterface(XNamed.class, xTable_Assert_odt);
+ assertEquals("assert default table name","test_TableExample",tableName_odt.getName());
+
+ //reopen the doc document and assert table border spacing to content
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
+ XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
+ Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
+ XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
+ XNamed tableName_doc=(XNamed)UnoRuntime.queryInterface(XNamed.class, xTable_Assert_doc);
+ assertEquals("assert default table name","test_TableExample",tableName_doc.getName());
+
+ }
+}
+
Index: testuno/source/testcase/uno/sw/table/tableVerticalAlignment.java
===================================================================
--- testuno/source/testcase/uno/sw/table/tableVerticalAlignment.java (revision 0)
+++ testuno/source/testcase/uno/sw/table/tableVerticalAlignment.java (working copy)
@@ -0,0 +1,263 @@
+package testcase.uno.sw.table;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openoffice.test.common.FileUtil;
+import org.openoffice.test.common.Testspace;
+import org.openoffice.test.uno.UnoApp;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.text.*;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.frame.XStorable;
+
+
+public class tableVerticalAlignment {
+
+ private static final UnoApp app = new UnoApp();
+ private XTextDocument xTextDocument=null;
+ private XMultiServiceFactory xWriterFactory=null;
+ private XText xText=null;
+ @Before
+ public void setUp() throws Exception {
+ app.start();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ app.close();
+ }
+ /*
+ * test table border spacing to content
+ * 1.new a text document and create a table
+ * 2.set table cell vertical alignment
+ * 3.save to odt/doc,close it and reopen new saved document
+ * 4.check the table cell vertical alignment
+ */
+ @Test
+ public void testtableVerticalAlignment_Bottom() throws Exception {
+ xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+ xText=xTextDocument.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ // get internal service factory of the document
+ xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ // Create a new table from the document's factory
+ XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
+ xText.insertTextContent(xTextCursor,xTable,false);
+ String[] cellName=xTable.getCellNames();
+ int i=0;
+ while(cellName[i] != null)
+ {
+ XPropertySet xCursorProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable.getCellByName(cellName[i]));
+ xCursorProps.setPropertyValue("VertOrient",VertOrientation.BOTTOM);
+ i++;
+ if(i==4)break;
+ }
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the odt document and assert table vertical alignment
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
+ XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
+ Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
+ XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
+ String[] cellName_assert_odt=xTable_Assert_odt.getCellNames();
+ int j=0;
+ while(cellName_assert_odt[j] != null)
+ {
+ XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt.getCellByName(cellName_assert_odt[j]));
+ assertEquals("assert table border spacing to content",VertOrientation.BOTTOM,xCursorProps_assert_odt.getPropertyValue("VertOrient"));
+ j++;
+ if(j==4)break;
+ }
+
+ //reopen the doc document and assert table vertical alignment
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
+ XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
+ Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
+ XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
+ String[] cellName_assert_doc=xTable_Assert_doc.getCellNames();
+ int k=0;
+ while(cellName_assert_doc[k] != null)
+ {
+ XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc.getCellByName(cellName_assert_doc[k]));
+ assertEquals("assert table vertical alignment",VertOrientation.BOTTOM,xCursorProps_assert_odt.getPropertyValue("VertOrient"));
+ k++;
+ if(k==4)break;
+ }
+ }
+ @Test
+ public void testtableVerticalAlignment_Center() throws Exception {
+ xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+ xText=xTextDocument.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ // get internal service factory of the document
+ xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ // Create a new table from the document's factory
+ XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
+ xText.insertTextContent(xTextCursor,xTable,false);
+ String[] cellName=xTable.getCellNames();
+ int i=0;
+ while(cellName[i] != null)
+ {
+ XPropertySet xCursorProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable.getCellByName(cellName[i]));
+ xCursorProps.setPropertyValue("VertOrient",VertOrientation.CENTER);
+ i++;
+ if(i==4)break;
+ }
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the odt document and assert table vertical alignment
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
+ XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
+ Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
+ XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
+ String[] cellName_assert_odt=xTable_Assert_odt.getCellNames();
+ int j=0;
+ while(cellName_assert_odt[j] != null)
+ {
+ XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt.getCellByName(cellName_assert_odt[j]));
+ assertEquals("assert table border spacing to content",VertOrientation.CENTER,xCursorProps_assert_odt.getPropertyValue("VertOrient"));
+ j++;
+ if(j==4)break;
+ }
+
+ //reopen the doc document and assert table vertical alignment
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
+ XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
+ Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
+ XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
+ String[] cellName_assert_doc=xTable_Assert_doc.getCellNames();
+ int k=0;
+ while(cellName_assert_doc[k] != null)
+ {
+ XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc.getCellByName(cellName_assert_doc[k]));
+ assertEquals("assert table vertical alignment",VertOrientation.CENTER,xCursorProps_assert_odt.getPropertyValue("VertOrient"));
+ k++;
+ if(k==4)break;
+ }
+ }
+ @Test
+ public void testtableVerticalAlignment_Top() throws Exception {
+ xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+ xText=xTextDocument.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ // get internal service factory of the document
+ xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ // Create a new table from the document's factory
+ XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
+ xText.insertTextContent(xTextCursor,xTable,false);
+ String[] cellName=xTable.getCellNames();
+ int i=0;
+ while(cellName[i] != null)
+ {
+ XPropertySet xCursorProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable.getCellByName(cellName[i]));
+ xCursorProps.setPropertyValue("VertOrient",VertOrientation.TOP);
+ i++;
+ if(i==4)break;
+ }
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the odt document and assert table vertical alignment
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
+ XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
+ Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
+ XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
+ String[] cellName_assert_odt=xTable_Assert_odt.getCellNames();
+ int j=0;
+ while(cellName_assert_odt[j] != null)
+ {
+ XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt.getCellByName(cellName_assert_odt[j]));
+ assertEquals("assert table border spacing to content",VertOrientation.TOP,xCursorProps_assert_odt.getPropertyValue("VertOrient"));
+ j++;
+ if(j==4)break;
+ }
+
+ //reopen the doc document and assert table vertical alignment
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
+ XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
+ Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
+ XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
+ String[] cellName_assert_doc=xTable_Assert_doc.getCellNames();
+ int k=0;
+ while(cellName_assert_doc[k] != null)
+ {
+ XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc.getCellByName(cellName_assert_doc[k]));
+ assertEquals("assert table vertical alignment",VertOrientation.TOP,xCursorProps_assert_odt.getPropertyValue("VertOrient"));
+ k++;
+ if(k==4)break;
+ }
+ }
+}
+