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