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