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