xref: /AOO41X/test/testuno/source/fvt/uno/sw/paragraph/ParagraphNumberingAndBullet_Graphic_Alignment.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.Ignore;
29eba4d44aSLiu Zhe import org.junit.Test;
30eba4d44aSLiu Zhe import org.openoffice.test.common.FileUtil;
31eba4d44aSLiu Zhe import org.openoffice.test.common.Testspace;
32eba4d44aSLiu Zhe import org.openoffice.test.uno.UnoApp;
33eba4d44aSLiu Zhe 
34eba4d44aSLiu Zhe import com.sun.star.style.NumberingType;
35eba4d44aSLiu Zhe import com.sun.star.text.*;
36eba4d44aSLiu Zhe import com.sun.star.beans.*;
37eba4d44aSLiu Zhe import com.sun.star.container.XIndexAccess;
38eba4d44aSLiu Zhe import com.sun.star.container.XIndexReplace;
39eba4d44aSLiu Zhe import com.sun.star.frame.XStorable;
40eba4d44aSLiu Zhe import com.sun.star.lang.XMultiServiceFactory;
41eba4d44aSLiu Zhe import com.sun.star.uno.UnoRuntime;
42eba4d44aSLiu Zhe 
43eba4d44aSLiu Zhe public class ParagraphNumberingAndBullet_Graphic_Alignment {
44eba4d44aSLiu Zhe 	private static final UnoApp app = new UnoApp();
45eba4d44aSLiu Zhe 	XText xText = null;
46eba4d44aSLiu Zhe 
47eba4d44aSLiu Zhe 	@Before
setUp()48eba4d44aSLiu Zhe 	public void setUp() throws Exception {
49eba4d44aSLiu Zhe 		app.start();
50eba4d44aSLiu Zhe 
51eba4d44aSLiu Zhe 	}
52eba4d44aSLiu Zhe 
53eba4d44aSLiu Zhe 	@After
tearDown()54eba4d44aSLiu Zhe 	public void tearDown() throws Exception {
55eba4d44aSLiu Zhe 		app.close();
56eba4d44aSLiu Zhe 	}
57eba4d44aSLiu Zhe 	/*
58eba4d44aSLiu Zhe 	 * test paragraph background color
59eba4d44aSLiu Zhe 	 * 1.new a text document
60eba4d44aSLiu Zhe 	 * 2.insert some text
61eba4d44aSLiu Zhe 	 * 3.set paragraph graphic bullet align
62eba4d44aSLiu Zhe 	 * 4.save and close the document
63eba4d44aSLiu Zhe 	 * 5.reload the saved document and check the paragraph graphic bullet align
64eba4d44aSLiu Zhe 	 */
65eba4d44aSLiu Zhe 	@Test@Ignore("Bug #120833 - [testUNO patch]graphic bullet will change to character bullet when save to doc.")
testNumberingBullet_Graphic_Align_BottomofBaseline()66eba4d44aSLiu Zhe 	public void testNumberingBullet_Graphic_Align_BottomofBaseline() throws Exception {
67eba4d44aSLiu Zhe 
68eba4d44aSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
69eba4d44aSLiu Zhe 		xText = xTextDocument.getText();
70eba4d44aSLiu 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!" +
71eba4d44aSLiu Zhe 				"Hello,world!Hello,world!");
72eba4d44aSLiu Zhe 		//create cursor to select paragraph and formating paragraph
73eba4d44aSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
74eba4d44aSLiu Zhe 		//create paragraph property set
75eba4d44aSLiu Zhe 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
76eba4d44aSLiu Zhe 		//create document service factory
77eba4d44aSLiu Zhe 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
78eba4d44aSLiu Zhe 		//set numbering character
79eba4d44aSLiu Zhe 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
80eba4d44aSLiu Zhe 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue(),new PropertyValue()};
81eba4d44aSLiu Zhe 		propsRule[0].Name = "NumberingType";
82eba4d44aSLiu Zhe 		propsRule[0].Value = NumberingType.BITMAP;
83eba4d44aSLiu Zhe 		propsRule[1].Name = "GraphicURL";
84eba4d44aSLiu Zhe 		propsRule[1].Value = FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif"));
85eba4d44aSLiu Zhe 		propsRule[2].Name = "VertOrient";
86eba4d44aSLiu Zhe 		propsRule[2].Value = VertOrientation.BOTTOM;
87eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
88eba4d44aSLiu Zhe 		xReplaceRule.replaceByIndex(0, propsRule);
89eba4d44aSLiu Zhe 		//set paragraph numbering and bullet character
90eba4d44aSLiu Zhe 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
91eba4d44aSLiu Zhe 
92eba4d44aSLiu Zhe 		//save to odt
93eba4d44aSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
94eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
95eba4d44aSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
96eba4d44aSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
97eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
98eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Value = true;
99eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
100eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Value = "writer8";
101eba4d44aSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
102eba4d44aSLiu Zhe 		//save to doc
103eba4d44aSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
104eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
105eba4d44aSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
106eba4d44aSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
107eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
108eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Value = true;
109eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
110eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
111eba4d44aSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
112eba4d44aSLiu Zhe 		app.closeDocument(xTextDocument);
113eba4d44aSLiu Zhe 
114eba4d44aSLiu Zhe 		//reopen the document
115eba4d44aSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
116eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
117eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
118eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
119eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
120eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
121eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
122eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.BITMAP,propsRule_assert_odt[11].Value);
123eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","GraphicURL",propsRule_assert_odt[12].Name);
124eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif")),propsRule_assert_odt[12].Value);
125eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","VertOrient",propsRule_assert_odt[15].Name);
126eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",VertOrientation.BOTTOM,propsRule_assert_odt[15].Value);
127eba4d44aSLiu Zhe 		//reopen the document
128eba4d44aSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
129eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
130eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
131eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
132eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
133eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
134eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.CHAR_SPECIAL,propsRule_assert_doc[11].Value);
135eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","GraphicURL",propsRule_assert_doc[12].Name);
136eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif")),propsRule_assert_doc[12].Value);
137eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","VertOrient",propsRule_assert_doc[15].Name);
138eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",VertOrientation.BOTTOM,propsRule_assert_doc[15].Value);
139eba4d44aSLiu Zhe 	}
140eba4d44aSLiu Zhe 	@Test@Ignore("Bug #120833 - [testUNO patch]graphic bullet will change to character bullet when save to doc.")
testNumberingBullet_Graphic_Align_CenterofBaseline()141eba4d44aSLiu Zhe 	public void testNumberingBullet_Graphic_Align_CenterofBaseline() throws Exception {
142eba4d44aSLiu Zhe 
143eba4d44aSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
144eba4d44aSLiu Zhe 		xText = xTextDocument.getText();
145eba4d44aSLiu 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!" +
146eba4d44aSLiu Zhe 				"Hello,world!Hello,world!");
147eba4d44aSLiu Zhe 		//create cursor to select paragraph and formating paragraph
148eba4d44aSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
149eba4d44aSLiu Zhe 		//create paragraph property set
150eba4d44aSLiu Zhe 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
151eba4d44aSLiu Zhe 		//create document service factory
152eba4d44aSLiu Zhe 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
153eba4d44aSLiu Zhe 		//set numbering character
154eba4d44aSLiu Zhe 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
155eba4d44aSLiu Zhe 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue(),new PropertyValue()};
156eba4d44aSLiu Zhe 		propsRule[0].Name = "NumberingType";
157eba4d44aSLiu Zhe 		propsRule[0].Value = NumberingType.BITMAP;
158eba4d44aSLiu Zhe 		propsRule[1].Name = "GraphicURL";
159eba4d44aSLiu Zhe 		propsRule[1].Value = FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif"));
160eba4d44aSLiu Zhe 		propsRule[2].Name = "VertOrient";
161eba4d44aSLiu Zhe 		propsRule[2].Value = VertOrientation.CENTER;
162eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
163eba4d44aSLiu Zhe 		xReplaceRule.replaceByIndex(0, propsRule);
164eba4d44aSLiu Zhe 		//set paragraph numbering and bullet character
165eba4d44aSLiu Zhe 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
166eba4d44aSLiu Zhe 
167eba4d44aSLiu Zhe 		//save to odt
168eba4d44aSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
169eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
170eba4d44aSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
171eba4d44aSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
172eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
173eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Value = true;
174eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
175eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Value = "writer8";
176eba4d44aSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
177eba4d44aSLiu Zhe 		//save to doc
178eba4d44aSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
179eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
180eba4d44aSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
181eba4d44aSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
182eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
183eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Value = true;
184eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
185eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
186eba4d44aSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
187eba4d44aSLiu Zhe 		app.closeDocument(xTextDocument);
188eba4d44aSLiu Zhe 
189eba4d44aSLiu Zhe 		//reopen the document
190eba4d44aSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
191eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
192eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
193eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
194eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
195eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
196eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
197eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.BITMAP,propsRule_assert_odt[11].Value);
198eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","GraphicURL",propsRule_assert_odt[12].Name);
199eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif")),propsRule_assert_odt[12].Value);
200eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","VertOrient",propsRule_assert_odt[15].Name);
201eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",VertOrientation.CENTER,propsRule_assert_odt[15].Value);
202eba4d44aSLiu Zhe 		//reopen the document
203eba4d44aSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
204eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
205eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
206eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
207eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
208eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
209eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.CHAR_SPECIAL,propsRule_assert_doc[11].Value);
210eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","GraphicURL",propsRule_assert_doc[12].Name);
211eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif")),propsRule_assert_doc[12].Value);
212eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","VertOrient",propsRule_assert_doc[15].Name);
213eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",VertOrientation.CENTER,propsRule_assert_doc[15].Value);
214eba4d44aSLiu Zhe 	}
215eba4d44aSLiu Zhe 	@Test@Ignore("Bug #120833 - [testUNO patch]graphic bullet will change to character bullet when save to doc.")
testNumberingBullet_Graphic_Align_TopofBaseline()216eba4d44aSLiu Zhe 	public void testNumberingBullet_Graphic_Align_TopofBaseline() throws Exception {
217eba4d44aSLiu Zhe 
218eba4d44aSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
219eba4d44aSLiu Zhe 		xText = xTextDocument.getText();
220eba4d44aSLiu 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!" +
221eba4d44aSLiu Zhe 				"Hello,world!Hello,world!");
222eba4d44aSLiu Zhe 		//create cursor to select paragraph and formating paragraph
223eba4d44aSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
224eba4d44aSLiu Zhe 		//create paragraph property set
225eba4d44aSLiu Zhe 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
226eba4d44aSLiu Zhe 		//create document service factory
227eba4d44aSLiu Zhe 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
228eba4d44aSLiu Zhe 		//set numbering character
229eba4d44aSLiu Zhe 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
230eba4d44aSLiu Zhe 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue(),new PropertyValue()};
231eba4d44aSLiu Zhe 		propsRule[0].Name = "NumberingType";
232eba4d44aSLiu Zhe 		propsRule[0].Value = NumberingType.BITMAP;
233eba4d44aSLiu Zhe 		propsRule[1].Name = "GraphicURL";
234eba4d44aSLiu Zhe 		propsRule[1].Value = FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif"));
235eba4d44aSLiu Zhe 		propsRule[2].Name = "VertOrient";
236eba4d44aSLiu Zhe 		propsRule[2].Value = VertOrientation.TOP;
237eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
238eba4d44aSLiu Zhe 		xReplaceRule.replaceByIndex(0, propsRule);
239eba4d44aSLiu Zhe 		//set paragraph numbering and bullet character
240eba4d44aSLiu Zhe 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
241eba4d44aSLiu Zhe 
242eba4d44aSLiu Zhe 		//save to odt
243eba4d44aSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
244eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
245eba4d44aSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
246eba4d44aSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
247eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
248eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Value = true;
249eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
250eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Value = "writer8";
251eba4d44aSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
252eba4d44aSLiu Zhe 		//save to doc
253eba4d44aSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
254eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
255eba4d44aSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
256eba4d44aSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
257eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
258eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Value = true;
259eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
260eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
261eba4d44aSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
262eba4d44aSLiu Zhe 		app.closeDocument(xTextDocument);
263eba4d44aSLiu Zhe 
264eba4d44aSLiu Zhe 		//reopen the document
265eba4d44aSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
266eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
267eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
268eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
269eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
270eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
271eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
272eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.BITMAP,propsRule_assert_odt[11].Value);
273eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","GraphicURL",propsRule_assert_odt[12].Name);
274eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif")),propsRule_assert_odt[12].Value);
275eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","VertOrient",propsRule_assert_odt[15].Name);
276eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",VertOrientation.TOP,propsRule_assert_odt[15].Value);
277eba4d44aSLiu Zhe 		//reopen the document
278eba4d44aSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
279eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
280eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
281eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
282eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
283eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
284eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.CHAR_SPECIAL,propsRule_assert_doc[11].Value);
285eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","GraphicURL",propsRule_assert_doc[12].Name);
286eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif")),propsRule_assert_doc[12].Value);
287eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","VertOrient",propsRule_assert_doc[15].Name);
288eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",VertOrientation.TOP,propsRule_assert_doc[15].Value);
289eba4d44aSLiu Zhe 	}
290eba4d44aSLiu Zhe 	@Test@Ignore("Bug #120833 - [testUNO patch]graphic bullet will change to character bullet when save to doc.")
testNumberingBullet_Graphic_Align_BottomofCharacter()291eba4d44aSLiu Zhe 	public void testNumberingBullet_Graphic_Align_BottomofCharacter() throws Exception {
292eba4d44aSLiu Zhe 
293eba4d44aSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
294eba4d44aSLiu Zhe 		xText = xTextDocument.getText();
295eba4d44aSLiu 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!" +
296eba4d44aSLiu Zhe 				"Hello,world!Hello,world!");
297eba4d44aSLiu Zhe 		//create cursor to select paragraph and formating paragraph
298eba4d44aSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
299eba4d44aSLiu Zhe 		//create paragraph property set
300eba4d44aSLiu Zhe 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
301eba4d44aSLiu Zhe 		//create document service factory
302eba4d44aSLiu Zhe 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
303eba4d44aSLiu Zhe 		//set numbering character
304eba4d44aSLiu Zhe 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
305eba4d44aSLiu Zhe 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue(),new PropertyValue()};
306eba4d44aSLiu Zhe 		propsRule[0].Name = "NumberingType";
307eba4d44aSLiu Zhe 		propsRule[0].Value = NumberingType.BITMAP;
308eba4d44aSLiu Zhe 		propsRule[1].Name = "GraphicURL";
309eba4d44aSLiu Zhe 		propsRule[1].Value = FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif"));
310eba4d44aSLiu Zhe 		propsRule[2].Name = "VertOrient";
311eba4d44aSLiu Zhe 		propsRule[2].Value = VertOrientation.CHAR_BOTTOM;
312eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
313eba4d44aSLiu Zhe 		xReplaceRule.replaceByIndex(0, propsRule);
314eba4d44aSLiu Zhe 		//set paragraph numbering and bullet character
315eba4d44aSLiu Zhe 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
316eba4d44aSLiu Zhe 
317eba4d44aSLiu Zhe 		//save to odt
318eba4d44aSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
319eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
320eba4d44aSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
321eba4d44aSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
322eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
323eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Value = true;
324eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
325eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Value = "writer8";
326eba4d44aSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
327eba4d44aSLiu Zhe 		//save to doc
328eba4d44aSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
329eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
330eba4d44aSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
331eba4d44aSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
332eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
333eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Value = true;
334eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
335eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
336eba4d44aSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
337eba4d44aSLiu Zhe 		app.closeDocument(xTextDocument);
338eba4d44aSLiu Zhe 
339eba4d44aSLiu Zhe 		//reopen the document
340eba4d44aSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
341eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
342eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
343eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
344eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
345eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
346eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
347eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.BITMAP,propsRule_assert_odt[11].Value);
348eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","GraphicURL",propsRule_assert_odt[12].Name);
349eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif")),propsRule_assert_odt[12].Value);
350eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","VertOrient",propsRule_assert_odt[15].Name);
351eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",VertOrientation.CHAR_BOTTOM,propsRule_assert_odt[15].Value);
352eba4d44aSLiu Zhe 		//reopen the document
353eba4d44aSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
354eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
355eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
356eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
357eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
358eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
359eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.CHAR_SPECIAL,propsRule_assert_doc[11].Value);
360eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","GraphicURL",propsRule_assert_doc[12].Name);
361eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif")),propsRule_assert_doc[12].Value);
362eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","VertOrient",propsRule_assert_doc[15].Name);
363eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",VertOrientation.CHAR_BOTTOM,propsRule_assert_doc[15].Value);
364eba4d44aSLiu Zhe 	}
365eba4d44aSLiu Zhe 	@Test@Ignore("Bug #120833 - [testUNO patch]graphic bullet will change to character bullet when save to doc.")
testNumberingBullet_Graphic_Align_CenterofCharacter()366eba4d44aSLiu Zhe 	public void testNumberingBullet_Graphic_Align_CenterofCharacter() throws Exception {
367eba4d44aSLiu Zhe 
368eba4d44aSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
369eba4d44aSLiu Zhe 		xText = xTextDocument.getText();
370eba4d44aSLiu 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!" +
371eba4d44aSLiu Zhe 				"Hello,world!Hello,world!");
372eba4d44aSLiu Zhe 		//create cursor to select paragraph and formating paragraph
373eba4d44aSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
374eba4d44aSLiu Zhe 		//create paragraph property set
375eba4d44aSLiu Zhe 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
376eba4d44aSLiu Zhe 		//create document service factory
377eba4d44aSLiu Zhe 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
378eba4d44aSLiu Zhe 		//set numbering character
379eba4d44aSLiu Zhe 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
380eba4d44aSLiu Zhe 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue(),new PropertyValue()};
381eba4d44aSLiu Zhe 		propsRule[0].Name = "NumberingType";
382eba4d44aSLiu Zhe 		propsRule[0].Value = NumberingType.BITMAP;
383eba4d44aSLiu Zhe 		propsRule[1].Name = "GraphicURL";
384eba4d44aSLiu Zhe 		propsRule[1].Value = FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif"));
385eba4d44aSLiu Zhe 		propsRule[2].Name = "VertOrient";
386eba4d44aSLiu Zhe 		propsRule[2].Value = VertOrientation.CHAR_CENTER;
387eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
388eba4d44aSLiu Zhe 		xReplaceRule.replaceByIndex(0, propsRule);
389eba4d44aSLiu Zhe 		//set paragraph numbering and bullet character
390eba4d44aSLiu Zhe 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
391eba4d44aSLiu Zhe 
392eba4d44aSLiu Zhe 		//save to odt
393eba4d44aSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
394eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
395eba4d44aSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
396eba4d44aSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
397eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
398eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Value = true;
399eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
400eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Value = "writer8";
401eba4d44aSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
402eba4d44aSLiu Zhe 		//save to doc
403eba4d44aSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
404eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
405eba4d44aSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
406eba4d44aSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
407eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
408eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Value = true;
409eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
410eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
411eba4d44aSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
412eba4d44aSLiu Zhe 		app.closeDocument(xTextDocument);
413eba4d44aSLiu Zhe 
414eba4d44aSLiu Zhe 		//reopen the document
415eba4d44aSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
416eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
417eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
418eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
419eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
420eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
421eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
422eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.BITMAP,propsRule_assert_odt[11].Value);
423eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","GraphicURL",propsRule_assert_odt[12].Name);
424eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif")),propsRule_assert_odt[12].Value);
425eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","VertOrient",propsRule_assert_odt[15].Name);
426eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",VertOrientation.CHAR_CENTER,propsRule_assert_odt[15].Value);
427eba4d44aSLiu Zhe 		//reopen the document
428eba4d44aSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
429eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
430eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
431eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
432eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
433eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
434eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.CHAR_SPECIAL,propsRule_assert_doc[11].Value);
435eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","GraphicURL",propsRule_assert_doc[12].Name);
436eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif")),propsRule_assert_doc[12].Value);
437eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","VertOrient",propsRule_assert_doc[15].Name);
438eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",VertOrientation.CHAR_CENTER,propsRule_assert_doc[15].Value);
439eba4d44aSLiu Zhe 	}
440eba4d44aSLiu Zhe 	@Test@Ignore("Bug #120833 - [testUNO patch]graphic bullet will change to character bullet when save to doc.")
testNumberingBullet_Graphic_Align_TopofCharacter()441eba4d44aSLiu Zhe 	public void testNumberingBullet_Graphic_Align_TopofCharacter() throws Exception {
442eba4d44aSLiu Zhe 
443eba4d44aSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
444eba4d44aSLiu Zhe 		xText = xTextDocument.getText();
445eba4d44aSLiu 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!" +
446eba4d44aSLiu Zhe 				"Hello,world!Hello,world!");
447eba4d44aSLiu Zhe 		//create cursor to select paragraph and formating paragraph
448eba4d44aSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
449eba4d44aSLiu Zhe 		//create paragraph property set
450eba4d44aSLiu Zhe 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
451eba4d44aSLiu Zhe 		//create document service factory
452eba4d44aSLiu Zhe 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
453eba4d44aSLiu Zhe 		//set numbering character
454eba4d44aSLiu Zhe 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
455eba4d44aSLiu Zhe 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue(),new PropertyValue()};
456eba4d44aSLiu Zhe 		propsRule[0].Name = "NumberingType";
457eba4d44aSLiu Zhe 		propsRule[0].Value = NumberingType.BITMAP;
458eba4d44aSLiu Zhe 		propsRule[1].Name = "GraphicURL";
459eba4d44aSLiu Zhe 		propsRule[1].Value = FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif"));
460eba4d44aSLiu Zhe 		propsRule[2].Name = "VertOrient";
461eba4d44aSLiu Zhe 		propsRule[2].Value = VertOrientation.CHAR_TOP;
462eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
463eba4d44aSLiu Zhe 		xReplaceRule.replaceByIndex(0, propsRule);
464eba4d44aSLiu Zhe 		//set paragraph numbering and bullet character
465eba4d44aSLiu Zhe 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
466eba4d44aSLiu Zhe 
467eba4d44aSLiu Zhe 		//save to odt
468eba4d44aSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
469eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
470eba4d44aSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
471eba4d44aSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
472eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
473eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Value = true;
474eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
475eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Value = "writer8";
476eba4d44aSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
477eba4d44aSLiu Zhe 		//save to doc
478eba4d44aSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
479eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
480eba4d44aSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
481eba4d44aSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
482eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
483eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Value = true;
484eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
485eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
486eba4d44aSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
487eba4d44aSLiu Zhe 		app.closeDocument(xTextDocument);
488eba4d44aSLiu Zhe 
489eba4d44aSLiu Zhe 		//reopen the document
490eba4d44aSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
491eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
492eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
493eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
494eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
495eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
496eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
497eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.BITMAP,propsRule_assert_odt[11].Value);
498eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","GraphicURL",propsRule_assert_odt[12].Name);
499eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif")),propsRule_assert_odt[12].Value);
500eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","VertOrient",propsRule_assert_odt[15].Name);
501eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",VertOrientation.CHAR_TOP,propsRule_assert_odt[15].Value);
502eba4d44aSLiu Zhe 		//reopen the document
503eba4d44aSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
504eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
505eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
506eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
507eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
508eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
509eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.CHAR_SPECIAL,propsRule_assert_doc[11].Value);
510eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","GraphicURL",propsRule_assert_doc[12].Name);
511eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif")),propsRule_assert_doc[12].Value);
512eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","VertOrient",propsRule_assert_doc[15].Name);
513eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",VertOrientation.CHAR_TOP,propsRule_assert_doc[15].Value);
514eba4d44aSLiu Zhe 	}
515eba4d44aSLiu Zhe 	@Test@Ignore("Bug #120833 - [testUNO patch]graphic bullet will change to character bullet when save to doc.")
testNumberingBullet_Graphic_Align_BottomofLine()516eba4d44aSLiu Zhe 	public void testNumberingBullet_Graphic_Align_BottomofLine() throws Exception {
517eba4d44aSLiu Zhe 
518eba4d44aSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
519eba4d44aSLiu Zhe 		xText = xTextDocument.getText();
520eba4d44aSLiu 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!" +
521eba4d44aSLiu Zhe 				"Hello,world!Hello,world!");
522eba4d44aSLiu Zhe 		//create cursor to select paragraph and formating paragraph
523eba4d44aSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
524eba4d44aSLiu Zhe 		//create paragraph property set
525eba4d44aSLiu Zhe 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
526eba4d44aSLiu Zhe 		//create document service factory
527eba4d44aSLiu Zhe 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
528eba4d44aSLiu Zhe 		//set numbering character
529eba4d44aSLiu Zhe 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
530eba4d44aSLiu Zhe 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue(),new PropertyValue()};
531eba4d44aSLiu Zhe 		propsRule[0].Name = "NumberingType";
532eba4d44aSLiu Zhe 		propsRule[0].Value = NumberingType.BITMAP;
533eba4d44aSLiu Zhe 		propsRule[1].Name = "GraphicURL";
534eba4d44aSLiu Zhe 		propsRule[1].Value = FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif"));
535eba4d44aSLiu Zhe 		propsRule[2].Name = "VertOrient";
536eba4d44aSLiu Zhe 		propsRule[2].Value = VertOrientation.LINE_BOTTOM;
537eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
538eba4d44aSLiu Zhe 		xReplaceRule.replaceByIndex(0, propsRule);
539eba4d44aSLiu Zhe 		//set paragraph numbering and bullet character
540eba4d44aSLiu Zhe 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
541eba4d44aSLiu Zhe 
542eba4d44aSLiu Zhe 		//save to odt
543eba4d44aSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
544eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
545eba4d44aSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
546eba4d44aSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
547eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
548eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Value = true;
549eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
550eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Value = "writer8";
551eba4d44aSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
552eba4d44aSLiu Zhe 		//save to doc
553eba4d44aSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
554eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
555eba4d44aSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
556eba4d44aSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
557eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
558eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Value = true;
559eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
560eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
561eba4d44aSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
562eba4d44aSLiu Zhe 		app.closeDocument(xTextDocument);
563eba4d44aSLiu Zhe 
564eba4d44aSLiu Zhe 		//reopen the document
565eba4d44aSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
566eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
567eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
568eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
569eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
570eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
571eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
572eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.BITMAP,propsRule_assert_odt[11].Value);
573eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","GraphicURL",propsRule_assert_odt[12].Name);
574eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif")),propsRule_assert_odt[12].Value);
575eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","VertOrient",propsRule_assert_odt[15].Name);
576eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",VertOrientation.LINE_BOTTOM,propsRule_assert_odt[15].Value);
577eba4d44aSLiu Zhe 		//reopen the document
578eba4d44aSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
579eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
580eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
581eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
582eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
583eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
584eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.CHAR_SPECIAL,propsRule_assert_doc[11].Value);
585eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","GraphicURL",propsRule_assert_doc[12].Name);
586eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif")),propsRule_assert_doc[12].Value);
587eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","VertOrient",propsRule_assert_doc[15].Name);
588eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",VertOrientation.LINE_BOTTOM,propsRule_assert_doc[15].Value);
589eba4d44aSLiu Zhe 	}
590eba4d44aSLiu Zhe 	@Test@Ignore("Bug #120833 - [testUNO patch]graphic bullet will change to character bullet when save to doc.")
testNumberingBullet_Graphic_Align_CenterofLine()591eba4d44aSLiu Zhe 	public void testNumberingBullet_Graphic_Align_CenterofLine() throws Exception {
592eba4d44aSLiu Zhe 
593eba4d44aSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
594eba4d44aSLiu Zhe 		xText = xTextDocument.getText();
595eba4d44aSLiu 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!" +
596eba4d44aSLiu Zhe 				"Hello,world!Hello,world!");
597eba4d44aSLiu Zhe 		//create cursor to select paragraph and formating paragraph
598eba4d44aSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
599eba4d44aSLiu Zhe 		//create paragraph property set
600eba4d44aSLiu Zhe 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
601eba4d44aSLiu Zhe 		//create document service factory
602eba4d44aSLiu Zhe 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
603eba4d44aSLiu Zhe 		//set numbering character
604eba4d44aSLiu Zhe 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
605eba4d44aSLiu Zhe 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue(),new PropertyValue()};
606eba4d44aSLiu Zhe 		propsRule[0].Name = "NumberingType";
607eba4d44aSLiu Zhe 		propsRule[0].Value = NumberingType.BITMAP;
608eba4d44aSLiu Zhe 		propsRule[1].Name = "GraphicURL";
609eba4d44aSLiu Zhe 		propsRule[1].Value = FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif"));
610eba4d44aSLiu Zhe 		propsRule[2].Name = "VertOrient";
611eba4d44aSLiu Zhe 		propsRule[2].Value = VertOrientation.LINE_CENTER;
612eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
613eba4d44aSLiu Zhe 		xReplaceRule.replaceByIndex(0, propsRule);
614eba4d44aSLiu Zhe 		//set paragraph numbering and bullet character
615eba4d44aSLiu Zhe 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
616eba4d44aSLiu Zhe 
617eba4d44aSLiu Zhe 		//save to odt
618eba4d44aSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
619eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
620eba4d44aSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
621eba4d44aSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
622eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
623eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Value = true;
624eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
625eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Value = "writer8";
626eba4d44aSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
627eba4d44aSLiu Zhe 		//save to doc
628eba4d44aSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
629eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
630eba4d44aSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
631eba4d44aSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
632eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
633eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Value = true;
634eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
635eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
636eba4d44aSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
637eba4d44aSLiu Zhe 		app.closeDocument(xTextDocument);
638eba4d44aSLiu Zhe 
639eba4d44aSLiu Zhe 		//reopen the document
640eba4d44aSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
641eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
642eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
643eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
644eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
645eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
646eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
647eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.BITMAP,propsRule_assert_odt[11].Value);
648eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","GraphicURL",propsRule_assert_odt[12].Name);
649eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif")),propsRule_assert_odt[12].Value);
650eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","VertOrient",propsRule_assert_odt[15].Name);
651eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",VertOrientation.LINE_CENTER,propsRule_assert_odt[15].Value);
652eba4d44aSLiu Zhe 		//reopen the document
653eba4d44aSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
654eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
655eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
656eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
657eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
658eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
659eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.CHAR_SPECIAL,propsRule_assert_doc[11].Value);
660eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","GraphicURL",propsRule_assert_doc[12].Name);
661eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif")),propsRule_assert_doc[12].Value);
662eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","VertOrient",propsRule_assert_doc[15].Name);
663eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",VertOrientation.LINE_CENTER,propsRule_assert_doc[15].Value);
664eba4d44aSLiu Zhe 	}
665eba4d44aSLiu Zhe 	@Test@Ignore("Bug #120833 - [testUNO patch]graphic bullet will change to character bullet when save to doc.")
testNumberingBullet_Graphic_Align_TopofLine()666eba4d44aSLiu Zhe 	public void testNumberingBullet_Graphic_Align_TopofLine() throws Exception {
667eba4d44aSLiu Zhe 
668eba4d44aSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
669eba4d44aSLiu Zhe 		xText = xTextDocument.getText();
670eba4d44aSLiu 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!" +
671eba4d44aSLiu Zhe 				"Hello,world!Hello,world!");
672eba4d44aSLiu Zhe 		//create cursor to select paragraph and formating paragraph
673eba4d44aSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
674eba4d44aSLiu Zhe 		//create paragraph property set
675eba4d44aSLiu Zhe 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
676eba4d44aSLiu Zhe 		//create document service factory
677eba4d44aSLiu Zhe 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
678eba4d44aSLiu Zhe 		//set numbering character
679eba4d44aSLiu Zhe 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
680eba4d44aSLiu Zhe 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue(),new PropertyValue()};
681eba4d44aSLiu Zhe 		propsRule[0].Name = "NumberingType";
682eba4d44aSLiu Zhe 		propsRule[0].Value = NumberingType.BITMAP;
683eba4d44aSLiu Zhe 		propsRule[1].Name = "GraphicURL";
684eba4d44aSLiu Zhe 		propsRule[1].Value = FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif"));
685eba4d44aSLiu Zhe 		propsRule[2].Name = "VertOrient";
686eba4d44aSLiu Zhe 		propsRule[2].Value = VertOrientation.LINE_TOP;
687eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
688eba4d44aSLiu Zhe 		xReplaceRule.replaceByIndex(0, propsRule);
689eba4d44aSLiu Zhe 		//set paragraph numbering and bullet character
690eba4d44aSLiu Zhe 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
691eba4d44aSLiu Zhe 
692eba4d44aSLiu Zhe 		//save to odt
693eba4d44aSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
694eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
695eba4d44aSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
696eba4d44aSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
697eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
698eba4d44aSLiu Zhe 		aStoreProperties_odt[0].Value = true;
699eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
700eba4d44aSLiu Zhe 		aStoreProperties_odt[1].Value = "writer8";
701eba4d44aSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
702eba4d44aSLiu Zhe 		//save to doc
703eba4d44aSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
704eba4d44aSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
705eba4d44aSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
706eba4d44aSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
707eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
708eba4d44aSLiu Zhe 		aStoreProperties_doc[0].Value = true;
709eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
710eba4d44aSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
711eba4d44aSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
712eba4d44aSLiu Zhe 		app.closeDocument(xTextDocument);
713eba4d44aSLiu Zhe 
714eba4d44aSLiu Zhe 		//reopen the document
715eba4d44aSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
716eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
717eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
718eba4d44aSLiu Zhe 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
719eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
720eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
721eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
722eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.BITMAP,propsRule_assert_odt[11].Value);
723eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","GraphicURL",propsRule_assert_odt[12].Name);
724eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif")),propsRule_assert_odt[12].Value);
725eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","VertOrient",propsRule_assert_odt[15].Name);
726eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",VertOrientation.LINE_TOP,propsRule_assert_odt[15].Value);
727eba4d44aSLiu Zhe 		//reopen the document
728eba4d44aSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
729eba4d44aSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
730eba4d44aSLiu Zhe 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
731eba4d44aSLiu Zhe 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
732eba4d44aSLiu Zhe 		//verify paragraph numbering and bullet alignment
733eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
734eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.CHAR_SPECIAL,propsRule_assert_doc[11].Value);
735eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","GraphicURL",propsRule_assert_doc[12].Name);
736eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",FileUtil.getUrl(Testspace.prepareData("uno/coffee_1.gif")),propsRule_assert_doc[12].Value);
737eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet","VertOrient",propsRule_assert_doc[15].Name);
738eba4d44aSLiu Zhe 		assertEquals("assert numbering and bullet",VertOrientation.LINE_TOP,propsRule_assert_doc[15].Value);
739eba4d44aSLiu Zhe 	}
740eba4d44aSLiu Zhe }
741