Index: testuno/.externalToolBuilders/Classpath Builder.launch
===================================================================
--- testuno/.externalToolBuilders/Classpath Builder.launch (revision 1374160)
+++ testuno/.externalToolBuilders/Classpath Builder.launch (working copy)
@@ -1,16 +1,22 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: testuno/source/testcase/uno/sw/field/CheckDateTimeField.java
===================================================================
--- testuno/source/testcase/uno/sw/field/CheckDateTimeField.java (revision 1374160)
+++ testuno/source/testcase/uno/sw/field/CheckDateTimeField.java (working copy)
@@ -30,6 +30,7 @@
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.openoffice.test.common.FileUtil;
import org.openoffice.test.common.Testspace;
import org.openoffice.test.uno.UnoApp;
@@ -52,12 +53,12 @@
public class CheckDateTimeField {
- private static final UnoApp app = new UnoApp();
- private XTextDocument document = null;
private String tempPath = "testcase/uno/sw/temp/" ;
private String tempFileName = String.valueOf(System.currentTimeMillis());
+ private static final UnoApp app = new UnoApp();
+ private XTextDocument document = null;
@Before
public void setUpDocument() throws Exception {
document = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
@@ -66,7 +67,7 @@
@After
public void tearDownDocument() {
app.closeDocument(document);
- // FileUtil.deleteFile(Testspace.getFile(tempPath));
+ FileUtil.deleteFile(Testspace.getFile(tempPath));
}
@@ -89,10 +90,11 @@
* 2.Verify the Time is created by check the date hour in the new document
* 3.Save and close the new document to doc format
* 4.Reload the new save doc file, check the time field
+ * @throws Exception
*/
@Test
- public void testCreateTimeFieldSaveDoc() {
+ public void testCreateTimeFieldSaveDoc() throws Exception {
String url = Testspace.getUrl(tempPath + tempFileName + ".doc");
PropertyValue[] propsValue = new PropertyValue[1];
@@ -108,9 +110,10 @@
* 2.Verify the Time Field is created by check the date hour in the new document
* 3.Save and close the new document to doc format
* 4.Reload the new save odt file, check the Time Field
+ * @throws Exception
*/
@Test
- public void testCreateTimeFieldSaveODT() {
+ public void testCreateTimeFieldSaveODT() throws Exception {
String url = Testspace.getUrl(tempPath + tempFileName + ".odt");
PropertyValue[] propsValue = new PropertyValue[0];
@@ -118,51 +121,37 @@
}
- private void createTimeFiled(XTextDocument document, String url, PropertyValue[] propsValue) {
+ private void createTimeFiled(XTextDocument document, String url, PropertyValue[] propsValue) throws Exception {
XMultiServiceFactory sevriceFactory = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
- try {
- XTextField dateFiled = (XTextField)UnoRuntime.queryInterface(XTextField.class, sevriceFactory.createInstance("com.sun.star.text.textfield.DateTime"));
-
+ XTextField dateFiled = (XTextField)UnoRuntime.queryInterface(XTextField.class, sevriceFactory.createInstance("com.sun.star.text.textfield.DateTime"));
- XPropertySet props = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, dateFiled);
- props.setPropertyValue("IsDate", false);
-
- document.getText().insertTextContent(document.getText().getEnd(), dateFiled, false);
- DateTime dateField = (DateTime) props.getPropertyValue("DateTimeValue");
- String dateString = document.getText().getString();
- assertTrue("Verify time field is creatd, by verify it's hour", dateString.indexOf(String.valueOf(dateField.Hours).trim()) != -1);
- assertTrue("Verify time field is creatd, by verify it's minutes", dateString.indexOf(String.valueOf(dateField.Minutes).trim()) != -1);
- int expectHour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
- assertEquals("Verify time field is creatd, value is right, by compare Hour", expectHour, dateField.Hours);
- XStorable store = UnoRuntime.queryInterface(XStorable.class, document);
- store.storeAsURL(url, propsValue);
- app.closeDocument(document);
-
- try {
- document = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.loadDocumentFromURL(url));
- XTextFieldsSupplier fieldsSupplier = UnoRuntime.queryInterface(XTextFieldsSupplier.class, document);
- XEnumerationAccess xEnumeratedFields = fieldsSupplier.getTextFields();
- XEnumeration enumeration = xEnumeratedFields.createEnumeration();
- while (enumeration.hasMoreElements()) {
- Object field = enumeration.nextElement();
- XPropertySet props2 = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, field);
- DateTime dateField2 = (DateTime) props2.getPropertyValue("DateTimeValue");
- assertEquals("Verify time field is creatd correct by save and reload.", expectHour, dateField2.Hours);
- }
-
-
- } catch (Exception e) {
- e.printStackTrace();
- }
-
-
-
-
- } catch (com.sun.star.uno.Exception e) {
- e.printStackTrace();
+ XPropertySet props = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, dateFiled);
+ props.setPropertyValue("IsDate", false);
+
+ document.getText().insertTextContent(document.getText().getEnd(), dateFiled, false);
+ DateTime dateField = (DateTime) props.getPropertyValue("DateTimeValue");
+
+ String dateString = document.getText().getString();
+ assertTrue("Verify time field is creatd, by verify it's hour", dateString.indexOf(String.valueOf(dateField.Hours).trim()) != -1);
+ assertTrue("Verify time field is creatd, by verify it's minutes", dateString.indexOf(String.valueOf(dateField.Minutes).trim()) != -1);
+ int expectHour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
+ assertEquals("Verify time field is creatd, value is right, by compare Hour", expectHour, dateField.Hours);
+ XStorable store = UnoRuntime.queryInterface(XStorable.class, document);
+ store.storeAsURL(url, propsValue);
+ app.closeDocument(document);
+ document = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.loadDocumentFromURL(url));
+ XTextFieldsSupplier fieldsSupplier = UnoRuntime.queryInterface(XTextFieldsSupplier.class, document);
+ XEnumerationAccess xEnumeratedFields = fieldsSupplier.getTextFields();
+ XEnumeration enumeration = xEnumeratedFields.createEnumeration();
+ while (enumeration.hasMoreElements()) {
+ Object field = enumeration.nextElement();
+ XPropertySet props2 = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, field);
+ DateTime dateField2 = (DateTime) props2.getPropertyValue("DateTimeValue");
+ assertEquals("Verify time field is creatd correct by save and reload.", expectHour, dateField2.Hours);
}
+
}
/**
* Test Date Field can be created correctly.
@@ -170,10 +159,11 @@
* 2.Verify the Date is created by check the date hour in the new document
* 3.Save and close the new document to doc format
* 4.Reload the new save doc file, check the Date field
+ * @throws Exception
*/
@Test
- public void testCreateDateFieldSaveDoc() {
+ public void testCreateDateFieldSaveDoc() throws Exception {
String url = Testspace.getUrl(tempPath + tempFileName + ".doc");
PropertyValue[] propsValue = new PropertyValue[1];
@@ -189,56 +179,44 @@
* 2.Verify the dateField is created by check the date hour in the new document
* 3.Save and close the new document to doc format
* 4.Reload the new save odt file, check the date field
+ * @throws Exception
*/
@Test
- public void testCreateDateFieldSaveODT() {
+ public void testCreateDateFieldSaveODT() throws Exception {
String url = Testspace.getUrl(tempPath + tempFileName + ".odt");
PropertyValue[] propsValue = new PropertyValue[0];
createDateFiled(document, url, propsValue);
}
- private void createDateFiled(XTextDocument document, String url, PropertyValue[] propsValue) {
+ private void createDateFiled(XTextDocument document, String url, PropertyValue[] propsValue) throws Exception {
XMultiServiceFactory sevriceFactory = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
- try {
- XTextField dateFiled = (XTextField)UnoRuntime.queryInterface(XTextField.class, sevriceFactory.createInstance("com.sun.star.text.textfield.DateTime"));
-
+ XTextField dateFiled = (XTextField)UnoRuntime.queryInterface(XTextField.class, sevriceFactory.createInstance("com.sun.star.text.textfield.DateTime"));
- XPropertySet props = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, dateFiled);
- props.setPropertyValue("IsDate", true);
-
- document.getText().insertTextContent(document.getText().getEnd(), dateFiled, false);
- DateTime dateField = (DateTime) props.getPropertyValue("DateTimeValue");
- String dateString = document.getText().getString();
- assertTrue("Verify date field is creatd, by verify it's Month", dateString.indexOf(String.valueOf(dateField.Month).trim()) != -1);
- assertTrue("Verify date field is creatd, by verify it's Day", dateString.indexOf(String.valueOf(dateField.Day).trim()) != -1);
- int expectDay = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
- assertEquals("Verify date field is creatd, value is right, by compare Day", expectDay, dateField.Day);
- XStorable store = UnoRuntime.queryInterface(XStorable.class, document);
- store.storeAsURL(url, propsValue);
- app.closeDocument(document);
-
- try {
- document = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.loadDocumentFromURL(url));
- XTextFieldsSupplier fieldsSupplier = UnoRuntime.queryInterface(XTextFieldsSupplier.class, document);
- XEnumerationAccess xEnumeratedFields = fieldsSupplier.getTextFields();
- XEnumeration enumeration = xEnumeratedFields.createEnumeration();
- while (enumeration.hasMoreElements()) {
- Object field = enumeration.nextElement();
- XPropertySet props2 = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, field);
- DateTime dateField2 = (DateTime) props2.getPropertyValue("DateTimeValue");
- assertEquals("Verify date field is creatd correct by save and reload.", expectDay, dateField2.Day);
- }
-
-
- } catch (Exception e) {
- e.printStackTrace();
- }
-
-
- } catch (com.sun.star.uno.Exception e) {
- e.printStackTrace();
+ XPropertySet props = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, dateFiled);
+ props.setPropertyValue("IsDate", true);
+
+ document.getText().insertTextContent(document.getText().getEnd(), dateFiled, false);
+ DateTime dateField = (DateTime) props.getPropertyValue("DateTimeValue");
+
+ String dateString = document.getText().getString();
+ assertTrue("Verify date field is creatd, by verify it's Month", dateString.indexOf(String.valueOf(dateField.Month).trim()) != -1);
+ assertTrue("Verify date field is creatd, by verify it's Day", dateString.indexOf(String.valueOf(dateField.Day).trim()) != -1);
+ int expectDay = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
+ assertEquals("Verify date field is creatd, value is right, by compare Day", expectDay, dateField.Day);
+ XStorable store = UnoRuntime.queryInterface(XStorable.class, document);
+ store.storeAsURL(url, propsValue);
+ app.closeDocument(document);
+ document = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.loadDocumentFromURL(url));
+ XTextFieldsSupplier fieldsSupplier = UnoRuntime.queryInterface(XTextFieldsSupplier.class, document);
+ XEnumerationAccess xEnumeratedFields = fieldsSupplier.getTextFields();
+ XEnumeration enumeration = xEnumeratedFields.createEnumeration();
+ while (enumeration.hasMoreElements()) {
+ Object field = enumeration.nextElement();
+ XPropertySet props2 = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, field);
+ DateTime dateField2 = (DateTime) props2.getPropertyValue("DateTimeValue");
+ assertEquals("Verify date field is creatd correct by save and reload.", expectDay, dateField2.Day);
}
}
Index: testuno/source/testcase/uno/sw/field/PageNumberField.java
===================================================================
--- testuno/source/testcase/uno/sw/field/PageNumberField.java (revision 0)
+++ testuno/source/testcase/uno/sw/field/PageNumberField.java (working copy)
@@ -0,0 +1,205 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+package testcase.uno.sw.field;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Collection;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.openoffice.test.common.FileUtil;
+import org.openoffice.test.common.Testspace;
+import org.openoffice.test.uno.UnoApp;
+
+import testlib.uno.sw.SWUtil;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XEnumeration;
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.frame.XStorable;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextField;
+import com.sun.star.text.XTextFieldsSupplier;
+import com.sun.star.text.XTextRange;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.DateTime;
+
+
+public class PageNumberField {
+
+ private static final UnoApp app = new UnoApp();
+ private static XTextDocument odtDocument = null;
+ private static XTextDocument docDocument = null;
+ private static String odtSample = "testcase/uno/sw/field/PageNumberFieldTest.odt";
+ private static String odtSampleWorking = "";
+ private static String docSample = "testcase/uno/sw/field/PageNumberFieldTest.doc";
+ private static String docSampleWorking = "";
+
+ private static String odtSaveAsDocSample = "testcase/uno/sw/field/PageNumberFieldTest_1.doc";
+ private static String docSaveAsODTSample = "testcase/uno/sw/field/PageNumberFieldTest_1.odt";
+
+ @Before
+ public void setUpDocument() throws Exception {
+
+ }
+
+ @After
+ public void tearDownDocument() {
+
+
+ }
+ @BeforeClass
+ public static void setUpConnection() throws Exception {
+ app.start();
+ }
+
+
+ @AfterClass
+ public static void tearDownConnection() throws InterruptedException,
+ Exception {
+ app.close();
+ }
+ /**
+ * There is a bug : Bug 120625
+ * Test Page Number Field Can created and Saved in odt file
+ * 1.launch a odt document
+ * 2.Create a page number field at end of this page
+ * 3.Save and Reopen this document
+ * @throws Throwable
+ */
+ @Test
+ public void testPageNumberFieldODT() throws Throwable {
+ odtSampleWorking = Testspace.prepareData(odtSample);
+ odtDocument = SWUtil.openDocument(odtSampleWorking, app);
+ createPageNumberFiled(odtDocument, 3, "odt");
+ app.closeDocument(odtDocument);
+ }
+
+ /**
+ * Bug 120625
+ * Test Page Number Field Can created and Saved in Doc file
+ * 1.launch a doc document
+ * 2.Create a page number field at end of this page
+ * 3.Save and Reopen this document, check page number field
+ * @throws Throwable
+ */
+ @Test
+ public void testPageNumberFieldDOC() throws Throwable {
+ docSampleWorking = Testspace.prepareData(docSample);
+ docDocument = SWUtil.openDocument(docSampleWorking, app);
+ createPageNumberFiled(docDocument, 2, "odt");
+ app.closeDocument(docDocument);
+ }
+
+ /**
+ * Test Page Number Field in odt file save to doc format works well
+ * 1.Launch the new saved file
+ * 2.Check page number filed.
+ * @throws Throwable
+ */
+ @Test
+ public void testSavedDoc2ODTPageNumberField() throws Throwable {
+ odtDocument = SWUtil.openDocumentFromURL(Testspace.getUrl(docSaveAsODTSample), app);
+ getPageNumberField(odtDocument, 2);
+ app.closeDocument(odtDocument);
+ }
+
+ /**
+ * Test Page Number Field in doc file save to odt format works well
+ * 1.Launch the new saved file
+ * 2.Check page number filed.
+ * @throws Throwable
+ */
+ @Test
+ public void testSavedODT2DOCPageNumberField() throws Throwable {
+ docDocument = SWUtil.openDocumentFromURL(Testspace.getUrl(odtSaveAsDocSample), app);
+ getPageNumberField(docDocument, 2);
+ app.closeDocument(docDocument);
+ }
+
+ private void createPageNumberFiled(XTextDocument document, int expectNumber, String saveAsFormat) throws Exception {
+ XMultiServiceFactory sevriceFactory = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
+ XTextField pageNumberFiled = (XTextField)UnoRuntime.queryInterface(XTextField.class, sevriceFactory.createInstance("com.sun.star.text.textfield.PageNumber"));
+
+ XPropertySet props = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, pageNumberFiled);
+ props.setPropertyValue("NumberingType", 4);//Set page number display as Arabic
+
+
+ SWUtil.moveCuror2End(document);
+ document.getText().insertTextContent(document.getText().getEnd(), pageNumberFiled, true);
+
+ String documentString = document.getText().getString().trim();
+ int length = documentString.length();
+ String strNum = String.valueOf(documentString.charAt(length -1));
+ int number = Integer.valueOf(strNum);
+ assertEquals("Test Page Number field can insert correctly", expectNumber, number);
+ SWUtil.save(document);
+ if("odt".equals(saveAsFormat)) {
+ SWUtil.saveAsDoc(document, Testspace.getUrl(odtSaveAsDocSample));
+
+
+ } else if ("doc".equals(saveAsFormat)) {
+ SWUtil.saveAsDoc(document, Testspace.getUrl(docSaveAsODTSample));
+
+ }
+ app.closeDocument(document);
+
+ //Verify after save.
+ document = SWUtil.openDocument(odtSampleWorking, app);
+
+ getPageNumberField(document, expectNumber);
+
+
+ }
+
+ private void getPageNumberField(XTextDocument document, int expectNumber) throws Exception {
+ XTextFieldsSupplier fieldsSupplier = UnoRuntime.queryInterface(XTextFieldsSupplier.class, document);
+ XEnumerationAccess xEnumeratedFields = fieldsSupplier.getTextFields();
+ XEnumeration enumeration = xEnumeratedFields.createEnumeration();
+ while (enumeration.hasMoreElements()) {
+ Object field = enumeration.nextElement();
+ XPropertySet props = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, field);
+ short numberType = (Short) props.getPropertyValue("NumberingType");
+ assertEquals("Verify page number field type is Arabic", 4, numberType);
+
+ }
+
+ String documentString = document.getText().getString().trim();
+ int length = documentString.length();
+ String strNum = String.valueOf(documentString.charAt(length -1));
+ int number = Integer.valueOf(strNum);
+ assertEquals("Test Page Number field can insert and saved correctly", expectNumber, number);
+
+
+ }
+}
Index: testuno/source/testcase/uno/sw/field/PageNumberFieldTest.doc
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: testuno/source/testcase/uno/sw/field/PageNumberFieldTest.doc
===================================================================
--- testuno/source/testcase/uno/sw/field/PageNumberFieldTest.doc (revision 0)
+++ testuno/source/testcase/uno/sw/field/PageNumberFieldTest.doc (working copy)
Property changes on: testuno/source/testcase/uno/sw/field/PageNumberFieldTest.doc
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: testuno/source/testcase/uno/sw/field/PageNumberFieldTest.odt
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: testuno/source/testcase/uno/sw/field/PageNumberFieldTest.odt
===================================================================
--- testuno/source/testcase/uno/sw/field/PageNumberFieldTest.odt (revision 0)
+++ testuno/source/testcase/uno/sw/field/PageNumberFieldTest.odt (working copy)
Property changes on: testuno/source/testcase/uno/sw/field/PageNumberFieldTest.odt
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: testuno/source/testlib/uno/sw/SWUtil.java
===================================================================
--- testuno/source/testlib/uno/sw/SWUtil.java (revision 1374160)
+++ testuno/source/testlib/uno/sw/SWUtil.java (working copy)
@@ -5,41 +5,64 @@
import com.sun.star.beans.PropertyValue;
import com.sun.star.frame.XStorable;
import com.sun.star.io.IOException;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextCursor;
import com.sun.star.text.XTextDocument;
import com.sun.star.uno.UnoRuntime;
public class SWUtil {
- private static final UnoApp app = new UnoApp();
- public static void saveAsDoc(XTextDocument document, String url) {
+
+ public static void saveAsDoc(XTextDocument document, String url) throws IOException {
saveAs(document, "MS Word 97", url);
}
- public static void saveAsODT(XTextDocument document, String url) {
+ public static void saveAsODT(XTextDocument document, String url) throws IOException {
saveAs(document, "writer8", url);
}
-
- public static void saveAs(XTextDocument document, String filterValue, String url) {
+
+ public static void save(XTextDocument document) throws IOException {
XStorable store = UnoRuntime.queryInterface(XStorable.class, document);
+ store.store();
+ }
+
+ public static void saveAs(XTextDocument document, String filterValue, String url) throws IOException {
+ XStorable store = UnoRuntime.queryInterface(XStorable.class, document);
+
PropertyValue[] propsValue = new PropertyValue[1];
propsValue[0] = new PropertyValue();
propsValue[0].Name = "FilterName";
propsValue[0].Value = filterValue;
- try {
- store.storeAsURL(url, propsValue);
- } catch (IOException e) {
- e.printStackTrace();
- }
+ store.storeAsURL(url, propsValue);
+
}
- public static XTextDocument newDocument() {
- try {
- return (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
+ public static XTextDocument newDocument(UnoApp app) throws Exception {
+ return (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+
}
+
+ public static XTextDocument openDocumentFromURL(String url, UnoApp app) throws Exception {
+ return (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.loadDocumentFromURL(url));
+
+ }
+
+ public static XTextDocument openDocument(String filePath, UnoApp app) throws Exception {
+
+ return (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(filePath));
+
+ }
+ public static void moveCuror2End(XTextDocument document) {
+ XText xText = document.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ xTextCursor.gotoEnd(false);
+ }
+
+ public static void moveCuror2Start(XTextDocument document) {
+ XText xText = document.getText();
+ XTextCursor xTextCursor = xText.createTextCursor();
+ xTextCursor.gotoStart(false);
+ }
}