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