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