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