xref: /AOO41X/test/testuno/source/fvt/uno/sw/paragraph/ParagraphNumberingAndBulletAlignment.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.paragraph;
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.Test;
29eba4d44aSLiu Zhe import org.openoffice.test.common.FileUtil;
30eba4d44aSLiu Zhe import org.openoffice.test.common.Testspace;
31eba4d44aSLiu Zhe import org.openoffice.test.uno.UnoApp;
32eba4d44aSLiu Zhe 
33eba4d44aSLiu Zhe import com.sun.star.style.NumberingType;
34eba4d44aSLiu Zhe import com.sun.star.text.*;
35eba4d44aSLiu Zhe import com.sun.star.beans.*;
36eba4d44aSLiu Zhe import com.sun.star.container.XIndexAccess;
37eba4d44aSLiu Zhe import com.sun.star.container.XIndexReplace;
38eba4d44aSLiu Zhe import com.sun.star.frame.XStorable;
39eba4d44aSLiu Zhe import com.sun.star.lang.XMultiServiceFactory;
40eba4d44aSLiu Zhe import com.sun.star.uno.UnoRuntime;
41eba4d44aSLiu Zhe 
42eba4d44aSLiu Zhe public class ParagraphNumberingAndBulletAlignment {
43eba4d44aSLiu Zhe 	private static final UnoApp app = new UnoApp();
44eba4d44aSLiu Zhe 	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 	/*
57eba4d44aSLiu Zhe 	 * test paragraph background color
58eba4d44aSLiu Zhe 	 * 1.new a text document
59eba4d44aSLiu Zhe 	 * 2.insert some text
60eba4d44aSLiu Zhe 	 * 3.set paragraph numbering alignment
61eba4d44aSLiu Zhe 	 * 4.save and close the document
62eba4d44aSLiu Zhe 	 * 5.reload the saved document and check the paragraph numbering alignment
63eba4d44aSLiu Zhe 	 */
64eba4d44aSLiu Zhe 	@Test
testNumberingBulletAlign_Right()65eba4d44aSLiu Zhe 	public void testNumberingBulletAlign_Right() throws Exception {
66eba4d44aSLiu Zhe 
67eba4d44aSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
68eba4d44aSLiu Zhe 		xText = xTextDocument.getText();
69eba4d44aSLiu Zhe 		xText.setString("we are Chinese,they are American.\nwe are all living in one earth!\nHello,world!Hello,world!Hello,world!\nHello,world!Hello,world!Hello,world!" +
70eba4d44aSLiu Zhe 				"Hello,world!Hello,world!");
71eba4d44aSLiu Zhe 		//create cursor to select paragraph and formating paragraph
72eba4d44aSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
73eba4d44aSLiu Zhe 		//create paragraph property set
74eba4d44aSLiu Zhe 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
75eba4d44aSLiu Zhe 		//create document service factory
76eba4d44aSLiu Zhe 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
77eba4d44aSLiu Zhe 		//set numbering character
78eba4d44aSLiu Zhe 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
79eba4d44aSLiu Zhe 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
80eba4d44aSLiu Zhe 		propsRule[1].Name = "NumberingType";
81eba4d44aSLiu Zhe 		propsRule[1].Value = NumberingType.ARABIC;
82eba4d44aSLiu Zhe 		propsRule[0].Name = "Adjust";
83eba4d44aSLiu Zhe 		propsRule[0].Value = HoriOrientation.RIGHT;
84eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
85eba4d44aSLiu Zhe 		xReplaceRule.replaceByIndex(0, propsRule);
86eba4d44aSLiu Zhe 		//set paragraph numbering and bullet character
87eba4d44aSLiu Zhe 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
88eba4d44aSLiu Zhe 		//save to odt
89eba4d44aSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
90eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
91eba4d44aSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
92eba4d44aSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
93eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
94eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Value = true;
95eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
96eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Value = "writer8";
97eba4d44aSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
98eba4d44aSLiu Zhe 		//save to doc
99eba4d44aSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
100eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
101eba4d44aSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
102eba4d44aSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
103eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
104eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Value = true;
105eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
106eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
107eba4d44aSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
108eba4d44aSLiu Zhe 		app.closeDocument(xTextDocument);
109eba4d44aSLiu Zhe 
110eba4d44aSLiu Zhe 		//reopen the document
111eba4d44aSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
112eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
113eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
114eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
115eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
116eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
117eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","Adjust",propsRule_assert_odt[0].Name);
118eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",HoriOrientation.RIGHT,propsRule_assert_odt[0].Value);
119eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
120eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
121eba4d44aSLiu Zhe 
122eba4d44aSLiu Zhe 		//reopen the document
123eba4d44aSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
124eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
125eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
126eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
127eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
128eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","Adjust",propsRule_assert_doc[0].Name);
129eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",HoriOrientation.RIGHT,propsRule_assert_doc[0].Value);
130eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
131eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
132eba4d44aSLiu Zhe 	}
133eba4d44aSLiu Zhe 	@Test
testNumberingBulletAlign_Left()134eba4d44aSLiu Zhe 	public void testNumberingBulletAlign_Left() throws Exception {
135eba4d44aSLiu Zhe 
136eba4d44aSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
137eba4d44aSLiu Zhe 		xText = xTextDocument.getText();
138eba4d44aSLiu Zhe 		xText.setString("we are Chinese,they are American.\nwe are all living in one earth!\nHello,world!Hello,world!Hello,world!\nHello,world!Hello,world!Hello,world!" +
139eba4d44aSLiu Zhe 				"Hello,world!Hello,world!");
140eba4d44aSLiu Zhe 		//create cursor to select paragraph and formating paragraph
141eba4d44aSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
142eba4d44aSLiu Zhe 		//create paragraph property set
143eba4d44aSLiu Zhe 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
144eba4d44aSLiu Zhe 		//create document service factory
145eba4d44aSLiu Zhe 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
146eba4d44aSLiu Zhe 		//set numbering character
147eba4d44aSLiu Zhe 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
148eba4d44aSLiu Zhe 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
149eba4d44aSLiu Zhe 		propsRule[1].Name = "NumberingType";
150eba4d44aSLiu Zhe 		propsRule[1].Value = NumberingType.ARABIC;
151eba4d44aSLiu Zhe 		propsRule[0].Name = "Adjust";
152eba4d44aSLiu Zhe 		propsRule[0].Value = HoriOrientation.LEFT;
153eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
154eba4d44aSLiu Zhe 		xReplaceRule.replaceByIndex(0, propsRule);
155eba4d44aSLiu Zhe 		//set paragraph numbering and bullet character
156eba4d44aSLiu Zhe 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
157eba4d44aSLiu Zhe 		//save to odt
158eba4d44aSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
159eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
160eba4d44aSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
161eba4d44aSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
162eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
163eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Value = true;
164eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
165eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Value = "writer8";
166eba4d44aSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
167eba4d44aSLiu Zhe 		//save to doc
168eba4d44aSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
169eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
170eba4d44aSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
171eba4d44aSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
172eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
173eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Value = true;
174eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
175eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
176eba4d44aSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
177eba4d44aSLiu Zhe 		app.closeDocument(xTextDocument);
178eba4d44aSLiu Zhe 
179eba4d44aSLiu Zhe 		//reopen the document
180eba4d44aSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
181eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
182eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
183eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
184eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
185eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
186eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","Adjust",propsRule_assert_odt[0].Name);
187eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",HoriOrientation.LEFT,propsRule_assert_odt[0].Value);
188eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
189eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
190eba4d44aSLiu Zhe 
191eba4d44aSLiu Zhe 		//reopen the document
192eba4d44aSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
193eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
194eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
195eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
196eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
197eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","Adjust",propsRule_assert_doc[0].Name);
198eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",HoriOrientation.LEFT,propsRule_assert_doc[0].Value);
199eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
200eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
201eba4d44aSLiu Zhe 	}
202eba4d44aSLiu Zhe 	@Test
testNumberingBulletAlign_Center()203eba4d44aSLiu Zhe 	public void testNumberingBulletAlign_Center() throws Exception {
204eba4d44aSLiu Zhe 
205eba4d44aSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
206eba4d44aSLiu Zhe 		xText = xTextDocument.getText();
207eba4d44aSLiu Zhe 		xText.setString("we are Chinese,they are American.\nwe are all living in one earth!\nHello,world!Hello,world!Hello,world!\nHello,world!Hello,world!Hello,world!" +
208eba4d44aSLiu Zhe 				"Hello,world!Hello,world!");
209eba4d44aSLiu Zhe 		//create cursor to select paragraph and formating paragraph
210eba4d44aSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
211eba4d44aSLiu Zhe 		//create paragraph property set
212eba4d44aSLiu Zhe 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
213eba4d44aSLiu Zhe 		//create document service factory
214eba4d44aSLiu Zhe 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
215eba4d44aSLiu Zhe 		//set numbering character
216eba4d44aSLiu Zhe 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
217eba4d44aSLiu Zhe 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
218eba4d44aSLiu Zhe 		propsRule[1].Name = "NumberingType";
219eba4d44aSLiu Zhe 		propsRule[1].Value = NumberingType.ARABIC;
220eba4d44aSLiu Zhe 		propsRule[0].Name = "Adjust";
221eba4d44aSLiu Zhe 		propsRule[0].Value = HoriOrientation.CENTER;
222eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
223eba4d44aSLiu Zhe 		xReplaceRule.replaceByIndex(0, propsRule);
224eba4d44aSLiu Zhe 		//set paragraph numbering and bullet character
225eba4d44aSLiu Zhe 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
226eba4d44aSLiu Zhe 		//save to odt
227eba4d44aSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
228eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
229eba4d44aSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
230eba4d44aSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
231eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
232eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Value = true;
233eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
234eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Value = "writer8";
235eba4d44aSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
236eba4d44aSLiu Zhe 		//save to doc
237eba4d44aSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
238eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
239eba4d44aSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
240eba4d44aSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
241eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
242eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Value = true;
243eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
244eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
245eba4d44aSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
246eba4d44aSLiu Zhe 		app.closeDocument(xTextDocument);
247eba4d44aSLiu Zhe 
248eba4d44aSLiu Zhe 		//reopen the document
249eba4d44aSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
250eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
251eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
252eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
253eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
254eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
255eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","Adjust",propsRule_assert_odt[0].Name);
256eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",HoriOrientation.CENTER,propsRule_assert_odt[0].Value);
257eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
258eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
259eba4d44aSLiu Zhe 
260eba4d44aSLiu Zhe 		//reopen the document
261eba4d44aSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
262eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
263eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
264eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
265eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
266eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","Adjust",propsRule_assert_doc[0].Name);
267eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",HoriOrientation.CENTER,propsRule_assert_doc[0].Value);
268eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
269eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
270eba4d44aSLiu Zhe 	}
271eba4d44aSLiu Zhe }
272