1*eba4d44aSLiu Zhe package fvt.uno.sw.paragraph;
24a089d9bSLiu Zhe 
34a089d9bSLiu Zhe import static org.junit.Assert.*;
44a089d9bSLiu Zhe 
54a089d9bSLiu Zhe import org.junit.After;
64a089d9bSLiu Zhe import org.junit.Before;
74a089d9bSLiu Zhe import org.junit.Test;
84a089d9bSLiu Zhe import org.openoffice.test.common.FileUtil;
94a089d9bSLiu Zhe import org.openoffice.test.common.Testspace;
104a089d9bSLiu Zhe import org.openoffice.test.uno.UnoApp;
114a089d9bSLiu Zhe 
124a089d9bSLiu Zhe import com.sun.star.style.NumberingType;
134a089d9bSLiu Zhe import com.sun.star.text.*;
144a089d9bSLiu Zhe import com.sun.star.beans.*;
154a089d9bSLiu Zhe import com.sun.star.container.XIndexAccess;
164a089d9bSLiu Zhe import com.sun.star.container.XIndexReplace;
174a089d9bSLiu Zhe import com.sun.star.frame.XStorable;
184a089d9bSLiu Zhe import com.sun.star.lang.XMultiServiceFactory;
194a089d9bSLiu Zhe import com.sun.star.uno.UnoRuntime;
204a089d9bSLiu Zhe 
214a089d9bSLiu Zhe public class ParagraphNumberingAndBulletAlignment {
224a089d9bSLiu Zhe 	private static final UnoApp app = new UnoApp();
234a089d9bSLiu Zhe 	XText xText = null;
244a089d9bSLiu Zhe 
254a089d9bSLiu Zhe 	@Before
264a089d9bSLiu Zhe 	public void setUp() throws Exception {
274a089d9bSLiu Zhe 		app.start();
284a089d9bSLiu Zhe 
294a089d9bSLiu Zhe 	}
304a089d9bSLiu Zhe 
314a089d9bSLiu Zhe 	@After
324a089d9bSLiu Zhe 	public void tearDown() throws Exception {
334a089d9bSLiu Zhe 		app.close();
344a089d9bSLiu Zhe 	}
354a089d9bSLiu Zhe 	/*
364a089d9bSLiu Zhe 	 * test paragraph background color
374a089d9bSLiu Zhe 	 * 1.new a text document
384a089d9bSLiu Zhe 	 * 2.insert some text
394a089d9bSLiu Zhe 	 * 3.set paragraph numbering alignment
404a089d9bSLiu Zhe 	 * 4.save and close the document
414a089d9bSLiu Zhe 	 * 5.reload the saved document and check the paragraph numbering alignment
424a089d9bSLiu Zhe 	 */
434a089d9bSLiu Zhe 	@Test
444a089d9bSLiu Zhe 	public void testNumberingBulletAlign_Right() throws Exception {
454a089d9bSLiu Zhe 
464a089d9bSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
474a089d9bSLiu Zhe 		xText = xTextDocument.getText();
484a089d9bSLiu Zhe 		xText.setString("we are Chinese,they are American.\nwe are all living in one earth!\nHello,world!Hello,world!Hello,world!\nHello,world!Hello,world!Hello,world!" +
494a089d9bSLiu Zhe 				"Hello,world!Hello,world!");
504a089d9bSLiu Zhe 		//create cursor to select paragraph and formating paragraph
514a089d9bSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
524a089d9bSLiu Zhe 		//create paragraph property set
534a089d9bSLiu Zhe 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
544a089d9bSLiu Zhe 		//create document service factory
554a089d9bSLiu Zhe 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
564a089d9bSLiu Zhe 		//set numbering character
574a089d9bSLiu Zhe 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
584a089d9bSLiu Zhe 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
594a089d9bSLiu Zhe 		propsRule[1].Name = "NumberingType";
604a089d9bSLiu Zhe 		propsRule[1].Value = NumberingType.ARABIC;
614a089d9bSLiu Zhe 		propsRule[0].Name = "Adjust";
624a089d9bSLiu Zhe 		propsRule[0].Value = HoriOrientation.RIGHT;
634a089d9bSLiu Zhe 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
644a089d9bSLiu Zhe 		xReplaceRule.replaceByIndex(0, propsRule);
654a089d9bSLiu Zhe 		//set paragraph numbering and bullet character
664a089d9bSLiu Zhe 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
674a089d9bSLiu Zhe 		//save to odt
684a089d9bSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
694a089d9bSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
704a089d9bSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
714a089d9bSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
724a089d9bSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
734a089d9bSLiu Zhe 		aStoreProperties_odt[0].Value = true;
744a089d9bSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
754a089d9bSLiu Zhe 		aStoreProperties_odt[1].Value = "writer8";
764a089d9bSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
774a089d9bSLiu Zhe 		//save to doc
784a089d9bSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
794a089d9bSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
804a089d9bSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
814a089d9bSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
824a089d9bSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
834a089d9bSLiu Zhe 		aStoreProperties_doc[0].Value = true;
844a089d9bSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
854a089d9bSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
864a089d9bSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
874a089d9bSLiu Zhe 		app.closeDocument(xTextDocument);
884a089d9bSLiu Zhe 
894a089d9bSLiu Zhe 		//reopen the document
904a089d9bSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
914a089d9bSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
924a089d9bSLiu Zhe 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
934a089d9bSLiu Zhe 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
944a089d9bSLiu Zhe 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
954a089d9bSLiu Zhe 		//verify paragraph numbering and bullet alignment
964a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet","Adjust",propsRule_assert_odt[0].Name);
974a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet",HoriOrientation.RIGHT,propsRule_assert_odt[0].Value);
984a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
994a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
1004a089d9bSLiu Zhe 
1014a089d9bSLiu Zhe 		//reopen the document
1024a089d9bSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
1034a089d9bSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
1044a089d9bSLiu Zhe 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
1054a089d9bSLiu Zhe 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
1064a089d9bSLiu Zhe 		//verify paragraph numbering and bullet alignment
1074a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet","Adjust",propsRule_assert_doc[0].Name);
1084a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet",HoriOrientation.RIGHT,propsRule_assert_doc[0].Value);
1094a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
1104a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
1114a089d9bSLiu Zhe 	}
1124a089d9bSLiu Zhe 	@Test
1134a089d9bSLiu Zhe 	public void testNumberingBulletAlign_Left() throws Exception {
1144a089d9bSLiu Zhe 
1154a089d9bSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
1164a089d9bSLiu Zhe 		xText = xTextDocument.getText();
1174a089d9bSLiu Zhe 		xText.setString("we are Chinese,they are American.\nwe are all living in one earth!\nHello,world!Hello,world!Hello,world!\nHello,world!Hello,world!Hello,world!" +
1184a089d9bSLiu Zhe 				"Hello,world!Hello,world!");
1194a089d9bSLiu Zhe 		//create cursor to select paragraph and formating paragraph
1204a089d9bSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
1214a089d9bSLiu Zhe 		//create paragraph property set
1224a089d9bSLiu Zhe 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
1234a089d9bSLiu Zhe 		//create document service factory
1244a089d9bSLiu Zhe 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
1254a089d9bSLiu Zhe 		//set numbering character
1264a089d9bSLiu Zhe 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
1274a089d9bSLiu Zhe 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
1284a089d9bSLiu Zhe 		propsRule[1].Name = "NumberingType";
1294a089d9bSLiu Zhe 		propsRule[1].Value = NumberingType.ARABIC;
1304a089d9bSLiu Zhe 		propsRule[0].Name = "Adjust";
1314a089d9bSLiu Zhe 		propsRule[0].Value = HoriOrientation.LEFT;
1324a089d9bSLiu Zhe 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
1334a089d9bSLiu Zhe 		xReplaceRule.replaceByIndex(0, propsRule);
1344a089d9bSLiu Zhe 		//set paragraph numbering and bullet character
1354a089d9bSLiu Zhe 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
1364a089d9bSLiu Zhe 		//save to odt
1374a089d9bSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1384a089d9bSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
1394a089d9bSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
1404a089d9bSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
1414a089d9bSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
1424a089d9bSLiu Zhe 		aStoreProperties_odt[0].Value = true;
1434a089d9bSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
1444a089d9bSLiu Zhe 		aStoreProperties_odt[1].Value = "writer8";
1454a089d9bSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
1464a089d9bSLiu Zhe 		//save to doc
1474a089d9bSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1484a089d9bSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
1494a089d9bSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
1504a089d9bSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
1514a089d9bSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
1524a089d9bSLiu Zhe 		aStoreProperties_doc[0].Value = true;
1534a089d9bSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
1544a089d9bSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
1554a089d9bSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
1564a089d9bSLiu Zhe 		app.closeDocument(xTextDocument);
1574a089d9bSLiu Zhe 
1584a089d9bSLiu Zhe 		//reopen the document
1594a089d9bSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
1604a089d9bSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
1614a089d9bSLiu Zhe 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
1624a089d9bSLiu Zhe 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
1634a089d9bSLiu Zhe 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
1644a089d9bSLiu Zhe 		//verify paragraph numbering and bullet alignment
1654a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet","Adjust",propsRule_assert_odt[0].Name);
1664a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet",HoriOrientation.LEFT,propsRule_assert_odt[0].Value);
1674a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
1684a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
1694a089d9bSLiu Zhe 
1704a089d9bSLiu Zhe 		//reopen the document
1714a089d9bSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
1724a089d9bSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
1734a089d9bSLiu Zhe 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
1744a089d9bSLiu Zhe 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
1754a089d9bSLiu Zhe 		//verify paragraph numbering and bullet alignment
1764a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet","Adjust",propsRule_assert_doc[0].Name);
1774a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet",HoriOrientation.LEFT,propsRule_assert_doc[0].Value);
1784a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
1794a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
1804a089d9bSLiu Zhe 	}
1814a089d9bSLiu Zhe 	@Test
1824a089d9bSLiu Zhe 	public void testNumberingBulletAlign_Center() throws Exception {
1834a089d9bSLiu Zhe 
1844a089d9bSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
1854a089d9bSLiu Zhe 		xText = xTextDocument.getText();
1864a089d9bSLiu Zhe 		xText.setString("we are Chinese,they are American.\nwe are all living in one earth!\nHello,world!Hello,world!Hello,world!\nHello,world!Hello,world!Hello,world!" +
1874a089d9bSLiu Zhe 				"Hello,world!Hello,world!");
1884a089d9bSLiu Zhe 		//create cursor to select paragraph and formating paragraph
1894a089d9bSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
1904a089d9bSLiu Zhe 		//create paragraph property set
1914a089d9bSLiu Zhe 		XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
1924a089d9bSLiu Zhe 		//create document service factory
1934a089d9bSLiu Zhe 		XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
1944a089d9bSLiu Zhe 		//set numbering character
1954a089d9bSLiu Zhe 		XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
1964a089d9bSLiu Zhe 		PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
1974a089d9bSLiu Zhe 		propsRule[1].Name = "NumberingType";
1984a089d9bSLiu Zhe 		propsRule[1].Value = NumberingType.ARABIC;
1994a089d9bSLiu Zhe 		propsRule[0].Name = "Adjust";
2004a089d9bSLiu Zhe 		propsRule[0].Value = HoriOrientation.CENTER;
2014a089d9bSLiu Zhe 		XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
2024a089d9bSLiu Zhe 		xReplaceRule.replaceByIndex(0, propsRule);
2034a089d9bSLiu Zhe 		//set paragraph numbering and bullet character
2044a089d9bSLiu Zhe 		xTextProps.setPropertyValue("NumberingRules", xNumRule);
2054a089d9bSLiu Zhe 		//save to odt
2064a089d9bSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
2074a089d9bSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
2084a089d9bSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
2094a089d9bSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
2104a089d9bSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
2114a089d9bSLiu Zhe 		aStoreProperties_odt[0].Value = true;
2124a089d9bSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
2134a089d9bSLiu Zhe 		aStoreProperties_odt[1].Value = "writer8";
2144a089d9bSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
2154a089d9bSLiu Zhe 		//save to doc
2164a089d9bSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
2174a089d9bSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
2184a089d9bSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
2194a089d9bSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
2204a089d9bSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
2214a089d9bSLiu Zhe 		aStoreProperties_doc[0].Value = true;
2224a089d9bSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
2234a089d9bSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
2244a089d9bSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
2254a089d9bSLiu Zhe 		app.closeDocument(xTextDocument);
2264a089d9bSLiu Zhe 
2274a089d9bSLiu Zhe 		//reopen the document
2284a089d9bSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
2294a089d9bSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
2304a089d9bSLiu Zhe 		XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
2314a089d9bSLiu Zhe 		XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
2324a089d9bSLiu Zhe 		PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
2334a089d9bSLiu Zhe 		//verify paragraph numbering and bullet alignment
2344a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet","Adjust",propsRule_assert_odt[0].Name);
2354a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet",HoriOrientation.CENTER,propsRule_assert_odt[0].Value);
2364a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
2374a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
2384a089d9bSLiu Zhe 
2394a089d9bSLiu Zhe 		//reopen the document
2404a089d9bSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
2414a089d9bSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
2424a089d9bSLiu Zhe 		XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
2434a089d9bSLiu Zhe 		PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
2444a089d9bSLiu Zhe 		//verify paragraph numbering and bullet alignment
2454a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet","Adjust",propsRule_assert_doc[0].Name);
2464a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet",HoriOrientation.CENTER,propsRule_assert_doc[0].Value);
2474a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
2484a089d9bSLiu Zhe 		assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
2494a089d9bSLiu Zhe 	}
2504a089d9bSLiu Zhe }
251