1*eba4d44aSLiu Zhe package fvt.uno.sw.paragraph;
29f0ca99bSLiu Zhe 
39f0ca99bSLiu Zhe import static org.junit.Assert.*;
49f0ca99bSLiu Zhe 
59f0ca99bSLiu Zhe import org.junit.After;
69f0ca99bSLiu Zhe import org.junit.Before;
79f0ca99bSLiu Zhe import org.junit.Ignore;
89f0ca99bSLiu Zhe import org.junit.Test;
99f0ca99bSLiu Zhe import org.openoffice.test.common.FileUtil;
109f0ca99bSLiu Zhe import org.openoffice.test.common.Testspace;
119f0ca99bSLiu Zhe import org.openoffice.test.uno.UnoApp;
129f0ca99bSLiu Zhe 
139f0ca99bSLiu Zhe import com.sun.star.style.TabAlign;
149f0ca99bSLiu Zhe import com.sun.star.style.TabStop;
159f0ca99bSLiu Zhe import com.sun.star.text.*;
169f0ca99bSLiu Zhe import com.sun.star.beans.*;
179f0ca99bSLiu Zhe import com.sun.star.frame.XStorable;
189f0ca99bSLiu Zhe import com.sun.star.uno.UnoRuntime;
199f0ca99bSLiu Zhe 
209f0ca99bSLiu Zhe public class ParagraphTabs {
219f0ca99bSLiu Zhe 	private static final UnoApp app = new UnoApp();
229f0ca99bSLiu Zhe 	XText xText = null;
239f0ca99bSLiu Zhe 
249f0ca99bSLiu Zhe 	@Before
259f0ca99bSLiu Zhe 	public void setUp() throws Exception {
269f0ca99bSLiu Zhe 		app.start();
279f0ca99bSLiu Zhe 
289f0ca99bSLiu Zhe 	}
299f0ca99bSLiu Zhe 
309f0ca99bSLiu Zhe 	@After
319f0ca99bSLiu Zhe 	public void tearDown() throws Exception {
329f0ca99bSLiu Zhe 		app.close();
339f0ca99bSLiu Zhe 	}
349f0ca99bSLiu Zhe 	@Test
359f0ca99bSLiu Zhe 	public void ParagraphTabs_Center() throws Exception {
369f0ca99bSLiu Zhe 
379f0ca99bSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
389f0ca99bSLiu Zhe 		xText = xTextDocument.getText();
399f0ca99bSLiu Zhe 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!");
409f0ca99bSLiu Zhe 		// create text cursor for selecting and formatting text
419f0ca99bSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
429f0ca99bSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
439f0ca99bSLiu Zhe 		//paraTabStops.
449f0ca99bSLiu Zhe 		TabStop[] tabStop=new TabStop[1];
459f0ca99bSLiu Zhe 		tabStop[0]=new TabStop();
469f0ca99bSLiu Zhe 		tabStop[0].Position=5001;
479f0ca99bSLiu Zhe 		tabStop[0].Alignment=TabAlign.CENTER;
489f0ca99bSLiu Zhe 		tabStop[0].FillChar='_';
499f0ca99bSLiu Zhe 		//set paragraph tab stops
509f0ca99bSLiu Zhe 		xCursorProps.setPropertyValue("ParaTabStops",tabStop);
519f0ca99bSLiu Zhe 		//save to odt
529f0ca99bSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
539f0ca99bSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
549f0ca99bSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
559f0ca99bSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
569f0ca99bSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
579f0ca99bSLiu Zhe 		aStoreProperties_odt[0].Value = true;
589f0ca99bSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
599f0ca99bSLiu Zhe 		aStoreProperties_odt[1].Value = "writer8";
609f0ca99bSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
619f0ca99bSLiu Zhe 		//save to doc
629f0ca99bSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
639f0ca99bSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
649f0ca99bSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
659f0ca99bSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
669f0ca99bSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
679f0ca99bSLiu Zhe 		aStoreProperties_doc[0].Value = true;
689f0ca99bSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
699f0ca99bSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
709f0ca99bSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
719f0ca99bSLiu Zhe 		app.closeDocument(xTextDocument);
729f0ca99bSLiu Zhe 
739f0ca99bSLiu Zhe 		//reopen the document
749f0ca99bSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
759f0ca99bSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
769f0ca99bSLiu Zhe 		Object paraTabs_obj_odt=xCursorProps_Assert_odt.getPropertyValue("ParaTabStops");
779f0ca99bSLiu Zhe 		TabStop[] paraTabs_assert_odt=(TabStop[]) UnoRuntime.queryInterface(TabStop[].class, paraTabs_obj_odt);
789f0ca99bSLiu Zhe 		//verify paragraph tabs
799f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",TabAlign.CENTER,paraTabs_assert_odt[0].Alignment);
809f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",'_',paraTabs_assert_odt[0].FillChar);
819f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",5001,paraTabs_assert_odt[0].Position);
829f0ca99bSLiu Zhe 
839f0ca99bSLiu Zhe 		//reopen the document
849f0ca99bSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
859f0ca99bSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
869f0ca99bSLiu Zhe 		TabStop[] paraTabs_assert_doc=(TabStop[]) UnoRuntime.queryInterface(TabStop[].class, xCursorProps_Assert_doc.getPropertyValue("ParaTabStops"));
879f0ca99bSLiu Zhe 		//verify paragraph tabs
889f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",TabAlign.CENTER,paraTabs_assert_doc[0].Alignment);
899f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",'_',paraTabs_assert_doc[0].FillChar);
909f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",5001,paraTabs_assert_doc[0].Position);
919f0ca99bSLiu Zhe 	}
929f0ca99bSLiu Zhe 	@Test
939f0ca99bSLiu Zhe 	public void ParagraphTabs_Left() throws Exception {
949f0ca99bSLiu Zhe 
959f0ca99bSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
969f0ca99bSLiu Zhe 		xText = xTextDocument.getText();
979f0ca99bSLiu Zhe 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!");
989f0ca99bSLiu Zhe 		// create text cursor for selecting and formatting text
999f0ca99bSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
1009f0ca99bSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
1019f0ca99bSLiu Zhe 		//paraTabStops.
1029f0ca99bSLiu Zhe 		TabStop[] tabStop=new TabStop[1];
1039f0ca99bSLiu Zhe 		tabStop[0]=new TabStop();
1049f0ca99bSLiu Zhe 		tabStop[0].Position=5001;
1059f0ca99bSLiu Zhe 		tabStop[0].Alignment=TabAlign.LEFT;
1069f0ca99bSLiu Zhe 		tabStop[0].FillChar='.';
1079f0ca99bSLiu Zhe 		//set paragraph tab stops
1089f0ca99bSLiu Zhe 		xCursorProps.setPropertyValue("ParaTabStops",tabStop);
1099f0ca99bSLiu Zhe 		//save to odt
1109f0ca99bSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1119f0ca99bSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
1129f0ca99bSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
1139f0ca99bSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
1149f0ca99bSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
1159f0ca99bSLiu Zhe 		aStoreProperties_odt[0].Value = true;
1169f0ca99bSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
1179f0ca99bSLiu Zhe 		aStoreProperties_odt[1].Value = "writer8";
1189f0ca99bSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
1199f0ca99bSLiu Zhe 		//save to doc
1209f0ca99bSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1219f0ca99bSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
1229f0ca99bSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
1239f0ca99bSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
1249f0ca99bSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
1259f0ca99bSLiu Zhe 		aStoreProperties_doc[0].Value = true;
1269f0ca99bSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
1279f0ca99bSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
1289f0ca99bSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
1299f0ca99bSLiu Zhe 		app.closeDocument(xTextDocument);
1309f0ca99bSLiu Zhe 
1319f0ca99bSLiu Zhe 		//reopen the document
1329f0ca99bSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
1339f0ca99bSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
1349f0ca99bSLiu Zhe 		Object paraTabs_obj_odt=xCursorProps_Assert_odt.getPropertyValue("ParaTabStops");
1359f0ca99bSLiu Zhe 		TabStop[] paraTabs_assert_odt=(TabStop[]) UnoRuntime.queryInterface(TabStop[].class, paraTabs_obj_odt);
1369f0ca99bSLiu Zhe 		//verify paragraph tabs
1379f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",TabAlign.LEFT,paraTabs_assert_odt[0].Alignment);
1389f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",'.',paraTabs_assert_odt[0].FillChar);
1399f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",5001,paraTabs_assert_odt[0].Position);
1409f0ca99bSLiu Zhe 
1419f0ca99bSLiu Zhe 		//reopen the document
1429f0ca99bSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
1439f0ca99bSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
1449f0ca99bSLiu Zhe 		TabStop[] paraTabs_assert_doc=(TabStop[]) UnoRuntime.queryInterface(TabStop[].class, xCursorProps_Assert_doc.getPropertyValue("ParaTabStops"));
1459f0ca99bSLiu Zhe 		//verify paragraph tabs
1469f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",TabAlign.LEFT,paraTabs_assert_doc[0].Alignment);
1479f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",'.',paraTabs_assert_doc[0].FillChar);
1489f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",5001,paraTabs_assert_doc[0].Position);
1499f0ca99bSLiu Zhe 	}
1509f0ca99bSLiu Zhe 	@Test
1519f0ca99bSLiu Zhe 	public void ParagraphTabs_Right() throws Exception {
1529f0ca99bSLiu Zhe 
1539f0ca99bSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
1549f0ca99bSLiu Zhe 		xText = xTextDocument.getText();
1559f0ca99bSLiu Zhe 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!");
1569f0ca99bSLiu Zhe 		// create text cursor for selecting and formatting text
1579f0ca99bSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
1589f0ca99bSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
1599f0ca99bSLiu Zhe 		//paraTabStops.
1609f0ca99bSLiu Zhe 		TabStop[] tabStop=new TabStop[1];
1619f0ca99bSLiu Zhe 		tabStop[0]=new TabStop();
1629f0ca99bSLiu Zhe 		tabStop[0].Position=5001;
1639f0ca99bSLiu Zhe 		tabStop[0].Alignment=TabAlign.RIGHT;
1649f0ca99bSLiu Zhe 		tabStop[0].FillChar='-';
1659f0ca99bSLiu Zhe 		//set paragraph tab stops
1669f0ca99bSLiu Zhe 		xCursorProps.setPropertyValue("ParaTabStops",tabStop);
1679f0ca99bSLiu Zhe 		//save to odt
1689f0ca99bSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1699f0ca99bSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
1709f0ca99bSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
1719f0ca99bSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
1729f0ca99bSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
1739f0ca99bSLiu Zhe 		aStoreProperties_odt[0].Value = true;
1749f0ca99bSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
1759f0ca99bSLiu Zhe 		aStoreProperties_odt[1].Value = "writer8";
1769f0ca99bSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
1779f0ca99bSLiu Zhe 		//save to doc
1789f0ca99bSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
1799f0ca99bSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
1809f0ca99bSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
1819f0ca99bSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
1829f0ca99bSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
1839f0ca99bSLiu Zhe 		aStoreProperties_doc[0].Value = true;
1849f0ca99bSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
1859f0ca99bSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
1869f0ca99bSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
1879f0ca99bSLiu Zhe 		app.closeDocument(xTextDocument);
1889f0ca99bSLiu Zhe 
1899f0ca99bSLiu Zhe 		//reopen the document
1909f0ca99bSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
1919f0ca99bSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
1929f0ca99bSLiu Zhe 		Object paraTabs_obj_odt=xCursorProps_Assert_odt.getPropertyValue("ParaTabStops");
1939f0ca99bSLiu Zhe 		TabStop[] paraTabs_assert_odt=(TabStop[]) UnoRuntime.queryInterface(TabStop[].class, paraTabs_obj_odt);
1949f0ca99bSLiu Zhe 		//verify paragraph tabs
1959f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",TabAlign.RIGHT,paraTabs_assert_odt[0].Alignment);
1969f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",'-',paraTabs_assert_odt[0].FillChar);
1979f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",5001,paraTabs_assert_odt[0].Position);
1989f0ca99bSLiu Zhe 
1999f0ca99bSLiu Zhe 		//reopen the document
2009f0ca99bSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
2019f0ca99bSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
2029f0ca99bSLiu Zhe 		TabStop[] paraTabs_assert_doc=(TabStop[]) UnoRuntime.queryInterface(TabStop[].class, xCursorProps_Assert_doc.getPropertyValue("ParaTabStops"));
2039f0ca99bSLiu Zhe 		//verify paragraph tabs
2049f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",TabAlign.RIGHT,paraTabs_assert_doc[0].Alignment);
2059f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",'-',paraTabs_assert_doc[0].FillChar);
2069f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",5001,paraTabs_assert_doc[0].Position);
2079f0ca99bSLiu Zhe 	}
2089f0ca99bSLiu Zhe 	@Test
2099f0ca99bSLiu Zhe 	public void ParagraphTabs_Decimal() throws Exception {
2109f0ca99bSLiu Zhe 
2119f0ca99bSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
2129f0ca99bSLiu Zhe 		xText = xTextDocument.getText();
2139f0ca99bSLiu Zhe 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!");
2149f0ca99bSLiu Zhe 		// create text cursor for selecting and formatting text
2159f0ca99bSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
2169f0ca99bSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
2179f0ca99bSLiu Zhe 		//paraTabStops.
2189f0ca99bSLiu Zhe 		TabStop[] tabStop=new TabStop[1];
2199f0ca99bSLiu Zhe 		tabStop[0]=new TabStop();
2209f0ca99bSLiu Zhe 		tabStop[0].Position=5001;
2219f0ca99bSLiu Zhe 		tabStop[0].Alignment=TabAlign.DECIMAL;
2229f0ca99bSLiu Zhe 		tabStop[0].DecimalChar='.';
2239f0ca99bSLiu Zhe 		tabStop[0].FillChar='-';
2249f0ca99bSLiu Zhe 		//set paragraph tab stops
2259f0ca99bSLiu Zhe 		xCursorProps.setPropertyValue("ParaTabStops",tabStop);
2269f0ca99bSLiu Zhe 		//save to odt
2279f0ca99bSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
2289f0ca99bSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
2299f0ca99bSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
2309f0ca99bSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
2319f0ca99bSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
2329f0ca99bSLiu Zhe 		aStoreProperties_odt[0].Value = true;
2339f0ca99bSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
2349f0ca99bSLiu Zhe 		aStoreProperties_odt[1].Value = "writer8";
2359f0ca99bSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
2369f0ca99bSLiu Zhe 		//save to doc
2379f0ca99bSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
2389f0ca99bSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
2399f0ca99bSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
2409f0ca99bSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
2419f0ca99bSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
2429f0ca99bSLiu Zhe 		aStoreProperties_doc[0].Value = true;
2439f0ca99bSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
2449f0ca99bSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
2459f0ca99bSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
2469f0ca99bSLiu Zhe 		app.closeDocument(xTextDocument);
2479f0ca99bSLiu Zhe 
2489f0ca99bSLiu Zhe 		//reopen the document
2499f0ca99bSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
2509f0ca99bSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
2519f0ca99bSLiu Zhe 		Object paraTabs_obj_odt=xCursorProps_Assert_odt.getPropertyValue("ParaTabStops");
2529f0ca99bSLiu Zhe 		TabStop[] paraTabs_assert_odt=(TabStop[]) UnoRuntime.queryInterface(TabStop[].class, paraTabs_obj_odt);
2539f0ca99bSLiu Zhe 		//verify paragraph tabs
2549f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",TabAlign.DECIMAL,paraTabs_assert_odt[0].Alignment);
2559f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",'-',paraTabs_assert_odt[0].FillChar);
2569f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",5001,paraTabs_assert_odt[0].Position);
2579f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",'.',paraTabs_assert_odt[0].DecimalChar);
2589f0ca99bSLiu Zhe 
2599f0ca99bSLiu Zhe 		//reopen the document
2609f0ca99bSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
2619f0ca99bSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
2629f0ca99bSLiu Zhe 		TabStop[] paraTabs_assert_doc=(TabStop[]) UnoRuntime.queryInterface(TabStop[].class, xCursorProps_Assert_doc.getPropertyValue("ParaTabStops"));
2639f0ca99bSLiu Zhe 		//verify paragraph tabs
2649f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",TabAlign.DECIMAL,paraTabs_assert_doc[0].Alignment);
2659f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",'-',paraTabs_assert_doc[0].FillChar);
2669f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",5001,paraTabs_assert_doc[0].Position);
2679f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",'.',paraTabs_assert_doc[0].DecimalChar);
2689f0ca99bSLiu Zhe 	}
269af986861SLiu Zhe 	@Test@Ignore("Bug #120748 - [testUNO patch]the tabstops character of paragraph change to default when save to doc.")
2709f0ca99bSLiu Zhe 	public void ParagraphTabs_Decimal_UserDefineCharacter() throws Exception {
2719f0ca99bSLiu Zhe 
2729f0ca99bSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
2739f0ca99bSLiu Zhe 		xText = xTextDocument.getText();
2749f0ca99bSLiu Zhe 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!");
2759f0ca99bSLiu Zhe 		// create text cursor for selecting and formatting text
2769f0ca99bSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
2779f0ca99bSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
2789f0ca99bSLiu Zhe 		//paraTabStops.
2799f0ca99bSLiu Zhe 		TabStop[] tabStop=new TabStop[1];
2809f0ca99bSLiu Zhe 		tabStop[0]=new TabStop();
2819f0ca99bSLiu Zhe 		tabStop[0].Position=5001;
2829f0ca99bSLiu Zhe 		tabStop[0].Alignment=TabAlign.DECIMAL;
2839f0ca99bSLiu Zhe 		tabStop[0].DecimalChar='@';
2849f0ca99bSLiu Zhe 		tabStop[0].FillChar='%';
2859f0ca99bSLiu Zhe 		//set paragraph tab stops
2869f0ca99bSLiu Zhe 		xCursorProps.setPropertyValue("ParaTabStops",tabStop);
2879f0ca99bSLiu Zhe 		//save to odt
2889f0ca99bSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
2899f0ca99bSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
2909f0ca99bSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
2919f0ca99bSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
2929f0ca99bSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
2939f0ca99bSLiu Zhe 		aStoreProperties_odt[0].Value = true;
2949f0ca99bSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
2959f0ca99bSLiu Zhe 		aStoreProperties_odt[1].Value = "writer8";
2969f0ca99bSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
2979f0ca99bSLiu Zhe 		//save to doc
2989f0ca99bSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
2999f0ca99bSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
3009f0ca99bSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
3019f0ca99bSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
3029f0ca99bSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
3039f0ca99bSLiu Zhe 		aStoreProperties_doc[0].Value = true;
3049f0ca99bSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
3059f0ca99bSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
3069f0ca99bSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
3079f0ca99bSLiu Zhe 		app.closeDocument(xTextDocument);
3089f0ca99bSLiu Zhe 
3099f0ca99bSLiu Zhe 		//reopen the document
3109f0ca99bSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
3119f0ca99bSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
3129f0ca99bSLiu Zhe 		Object paraTabs_obj_odt=xCursorProps_Assert_odt.getPropertyValue("ParaTabStops");
3139f0ca99bSLiu Zhe 		TabStop[] paraTabs_assert_odt=(TabStop[]) UnoRuntime.queryInterface(TabStop[].class, paraTabs_obj_odt);
3149f0ca99bSLiu Zhe 		//verify paragraph tabs
3159f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",TabAlign.DECIMAL,paraTabs_assert_odt[0].Alignment);
3169f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",'%',paraTabs_assert_odt[0].FillChar);
3179f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",5001,paraTabs_assert_odt[0].Position);
3189f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",'@',paraTabs_assert_odt[0].DecimalChar);
3199f0ca99bSLiu Zhe 
3209f0ca99bSLiu Zhe 		//reopen the document
3219f0ca99bSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
3229f0ca99bSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
3239f0ca99bSLiu Zhe 		TabStop[] paraTabs_assert_doc=(TabStop[]) UnoRuntime.queryInterface(TabStop[].class, xCursorProps_Assert_doc.getPropertyValue("ParaTabStops"));
3249f0ca99bSLiu Zhe 		//verify paragraph tabs
3259f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",TabAlign.DECIMAL,paraTabs_assert_doc[0].Alignment);
3269f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",'%',paraTabs_assert_doc[0].FillChar);
3279f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",5001,paraTabs_assert_doc[0].Position);
3289f0ca99bSLiu Zhe 		assertEquals("assert paragraph tab setting",'@',paraTabs_assert_doc[0].DecimalChar);
3299f0ca99bSLiu Zhe 	}
3309f0ca99bSLiu Zhe }
331