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