1*07d7dbdcSHerbert Dürr /**************************************************************
2*07d7dbdcSHerbert Dürr  *
3*07d7dbdcSHerbert Dürr  * Licensed to the Apache Software Foundation (ASF) under one
4*07d7dbdcSHerbert Dürr  * or more contributor license agreements.  See the NOTICE file
5*07d7dbdcSHerbert Dürr  * distributed with this work for additional information
6*07d7dbdcSHerbert Dürr  * regarding copyright ownership.  The ASF licenses this file
7*07d7dbdcSHerbert Dürr  * to you under the Apache License, Version 2.0 (the
8*07d7dbdcSHerbert Dürr  * "License"); you may not use this file except in compliance
9*07d7dbdcSHerbert Dürr  * with the License.  You may obtain a copy of the License at
10*07d7dbdcSHerbert Dürr  *
11*07d7dbdcSHerbert Dürr  *   http://www.apache.org/licenses/LICENSE-2.0
12*07d7dbdcSHerbert Dürr  *
13*07d7dbdcSHerbert Dürr  * Unless required by applicable law or agreed to in writing,
14*07d7dbdcSHerbert Dürr  * software distributed under the License is distributed on an
15*07d7dbdcSHerbert Dürr  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*07d7dbdcSHerbert Dürr  * KIND, either express or implied.  See the License for the
17*07d7dbdcSHerbert Dürr  * specific language governing permissions and limitations
18*07d7dbdcSHerbert Dürr  * under the License.
19*07d7dbdcSHerbert Dürr  *
20*07d7dbdcSHerbert Dürr  *************************************************************/
21*07d7dbdcSHerbert Dürr 
22eba4d44aSLiu Zhe package fvt.uno.sw.table;
23f4c702faSLiu Zhe 
24f4c702faSLiu Zhe import static org.junit.Assert.*;
25f4c702faSLiu Zhe 
26f4c702faSLiu Zhe import org.junit.After;
27f4c702faSLiu Zhe import org.junit.Before;
28f4c702faSLiu Zhe import org.junit.Ignore;
29f4c702faSLiu Zhe import org.junit.Test;
30f4c702faSLiu Zhe import org.openoffice.test.common.FileUtil;
31f4c702faSLiu Zhe import org.openoffice.test.common.Testspace;
32f4c702faSLiu Zhe import org.openoffice.test.uno.UnoApp;
33f4c702faSLiu Zhe import com.sun.star.text.*;
34f4c702faSLiu Zhe import com.sun.star.beans.*;
35f4c702faSLiu Zhe import com.sun.star.container.XIndexAccess;
36f4c702faSLiu Zhe import com.sun.star.frame.XStorable;
37f4c702faSLiu Zhe import com.sun.star.lang.XMultiServiceFactory;
38f4c702faSLiu Zhe import com.sun.star.uno.UnoRuntime;
39f4c702faSLiu Zhe 
40f4c702faSLiu Zhe public class TableInsertBreak {
41f4c702faSLiu Zhe 	private static final UnoApp app = new UnoApp();
42f4c702faSLiu Zhe 	private XTextDocument xTextDocument=null;
43f4c702faSLiu Zhe 	private XMultiServiceFactory xWriterFactory=null;
44f4c702faSLiu Zhe 	private XText xText=null;
45f4c702faSLiu Zhe 
46f4c702faSLiu Zhe 	@Before
setUp()47f4c702faSLiu Zhe 	public void setUp() throws Exception {
48f4c702faSLiu Zhe 		app.start();
49f4c702faSLiu Zhe 
50f4c702faSLiu Zhe 	}
51f4c702faSLiu Zhe 
52f4c702faSLiu Zhe 	@After
tearDown()53f4c702faSLiu Zhe 	public void tearDown() throws Exception {
54f4c702faSLiu Zhe 		app.close();
55f4c702faSLiu Zhe 	}
56932de486SLiu Zhe 	@Test@Ignore("Bug #120719 - [testUNO patch]the page_after break change to page_before break when save to doc.")
InsertPage_BeforeBreak_Split_KeepTogether()57f4c702faSLiu Zhe 	public void InsertPage_BeforeBreak_Split_KeepTogether() throws Exception {
58f4c702faSLiu Zhe 
59f4c702faSLiu Zhe 		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
60f4c702faSLiu Zhe 		xText=xTextDocument.getText();
61f4c702faSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
62f4c702faSLiu Zhe 		// get internal service factory of the document
63f4c702faSLiu Zhe 		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
64f4c702faSLiu Zhe 		// Create a new table from the document's factory
65f4c702faSLiu Zhe 		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
66f4c702faSLiu Zhe 		xText.insertTextContent(xTextCursor,xTable,false);
67f4c702faSLiu Zhe 		//insert page break for table
68f4c702faSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable);
69f4c702faSLiu Zhe 		assertEquals("assert default split",true,xCursorProps.getPropertyValue("Split"));
70f4c702faSLiu Zhe 		assertEquals("assert default keep_together",false,xCursorProps.getPropertyValue("KeepTogether"));
71f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
72f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("Split",false);
73f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("KeepTogether",true);
74f4c702faSLiu Zhe 		//save to odt
75f4c702faSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
76f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
77f4c702faSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
78f4c702faSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
79f4c702faSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
80f4c702faSLiu Zhe 		aStoreProperties_odt[0].Value = true;
81f4c702faSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
82f4c702faSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
83f4c702faSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
84f4c702faSLiu Zhe 		//save to doc
85f4c702faSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
86f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
87f4c702faSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
88f4c702faSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
89f4c702faSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
90f4c702faSLiu Zhe 		aStoreProperties_doc[0].Value = true;
91f4c702faSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
92f4c702faSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
93f4c702faSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
94f4c702faSLiu Zhe 		app.closeDocument(xTextDocument);
95f4c702faSLiu Zhe 
96f4c702faSLiu Zhe 		//reopen the document
97f4c702faSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
98f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
99f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
100f4c702faSLiu Zhe 		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
101f4c702faSLiu Zhe 		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
102f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
103f4c702faSLiu Zhe 		//verify paragraph break
104f4c702faSLiu Zhe 		assertEquals("assert table break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
105f4c702faSLiu Zhe 		assertEquals("assert table split",false,xCursorProps_Assert_odt.getPropertyValue("Split"));
106f4c702faSLiu Zhe 		assertEquals("assert table keep_tpgether",true,xCursorProps_Assert_odt.getPropertyValue("KeepTogether"));
107f4c702faSLiu Zhe 
108f4c702faSLiu Zhe 		//reopen the doc document and assert table break
109f4c702faSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
110f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
111f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
112f4c702faSLiu Zhe 		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
113f4c702faSLiu Zhe 		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
114f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
115f4c702faSLiu Zhe 		//verify paragraph background color
116f4c702faSLiu Zhe 		assertEquals("assert table break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
117f4c702faSLiu Zhe 		assertEquals("assert table split",false,xCursorProps_Assert_doc.getPropertyValue("Split"));
118f4c702faSLiu Zhe 		assertEquals("assert table keep_together",true,xCursorProps_Assert_doc.getPropertyValue("KeepTogether"));
119f4c702faSLiu Zhe 	}
120932de486SLiu Zhe 	@Test@Ignore("Bug #120719 - [testUNO patch]the page_after break change to page_before break when save to doc.")
InsertPage_AfterBreak()121f4c702faSLiu Zhe 	public void InsertPage_AfterBreak() throws Exception {
122f4c702faSLiu Zhe 
123f4c702faSLiu Zhe 		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
124f4c702faSLiu Zhe 		xText=xTextDocument.getText();
125f4c702faSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
126f4c702faSLiu Zhe 		// get internal service factory of the document
127f4c702faSLiu Zhe 		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
128f4c702faSLiu Zhe 		// Create a new table from the document's factory
129f4c702faSLiu Zhe 		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
130f4c702faSLiu Zhe 		xText.insertTextContent(xTextCursor,xTable,false);
131f4c702faSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
132f4c702faSLiu Zhe 		//set table break type
133f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_AFTER);
134f4c702faSLiu Zhe 		//save to odt
135f4c702faSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
136f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
137f4c702faSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
138f4c702faSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
139f4c702faSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
140f4c702faSLiu Zhe 		aStoreProperties_odt[0].Value = true;
141f4c702faSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
142f4c702faSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
143f4c702faSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
144f4c702faSLiu Zhe 		//save to doc
145f4c702faSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
146f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
147f4c702faSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
148f4c702faSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
149f4c702faSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
150f4c702faSLiu Zhe 		aStoreProperties_doc[0].Value = true;
151f4c702faSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
152f4c702faSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
153f4c702faSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
154f4c702faSLiu Zhe 		app.closeDocument(xTextDocument);
155f4c702faSLiu Zhe 
156f4c702faSLiu Zhe 		//reopen the document
157f4c702faSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
158f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
159f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
160f4c702faSLiu Zhe 		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
161f4c702faSLiu Zhe 		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
162f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
163f4c702faSLiu Zhe 		//verify paragraph break
164f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_AFTER,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
165f4c702faSLiu Zhe 
166f4c702faSLiu Zhe 		//reopen the doc document and assert table break
167f4c702faSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
168f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
169f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
170f4c702faSLiu Zhe 		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
171f4c702faSLiu Zhe 		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
172f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
173f4c702faSLiu Zhe 		//verify paragraph break
174f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_AFTER,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
175f4c702faSLiu Zhe 	}
176932de486SLiu Zhe 	@Test@Ignore("Bug #120719 - [testUNO patch]the page_after break change to page_before break when save to doc.")
InsertColumn_BeforeBreak()177f4c702faSLiu Zhe 	public void InsertColumn_BeforeBreak() throws Exception {
178f4c702faSLiu Zhe 
179f4c702faSLiu Zhe 		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
180f4c702faSLiu Zhe 		xText=xTextDocument.getText();
181f4c702faSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
182f4c702faSLiu Zhe 		// get internal service factory of the document
183f4c702faSLiu Zhe 		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
184f4c702faSLiu Zhe 		// Create a new table from the document's factory
185f4c702faSLiu Zhe 		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
186f4c702faSLiu Zhe 		xText.insertTextContent(xTextCursor,xTable,false);
187f4c702faSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
188f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.COLUMN_BEFORE);
189f4c702faSLiu Zhe 		//save to odt
190f4c702faSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
191f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
192f4c702faSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
193f4c702faSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
194f4c702faSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
195f4c702faSLiu Zhe 		aStoreProperties_odt[0].Value = true;
196f4c702faSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
197f4c702faSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
198f4c702faSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
199f4c702faSLiu Zhe 		//save to doc
200f4c702faSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
201f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
202f4c702faSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
203f4c702faSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
204f4c702faSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
205f4c702faSLiu Zhe 		aStoreProperties_doc[0].Value = true;
206f4c702faSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
207f4c702faSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
208f4c702faSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
209f4c702faSLiu Zhe 		app.closeDocument(xTextDocument);
210f4c702faSLiu Zhe 
211f4c702faSLiu Zhe 		//reopen the document
212f4c702faSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
213f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
214f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
215f4c702faSLiu Zhe 		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
216f4c702faSLiu Zhe 		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
217f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
218f4c702faSLiu Zhe 		//verify paragraph break
219f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.COLUMN_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
220f4c702faSLiu Zhe 
221f4c702faSLiu Zhe 		//reopen the doc document and assert table break
222f4c702faSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
223f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
224f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
225f4c702faSLiu Zhe 		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
226f4c702faSLiu Zhe 		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
227f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
228f4c702faSLiu Zhe 		//verify paragraph break
229f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.COLUMN_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
230f4c702faSLiu Zhe 	}
231932de486SLiu Zhe 	@Test@Ignore("Bug #120719 - [testUNO patch]the page_after break change to page_before break when save to doc.")
InsertColumn_AfterBreak()232f4c702faSLiu Zhe 	public void InsertColumn_AfterBreak() throws Exception {
233f4c702faSLiu Zhe 
234f4c702faSLiu Zhe 		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
235f4c702faSLiu Zhe 		xText=xTextDocument.getText();
236f4c702faSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
237f4c702faSLiu Zhe 		// get internal service factory of the document
238f4c702faSLiu Zhe 		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
239f4c702faSLiu Zhe 		// Create a new table from the document's factory
240f4c702faSLiu Zhe 		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
241f4c702faSLiu Zhe 		xText.insertTextContent(xTextCursor,xTable,false);
242f4c702faSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
243f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.COLUMN_AFTER);
244f4c702faSLiu Zhe 		//save to odt
245f4c702faSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
246f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
247f4c702faSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
248f4c702faSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
249f4c702faSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
250f4c702faSLiu Zhe 		aStoreProperties_odt[0].Value = true;
251f4c702faSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
252f4c702faSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
253f4c702faSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
254f4c702faSLiu Zhe 		//save to doc
255f4c702faSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
256f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
257f4c702faSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
258f4c702faSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
259f4c702faSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
260f4c702faSLiu Zhe 		aStoreProperties_doc[0].Value = true;
261f4c702faSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
262f4c702faSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
263f4c702faSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
264f4c702faSLiu Zhe 		app.closeDocument(xTextDocument);
265f4c702faSLiu Zhe 
266f4c702faSLiu Zhe 		//reopen the document
267f4c702faSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
268f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
269f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
270f4c702faSLiu Zhe 		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
271f4c702faSLiu Zhe 		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
272f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
273f4c702faSLiu Zhe 		//verify paragraph break
274f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.COLUMN_AFTER,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
275f4c702faSLiu Zhe 
276f4c702faSLiu Zhe 		//reopen the doc document and assert table break
277f4c702faSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
278f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
279f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
280f4c702faSLiu Zhe 		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
281f4c702faSLiu Zhe 		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
282f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
283f4c702faSLiu Zhe 		//verify table break
284f4c702faSLiu Zhe 		assertEquals("assert table break",com.sun.star.style.BreakType.COLUMN_AFTER,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
285f4c702faSLiu Zhe 	}
286932de486SLiu Zhe 	@Test@Ignore("Bug #120719 - [testUNO patch]the page_after break change to page_before break when save to doc.")
InsertPage_Endnote_BeforeBreak()287f4c702faSLiu Zhe 	public void InsertPage_Endnote_BeforeBreak() throws Exception {
288f4c702faSLiu Zhe 
289f4c702faSLiu Zhe 		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
290f4c702faSLiu Zhe 		xText=xTextDocument.getText();
291f4c702faSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
292f4c702faSLiu Zhe 		// get internal service factory of the document
293f4c702faSLiu Zhe 		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
294f4c702faSLiu Zhe 		// Create a new table from the document's factory
295f4c702faSLiu Zhe 		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
296f4c702faSLiu Zhe 		xText.insertTextContent(xTextCursor,xTable,false);
297f4c702faSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
298f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
299f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("PageDescName","Endnote");
300f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
301f4c702faSLiu Zhe 		//save to odt
302f4c702faSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
303f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
304f4c702faSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
305f4c702faSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
306f4c702faSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
307f4c702faSLiu Zhe 		aStoreProperties_odt[0].Value = true;
308f4c702faSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
309f4c702faSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
310f4c702faSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
311f4c702faSLiu Zhe 		//save to doc
312f4c702faSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
313f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
314f4c702faSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
315f4c702faSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
316f4c702faSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
317f4c702faSLiu Zhe 		aStoreProperties_doc[0].Value = true;
318f4c702faSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
319f4c702faSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
320f4c702faSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
321f4c702faSLiu Zhe 		app.closeDocument(xTextDocument);
322f4c702faSLiu Zhe 
323f4c702faSLiu Zhe 		//reopen the document
324f4c702faSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
325f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
326f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
327f4c702faSLiu Zhe 		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
328f4c702faSLiu Zhe 		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
329f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
330f4c702faSLiu Zhe 		//verify paragraph break
331f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
332f4c702faSLiu Zhe 		assertEquals("assert paragraph break","Endnote",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
333f4c702faSLiu Zhe 		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
334f4c702faSLiu Zhe 		//reopen the doc document and assert table break
335f4c702faSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
336f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
337f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
338f4c702faSLiu Zhe 		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
339f4c702faSLiu Zhe 		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
340f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
341f4c702faSLiu Zhe 		//verify paragraph background color
342f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
343f4c702faSLiu Zhe 		assertEquals("assert paragraph break","Endnote",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
344f4c702faSLiu Zhe 		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
345f4c702faSLiu Zhe 	}
346f4c702faSLiu Zhe 
347932de486SLiu Zhe 	@Test@Ignore("Bug #120721 - [testUNO patch]the page_endnote_break type change to page_default_break when save to doc.")
InsertPage_Envelop_BeforeBreak()348f4c702faSLiu Zhe 	public void InsertPage_Envelop_BeforeBreak() throws Exception {
349f4c702faSLiu Zhe 
350f4c702faSLiu Zhe 		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
351f4c702faSLiu Zhe 		xText=xTextDocument.getText();
352f4c702faSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
353f4c702faSLiu Zhe 		// get internal service factory of the document
354f4c702faSLiu Zhe 		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
355f4c702faSLiu Zhe 		// Create a new table from the document's factory
356f4c702faSLiu Zhe 		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
357f4c702faSLiu Zhe 		xText.insertTextContent(xTextCursor,xTable,false);
358f4c702faSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
359f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
360f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("PageDescName","Envelope");
361f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
362f4c702faSLiu Zhe 		//save to odt
363f4c702faSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
364f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
365f4c702faSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
366f4c702faSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
367f4c702faSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
368f4c702faSLiu Zhe 		aStoreProperties_odt[0].Value = true;
369f4c702faSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
370f4c702faSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
371f4c702faSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
372f4c702faSLiu Zhe 		//save to doc
373f4c702faSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
374f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
375f4c702faSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
376f4c702faSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
377f4c702faSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
378f4c702faSLiu Zhe 		aStoreProperties_doc[0].Value = true;
379f4c702faSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
380f4c702faSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
381f4c702faSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
382f4c702faSLiu Zhe 		app.closeDocument(xTextDocument);
383f4c702faSLiu Zhe 
384f4c702faSLiu Zhe 		//reopen the document
385f4c702faSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
386f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
387f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
388f4c702faSLiu Zhe 		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
389f4c702faSLiu Zhe 		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
390f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
391f4c702faSLiu Zhe 		//verify paragraph break
392f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
393f4c702faSLiu Zhe 		assertEquals("assert paragraph break","Envelope",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
394f4c702faSLiu Zhe 		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
395f4c702faSLiu Zhe 		//reopen the doc document and assert table break
396f4c702faSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
397f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
398f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
399f4c702faSLiu Zhe 		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
400f4c702faSLiu Zhe 		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
401f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
402f4c702faSLiu Zhe 		//verify paragraph background color
403f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
404f4c702faSLiu Zhe 		assertEquals("assert paragraph break","Envelope",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
405f4c702faSLiu Zhe 		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
406f4c702faSLiu Zhe 	}
407f4c702faSLiu Zhe 
408f4c702faSLiu Zhe 	@Test
InsertPage_Firstpage_BeforeBreak()409f4c702faSLiu Zhe 	public void InsertPage_Firstpage_BeforeBreak() throws Exception {
410f4c702faSLiu Zhe 
411f4c702faSLiu Zhe 		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
412f4c702faSLiu Zhe 		xText=xTextDocument.getText();
413f4c702faSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
414f4c702faSLiu Zhe 		// get internal service factory of the document
415f4c702faSLiu Zhe 		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
416f4c702faSLiu Zhe 		// Create a new table from the document's factory
417f4c702faSLiu Zhe 		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
418f4c702faSLiu Zhe 		xText.insertTextContent(xTextCursor,xTable,false);
419f4c702faSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
420f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
421f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("PageDescName","First Page");
422f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
423f4c702faSLiu Zhe 		//save to odt
424f4c702faSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
425f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
426f4c702faSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
427f4c702faSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
428f4c702faSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
429f4c702faSLiu Zhe 		aStoreProperties_odt[0].Value = true;
430f4c702faSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
431f4c702faSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
432f4c702faSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
433f4c702faSLiu Zhe 		//save to doc
434f4c702faSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
435f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
436f4c702faSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
437f4c702faSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
438f4c702faSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
439f4c702faSLiu Zhe 		aStoreProperties_doc[0].Value = true;
440f4c702faSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
441f4c702faSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
442f4c702faSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
443f4c702faSLiu Zhe 		app.closeDocument(xTextDocument);
444f4c702faSLiu Zhe 
445f4c702faSLiu Zhe 		//reopen the document
446f4c702faSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
447f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
448f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
449f4c702faSLiu Zhe 		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
450f4c702faSLiu Zhe 		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
451f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
452f4c702faSLiu Zhe 		//verify paragraph break
453f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
454f4c702faSLiu Zhe 		assertEquals("assert paragraph break","First Page",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
455f4c702faSLiu Zhe 		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
456f4c702faSLiu Zhe 		//reopen the doc document and assert table break
457f4c702faSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
458f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
459f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
460f4c702faSLiu Zhe 		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
461f4c702faSLiu Zhe 		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
462f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
463f4c702faSLiu Zhe 		//verify paragraph background color
464f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
465f4c702faSLiu Zhe 		assertEquals("assert paragraph break","First Page",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
466f4c702faSLiu Zhe 		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
467f4c702faSLiu Zhe 	}
468932de486SLiu Zhe 	@Test@Ignore("Bug #120721 - [testUNO patch]the page_endnote_break type change to page_default_break when save to doc.")
InsertPage_Footnote_BeforeBreak()469f4c702faSLiu Zhe 	public void InsertPage_Footnote_BeforeBreak() throws Exception {
470f4c702faSLiu Zhe 
471f4c702faSLiu Zhe 		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
472f4c702faSLiu Zhe 		xText=xTextDocument.getText();
473f4c702faSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
474f4c702faSLiu Zhe 		// get internal service factory of the document
475f4c702faSLiu Zhe 		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
476f4c702faSLiu Zhe 		// Create a new table from the document's factory
477f4c702faSLiu Zhe 		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
478f4c702faSLiu Zhe 		xText.insertTextContent(xTextCursor,xTable,false);
479f4c702faSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
480f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
481f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("PageDescName","Footnote");
482f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
483f4c702faSLiu Zhe 		//save to odt
484f4c702faSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
485f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
486f4c702faSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
487f4c702faSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
488f4c702faSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
489f4c702faSLiu Zhe 		aStoreProperties_odt[0].Value = true;
490f4c702faSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
491f4c702faSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
492f4c702faSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
493f4c702faSLiu Zhe 		//save to doc
494f4c702faSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
495f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
496f4c702faSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
497f4c702faSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
498f4c702faSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
499f4c702faSLiu Zhe 		aStoreProperties_doc[0].Value = true;
500f4c702faSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
501f4c702faSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
502f4c702faSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
503f4c702faSLiu Zhe 		app.closeDocument(xTextDocument);
504f4c702faSLiu Zhe 
505f4c702faSLiu Zhe 		//reopen the document
506f4c702faSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
507f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
508f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
509f4c702faSLiu Zhe 		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
510f4c702faSLiu Zhe 		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
511f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
512f4c702faSLiu Zhe 		//verify paragraph break
513f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
514f4c702faSLiu Zhe 		assertEquals("assert paragraph break","Footnote",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
515f4c702faSLiu Zhe 		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
516f4c702faSLiu Zhe 		//reopen the doc document and assert table break
517f4c702faSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
518f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
519f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
520f4c702faSLiu Zhe 		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
521f4c702faSLiu Zhe 		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
522f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
523f4c702faSLiu Zhe 		//verify paragraph background color
524f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
525f4c702faSLiu Zhe 		assertEquals("assert paragraph break","Footnote",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
526f4c702faSLiu Zhe 		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
527f4c702faSLiu Zhe 	}
528932de486SLiu Zhe 	@Test@Ignore("Bug #120721 - [testUNO patch]the page_endnote_break type change to page_default_break when save to doc.")
InsertPage_HTML_BeforeBreak()529f4c702faSLiu Zhe 	public void InsertPage_HTML_BeforeBreak() throws Exception {
530f4c702faSLiu Zhe 
531f4c702faSLiu Zhe 		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
532f4c702faSLiu Zhe 		xText=xTextDocument.getText();
533f4c702faSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
534f4c702faSLiu Zhe 		// get internal service factory of the document
535f4c702faSLiu Zhe 		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
536f4c702faSLiu Zhe 		// Create a new table from the document's factory
537f4c702faSLiu Zhe 		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
538f4c702faSLiu Zhe 		xText.insertTextContent(xTextCursor,xTable,false);
539f4c702faSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
540f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
541f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("PageDescName","HTML");
542f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
543f4c702faSLiu Zhe 		//save to odt
544f4c702faSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
545f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
546f4c702faSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
547f4c702faSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
548f4c702faSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
549f4c702faSLiu Zhe 		aStoreProperties_odt[0].Value = true;
550f4c702faSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
551f4c702faSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
552f4c702faSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
553f4c702faSLiu Zhe 		//save to doc
554f4c702faSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
555f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
556f4c702faSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
557f4c702faSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
558f4c702faSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
559f4c702faSLiu Zhe 		aStoreProperties_doc[0].Value = true;
560f4c702faSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
561f4c702faSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
562f4c702faSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
563f4c702faSLiu Zhe 		app.closeDocument(xTextDocument);
564f4c702faSLiu Zhe 
565f4c702faSLiu Zhe 		//reopen the document
566f4c702faSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
567f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
568f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
569f4c702faSLiu Zhe 		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
570f4c702faSLiu Zhe 		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
571f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
572f4c702faSLiu Zhe 		//verify paragraph break
573f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
574f4c702faSLiu Zhe 		assertEquals("assert paragraph break","HTML",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
575f4c702faSLiu Zhe 		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
576f4c702faSLiu Zhe 		//reopen the doc document and assert table break
577f4c702faSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
578f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
579f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
580f4c702faSLiu Zhe 		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
581f4c702faSLiu Zhe 		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
582f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
583f4c702faSLiu Zhe 		//verify paragraph background color
584f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
585f4c702faSLiu Zhe 		assertEquals("assert paragraph break","HTML",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
586f4c702faSLiu Zhe 		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
587f4c702faSLiu Zhe 	}
588932de486SLiu Zhe 	@Test@Ignore("Bug #120721 - [testUNO patch]the page_endnote_break type change to page_default_break when save to doc.")
InsertPage_Index_BeforeBreak()589f4c702faSLiu Zhe 	public void InsertPage_Index_BeforeBreak() throws Exception {
590f4c702faSLiu Zhe 
591f4c702faSLiu Zhe 		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
592f4c702faSLiu Zhe 		xText=xTextDocument.getText();
593f4c702faSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
594f4c702faSLiu Zhe 		// get internal service factory of the document
595f4c702faSLiu Zhe 		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
596f4c702faSLiu Zhe 		// Create a new table from the document's factory
597f4c702faSLiu Zhe 		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
598f4c702faSLiu Zhe 		xText.insertTextContent(xTextCursor,xTable,false);
599f4c702faSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
600f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
601f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("PageDescName","Index");
602f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
603f4c702faSLiu Zhe 		//save to odt
604f4c702faSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
605f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
606f4c702faSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
607f4c702faSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
608f4c702faSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
609f4c702faSLiu Zhe 		aStoreProperties_odt[0].Value = true;
610f4c702faSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
611f4c702faSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
612f4c702faSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
613f4c702faSLiu Zhe 		//save to doc
614f4c702faSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
615f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
616f4c702faSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
617f4c702faSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
618f4c702faSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
619f4c702faSLiu Zhe 		aStoreProperties_doc[0].Value = true;
620f4c702faSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
621f4c702faSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
622f4c702faSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
623f4c702faSLiu Zhe 		app.closeDocument(xTextDocument);
624f4c702faSLiu Zhe 
625f4c702faSLiu Zhe 		//reopen the document
626f4c702faSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
627f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
628f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
629f4c702faSLiu Zhe 		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
630f4c702faSLiu Zhe 		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
631f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
632f4c702faSLiu Zhe 		//verify paragraph break
633f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
634f4c702faSLiu Zhe 		assertEquals("assert paragraph break","Index",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
635f4c702faSLiu Zhe 		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
636f4c702faSLiu Zhe 		//reopen the doc document and assert table break
637f4c702faSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
638f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
639f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
640f4c702faSLiu Zhe 		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
641f4c702faSLiu Zhe 		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
642f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
643f4c702faSLiu Zhe 		//verify paragraph background color
644f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
645f4c702faSLiu Zhe 		assertEquals("assert paragraph break","Index",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
646f4c702faSLiu Zhe 		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
647f4c702faSLiu Zhe 	}
648932de486SLiu Zhe 	@Test@Ignore("Bug #120721 - [testUNO patch]the page_endnote_break type change to page_default_break when save to doc.")
InsertPage_Landscape_BeforeBreak()649f4c702faSLiu Zhe 	public void InsertPage_Landscape_BeforeBreak() throws Exception {
650f4c702faSLiu Zhe 
651f4c702faSLiu Zhe 		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
652f4c702faSLiu Zhe 		xText=xTextDocument.getText();
653f4c702faSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
654f4c702faSLiu Zhe 		// get internal service factory of the document
655f4c702faSLiu Zhe 		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
656f4c702faSLiu Zhe 		// Create a new table from the document's factory
657f4c702faSLiu Zhe 		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
658f4c702faSLiu Zhe 		xText.insertTextContent(xTextCursor,xTable,false);
659f4c702faSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
660f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
661f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("PageDescName","Landscape");
662f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
663f4c702faSLiu Zhe 		//save to odt
664f4c702faSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
665f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
666f4c702faSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
667f4c702faSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
668f4c702faSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
669f4c702faSLiu Zhe 		aStoreProperties_odt[0].Value = true;
670f4c702faSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
671f4c702faSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
672f4c702faSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
673f4c702faSLiu Zhe 		//save to doc
674f4c702faSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
675f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
676f4c702faSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
677f4c702faSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
678f4c702faSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
679f4c702faSLiu Zhe 		aStoreProperties_doc[0].Value = true;
680f4c702faSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
681f4c702faSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
682f4c702faSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
683f4c702faSLiu Zhe 		app.closeDocument(xTextDocument);
684f4c702faSLiu Zhe 
685f4c702faSLiu Zhe 		//reopen the document
686f4c702faSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
687f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
688f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
689f4c702faSLiu Zhe 		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
690f4c702faSLiu Zhe 		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
691f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
692f4c702faSLiu Zhe 		//verify paragraph break
693f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
694f4c702faSLiu Zhe 		assertEquals("assert paragraph break","Landscape",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
695f4c702faSLiu Zhe 		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
696f4c702faSLiu Zhe 		//reopen the doc document and assert table break
697f4c702faSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
698f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
699f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
700f4c702faSLiu Zhe 		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
701f4c702faSLiu Zhe 		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
702f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
703f4c702faSLiu Zhe 		//verify paragraph background color
704f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
705f4c702faSLiu Zhe 		assertEquals("assert paragraph break","Landscape",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
706f4c702faSLiu Zhe 		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
707f4c702faSLiu Zhe 	}
708932de486SLiu Zhe 	@Test@Ignore("Bug #120721 - [testUNO patch]the page_endnote_break type change to page_default_break when save to doc.")
InsertPage_LeftPage_BeforeBreak()709f4c702faSLiu Zhe 	public void InsertPage_LeftPage_BeforeBreak() throws Exception {
710f4c702faSLiu Zhe 
711f4c702faSLiu Zhe 		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
712f4c702faSLiu Zhe 		xText=xTextDocument.getText();
713f4c702faSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
714f4c702faSLiu Zhe 		// get internal service factory of the document
715f4c702faSLiu Zhe 		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
716f4c702faSLiu Zhe 		// Create a new table from the document's factory
717f4c702faSLiu Zhe 		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
718f4c702faSLiu Zhe 		xText.insertTextContent(xTextCursor,xTable,false);
719f4c702faSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
720f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
721f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("PageDescName","Left Page");
722f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
723f4c702faSLiu Zhe 		//save to odt
724f4c702faSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
725f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
726f4c702faSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
727f4c702faSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
728f4c702faSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
729f4c702faSLiu Zhe 		aStoreProperties_odt[0].Value = true;
730f4c702faSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
731f4c702faSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
732f4c702faSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
733f4c702faSLiu Zhe 		//save to doc
734f4c702faSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
735f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
736f4c702faSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
737f4c702faSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
738f4c702faSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
739f4c702faSLiu Zhe 		aStoreProperties_doc[0].Value = true;
740f4c702faSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
741f4c702faSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
742f4c702faSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
743f4c702faSLiu Zhe 		app.closeDocument(xTextDocument);
744f4c702faSLiu Zhe 
745f4c702faSLiu Zhe 		//reopen the document
746f4c702faSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
747f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
748f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
749f4c702faSLiu Zhe 		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
750f4c702faSLiu Zhe 		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
751f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
752f4c702faSLiu Zhe 		//verify paragraph break
753f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
754f4c702faSLiu Zhe 		assertEquals("assert paragraph break","Left Page",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
755f4c702faSLiu Zhe 		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
756f4c702faSLiu Zhe 		//reopen the doc document and assert table break
757f4c702faSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
758f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
759f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
760f4c702faSLiu Zhe 		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
761f4c702faSLiu Zhe 		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
762f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
763f4c702faSLiu Zhe 		//verify paragraph background color
764f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
765f4c702faSLiu Zhe 		assertEquals("assert paragraph break","Left Page",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
766f4c702faSLiu Zhe 		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
767f4c702faSLiu Zhe 	}
768932de486SLiu Zhe 	@Test@Ignore("Bug #120721 - [testUNO patch]the page_endnote_break type change to page_default_break when save to doc.")
InsertPage_RightPage_BeforeBreak()769f4c702faSLiu Zhe 	public void InsertPage_RightPage_BeforeBreak() throws Exception {
770f4c702faSLiu Zhe 
771f4c702faSLiu Zhe 		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
772f4c702faSLiu Zhe 		xText=xTextDocument.getText();
773f4c702faSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
774f4c702faSLiu Zhe 		// get internal service factory of the document
775f4c702faSLiu Zhe 		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
776f4c702faSLiu Zhe 		// Create a new table from the document's factory
777f4c702faSLiu Zhe 		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
778f4c702faSLiu Zhe 		xText.insertTextContent(xTextCursor,xTable,false);
779f4c702faSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
780f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
781f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("PageDescName","Right Page");
782f4c702faSLiu Zhe 		xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
783f4c702faSLiu Zhe 		//save to odt
784f4c702faSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
785f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
786f4c702faSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
787f4c702faSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
788f4c702faSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
789f4c702faSLiu Zhe 		aStoreProperties_odt[0].Value = true;
790f4c702faSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
791f4c702faSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
792f4c702faSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
793f4c702faSLiu Zhe 		//save to doc
794f4c702faSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
795f4c702faSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
796f4c702faSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
797f4c702faSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
798f4c702faSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
799f4c702faSLiu Zhe 		aStoreProperties_doc[0].Value = true;
800f4c702faSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
801f4c702faSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
802f4c702faSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
803f4c702faSLiu Zhe 		app.closeDocument(xTextDocument);
804f4c702faSLiu Zhe 
805f4c702faSLiu Zhe 		//reopen the document
806f4c702faSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
807f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
808f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
809f4c702faSLiu Zhe 		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
810f4c702faSLiu Zhe 		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
811f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
812f4c702faSLiu Zhe 		//verify paragraph break
813f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
814f4c702faSLiu Zhe 		assertEquals("assert paragraph break","Right Page",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
815f4c702faSLiu Zhe 		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
816f4c702faSLiu Zhe 		//reopen the doc document and assert table break
817f4c702faSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
818f4c702faSLiu Zhe 		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
819f4c702faSLiu Zhe 		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
820f4c702faSLiu Zhe 		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
821f4c702faSLiu Zhe 		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
822f4c702faSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
823f4c702faSLiu Zhe 		//verify paragraph background color
824f4c702faSLiu Zhe 		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
825f4c702faSLiu Zhe 		assertEquals("assert paragraph break","Right Page",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
826f4c702faSLiu Zhe 		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
827f4c702faSLiu Zhe 	}
828f4c702faSLiu Zhe }
829