1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 package fvt.uno.sw.paragraph;
23 
24 import static org.junit.Assert.*;
25 
26 import org.junit.After;
27 import org.junit.Before;
28 import org.junit.Test;
29 import org.openoffice.test.common.FileUtil;
30 import org.openoffice.test.common.Testspace;
31 import org.openoffice.test.uno.UnoApp;
32 
33 import com.sun.star.style.NumberingType;
34 import com.sun.star.text.*;
35 import com.sun.star.beans.*;
36 import com.sun.star.container.XIndexAccess;
37 import com.sun.star.container.XIndexReplace;
38 import com.sun.star.frame.XStorable;
39 import com.sun.star.lang.XMultiServiceFactory;
40 import com.sun.star.uno.UnoRuntime;
41 
42 public class ParagraphNumberingAndBulletCharacterStyle {
43 	private static final UnoApp app = new UnoApp();
44 	XText xText = null;
45 
46 	@Before
setUp()47 	public void setUp() throws Exception {
48 		app.start();
49 
50 	}
51 
52 	@After
tearDown()53 	public void tearDown() throws Exception {
54 		app.close();
55 	}
56 	/*
57 	 * test paragraph background color
58 	 * 1.new a text document
59 	 * 2.insert some text
60 	 * 3.set paragraph numbering bullet character style
61 	 * 4.save and close the document
62 	 * 5.reload the saved document and check the paragraph numbering bullet character style
63 	 */
64 	@Test
testNumberingBulletCharacterStyle_Rubies()65 	public void testNumberingBulletCharacterStyle_Rubies() throws Exception {
66 
67 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
68 		xText = xTextDocument.getText();
69 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
70 				"Hello,world!Hello,world!");
71 		//create cursor to select paragraph and formatting paragraph
72 		XTextCursor xTextCursor = xText.createTextCursor();
73 		//create paragraph property set
74 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
75 		//create document service factory
76 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
77 		//set numbering character
78 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
79 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
80 		propsRule[0].Name = "NumberingType";
81 		propsRule[0].Value = NumberingType.ARABIC;
82 		propsRule[1].Name = "CharStyleName";
83 		propsRule[1].Value = "Rubies";
84 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
85 		xReplaceRule.replaceByIndex(0, propsRule);
86 		//set paragraph numbering and bullet character
87 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
88 		//save to odt
89 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
90 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
91 		aStoreProperties_odt[0] = new PropertyValue();
92 		aStoreProperties_odt[1] = new PropertyValue();
93 		aStoreProperties_odt[0].Name = "Override";
94 		aStoreProperties_odt[0].Value = true;
95 		aStoreProperties_odt[1].Name = "FilterName";
96 		aStoreProperties_odt[1].Value = "writer8";
97 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
98 		//save to doc
99 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
100 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
101 		aStoreProperties_doc[0] = new PropertyValue();
102 		aStoreProperties_doc[1] = new PropertyValue();
103 		aStoreProperties_doc[0].Name = "Override";
104 		aStoreProperties_doc[0].Value = true;
105 		aStoreProperties_doc[1].Name = "FilterName";
106 		aStoreProperties_doc[1].Value = "MS Word 97";
107 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
108 		app.closeDocument(xTextDocument);
109 
110 		//reopen the document
111 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
112 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
113 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
114 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
115 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
116 		//verify paragraph numbering and bullet alignment
117 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
118 		assertEquals("assert numbering and bullet","Rubies",propsRule_assert_odt[4].Value);
119 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
120 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
121 
122 		//reopen the document
123 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
124 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
125 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
126 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
127 		//verify paragraph numbering and bullet alignment
128 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
129 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
130 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
131 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
132 	}
133 	@Test
testNumberingBulletCharacterStyle_Emphasis()134 	public void testNumberingBulletCharacterStyle_Emphasis() throws Exception {
135 
136 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
137 		xText = xTextDocument.getText();
138 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
139 				"Hello,world!Hello,world!");
140 		//create cursor to select paragraph and formatting paragraph
141 		XTextCursor xTextCursor = xText.createTextCursor();
142 		//create paragraph property set
143 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
144 		//create document service factory
145 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
146 		//set numbering character
147 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
148 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
149 		propsRule[0].Name = "NumberingType";
150 		propsRule[0].Value = NumberingType.ARABIC;
151 		propsRule[1].Name = "CharStyleName";
152 		propsRule[1].Value = "Emphasis";
153 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
154 		xReplaceRule.replaceByIndex(0, propsRule);
155 		//set paragraph numbering and bullet character
156 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
157 		//save to odt
158 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
159 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
160 		aStoreProperties_odt[0] = new PropertyValue();
161 		aStoreProperties_odt[1] = new PropertyValue();
162 		aStoreProperties_odt[0].Name = "Override";
163 		aStoreProperties_odt[0].Value = true;
164 		aStoreProperties_odt[1].Name = "FilterName";
165 		aStoreProperties_odt[1].Value = "writer8";
166 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
167 		//save to doc
168 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
169 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
170 		aStoreProperties_doc[0] = new PropertyValue();
171 		aStoreProperties_doc[1] = new PropertyValue();
172 		aStoreProperties_doc[0].Name = "Override";
173 		aStoreProperties_doc[0].Value = true;
174 		aStoreProperties_doc[1].Name = "FilterName";
175 		aStoreProperties_doc[1].Value = "MS Word 97";
176 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
177 		app.closeDocument(xTextDocument);
178 
179 		//reopen the document
180 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
181 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
182 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
183 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
184 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
185 		//verify paragraph numbering and bullet alignment
186 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
187 		assertEquals("assert numbering and bullet","Emphasis",propsRule_assert_odt[4].Value);
188 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
189 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
190 
191 		//reopen the document
192 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
193 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
194 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
195 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
196 		//verify paragraph numbering and bullet alignment
197 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
198 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
199 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
200 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
201 	}
202 	@Test
testNumberingBulletCharacterStyle_FootnoteCharacters()203 	public void testNumberingBulletCharacterStyle_FootnoteCharacters() throws Exception {
204 
205 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
206 		xText = xTextDocument.getText();
207 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
208 				"Hello,world!Hello,world!");
209 		//create cursor to select paragraph and formatting paragraph
210 		XTextCursor xTextCursor = xText.createTextCursor();
211 		//create paragraph property set
212 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
213 		//create document service factory
214 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
215 		//set numbering character
216 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
217 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
218 		propsRule[0].Name = "NumberingType";
219 		propsRule[0].Value = NumberingType.ARABIC;
220 		propsRule[1].Name = "CharStyleName";
221 		propsRule[1].Value = "Footnote Characters";
222 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
223 		xReplaceRule.replaceByIndex(0, propsRule);
224 		//set paragraph numbering and bullet character
225 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
226 		//save to odt
227 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
228 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
229 		aStoreProperties_odt[0] = new PropertyValue();
230 		aStoreProperties_odt[1] = new PropertyValue();
231 		aStoreProperties_odt[0].Name = "Override";
232 		aStoreProperties_odt[0].Value = true;
233 		aStoreProperties_odt[1].Name = "FilterName";
234 		aStoreProperties_odt[1].Value = "writer8";
235 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
236 		//save to doc
237 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
238 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
239 		aStoreProperties_doc[0] = new PropertyValue();
240 		aStoreProperties_doc[1] = new PropertyValue();
241 		aStoreProperties_doc[0].Name = "Override";
242 		aStoreProperties_doc[0].Value = true;
243 		aStoreProperties_doc[1].Name = "FilterName";
244 		aStoreProperties_doc[1].Value = "MS Word 97";
245 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
246 		app.closeDocument(xTextDocument);
247 
248 		//reopen the document
249 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
250 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
251 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
252 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
253 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
254 		//verify paragraph numbering and bullet alignment
255 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
256 		assertEquals("assert numbering and bullet","Footnote Symbol",propsRule_assert_odt[4].Value);
257 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
258 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
259 
260 		//reopen the document
261 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
262 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
263 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
264 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
265 		//verify paragraph numbering and bullet alignment
266 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
267 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
268 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
269 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
270 	}
271 	@Test
testNumberingBulletCharacterStyle_PageNumber()272 	public void testNumberingBulletCharacterStyle_PageNumber() throws Exception {
273 
274 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
275 		xText = xTextDocument.getText();
276 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
277 				"Hello,world!Hello,world!");
278 		//create cursor to select paragraph and formatting paragraph
279 		XTextCursor xTextCursor = xText.createTextCursor();
280 		//create paragraph property set
281 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
282 		//create document service factory
283 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
284 		//set numbering character
285 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
286 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
287 		propsRule[0].Name = "NumberingType";
288 		propsRule[0].Value = NumberingType.ARABIC;
289 		propsRule[1].Name = "CharStyleName";
290 		propsRule[1].Value = "Page Number";
291 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
292 		xReplaceRule.replaceByIndex(0, propsRule);
293 		//set paragraph numbering and bullet character
294 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
295 		//save to odt
296 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
297 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
298 		aStoreProperties_odt[0] = new PropertyValue();
299 		aStoreProperties_odt[1] = new PropertyValue();
300 		aStoreProperties_odt[0].Name = "Override";
301 		aStoreProperties_odt[0].Value = true;
302 		aStoreProperties_odt[1].Name = "FilterName";
303 		aStoreProperties_odt[1].Value = "writer8";
304 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
305 		//save to doc
306 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
307 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
308 		aStoreProperties_doc[0] = new PropertyValue();
309 		aStoreProperties_doc[1] = new PropertyValue();
310 		aStoreProperties_doc[0].Name = "Override";
311 		aStoreProperties_doc[0].Value = true;
312 		aStoreProperties_doc[1].Name = "FilterName";
313 		aStoreProperties_doc[1].Value = "MS Word 97";
314 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
315 		app.closeDocument(xTextDocument);
316 
317 		//reopen the document
318 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
319 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
320 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
321 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
322 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
323 		//verify paragraph numbering and bullet alignment
324 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
325 		assertEquals("assert numbering and bullet","Page Number",propsRule_assert_odt[4].Value);
326 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
327 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
328 
329 		//reopen the document
330 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
331 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
332 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
333 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
334 		//verify paragraph numbering and bullet alignment
335 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
336 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
337 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
338 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
339 	}
340 	@Test
testNumberingBulletCharacterStyle_CaptionCharacters()341 	public void testNumberingBulletCharacterStyle_CaptionCharacters() throws Exception {
342 
343 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
344 		xText = xTextDocument.getText();
345 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
346 				"Hello,world!Hello,world!");
347 		//create cursor to select paragraph and formatting paragraph
348 		XTextCursor xTextCursor = xText.createTextCursor();
349 		//create paragraph property set
350 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
351 		//create document service factory
352 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
353 		//set numbering character
354 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
355 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
356 		propsRule[0].Name = "NumberingType";
357 		propsRule[0].Value = NumberingType.ARABIC;
358 		propsRule[1].Name = "CharStyleName";
359 		propsRule[1].Value = "Caption Characters";
360 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
361 		xReplaceRule.replaceByIndex(0, propsRule);
362 		//set paragraph numbering and bullet character
363 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
364 		//save to odt
365 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
366 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
367 		aStoreProperties_odt[0] = new PropertyValue();
368 		aStoreProperties_odt[1] = new PropertyValue();
369 		aStoreProperties_odt[0].Name = "Override";
370 		aStoreProperties_odt[0].Value = true;
371 		aStoreProperties_odt[1].Name = "FilterName";
372 		aStoreProperties_odt[1].Value = "writer8";
373 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
374 		//save to doc
375 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
376 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
377 		aStoreProperties_doc[0] = new PropertyValue();
378 		aStoreProperties_doc[1] = new PropertyValue();
379 		aStoreProperties_doc[0].Name = "Override";
380 		aStoreProperties_doc[0].Value = true;
381 		aStoreProperties_doc[1].Name = "FilterName";
382 		aStoreProperties_doc[1].Value = "MS Word 97";
383 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
384 		app.closeDocument(xTextDocument);
385 
386 		//reopen the document
387 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
388 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
389 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
390 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
391 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
392 		//verify paragraph numbering and bullet alignment
393 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
394 		assertEquals("assert numbering and bullet","Caption characters",propsRule_assert_odt[4].Value);
395 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
396 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
397 
398 		//reopen the document
399 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
400 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
401 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
402 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
403 		//verify paragraph numbering and bullet alignment
404 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
405 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
406 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
407 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
408 	}
409 	@Test
testNumberingBulletCharacterStyle_DropCaps()410 	public void testNumberingBulletCharacterStyle_DropCaps() throws Exception {
411 
412 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
413 		xText = xTextDocument.getText();
414 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
415 				"Hello,world!Hello,world!");
416 		//create cursor to select paragraph and formatting paragraph
417 		XTextCursor xTextCursor = xText.createTextCursor();
418 		//create paragraph property set
419 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
420 		//create document service factory
421 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
422 		//set numbering character
423 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
424 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
425 		propsRule[0].Name = "NumberingType";
426 		propsRule[0].Value = NumberingType.ARABIC;
427 		propsRule[1].Name = "CharStyleName";
428 		propsRule[1].Value = "Drop Caps";
429 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
430 		xReplaceRule.replaceByIndex(0, propsRule);
431 		//set paragraph numbering and bullet character
432 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
433 		//save to odt
434 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
435 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
436 		aStoreProperties_odt[0] = new PropertyValue();
437 		aStoreProperties_odt[1] = new PropertyValue();
438 		aStoreProperties_odt[0].Name = "Override";
439 		aStoreProperties_odt[0].Value = true;
440 		aStoreProperties_odt[1].Name = "FilterName";
441 		aStoreProperties_odt[1].Value = "writer8";
442 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
443 		//save to doc
444 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
445 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
446 		aStoreProperties_doc[0] = new PropertyValue();
447 		aStoreProperties_doc[1] = new PropertyValue();
448 		aStoreProperties_doc[0].Name = "Override";
449 		aStoreProperties_doc[0].Value = true;
450 		aStoreProperties_doc[1].Name = "FilterName";
451 		aStoreProperties_doc[1].Value = "MS Word 97";
452 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
453 		app.closeDocument(xTextDocument);
454 
455 		//reopen the document
456 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
457 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
458 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
459 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
460 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
461 		//verify paragraph numbering and bullet alignment
462 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
463 		assertEquals("assert numbering and bullet","Drop Caps",propsRule_assert_odt[4].Value);
464 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
465 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
466 
467 		//reopen the document
468 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
469 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
470 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
471 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
472 		//verify paragraph numbering and bullet alignment
473 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
474 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
475 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
476 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
477 	}
478 	@Test
testNumberingBulletCharacterStyle_NumberingSymbols()479 	public void testNumberingBulletCharacterStyle_NumberingSymbols() throws Exception {
480 
481 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
482 		xText = xTextDocument.getText();
483 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
484 				"Hello,world!Hello,world!");
485 		//create cursor to select paragraph and formatting paragraph
486 		XTextCursor xTextCursor = xText.createTextCursor();
487 		//create paragraph property set
488 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
489 		//create document service factory
490 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
491 		//set numbering character
492 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
493 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
494 		propsRule[0].Name = "NumberingType";
495 		propsRule[0].Value = NumberingType.ARABIC;
496 		propsRule[1].Name = "CharStyleName";
497 		propsRule[1].Value = "Numbering Symbols";
498 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
499 		xReplaceRule.replaceByIndex(0, propsRule);
500 		//set paragraph numbering and bullet character
501 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
502 		//save to odt
503 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
504 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
505 		aStoreProperties_odt[0] = new PropertyValue();
506 		aStoreProperties_odt[1] = new PropertyValue();
507 		aStoreProperties_odt[0].Name = "Override";
508 		aStoreProperties_odt[0].Value = true;
509 		aStoreProperties_odt[1].Name = "FilterName";
510 		aStoreProperties_odt[1].Value = "writer8";
511 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
512 		//save to doc
513 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
514 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
515 		aStoreProperties_doc[0] = new PropertyValue();
516 		aStoreProperties_doc[1] = new PropertyValue();
517 		aStoreProperties_doc[0].Name = "Override";
518 		aStoreProperties_doc[0].Value = true;
519 		aStoreProperties_doc[1].Name = "FilterName";
520 		aStoreProperties_doc[1].Value = "MS Word 97";
521 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
522 		app.closeDocument(xTextDocument);
523 
524 		//reopen the document
525 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
526 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
527 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
528 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
529 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
530 		//verify paragraph numbering and bullet alignment
531 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
532 		assertEquals("assert numbering and bullet","Numbering Symbols",propsRule_assert_odt[4].Value);
533 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
534 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
535 
536 		//reopen the document
537 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
538 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
539 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
540 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
541 		//verify paragraph numbering and bullet alignment
542 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
543 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
544 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
545 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
546 	}
547 	@Test
testNumberingBulletCharacterStyle_Bullets()548 	public void testNumberingBulletCharacterStyle_Bullets() throws Exception {
549 
550 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
551 		xText = xTextDocument.getText();
552 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
553 				"Hello,world!Hello,world!");
554 		//create cursor to select paragraph and formatting paragraph
555 		XTextCursor xTextCursor = xText.createTextCursor();
556 		//create paragraph property set
557 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
558 		//create document service factory
559 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
560 		//set numbering character
561 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
562 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
563 		propsRule[0].Name = "NumberingType";
564 		propsRule[0].Value = NumberingType.ARABIC;
565 		propsRule[1].Name = "CharStyleName";
566 		propsRule[1].Value = "Bullets";
567 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
568 		xReplaceRule.replaceByIndex(0, propsRule);
569 		//set paragraph numbering and bullet character
570 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
571 		//save to odt
572 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
573 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
574 		aStoreProperties_odt[0] = new PropertyValue();
575 		aStoreProperties_odt[1] = new PropertyValue();
576 		aStoreProperties_odt[0].Name = "Override";
577 		aStoreProperties_odt[0].Value = true;
578 		aStoreProperties_odt[1].Name = "FilterName";
579 		aStoreProperties_odt[1].Value = "writer8";
580 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
581 		//save to doc
582 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
583 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
584 		aStoreProperties_doc[0] = new PropertyValue();
585 		aStoreProperties_doc[1] = new PropertyValue();
586 		aStoreProperties_doc[0].Name = "Override";
587 		aStoreProperties_doc[0].Value = true;
588 		aStoreProperties_doc[1].Name = "FilterName";
589 		aStoreProperties_doc[1].Value = "MS Word 97";
590 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
591 		app.closeDocument(xTextDocument);
592 
593 		//reopen the document
594 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
595 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
596 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
597 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
598 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
599 		//verify paragraph numbering and bullet alignment
600 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
601 		assertEquals("assert numbering and bullet","Bullet Symbols",propsRule_assert_odt[4].Value);
602 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
603 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
604 
605 		//reopen the document
606 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
607 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
608 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
609 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
610 		//verify paragraph numbering and bullet alignment
611 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
612 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
613 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
614 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
615 	}
616 	@Test
testNumberingBulletCharacterStyle_InternetLink()617 	public void testNumberingBulletCharacterStyle_InternetLink() throws Exception {
618 
619 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
620 		xText = xTextDocument.getText();
621 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
622 				"Hello,world!Hello,world!");
623 		//create cursor to select paragraph and formatting paragraph
624 		XTextCursor xTextCursor = xText.createTextCursor();
625 		//create paragraph property set
626 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
627 		//create document service factory
628 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
629 		//set numbering character
630 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
631 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
632 		propsRule[0].Name = "NumberingType";
633 		propsRule[0].Value = NumberingType.ARABIC;
634 		propsRule[1].Name = "CharStyleName";
635 		propsRule[1].Value = "Internet Link";
636 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
637 		xReplaceRule.replaceByIndex(0, propsRule);
638 		//set paragraph numbering and bullet character
639 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
640 		//save to odt
641 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
642 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
643 		aStoreProperties_odt[0] = new PropertyValue();
644 		aStoreProperties_odt[1] = new PropertyValue();
645 		aStoreProperties_odt[0].Name = "Override";
646 		aStoreProperties_odt[0].Value = true;
647 		aStoreProperties_odt[1].Name = "FilterName";
648 		aStoreProperties_odt[1].Value = "writer8";
649 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
650 		//save to doc
651 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
652 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
653 		aStoreProperties_doc[0] = new PropertyValue();
654 		aStoreProperties_doc[1] = new PropertyValue();
655 		aStoreProperties_doc[0].Name = "Override";
656 		aStoreProperties_doc[0].Value = true;
657 		aStoreProperties_doc[1].Name = "FilterName";
658 		aStoreProperties_doc[1].Value = "MS Word 97";
659 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
660 		app.closeDocument(xTextDocument);
661 
662 		//reopen the document
663 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
664 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
665 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
666 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
667 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
668 		//verify paragraph numbering and bullet alignment
669 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
670 		assertEquals("assert numbering and bullet","Internet link",propsRule_assert_odt[4].Value);
671 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
672 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
673 
674 		//reopen the document
675 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
676 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
677 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
678 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
679 		//verify paragraph numbering and bullet alignment
680 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
681 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
682 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
683 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
684 	}
685 	@Test
testNumberingBulletCharacterStyle_VisitedInternetLink()686 	public void testNumberingBulletCharacterStyle_VisitedInternetLink() throws Exception {
687 
688 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
689 		xText = xTextDocument.getText();
690 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
691 				"Hello,world!Hello,world!");
692 		//create cursor to select paragraph and formatting paragraph
693 		XTextCursor xTextCursor = xText.createTextCursor();
694 		//create paragraph property set
695 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
696 		//create document service factory
697 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
698 		//set numbering character
699 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
700 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
701 		propsRule[0].Name = "NumberingType";
702 		propsRule[0].Value = NumberingType.ARABIC;
703 		propsRule[1].Name = "CharStyleName";
704 		propsRule[1].Value = "Visited Internet Link";
705 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
706 		xReplaceRule.replaceByIndex(0, propsRule);
707 		//set paragraph numbering and bullet character
708 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
709 		//save to odt
710 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
711 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
712 		aStoreProperties_odt[0] = new PropertyValue();
713 		aStoreProperties_odt[1] = new PropertyValue();
714 		aStoreProperties_odt[0].Name = "Override";
715 		aStoreProperties_odt[0].Value = true;
716 		aStoreProperties_odt[1].Name = "FilterName";
717 		aStoreProperties_odt[1].Value = "writer8";
718 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
719 		//save to doc
720 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
721 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
722 		aStoreProperties_doc[0] = new PropertyValue();
723 		aStoreProperties_doc[1] = new PropertyValue();
724 		aStoreProperties_doc[0].Name = "Override";
725 		aStoreProperties_doc[0].Value = true;
726 		aStoreProperties_doc[1].Name = "FilterName";
727 		aStoreProperties_doc[1].Value = "MS Word 97";
728 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
729 		app.closeDocument(xTextDocument);
730 
731 		//reopen the document
732 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
733 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
734 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
735 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
736 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
737 		//verify paragraph numbering and bullet alignment
738 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
739 		assertEquals("assert numbering and bullet","Visited Internet Link",propsRule_assert_odt[4].Value);
740 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
741 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
742 
743 		//reopen the document
744 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
745 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
746 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
747 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
748 		//verify paragraph numbering and bullet alignment
749 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
750 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
751 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
752 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
753 	}
754 	@Test
testNumberingBulletCharacterStyle_Placeholder()755 	public void testNumberingBulletCharacterStyle_Placeholder() throws Exception {
756 
757 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
758 		xText = xTextDocument.getText();
759 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
760 				"Hello,world!Hello,world!");
761 		//create cursor to select paragraph and formatting paragraph
762 		XTextCursor xTextCursor = xText.createTextCursor();
763 		//create paragraph property set
764 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
765 		//create document service factory
766 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
767 		//set numbering character
768 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
769 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
770 		propsRule[0].Name = "NumberingType";
771 		propsRule[0].Value = NumberingType.ARABIC;
772 		propsRule[1].Name = "CharStyleName";
773 		propsRule[1].Value = "Placeholder";
774 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
775 		xReplaceRule.replaceByIndex(0, propsRule);
776 		//set paragraph numbering and bullet character
777 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
778 		//save to odt
779 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
780 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
781 		aStoreProperties_odt[0] = new PropertyValue();
782 		aStoreProperties_odt[1] = new PropertyValue();
783 		aStoreProperties_odt[0].Name = "Override";
784 		aStoreProperties_odt[0].Value = true;
785 		aStoreProperties_odt[1].Name = "FilterName";
786 		aStoreProperties_odt[1].Value = "writer8";
787 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
788 		//save to doc
789 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
790 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
791 		aStoreProperties_doc[0] = new PropertyValue();
792 		aStoreProperties_doc[1] = new PropertyValue();
793 		aStoreProperties_doc[0].Name = "Override";
794 		aStoreProperties_doc[0].Value = true;
795 		aStoreProperties_doc[1].Name = "FilterName";
796 		aStoreProperties_doc[1].Value = "MS Word 97";
797 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
798 		app.closeDocument(xTextDocument);
799 
800 		//reopen the document
801 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
802 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
803 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
804 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
805 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
806 		//verify paragraph numbering and bullet alignment
807 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
808 		assertEquals("assert numbering and bullet","Placeholder",propsRule_assert_odt[4].Value);
809 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
810 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
811 
812 		//reopen the document
813 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
814 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
815 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
816 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
817 		//verify paragraph numbering and bullet alignment
818 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
819 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
820 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
821 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
822 	}
823 	@Test
testNumberingBulletCharacterStyle_Indexlink()824 	public void testNumberingBulletCharacterStyle_Indexlink() throws Exception {
825 
826 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
827 		xText = xTextDocument.getText();
828 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
829 				"Hello,world!Hello,world!");
830 		//create cursor to select paragraph and formatting paragraph
831 		XTextCursor xTextCursor = xText.createTextCursor();
832 		//create paragraph property set
833 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
834 		//create document service factory
835 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
836 		//set numbering character
837 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
838 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
839 		propsRule[0].Name = "NumberingType";
840 		propsRule[0].Value = NumberingType.ARABIC;
841 		propsRule[1].Name = "CharStyleName";
842 		propsRule[1].Value = "Index Link";
843 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
844 		xReplaceRule.replaceByIndex(0, propsRule);
845 		//set paragraph numbering and bullet character
846 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
847 		//save to odt
848 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
849 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
850 		aStoreProperties_odt[0] = new PropertyValue();
851 		aStoreProperties_odt[1] = new PropertyValue();
852 		aStoreProperties_odt[0].Name = "Override";
853 		aStoreProperties_odt[0].Value = true;
854 		aStoreProperties_odt[1].Name = "FilterName";
855 		aStoreProperties_odt[1].Value = "writer8";
856 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
857 		//save to doc
858 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
859 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
860 		aStoreProperties_doc[0] = new PropertyValue();
861 		aStoreProperties_doc[1] = new PropertyValue();
862 		aStoreProperties_doc[0].Name = "Override";
863 		aStoreProperties_doc[0].Value = true;
864 		aStoreProperties_doc[1].Name = "FilterName";
865 		aStoreProperties_doc[1].Value = "MS Word 97";
866 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
867 		app.closeDocument(xTextDocument);
868 
869 		//reopen the document
870 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
871 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
872 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
873 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
874 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
875 		//verify paragraph numbering and bullet alignment
876 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
877 		assertEquals("assert numbering and bullet","Index Link",propsRule_assert_odt[4].Value);
878 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
879 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
880 
881 		//reopen the document
882 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
883 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
884 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
885 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
886 		//verify paragraph numbering and bullet alignment
887 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
888 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
889 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
890 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
891 	}
892 	@Test
testNumberingBulletCharacterStyle_EndnoteCharacters()893 	public void testNumberingBulletCharacterStyle_EndnoteCharacters() throws Exception {
894 
895 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
896 		xText = xTextDocument.getText();
897 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
898 				"Hello,world!Hello,world!");
899 		//create cursor to select paragraph and formatting paragraph
900 		XTextCursor xTextCursor = xText.createTextCursor();
901 		//create paragraph property set
902 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
903 		//create document service factory
904 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
905 		//set numbering character
906 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
907 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
908 		propsRule[0].Name = "NumberingType";
909 		propsRule[0].Value = NumberingType.ARABIC;
910 		propsRule[1].Name = "CharStyleName";
911 		propsRule[1].Value = "Endnote Characters";
912 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
913 		xReplaceRule.replaceByIndex(0, propsRule);
914 		//set paragraph numbering and bullet character
915 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
916 		//save to odt
917 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
918 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
919 		aStoreProperties_odt[0] = new PropertyValue();
920 		aStoreProperties_odt[1] = new PropertyValue();
921 		aStoreProperties_odt[0].Name = "Override";
922 		aStoreProperties_odt[0].Value = true;
923 		aStoreProperties_odt[1].Name = "FilterName";
924 		aStoreProperties_odt[1].Value = "writer8";
925 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
926 		//save to doc
927 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
928 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
929 		aStoreProperties_doc[0] = new PropertyValue();
930 		aStoreProperties_doc[1] = new PropertyValue();
931 		aStoreProperties_doc[0].Name = "Override";
932 		aStoreProperties_doc[0].Value = true;
933 		aStoreProperties_doc[1].Name = "FilterName";
934 		aStoreProperties_doc[1].Value = "MS Word 97";
935 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
936 		app.closeDocument(xTextDocument);
937 
938 		//reopen the document
939 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
940 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
941 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
942 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
943 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
944 		//verify paragraph numbering and bullet alignment
945 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
946 		assertEquals("assert numbering and bullet","Endnote Symbol",propsRule_assert_odt[4].Value);
947 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
948 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
949 
950 		//reopen the document
951 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
952 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
953 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
954 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
955 		//verify paragraph numbering and bullet alignment
956 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
957 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
958 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
959 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
960 	}
961 	@Test
testNumberingBulletCharacterStyle_LineNumbering()962 	public void testNumberingBulletCharacterStyle_LineNumbering() throws Exception {
963 
964 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
965 		xText = xTextDocument.getText();
966 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
967 				"Hello,world!Hello,world!");
968 		//create cursor to select paragraph and formatting paragraph
969 		XTextCursor xTextCursor = xText.createTextCursor();
970 		//create paragraph property set
971 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
972 		//create document service factory
973 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
974 		//set numbering character
975 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
976 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
977 		propsRule[0].Name = "NumberingType";
978 		propsRule[0].Value = NumberingType.ARABIC;
979 		propsRule[1].Name = "CharStyleName";
980 		propsRule[1].Value = "Line numbering";
981 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
982 		xReplaceRule.replaceByIndex(0, propsRule);
983 		//set paragraph numbering and bullet character
984 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
985 		//save to odt
986 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
987 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
988 		aStoreProperties_odt[0] = new PropertyValue();
989 		aStoreProperties_odt[1] = new PropertyValue();
990 		aStoreProperties_odt[0].Name = "Override";
991 		aStoreProperties_odt[0].Value = true;
992 		aStoreProperties_odt[1].Name = "FilterName";
993 		aStoreProperties_odt[1].Value = "writer8";
994 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
995 		//save to doc
996 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
997 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
998 		aStoreProperties_doc[0] = new PropertyValue();
999 		aStoreProperties_doc[1] = new PropertyValue();
1000 		aStoreProperties_doc[0].Name = "Override";
1001 		aStoreProperties_doc[0].Value = true;
1002 		aStoreProperties_doc[1].Name = "FilterName";
1003 		aStoreProperties_doc[1].Value = "MS Word 97";
1004 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
1005 		app.closeDocument(xTextDocument);
1006 
1007 		//reopen the document
1008 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
1009 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
1010 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
1011 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
1012 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
1013 		//verify paragraph numbering and bullet alignment
1014 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
1015 		assertEquals("assert numbering and bullet","Line numbering",propsRule_assert_odt[4].Value);
1016 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
1017 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
1018 
1019 		//reopen the document
1020 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
1021 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
1022 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
1023 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
1024 		//verify paragraph numbering and bullet alignment
1025 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
1026 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
1027 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
1028 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
1029 	}
1030 	@Test
testNumberingBulletCharacterStyle_MainIndexEntery()1031 	public void testNumberingBulletCharacterStyle_MainIndexEntery() throws Exception {
1032 
1033 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
1034 		xText = xTextDocument.getText();
1035 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
1036 				"Hello,world!Hello,world!");
1037 		//create cursor to select paragraph and formatting paragraph
1038 		XTextCursor xTextCursor = xText.createTextCursor();
1039 		//create paragraph property set
1040 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
1041 		//create document service factory
1042 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
1043 		//set numbering character
1044 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
1045 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
1046 		propsRule[0].Name = "NumberingType";
1047 		propsRule[0].Value = NumberingType.ARABIC;
1048 		propsRule[1].Name = "CharStyleName";
1049 		propsRule[1].Value = "Main index entry";
1050 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
1051 		xReplaceRule.replaceByIndex(0, propsRule);
1052 		//set paragraph numbering and bullet character
1053 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
1054 		//save to odt
1055 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1056 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
1057 		aStoreProperties_odt[0] = new PropertyValue();
1058 		aStoreProperties_odt[1] = new PropertyValue();
1059 		aStoreProperties_odt[0].Name = "Override";
1060 		aStoreProperties_odt[0].Value = true;
1061 		aStoreProperties_odt[1].Name = "FilterName";
1062 		aStoreProperties_odt[1].Value = "writer8";
1063 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
1064 		//save to doc
1065 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1066 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
1067 		aStoreProperties_doc[0] = new PropertyValue();
1068 		aStoreProperties_doc[1] = new PropertyValue();
1069 		aStoreProperties_doc[0].Name = "Override";
1070 		aStoreProperties_doc[0].Value = true;
1071 		aStoreProperties_doc[1].Name = "FilterName";
1072 		aStoreProperties_doc[1].Value = "MS Word 97";
1073 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
1074 		app.closeDocument(xTextDocument);
1075 
1076 		//reopen the document
1077 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
1078 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
1079 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
1080 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
1081 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
1082 		//verify paragraph numbering and bullet alignment
1083 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
1084 		assertEquals("assert numbering and bullet","Main index entry",propsRule_assert_odt[4].Value);
1085 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
1086 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
1087 
1088 		//reopen the document
1089 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
1090 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
1091 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
1092 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
1093 		//verify paragraph numbering and bullet alignment
1094 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
1095 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
1096 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
1097 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
1098 	}
1099 	@Test
testNumberingBulletCharacterStyle_FootnoteAnchor()1100 	public void testNumberingBulletCharacterStyle_FootnoteAnchor() throws Exception {
1101 
1102 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
1103 		xText = xTextDocument.getText();
1104 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
1105 				"Hello,world!Hello,world!");
1106 		//create cursor to select paragraph and formatting paragraph
1107 		XTextCursor xTextCursor = xText.createTextCursor();
1108 		//create paragraph property set
1109 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
1110 		//create document service factory
1111 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
1112 		//set numbering character
1113 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
1114 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
1115 		propsRule[0].Name = "NumberingType";
1116 		propsRule[0].Value = NumberingType.ARABIC;
1117 		propsRule[1].Name = "CharStyleName";
1118 		propsRule[1].Value = "Footnote anchor";
1119 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
1120 		xReplaceRule.replaceByIndex(0, propsRule);
1121 		//set paragraph numbering and bullet character
1122 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
1123 		//save to odt
1124 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1125 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
1126 		aStoreProperties_odt[0] = new PropertyValue();
1127 		aStoreProperties_odt[1] = new PropertyValue();
1128 		aStoreProperties_odt[0].Name = "Override";
1129 		aStoreProperties_odt[0].Value = true;
1130 		aStoreProperties_odt[1].Name = "FilterName";
1131 		aStoreProperties_odt[1].Value = "writer8";
1132 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
1133 		//save to doc
1134 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1135 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
1136 		aStoreProperties_doc[0] = new PropertyValue();
1137 		aStoreProperties_doc[1] = new PropertyValue();
1138 		aStoreProperties_doc[0].Name = "Override";
1139 		aStoreProperties_doc[0].Value = true;
1140 		aStoreProperties_doc[1].Name = "FilterName";
1141 		aStoreProperties_doc[1].Value = "MS Word 97";
1142 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
1143 		app.closeDocument(xTextDocument);
1144 
1145 		//reopen the document
1146 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
1147 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
1148 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
1149 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
1150 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
1151 		//verify paragraph numbering and bullet alignment
1152 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
1153 		assertEquals("assert numbering and bullet","Footnote anchor",propsRule_assert_odt[4].Value);
1154 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
1155 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
1156 
1157 		//reopen the document
1158 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
1159 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
1160 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
1161 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
1162 		//verify paragraph numbering and bullet alignment
1163 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
1164 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
1165 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
1166 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
1167 	}
1168 	@Test
testNumberingBulletCharacterStyle_EndnoteAnchor()1169 	public void testNumberingBulletCharacterStyle_EndnoteAnchor() throws Exception {
1170 
1171 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
1172 		xText = xTextDocument.getText();
1173 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
1174 				"Hello,world!Hello,world!");
1175 		//create cursor to select paragraph and formatting paragraph
1176 		XTextCursor xTextCursor = xText.createTextCursor();
1177 		//create paragraph property set
1178 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
1179 		//create document service factory
1180 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
1181 		//set numbering character
1182 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
1183 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
1184 		propsRule[0].Name = "NumberingType";
1185 		propsRule[0].Value = NumberingType.ARABIC;
1186 		propsRule[1].Name = "CharStyleName";
1187 		propsRule[1].Value = "Endnote anchor";
1188 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
1189 		xReplaceRule.replaceByIndex(0, propsRule);
1190 		//set paragraph numbering and bullet character
1191 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
1192 		//save to odt
1193 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1194 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
1195 		aStoreProperties_odt[0] = new PropertyValue();
1196 		aStoreProperties_odt[1] = new PropertyValue();
1197 		aStoreProperties_odt[0].Name = "Override";
1198 		aStoreProperties_odt[0].Value = true;
1199 		aStoreProperties_odt[1].Name = "FilterName";
1200 		aStoreProperties_odt[1].Value = "writer8";
1201 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
1202 		//save to doc
1203 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1204 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
1205 		aStoreProperties_doc[0] = new PropertyValue();
1206 		aStoreProperties_doc[1] = new PropertyValue();
1207 		aStoreProperties_doc[0].Name = "Override";
1208 		aStoreProperties_doc[0].Value = true;
1209 		aStoreProperties_doc[1].Name = "FilterName";
1210 		aStoreProperties_doc[1].Value = "MS Word 97";
1211 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
1212 		app.closeDocument(xTextDocument);
1213 
1214 		//reopen the document
1215 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
1216 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
1217 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
1218 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
1219 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
1220 		//verify paragraph numbering and bullet alignment
1221 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
1222 		assertEquals("assert numbering and bullet","Endnote anchor",propsRule_assert_odt[4].Value);
1223 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
1224 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
1225 
1226 		//reopen the document
1227 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
1228 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
1229 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
1230 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
1231 		//verify paragraph numbering and bullet alignment
1232 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
1233 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
1234 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
1235 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
1236 	}
1237 	@Test
testNumberingBulletCharacterStyle_VerticalNumberingSymbols()1238 	public void testNumberingBulletCharacterStyle_VerticalNumberingSymbols() throws Exception {
1239 
1240 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
1241 		xText = xTextDocument.getText();
1242 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
1243 				"Hello,world!Hello,world!");
1244 		//create cursor to select paragraph and formatting paragraph
1245 		XTextCursor xTextCursor = xText.createTextCursor();
1246 		//create paragraph property set
1247 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
1248 		//create document service factory
1249 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
1250 		//set numbering character
1251 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
1252 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
1253 		propsRule[0].Name = "NumberingType";
1254 		propsRule[0].Value = NumberingType.ARABIC;
1255 		propsRule[1].Name = "CharStyleName";
1256 		propsRule[1].Value = "Vertical Numbering Symbols";
1257 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
1258 		xReplaceRule.replaceByIndex(0, propsRule);
1259 		//set paragraph numbering and bullet character
1260 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
1261 		//save to odt
1262 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1263 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
1264 		aStoreProperties_odt[0] = new PropertyValue();
1265 		aStoreProperties_odt[1] = new PropertyValue();
1266 		aStoreProperties_odt[0].Name = "Override";
1267 		aStoreProperties_odt[0].Value = true;
1268 		aStoreProperties_odt[1].Name = "FilterName";
1269 		aStoreProperties_odt[1].Value = "writer8";
1270 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
1271 		//save to doc
1272 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1273 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
1274 		aStoreProperties_doc[0] = new PropertyValue();
1275 		aStoreProperties_doc[1] = new PropertyValue();
1276 		aStoreProperties_doc[0].Name = "Override";
1277 		aStoreProperties_doc[0].Value = true;
1278 		aStoreProperties_doc[1].Name = "FilterName";
1279 		aStoreProperties_doc[1].Value = "MS Word 97";
1280 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
1281 		app.closeDocument(xTextDocument);
1282 
1283 		//reopen the document
1284 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
1285 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
1286 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
1287 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
1288 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
1289 		//verify paragraph numbering and bullet alignment
1290 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
1291 		assertEquals("assert numbering and bullet","Vertical Numbering Symbols",propsRule_assert_odt[4].Value);
1292 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
1293 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
1294 
1295 		//reopen the document
1296 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
1297 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
1298 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
1299 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
1300 		//verify paragraph numbering and bullet alignment
1301 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
1302 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
1303 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
1304 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
1305 	}
1306 	@Test
testNumberingBulletCharacterStyle_Quotation()1307 	public void testNumberingBulletCharacterStyle_Quotation() throws Exception {
1308 
1309 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
1310 		xText = xTextDocument.getText();
1311 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
1312 				"Hello,world!Hello,world!");
1313 		//create cursor to select paragraph and formatting paragraph
1314 		XTextCursor xTextCursor = xText.createTextCursor();
1315 		//create paragraph property set
1316 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
1317 		//create document service factory
1318 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
1319 		//set numbering character
1320 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
1321 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
1322 		propsRule[0].Name = "NumberingType";
1323 		propsRule[0].Value = NumberingType.ARABIC;
1324 		propsRule[1].Name = "CharStyleName";
1325 		propsRule[1].Value = "Quotation";
1326 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
1327 		xReplaceRule.replaceByIndex(0, propsRule);
1328 		//set paragraph numbering and bullet character
1329 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
1330 		//save to odt
1331 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1332 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
1333 		aStoreProperties_odt[0] = new PropertyValue();
1334 		aStoreProperties_odt[1] = new PropertyValue();
1335 		aStoreProperties_odt[0].Name = "Override";
1336 		aStoreProperties_odt[0].Value = true;
1337 		aStoreProperties_odt[1].Name = "FilterName";
1338 		aStoreProperties_odt[1].Value = "writer8";
1339 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
1340 		//save to doc
1341 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1342 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
1343 		aStoreProperties_doc[0] = new PropertyValue();
1344 		aStoreProperties_doc[1] = new PropertyValue();
1345 		aStoreProperties_doc[0].Name = "Override";
1346 		aStoreProperties_doc[0].Value = true;
1347 		aStoreProperties_doc[1].Name = "FilterName";
1348 		aStoreProperties_doc[1].Value = "MS Word 97";
1349 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
1350 		app.closeDocument(xTextDocument);
1351 
1352 		//reopen the document
1353 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
1354 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
1355 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
1356 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
1357 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
1358 		//verify paragraph numbering and bullet alignment
1359 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
1360 		assertEquals("assert numbering and bullet","Citation",propsRule_assert_odt[4].Value);
1361 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
1362 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
1363 
1364 		//reopen the document
1365 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
1366 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
1367 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
1368 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
1369 		//verify paragraph numbering and bullet alignment
1370 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
1371 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
1372 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
1373 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
1374 	}
1375 	@Test
testNumberingBulletCharacterStyle_StrongEmphasis()1376 	public void testNumberingBulletCharacterStyle_StrongEmphasis() throws Exception {
1377 
1378 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
1379 		xText = xTextDocument.getText();
1380 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
1381 				"Hello,world!Hello,world!");
1382 		//create cursor to select paragraph and formatting paragraph
1383 		XTextCursor xTextCursor = xText.createTextCursor();
1384 		//create paragraph property set
1385 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
1386 		//create document service factory
1387 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
1388 		//set numbering character
1389 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
1390 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
1391 		propsRule[0].Name = "NumberingType";
1392 		propsRule[0].Value = NumberingType.ARABIC;
1393 		propsRule[1].Name = "CharStyleName";
1394 		propsRule[1].Value = "Strong Emphasis";
1395 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
1396 		xReplaceRule.replaceByIndex(0, propsRule);
1397 		//set paragraph numbering and bullet character
1398 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
1399 		//save to odt
1400 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1401 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
1402 		aStoreProperties_odt[0] = new PropertyValue();
1403 		aStoreProperties_odt[1] = new PropertyValue();
1404 		aStoreProperties_odt[0].Name = "Override";
1405 		aStoreProperties_odt[0].Value = true;
1406 		aStoreProperties_odt[1].Name = "FilterName";
1407 		aStoreProperties_odt[1].Value = "writer8";
1408 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
1409 		//save to doc
1410 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1411 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
1412 		aStoreProperties_doc[0] = new PropertyValue();
1413 		aStoreProperties_doc[1] = new PropertyValue();
1414 		aStoreProperties_doc[0].Name = "Override";
1415 		aStoreProperties_doc[0].Value = true;
1416 		aStoreProperties_doc[1].Name = "FilterName";
1417 		aStoreProperties_doc[1].Value = "MS Word 97";
1418 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
1419 		app.closeDocument(xTextDocument);
1420 
1421 		//reopen the document
1422 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
1423 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
1424 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
1425 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
1426 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
1427 		//verify paragraph numbering and bullet alignment
1428 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
1429 		assertEquals("assert numbering and bullet","Strong Emphasis",propsRule_assert_odt[4].Value);
1430 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
1431 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
1432 
1433 		//reopen the document
1434 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
1435 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
1436 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
1437 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
1438 		//verify paragraph numbering and bullet alignment
1439 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
1440 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
1441 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
1442 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
1443 	}
1444 	@Test
testNumberingBulletCharacterStyle_Variable()1445 	public void testNumberingBulletCharacterStyle_Variable() throws Exception {
1446 
1447 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
1448 		xText = xTextDocument.getText();
1449 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
1450 				"Hello,world!Hello,world!");
1451 		//create cursor to select paragraph and formatting paragraph
1452 		XTextCursor xTextCursor = xText.createTextCursor();
1453 		//create paragraph property set
1454 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
1455 		//create document service factory
1456 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
1457 		//set numbering character
1458 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
1459 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
1460 		propsRule[0].Name = "NumberingType";
1461 		propsRule[0].Value = NumberingType.ARABIC;
1462 		propsRule[1].Name = "CharStyleName";
1463 		propsRule[1].Value = "Variable";
1464 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
1465 		xReplaceRule.replaceByIndex(0, propsRule);
1466 		//set paragraph numbering and bullet character
1467 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
1468 		//save to odt
1469 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1470 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
1471 		aStoreProperties_odt[0] = new PropertyValue();
1472 		aStoreProperties_odt[1] = new PropertyValue();
1473 		aStoreProperties_odt[0].Name = "Override";
1474 		aStoreProperties_odt[0].Value = true;
1475 		aStoreProperties_odt[1].Name = "FilterName";
1476 		aStoreProperties_odt[1].Value = "writer8";
1477 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
1478 		//save to doc
1479 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1480 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
1481 		aStoreProperties_doc[0] = new PropertyValue();
1482 		aStoreProperties_doc[1] = new PropertyValue();
1483 		aStoreProperties_doc[0].Name = "Override";
1484 		aStoreProperties_doc[0].Value = true;
1485 		aStoreProperties_doc[1].Name = "FilterName";
1486 		aStoreProperties_doc[1].Value = "MS Word 97";
1487 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
1488 		app.closeDocument(xTextDocument);
1489 
1490 		//reopen the document
1491 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
1492 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
1493 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
1494 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
1495 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
1496 		//verify paragraph numbering and bullet alignment
1497 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
1498 		assertEquals("assert numbering and bullet","Variable",propsRule_assert_odt[4].Value);
1499 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
1500 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
1501 
1502 		//reopen the document
1503 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
1504 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
1505 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
1506 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
1507 		//verify paragraph numbering and bullet alignment
1508 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
1509 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
1510 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
1511 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
1512 	}
1513 	@Test
testNumberingBulletCharacterStyle_Example()1514 	public void testNumberingBulletCharacterStyle_Example() throws Exception {
1515 
1516 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
1517 		xText = xTextDocument.getText();
1518 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
1519 				"Hello,world!Hello,world!");
1520 		//create cursor to select paragraph and formatting paragraph
1521 		XTextCursor xTextCursor = xText.createTextCursor();
1522 		//create paragraph property set
1523 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
1524 		//create document service factory
1525 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
1526 		//set numbering character
1527 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
1528 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
1529 		propsRule[0].Name = "NumberingType";
1530 		propsRule[0].Value = NumberingType.ARABIC;
1531 		propsRule[1].Name = "CharStyleName";
1532 		propsRule[1].Value = "Example";
1533 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
1534 		xReplaceRule.replaceByIndex(0, propsRule);
1535 		//set paragraph numbering and bullet character
1536 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
1537 		//save to odt
1538 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1539 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
1540 		aStoreProperties_odt[0] = new PropertyValue();
1541 		aStoreProperties_odt[1] = new PropertyValue();
1542 		aStoreProperties_odt[0].Name = "Override";
1543 		aStoreProperties_odt[0].Value = true;
1544 		aStoreProperties_odt[1].Name = "FilterName";
1545 		aStoreProperties_odt[1].Value = "writer8";
1546 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
1547 		//save to doc
1548 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1549 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
1550 		aStoreProperties_doc[0] = new PropertyValue();
1551 		aStoreProperties_doc[1] = new PropertyValue();
1552 		aStoreProperties_doc[0].Name = "Override";
1553 		aStoreProperties_doc[0].Value = true;
1554 		aStoreProperties_doc[1].Name = "FilterName";
1555 		aStoreProperties_doc[1].Value = "MS Word 97";
1556 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
1557 		app.closeDocument(xTextDocument);
1558 
1559 		//reopen the document
1560 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
1561 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
1562 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
1563 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
1564 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
1565 		//verify paragraph numbering and bullet alignment
1566 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
1567 		assertEquals("assert numbering and bullet","Example",propsRule_assert_odt[4].Value);
1568 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
1569 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
1570 
1571 		//reopen the document
1572 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
1573 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
1574 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
1575 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
1576 		//verify paragraph numbering and bullet alignment
1577 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
1578 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
1579 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
1580 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
1581 	}	@Test
testNumberingBulletCharacterStyle_UserEntery()1582 	public void testNumberingBulletCharacterStyle_UserEntery() throws Exception {
1583 
1584 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
1585 		xText = xTextDocument.getText();
1586 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
1587 				"Hello,world!Hello,world!");
1588 		//create cursor to select paragraph and formatting paragraph
1589 		XTextCursor xTextCursor = xText.createTextCursor();
1590 		//create paragraph property set
1591 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
1592 		//create document service factory
1593 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
1594 		//set numbering character
1595 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
1596 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
1597 		propsRule[0].Name = "NumberingType";
1598 		propsRule[0].Value = NumberingType.ARABIC;
1599 		propsRule[1].Name = "CharStyleName";
1600 		propsRule[1].Value = "User Entery";
1601 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
1602 		xReplaceRule.replaceByIndex(0, propsRule);
1603 		//set paragraph numbering and bullet character
1604 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
1605 		//save to odt
1606 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1607 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
1608 		aStoreProperties_odt[0] = new PropertyValue();
1609 		aStoreProperties_odt[1] = new PropertyValue();
1610 		aStoreProperties_odt[0].Name = "Override";
1611 		aStoreProperties_odt[0].Value = true;
1612 		aStoreProperties_odt[1].Name = "FilterName";
1613 		aStoreProperties_odt[1].Value = "writer8";
1614 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
1615 		//save to doc
1616 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1617 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
1618 		aStoreProperties_doc[0] = new PropertyValue();
1619 		aStoreProperties_doc[1] = new PropertyValue();
1620 		aStoreProperties_doc[0].Name = "Override";
1621 		aStoreProperties_doc[0].Value = true;
1622 		aStoreProperties_doc[1].Name = "FilterName";
1623 		aStoreProperties_doc[1].Value = "MS Word 97";
1624 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
1625 		app.closeDocument(xTextDocument);
1626 
1627 		//reopen the document
1628 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
1629 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
1630 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
1631 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
1632 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
1633 		//verify paragraph numbering and bullet alignment
1634 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
1635 		assertEquals("assert numbering and bullet","User Entery",propsRule_assert_odt[4].Value);
1636 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
1637 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
1638 
1639 		//reopen the document
1640 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
1641 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
1642 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
1643 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
1644 		//verify paragraph numbering and bullet alignment
1645 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
1646 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
1647 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
1648 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
1649 	}
1650 	@Test
testNumberingBulletCharacterStyle_Sourcetext()1651 	public void testNumberingBulletCharacterStyle_Sourcetext() throws Exception {
1652 
1653 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
1654 		xText = xTextDocument.getText();
1655 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
1656 				"Hello,world!Hello,world!");
1657 		//create cursor to select paragraph and formatting paragraph
1658 		XTextCursor xTextCursor = xText.createTextCursor();
1659 		//create paragraph property set
1660 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
1661 		//create document service factory
1662 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
1663 		//set numbering character
1664 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
1665 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
1666 		propsRule[0].Name = "NumberingType";
1667 		propsRule[0].Value = NumberingType.ARABIC;
1668 		propsRule[1].Name = "CharStyleName";
1669 		propsRule[1].Value = "Source Text";
1670 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
1671 		xReplaceRule.replaceByIndex(0, propsRule);
1672 		//set paragraph numbering and bullet character
1673 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
1674 		//save to odt
1675 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1676 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
1677 		aStoreProperties_odt[0] = new PropertyValue();
1678 		aStoreProperties_odt[1] = new PropertyValue();
1679 		aStoreProperties_odt[0].Name = "Override";
1680 		aStoreProperties_odt[0].Value = true;
1681 		aStoreProperties_odt[1].Name = "FilterName";
1682 		aStoreProperties_odt[1].Value = "writer8";
1683 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
1684 		//save to doc
1685 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1686 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
1687 		aStoreProperties_doc[0] = new PropertyValue();
1688 		aStoreProperties_doc[1] = new PropertyValue();
1689 		aStoreProperties_doc[0].Name = "Override";
1690 		aStoreProperties_doc[0].Value = true;
1691 		aStoreProperties_doc[1].Name = "FilterName";
1692 		aStoreProperties_doc[1].Value = "MS Word 97";
1693 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
1694 		app.closeDocument(xTextDocument);
1695 
1696 		//reopen the document
1697 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
1698 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
1699 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
1700 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
1701 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
1702 		//verify paragraph numbering and bullet alignment
1703 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
1704 		assertEquals("assert numbering and bullet","Source Text",propsRule_assert_odt[4].Value);
1705 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
1706 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
1707 
1708 		//reopen the document
1709 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
1710 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
1711 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
1712 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
1713 		//verify paragraph numbering and bullet alignment
1714 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
1715 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
1716 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
1717 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
1718 	}
1719 	@Test
testNumberingBulletCharacterStyle_Definition()1720 	public void testNumberingBulletCharacterStyle_Definition() throws Exception {
1721 
1722 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
1723 		xText = xTextDocument.getText();
1724 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
1725 				"Hello,world!Hello,world!");
1726 		//create cursor to select paragraph and formatting paragraph
1727 		XTextCursor xTextCursor = xText.createTextCursor();
1728 		//create paragraph property set
1729 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
1730 		//create document service factory
1731 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
1732 		//set numbering character
1733 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
1734 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
1735 		propsRule[0].Name = "NumberingType";
1736 		propsRule[0].Value = NumberingType.ARABIC;
1737 		propsRule[1].Name = "CharStyleName";
1738 		propsRule[1].Value = "Definition";
1739 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
1740 		xReplaceRule.replaceByIndex(0, propsRule);
1741 		//set paragraph numbering and bullet character
1742 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
1743 		//save to odt
1744 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1745 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
1746 		aStoreProperties_odt[0] = new PropertyValue();
1747 		aStoreProperties_odt[1] = new PropertyValue();
1748 		aStoreProperties_odt[0].Name = "Override";
1749 		aStoreProperties_odt[0].Value = true;
1750 		aStoreProperties_odt[1].Name = "FilterName";
1751 		aStoreProperties_odt[1].Value = "writer8";
1752 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
1753 		//save to doc
1754 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1755 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
1756 		aStoreProperties_doc[0] = new PropertyValue();
1757 		aStoreProperties_doc[1] = new PropertyValue();
1758 		aStoreProperties_doc[0].Name = "Override";
1759 		aStoreProperties_doc[0].Value = true;
1760 		aStoreProperties_doc[1].Name = "FilterName";
1761 		aStoreProperties_doc[1].Value = "MS Word 97";
1762 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
1763 		app.closeDocument(xTextDocument);
1764 
1765 		//reopen the document
1766 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
1767 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
1768 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
1769 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
1770 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
1771 		//verify paragraph numbering and bullet alignment
1772 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
1773 		assertEquals("assert numbering and bullet","Definition",propsRule_assert_odt[4].Value);
1774 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
1775 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
1776 
1777 		//reopen the document
1778 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
1779 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
1780 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
1781 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
1782 		//verify paragraph numbering and bullet alignment
1783 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
1784 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
1785 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
1786 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
1787 	}
1788 	@Test
testNumberingBulletCharacterStyle_Teletype()1789 	public void testNumberingBulletCharacterStyle_Teletype() throws Exception {
1790 
1791 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
1792 		xText = xTextDocument.getText();
1793 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
1794 				"Hello,world!Hello,world!");
1795 		//create cursor to select paragraph and formatting paragraph
1796 		XTextCursor xTextCursor = xText.createTextCursor();
1797 		//create paragraph property set
1798 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
1799 		//create document service factory
1800 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
1801 		//set numbering character
1802 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
1803 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
1804 		propsRule[0].Name = "NumberingType";
1805 		propsRule[0].Value = NumberingType.ARABIC;
1806 		propsRule[1].Name = "CharStyleName";
1807 		propsRule[1].Value = "Teletype";
1808 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
1809 		xReplaceRule.replaceByIndex(0, propsRule);
1810 		//set paragraph numbering and bullet character
1811 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
1812 		//save to odt
1813 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1814 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
1815 		aStoreProperties_odt[0] = new PropertyValue();
1816 		aStoreProperties_odt[1] = new PropertyValue();
1817 		aStoreProperties_odt[0].Name = "Override";
1818 		aStoreProperties_odt[0].Value = true;
1819 		aStoreProperties_odt[1].Name = "FilterName";
1820 		aStoreProperties_odt[1].Value = "writer8";
1821 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
1822 		//save to doc
1823 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1824 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
1825 		aStoreProperties_doc[0] = new PropertyValue();
1826 		aStoreProperties_doc[1] = new PropertyValue();
1827 		aStoreProperties_doc[0].Name = "Override";
1828 		aStoreProperties_doc[0].Value = true;
1829 		aStoreProperties_doc[1].Name = "FilterName";
1830 		aStoreProperties_doc[1].Value = "MS Word 97";
1831 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
1832 		app.closeDocument(xTextDocument);
1833 
1834 		//reopen the document
1835 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
1836 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
1837 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
1838 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
1839 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
1840 		//verify paragraph numbering and bullet alignment
1841 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_odt[4].Name);
1842 		assertEquals("assert numbering and bullet","Teletype",propsRule_assert_odt[4].Value);
1843 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
1844 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
1845 
1846 		//reopen the document
1847 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
1848 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
1849 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
1850 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
1851 		//verify paragraph numbering and bullet alignment
1852 		assertEquals("assert numbering and bullet","CharStyleName",propsRule_assert_doc[4].Name);
1853 		assertEquals("assert numbering and bullet","WW8Num1z0",propsRule_assert_doc[4].Value);
1854 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
1855 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
1856 	}
1857 }
1858