1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir package complex.calcPreview; 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir // import complexlib.ComplexTestCase; 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir import com.sun.star.awt.XWindow; 33*cdf0e10cSrcweir import com.sun.star.container.XIndexAccess; 34*cdf0e10cSrcweir import com.sun.star.frame.XController; 35*cdf0e10cSrcweir import com.sun.star.frame.XDispatch; 36*cdf0e10cSrcweir import com.sun.star.frame.XDispatchProvider; 37*cdf0e10cSrcweir import com.sun.star.frame.XModel; 38*cdf0e10cSrcweir // import com.sun.star.lang.XComponent; 39*cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory; 40*cdf0e10cSrcweir import com.sun.star.sheet.XSpreadsheet; 41*cdf0e10cSrcweir // import com.sun.star.sheet.XSpreadsheetDocument; 42*cdf0e10cSrcweir import com.sun.star.sheet.XSpreadsheets; 43*cdf0e10cSrcweir import com.sun.star.table.XCell; 44*cdf0e10cSrcweir // import com.sun.star.uno.Any; 45*cdf0e10cSrcweir import com.sun.star.uno.AnyConverter; 46*cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime; 47*cdf0e10cSrcweir import com.sun.star.uno.XInterface; 48*cdf0e10cSrcweir import com.sun.star.util.URL; 49*cdf0e10cSrcweir import com.sun.star.util.XURLTransformer; 50*cdf0e10cSrcweir import com.sun.star.accessibility.AccessibleRole; 51*cdf0e10cSrcweir import com.sun.star.accessibility.XAccessible; 52*cdf0e10cSrcweir import com.sun.star.accessibility.XAccessibleText; 53*cdf0e10cSrcweir import com.sun.star.accessibility.XAccessibleValue; 54*cdf0e10cSrcweir import com.sun.star.accessibility.XAccessibleComponent; 55*cdf0e10cSrcweir import com.sun.star.accessibility.XAccessibleContext; 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir import util.AccessibilityTools; 58*cdf0e10cSrcweir import util.SOfficeFactory; 59*cdf0e10cSrcweir import util.utils; 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir import com.sun.star.beans.XPropertySet; 62*cdf0e10cSrcweir // import com.sun.star.beans.XPropertySetInfo; 63*cdf0e10cSrcweir import com.sun.star.container.XNameAccess; 64*cdf0e10cSrcweir import com.sun.star.lang.XComponent; 65*cdf0e10cSrcweir import com.sun.star.sheet.XHeaderFooterContent; 66*cdf0e10cSrcweir import com.sun.star.sheet.XSpreadsheetDocument; 67*cdf0e10cSrcweir import com.sun.star.style.XStyle; 68*cdf0e10cSrcweir import com.sun.star.style.XStyleFamiliesSupplier; 69*cdf0e10cSrcweir import com.sun.star.text.XText; 70*cdf0e10cSrcweir // import com.sun.star.drawing.XDrawPageSupplier; 71*cdf0e10cSrcweir // import com.sun.star.drawing.XDrawPage; 72*cdf0e10cSrcweir // import com.sun.star.drawing.XShape; 73*cdf0e10cSrcweir // import com.sun.star.drawing.XShapes; 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir // import com.sun.star.beans.Property; 77*cdf0e10cSrcweir // import com.sun.star.lang.XServiceInfo; 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir // import org.junit.After; 82*cdf0e10cSrcweir import org.junit.AfterClass; 83*cdf0e10cSrcweir import org.junit.Before; 84*cdf0e10cSrcweir import org.junit.BeforeClass; 85*cdf0e10cSrcweir import org.junit.Test; 86*cdf0e10cSrcweir import org.openoffice.test.OfficeConnection; 87*cdf0e10cSrcweir import static org.junit.Assert.*; 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir /** 90*cdf0e10cSrcweir * A complex test for the preview of Calc documents. This complex test 91*cdf0e10cSrcweir * needs interaction from the user: documents have to be resized and moved. 92*cdf0e10cSrcweir */ 93*cdf0e10cSrcweir public class ViewForwarder { 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir /** The MultiServiceFactory **/ 96*cdf0e10cSrcweir private XMultiServiceFactory mXMSF = null; 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir /** Get all test methods. 99*cdf0e10cSrcweir * @return The test methods. 100*cdf0e10cSrcweir */ 101*cdf0e10cSrcweir // public String[] getTestMethodNames() { 102*cdf0e10cSrcweir // return new String[]{"checkPositiveViewForwarder", 103*cdf0e10cSrcweir // "checkNegativeViewForwarder", 104*cdf0e10cSrcweir // "checkPreviewHeaderCells", 105*cdf0e10cSrcweir // "checkPreviewShape" 106*cdf0e10cSrcweir // }; 107*cdf0e10cSrcweir // } 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir /** 110*cdf0e10cSrcweir * Get a MultiServiceFactory from the Office before the test. 111*cdf0e10cSrcweir */ 112*cdf0e10cSrcweir @Before public void before() 113*cdf0e10cSrcweir { 114*cdf0e10cSrcweir mXMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); 115*cdf0e10cSrcweir // SOfficeFactory SOF = SOfficeFactory.getFactory(mXMSF); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir // param = new TestParameters(); 118*cdf0e10cSrcweir // param.put("ServiceFactory", xMsf); 119*cdf0e10cSrcweir // mXMSF = (XMultiServiceFactory)param.getMSF(); 120*cdf0e10cSrcweir } 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir /** Create a spreadsheet document, insert some text, header and footer. 124*cdf0e10cSrcweir * Let the user resize the document and check the contents. 125*cdf0e10cSrcweir */ 126*cdf0e10cSrcweir @Test public void checkPositiveViewForwarder() { 127*cdf0e10cSrcweir SOfficeFactory SOF = SOfficeFactory.getFactory( mXMSF ); 128*cdf0e10cSrcweir XSpreadsheetDocument xSpreadsheetDoc = null; 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir try { 131*cdf0e10cSrcweir System.out.println("Creating a spreadsheet document"); 132*cdf0e10cSrcweir xSpreadsheetDoc = SOF.createCalcDoc(null); 133*cdf0e10cSrcweir } catch (com.sun.star.uno.Exception e) { 134*cdf0e10cSrcweir fail(e.getMessage()); 135*cdf0e10cSrcweir return; 136*cdf0e10cSrcweir } 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir XInterface oObj = null; 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir // inserting some content to have non-empty page preview 141*cdf0e10cSrcweir XCell xCell = null; 142*cdf0e10cSrcweir try { 143*cdf0e10cSrcweir XSpreadsheets oSheets = xSpreadsheetDoc.getSheets() ; 144*cdf0e10cSrcweir XIndexAccess oIndexSheets = 145*cdf0e10cSrcweir UnoRuntime.queryInterface(XIndexAccess.class, oSheets); 146*cdf0e10cSrcweir Object o = oIndexSheets.getByIndex(0); 147*cdf0e10cSrcweir XSpreadsheet oSheet = (XSpreadsheet)AnyConverter.toObject( 148*cdf0e10cSrcweir new com.sun.star.uno.Type(XSpreadsheet.class), o); 149*cdf0e10cSrcweir xCell = oSheet.getCellByPosition(0, 0) ; 150*cdf0e10cSrcweir xCell.setFormula("ScAccessiblePageHeader"); 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir xCell = oSheet.getCellByPosition(0, 1) ; 153*cdf0e10cSrcweir xCell.setFormula("Cell 1"); 154*cdf0e10cSrcweir xCell = oSheet.getCellByPosition(0, 2) ; 155*cdf0e10cSrcweir xCell.setFormula("Cell 2"); 156*cdf0e10cSrcweir } catch(com.sun.star.lang.IllegalArgumentException e) { 157*cdf0e10cSrcweir System.out.println("Exception ceating relation :"); 158*cdf0e10cSrcweir fail(e.getMessage()); 159*cdf0e10cSrcweir } catch(com.sun.star.lang.WrappedTargetException e) { 160*cdf0e10cSrcweir System.out.println("Exception ceating relation :"); 161*cdf0e10cSrcweir fail(e.getMessage()); 162*cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 163*cdf0e10cSrcweir System.out.println("Exception ceating relation :"); 164*cdf0e10cSrcweir fail(e.getMessage()); 165*cdf0e10cSrcweir } 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir XModel aModel = 168*cdf0e10cSrcweir UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc); 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir XController xController = aModel.getCurrentController(); 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir // get page styles 173*cdf0e10cSrcweir XStyleFamiliesSupplier StyleFam = 174*cdf0e10cSrcweir UnoRuntime.queryInterface( 175*cdf0e10cSrcweir XStyleFamiliesSupplier.class, 176*cdf0e10cSrcweir xSpreadsheetDoc ); 177*cdf0e10cSrcweir XNameAccess StyleFamNames = StyleFam.getStyleFamilies(); 178*cdf0e10cSrcweir XStyle StdStyle = null; 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir try{ 181*cdf0e10cSrcweir Object o = StyleFamNames.getByName("PageStyles"); 182*cdf0e10cSrcweir XNameAccess PageStyles = (XNameAccess)AnyConverter.toObject( 183*cdf0e10cSrcweir new com.sun.star.uno.Type(XNameAccess.class), o); 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir o = PageStyles.getByName("Default"); 186*cdf0e10cSrcweir StdStyle = (XStyle)AnyConverter.toObject( 187*cdf0e10cSrcweir new com.sun.star.uno.Type(XStyle.class), o); 188*cdf0e10cSrcweir } catch(com.sun.star.lang.IllegalArgumentException e) { 189*cdf0e10cSrcweir fail(e.getMessage()); 190*cdf0e10cSrcweir } catch(com.sun.star.lang.WrappedTargetException e){ 191*cdf0e10cSrcweir fail(e.getMessage()); 192*cdf0e10cSrcweir return; 193*cdf0e10cSrcweir } catch(com.sun.star.container.NoSuchElementException e){ 194*cdf0e10cSrcweir fail(e.getMessage()); 195*cdf0e10cSrcweir return; 196*cdf0e10cSrcweir } 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir //get the property-set 199*cdf0e10cSrcweir final XPropertySet PropSet = 200*cdf0e10cSrcweir UnoRuntime.queryInterface(XPropertySet.class, StdStyle); 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir XHeaderFooterContent RPHFC = null; 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir // get the header 205*cdf0e10cSrcweir try { 206*cdf0e10cSrcweir Object o = PropSet.getPropertyValue("RightPageHeaderContent"); 207*cdf0e10cSrcweir RPHFC = (XHeaderFooterContent)AnyConverter.toObject( 208*cdf0e10cSrcweir new com.sun.star.uno.Type(XHeaderFooterContent.class), o); 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir } catch(com.sun.star.lang.IllegalArgumentException e) { 211*cdf0e10cSrcweir fail(e.getMessage()); 212*cdf0e10cSrcweir } catch(com.sun.star.lang.WrappedTargetException e){ 213*cdf0e10cSrcweir fail(e.getMessage()); 214*cdf0e10cSrcweir return; 215*cdf0e10cSrcweir } catch(com.sun.star.beans.UnknownPropertyException e){ 216*cdf0e10cSrcweir fail(e.getMessage()); 217*cdf0e10cSrcweir return; 218*cdf0e10cSrcweir } 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir // insert text into header 221*cdf0e10cSrcweir XText center = RPHFC.getCenterText(); 222*cdf0e10cSrcweir center.setString("First line \n\r Second line \n\r third line "); 223*cdf0e10cSrcweir try { 224*cdf0e10cSrcweir PropSet.setPropertyValue("RightPageHeaderContent",RPHFC); 225*cdf0e10cSrcweir } catch (com.sun.star.beans.UnknownPropertyException e) { 226*cdf0e10cSrcweir } catch (com.sun.star.beans.PropertyVetoException e) { 227*cdf0e10cSrcweir } catch (com.sun.star.lang.IllegalArgumentException e) { 228*cdf0e10cSrcweir } catch (com.sun.star.lang.WrappedTargetException e) {} 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir // get footer 231*cdf0e10cSrcweir RPHFC = null; 232*cdf0e10cSrcweir try { 233*cdf0e10cSrcweir Object o = PropSet.getPropertyValue("RightPageHeaderContent"); 234*cdf0e10cSrcweir RPHFC = (XHeaderFooterContent)AnyConverter.toObject( 235*cdf0e10cSrcweir new com.sun.star.uno.Type(XHeaderFooterContent.class), o); 236*cdf0e10cSrcweir } catch(com.sun.star.lang.IllegalArgumentException e) { 237*cdf0e10cSrcweir fail(e.getMessage()); 238*cdf0e10cSrcweir } catch(com.sun.star.lang.WrappedTargetException e){ 239*cdf0e10cSrcweir fail(e.getMessage()); 240*cdf0e10cSrcweir return; 241*cdf0e10cSrcweir } catch(com.sun.star.beans.UnknownPropertyException e){ 242*cdf0e10cSrcweir fail(e.getMessage()); 243*cdf0e10cSrcweir return; 244*cdf0e10cSrcweir } 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir // insert text into footer 247*cdf0e10cSrcweir center = RPHFC.getCenterText(); 248*cdf0e10cSrcweir center.setString("Third last line\n\r Second last line\n\r last line"); 249*cdf0e10cSrcweir try { 250*cdf0e10cSrcweir PropSet.setPropertyValue("RightPageFooterContent",RPHFC); 251*cdf0e10cSrcweir } catch (com.sun.star.beans.UnknownPropertyException e) { 252*cdf0e10cSrcweir } catch (com.sun.star.beans.PropertyVetoException e) { 253*cdf0e10cSrcweir } catch (com.sun.star.lang.IllegalArgumentException e) { 254*cdf0e10cSrcweir } catch (com.sun.star.lang.WrappedTargetException e) {} 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir // switching to 'Page Preview' mode 257*cdf0e10cSrcweir try { 258*cdf0e10cSrcweir XDispatchProvider xDispProv = 259*cdf0e10cSrcweir UnoRuntime.queryInterface(XDispatchProvider.class, xController); 260*cdf0e10cSrcweir XURLTransformer xParser = 261*cdf0e10cSrcweir UnoRuntime.queryInterface(XURLTransformer.class, 262*cdf0e10cSrcweir mXMSF.createInstance("com.sun.star.util.URLTransformer")); 263*cdf0e10cSrcweir // Because it's an in/out parameter we must use an 264*cdf0e10cSrcweir // array of URL objects. 265*cdf0e10cSrcweir URL[] aParseURL = new URL[1]; 266*cdf0e10cSrcweir aParseURL[0] = new URL(); 267*cdf0e10cSrcweir aParseURL[0].Complete = ".uno:PrintPreview"; 268*cdf0e10cSrcweir xParser.parseStrict(aParseURL); 269*cdf0e10cSrcweir URL aURL = aParseURL[0]; 270*cdf0e10cSrcweir XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); 271*cdf0e10cSrcweir if(xDispatcher != null) 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir xDispatcher.dispatch( aURL, null ); 274*cdf0e10cSrcweir } 275*cdf0e10cSrcweir } catch (com.sun.star.uno.Exception e) { 276*cdf0e10cSrcweir fail("Couldn't change mode"); 277*cdf0e10cSrcweir return; 278*cdf0e10cSrcweir } 279*cdf0e10cSrcweir 280*cdf0e10cSrcweir try { 281*cdf0e10cSrcweir Thread.sleep(500); 282*cdf0e10cSrcweir } catch (InterruptedException ex) {} 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir System.out.println("Press any key after resizing "); 285*cdf0e10cSrcweir try{ 286*cdf0e10cSrcweir byte[]b = new byte[16]; 287*cdf0e10cSrcweir System.in.read(b); 288*cdf0e10cSrcweir } catch (Exception e) { 289*cdf0e10cSrcweir e.printStackTrace(); 290*cdf0e10cSrcweir } 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir // get the accessible content 293*cdf0e10cSrcweir AccessibilityTools at = new AccessibilityTools(); 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir XWindow xWindow = at.getCurrentWindow(mXMSF, aModel); 296*cdf0e10cSrcweir XAccessible xRoot = at.getAccessibleObject(xWindow); 297*cdf0e10cSrcweir XAccessible parent = null; 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir try { 300*cdf0e10cSrcweir parent = at.getAccessibleObjectForRole 301*cdf0e10cSrcweir (xRoot, AccessibleRole.HEADER, "").getAccessibleChild(0); 302*cdf0e10cSrcweir oObj = parent.getAccessibleContext().getAccessibleChild(0); 303*cdf0e10cSrcweir } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { 304*cdf0e10cSrcweir fail(iabe.getMessage()); 305*cdf0e10cSrcweir return; 306*cdf0e10cSrcweir } 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir System.out.println("ImplementationName " + utils.getImplName(oObj)); 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir XAccessibleComponent accPC = 311*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleComponent.class, parent); 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir System.out.println("Parent-BoundsX= "+accPC.getBounds().X); 314*cdf0e10cSrcweir System.out.println("Parent-BoundsY= "+accPC.getBounds().Y); 315*cdf0e10cSrcweir System.out.println("Parent-BoundsWidth= "+accPC.getBounds().Width); 316*cdf0e10cSrcweir System.out.println("Parent-BoundsHeight= "+accPC.getBounds().Height); 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir XAccessibleComponent accPPC = 319*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleComponent.class, 320*cdf0e10cSrcweir parent.getAccessibleContext().getAccessibleParent()); 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir System.out.println("P-Parent-BoundsX= "+accPPC.getBounds().X); 323*cdf0e10cSrcweir System.out.println("P-Parent-BoundsY= "+accPPC.getBounds().Y); 324*cdf0e10cSrcweir System.out.println("P-Parent-BoundsWidth= "+accPPC.getBounds().Width); 325*cdf0e10cSrcweir System.out.println("P-Parent-BoundsHeight= "+accPPC.getBounds().Height); 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir try { 328*cdf0e10cSrcweir Thread.sleep(500); 329*cdf0e10cSrcweir } catch (InterruptedException ex) {} 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir System.out.println("Press any key when the second line is on top"); 332*cdf0e10cSrcweir try{ 333*cdf0e10cSrcweir byte[]b = new byte[16]; 334*cdf0e10cSrcweir System.in.read(b); 335*cdf0e10cSrcweir } catch (Exception e) { 336*cdf0e10cSrcweir e.printStackTrace(); 337*cdf0e10cSrcweir } 338*cdf0e10cSrcweir 339*cdf0e10cSrcweir try { 340*cdf0e10cSrcweir System.out.println("ChildCount: "+ 341*cdf0e10cSrcweir parent.getAccessibleContext().getAccessibleChildCount()); 342*cdf0e10cSrcweir System.out.println("Getting child 0 again"); 343*cdf0e10cSrcweir oObj = parent.getAccessibleContext().getAccessibleChild(0); 344*cdf0e10cSrcweir } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { 345*cdf0e10cSrcweir fail(iabe.getMessage()); 346*cdf0e10cSrcweir return; 347*cdf0e10cSrcweir } 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir XAccessibleText accT = 350*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleText.class, oObj); 351*cdf0e10cSrcweir System.out.println("Getting the text: "+accT.getText()); 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir XAccessibleComponent accC = 354*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleComponent.class, oObj); 355*cdf0e10cSrcweir System.out.println("BoundsX= "+accC.getBounds().X); 356*cdf0e10cSrcweir System.out.println("BoundsY= "+accC.getBounds().Y); 357*cdf0e10cSrcweir System.out.println("BoundsWidth= "+accC.getBounds().Width); 358*cdf0e10cSrcweir System.out.println("BoundsHeight= "+accC.getBounds().Height); 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir accPC = 361*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleComponent.class, parent); 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir System.out.println("Parent-BoundsX= "+accPC.getBounds().X); 364*cdf0e10cSrcweir System.out.println("Parent-BoundsY= "+accPC.getBounds().Y); 365*cdf0e10cSrcweir System.out.println("Parent-BoundsWidth= "+accPC.getBounds().Width); 366*cdf0e10cSrcweir System.out.println("Parent-BoundsHeight= "+accPC.getBounds().Height); 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir accPPC = 369*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleComponent.class, 370*cdf0e10cSrcweir parent.getAccessibleContext().getAccessibleParent()); 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir System.out.println("P-Parent-BoundsX= "+accPPC.getBounds().X); 373*cdf0e10cSrcweir System.out.println("P-Parent-BoundsY= "+accPPC.getBounds().Y); 374*cdf0e10cSrcweir System.out.println("P-Parent-BoundsWidth= "+accPPC.getBounds().Width); 375*cdf0e10cSrcweir System.out.println("P-Parent-BoundsHeight= "+accPPC.getBounds().Height); 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir System.out.println("Press any key when the footer is visible."); 380*cdf0e10cSrcweir try{ 381*cdf0e10cSrcweir byte[]b = new byte[16]; 382*cdf0e10cSrcweir System.in.read(b); 383*cdf0e10cSrcweir } catch (Exception e) { 384*cdf0e10cSrcweir e.printStackTrace(); 385*cdf0e10cSrcweir } 386*cdf0e10cSrcweir 387*cdf0e10cSrcweir try { 388*cdf0e10cSrcweir parent = at.getAccessibleObjectForRole 389*cdf0e10cSrcweir (xRoot, AccessibleRole.FOOTER, "").getAccessibleChild(0); 390*cdf0e10cSrcweir } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { 391*cdf0e10cSrcweir fail(iabe.getMessage()); 392*cdf0e10cSrcweir return; 393*cdf0e10cSrcweir } 394*cdf0e10cSrcweir 395*cdf0e10cSrcweir accPC = 396*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleComponent.class, parent); 397*cdf0e10cSrcweir 398*cdf0e10cSrcweir try { 399*cdf0e10cSrcweir System.out.println("ChildCount: "+ 400*cdf0e10cSrcweir parent.getAccessibleContext().getAccessibleChildCount()); 401*cdf0e10cSrcweir System.out.println("Getting child 0 again"); 402*cdf0e10cSrcweir oObj = parent.getAccessibleContext().getAccessibleChild(0); 403*cdf0e10cSrcweir } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { 404*cdf0e10cSrcweir fail(iabe.getMessage()); 405*cdf0e10cSrcweir return; 406*cdf0e10cSrcweir } 407*cdf0e10cSrcweir 408*cdf0e10cSrcweir accT = 409*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleText.class, oObj); 410*cdf0e10cSrcweir System.out.println("Getting the text: "+accT.getText()); 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir accC = 413*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleComponent.class, oObj); 414*cdf0e10cSrcweir System.out.println("BoundsX= "+accC.getBounds().X); 415*cdf0e10cSrcweir System.out.println("BoundsY= "+accC.getBounds().Y); 416*cdf0e10cSrcweir System.out.println("BoundsWidth= "+accC.getBounds().Width); 417*cdf0e10cSrcweir System.out.println("BoundsHeight= "+accC.getBounds().Height); 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir accPC = 420*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleComponent.class, parent); 421*cdf0e10cSrcweir 422*cdf0e10cSrcweir System.out.println("Parent-BoundsX= "+accPC.getBounds().X); 423*cdf0e10cSrcweir System.out.println("Parent-BoundsY= "+accPC.getBounds().Y); 424*cdf0e10cSrcweir System.out.println("Parent-BoundsWidth= "+accPC.getBounds().Width); 425*cdf0e10cSrcweir System.out.println("Parent-BoundsHeight= "+accPC.getBounds().Height); 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir accPPC = 428*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleComponent.class, 429*cdf0e10cSrcweir parent.getAccessibleContext().getAccessibleParent()); 430*cdf0e10cSrcweir 431*cdf0e10cSrcweir System.out.println("P-Parent-BoundsX= "+accPPC.getBounds().X); 432*cdf0e10cSrcweir System.out.println("P-Parent-BoundsY= "+accPPC.getBounds().Y); 433*cdf0e10cSrcweir System.out.println("P-Parent-BoundsWidth= "+accPPC.getBounds().Width); 434*cdf0e10cSrcweir System.out.println("P-Parent-BoundsHeight= "+accPPC.getBounds().Height); 435*cdf0e10cSrcweir 436*cdf0e10cSrcweir 437*cdf0e10cSrcweir System.out.println("Press any key when the page content is on top"); 438*cdf0e10cSrcweir try{ 439*cdf0e10cSrcweir byte[]b = new byte[16]; 440*cdf0e10cSrcweir System.in.read(b); 441*cdf0e10cSrcweir } catch (Exception e) { 442*cdf0e10cSrcweir e.printStackTrace(); 443*cdf0e10cSrcweir } 444*cdf0e10cSrcweir 445*cdf0e10cSrcweir try { 446*cdf0e10cSrcweir parent = at.getAccessibleObjectForRole 447*cdf0e10cSrcweir (xRoot, AccessibleRole.DOCUMENT, "").getAccessibleChild(0); 448*cdf0e10cSrcweir } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { 449*cdf0e10cSrcweir fail(iabe.getMessage()); 450*cdf0e10cSrcweir return; 451*cdf0e10cSrcweir } 452*cdf0e10cSrcweir System.out.println("PARENT: " + parent.getAccessibleContext().getAccessibleName()); 453*cdf0e10cSrcweir accPC = 454*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleComponent.class, parent); 455*cdf0e10cSrcweir 456*cdf0e10cSrcweir int cCount = 0; 457*cdf0e10cSrcweir try { 458*cdf0e10cSrcweir cCount = 459*cdf0e10cSrcweir parent.getAccessibleContext().getAccessibleChildCount(); 460*cdf0e10cSrcweir System.out.println("ChildCount: "+cCount); 461*cdf0e10cSrcweir System.out.println("Getting child 0 again"); 462*cdf0e10cSrcweir oObj = parent.getAccessibleContext().getAccessibleChild(0); 463*cdf0e10cSrcweir } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { 464*cdf0e10cSrcweir fail(iabe.getMessage()); 465*cdf0e10cSrcweir return; 466*cdf0e10cSrcweir } 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir for (int i=0; i<cCount; i++) { 469*cdf0e10cSrcweir try { 470*cdf0e10cSrcweir XAccessible xA = parent.getAccessibleContext().getAccessibleChild(i); 471*cdf0e10cSrcweir System.out.println("NAME object " + i + ": " + xA.getAccessibleContext().getAccessibleName()); 472*cdf0e10cSrcweir } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { 473*cdf0e10cSrcweir fail(iabe.getMessage()); 474*cdf0e10cSrcweir return; 475*cdf0e10cSrcweir } 476*cdf0e10cSrcweir } 477*cdf0e10cSrcweir 478*cdf0e10cSrcweir System.out.println("SERVICES:"); 479*cdf0e10cSrcweir util.dbg.getSuppServices(oObj); 480*cdf0e10cSrcweir 481*cdf0e10cSrcweir XAccessibleValue accV = 482*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleValue.class, oObj); 483*cdf0e10cSrcweir Object o = accV.getCurrentValue(); 484*cdf0e10cSrcweir if (o instanceof String) 485*cdf0e10cSrcweir { 486*cdf0e10cSrcweir System.out.println("Value: " + (String)o); 487*cdf0e10cSrcweir } 488*cdf0e10cSrcweir else 489*cdf0e10cSrcweir { 490*cdf0e10cSrcweir System.out.println("Name of Object: " + o.getClass().getName()); 491*cdf0e10cSrcweir } 492*cdf0e10cSrcweir System.out.println("Getting the value: "+accV.getCurrentValue()); 493*cdf0e10cSrcweir 494*cdf0e10cSrcweir 495*cdf0e10cSrcweir 496*cdf0e10cSrcweir 497*cdf0e10cSrcweir accC = 498*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleComponent.class, oObj); 499*cdf0e10cSrcweir System.out.println("BoundsX= "+accC.getBounds().X); 500*cdf0e10cSrcweir System.out.println("BoundsY= "+accC.getBounds().Y); 501*cdf0e10cSrcweir System.out.println("BoundsWidth= "+accC.getBounds().Width); 502*cdf0e10cSrcweir System.out.println("BoundsHeight= "+accC.getBounds().Height); 503*cdf0e10cSrcweir 504*cdf0e10cSrcweir accPC = 505*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleComponent.class, parent); 506*cdf0e10cSrcweir 507*cdf0e10cSrcweir System.out.println("Parent-BoundsX= "+accPC.getBounds().X); 508*cdf0e10cSrcweir System.out.println("Parent-BoundsY= "+accPC.getBounds().Y); 509*cdf0e10cSrcweir System.out.println("Parent-BoundsWidth= "+accPC.getBounds().Width); 510*cdf0e10cSrcweir System.out.println("Parent-BoundsHeight= "+accPC.getBounds().Height); 511*cdf0e10cSrcweir 512*cdf0e10cSrcweir accPPC = 513*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleComponent.class, 514*cdf0e10cSrcweir parent.getAccessibleContext().getAccessibleParent()); 515*cdf0e10cSrcweir 516*cdf0e10cSrcweir System.out.println("P-Parent-BoundsX= "+accPPC.getBounds().X); 517*cdf0e10cSrcweir System.out.println("P-Parent-BoundsY= "+accPPC.getBounds().Y); 518*cdf0e10cSrcweir System.out.println("P-Parent-BoundsWidth= "+accPPC.getBounds().Width); 519*cdf0e10cSrcweir System.out.println("P-Parent-BoundsHeight= "+accPPC.getBounds().Height); 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir XComponent xComp = UnoRuntime.queryInterface( 522*cdf0e10cSrcweir XComponent.class, xSpreadsheetDoc); 523*cdf0e10cSrcweir xComp.dispose(); 524*cdf0e10cSrcweir } 525*cdf0e10cSrcweir 526*cdf0e10cSrcweir 527*cdf0e10cSrcweir 528*cdf0e10cSrcweir 529*cdf0e10cSrcweir 530*cdf0e10cSrcweir 531*cdf0e10cSrcweir 532*cdf0e10cSrcweir 533*cdf0e10cSrcweir /** 534*cdf0e10cSrcweir * Create a spreadsheet document, insert some text, header and footer. 535*cdf0e10cSrcweir * Let the user resize the document and check the contents. 536*cdf0e10cSrcweir */ 537*cdf0e10cSrcweir @Test public void checkNegativeViewForwarder() { 538*cdf0e10cSrcweir SOfficeFactory SOF = SOfficeFactory.getFactory( mXMSF ); 539*cdf0e10cSrcweir XSpreadsheetDocument xSpreadsheetDoc = null; 540*cdf0e10cSrcweir 541*cdf0e10cSrcweir try { 542*cdf0e10cSrcweir System.out.println("Creating a spreadsheet document"); 543*cdf0e10cSrcweir xSpreadsheetDoc = SOF.createCalcDoc(null); 544*cdf0e10cSrcweir } catch (com.sun.star.uno.Exception e) { 545*cdf0e10cSrcweir fail(e.getMessage()); 546*cdf0e10cSrcweir return; 547*cdf0e10cSrcweir } 548*cdf0e10cSrcweir 549*cdf0e10cSrcweir XInterface oObj = null; 550*cdf0e10cSrcweir 551*cdf0e10cSrcweir // inserting some content to have non-empty page preview 552*cdf0e10cSrcweir XCell xCell = null; 553*cdf0e10cSrcweir try { 554*cdf0e10cSrcweir XSpreadsheets oSheets = xSpreadsheetDoc.getSheets() ; 555*cdf0e10cSrcweir XIndexAccess oIndexSheets = 556*cdf0e10cSrcweir UnoRuntime.queryInterface(XIndexAccess.class, oSheets); 557*cdf0e10cSrcweir Object o = oIndexSheets.getByIndex(0); 558*cdf0e10cSrcweir XSpreadsheet oSheet = (XSpreadsheet)AnyConverter.toObject( 559*cdf0e10cSrcweir new com.sun.star.uno.Type(XSpreadsheet.class), o); 560*cdf0e10cSrcweir xCell = oSheet.getCellByPosition(0, 0) ; 561*cdf0e10cSrcweir xCell.setFormula("ScAccessiblePageHeader"); 562*cdf0e10cSrcweir 563*cdf0e10cSrcweir xCell = oSheet.getCellByPosition(0, 1) ; 564*cdf0e10cSrcweir xCell.setFormula("Cell 1"); 565*cdf0e10cSrcweir xCell = oSheet.getCellByPosition(0, 2) ; 566*cdf0e10cSrcweir xCell.setFormula("Cell 2"); 567*cdf0e10cSrcweir } catch(com.sun.star.lang.IllegalArgumentException e) { 568*cdf0e10cSrcweir System.out.println("Exception ceating relation :"); 569*cdf0e10cSrcweir fail(e.getMessage()); 570*cdf0e10cSrcweir } catch(com.sun.star.lang.WrappedTargetException e) { 571*cdf0e10cSrcweir System.out.println("Exception ceating relation :"); 572*cdf0e10cSrcweir fail(e.getMessage()); 573*cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 574*cdf0e10cSrcweir System.out.println("Exception ceating relation :"); 575*cdf0e10cSrcweir fail(e.getMessage()); 576*cdf0e10cSrcweir } 577*cdf0e10cSrcweir 578*cdf0e10cSrcweir XModel aModel = 579*cdf0e10cSrcweir UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc); 580*cdf0e10cSrcweir 581*cdf0e10cSrcweir XController xController = aModel.getCurrentController(); 582*cdf0e10cSrcweir 583*cdf0e10cSrcweir // get page styles 584*cdf0e10cSrcweir XStyleFamiliesSupplier StyleFam = 585*cdf0e10cSrcweir UnoRuntime.queryInterface( 586*cdf0e10cSrcweir XStyleFamiliesSupplier.class, 587*cdf0e10cSrcweir xSpreadsheetDoc ); 588*cdf0e10cSrcweir XNameAccess StyleFamNames = StyleFam.getStyleFamilies(); 589*cdf0e10cSrcweir XStyle StdStyle = null; 590*cdf0e10cSrcweir 591*cdf0e10cSrcweir try{ 592*cdf0e10cSrcweir Object o = StyleFamNames.getByName("PageStyles"); 593*cdf0e10cSrcweir XNameAccess PageStyles = (XNameAccess)AnyConverter.toObject( 594*cdf0e10cSrcweir new com.sun.star.uno.Type(XNameAccess.class), o); 595*cdf0e10cSrcweir 596*cdf0e10cSrcweir o = PageStyles.getByName("Default"); 597*cdf0e10cSrcweir StdStyle = (XStyle)AnyConverter.toObject( 598*cdf0e10cSrcweir new com.sun.star.uno.Type(XStyle.class), o); 599*cdf0e10cSrcweir } catch(com.sun.star.lang.IllegalArgumentException e) { 600*cdf0e10cSrcweir fail(e.getMessage()); 601*cdf0e10cSrcweir } catch(com.sun.star.lang.WrappedTargetException e){ 602*cdf0e10cSrcweir fail(e.getMessage()); 603*cdf0e10cSrcweir return; 604*cdf0e10cSrcweir } catch(com.sun.star.container.NoSuchElementException e){ 605*cdf0e10cSrcweir fail(e.getMessage()); 606*cdf0e10cSrcweir return; 607*cdf0e10cSrcweir } 608*cdf0e10cSrcweir 609*cdf0e10cSrcweir //get the property-set 610*cdf0e10cSrcweir final XPropertySet PropSet = 611*cdf0e10cSrcweir UnoRuntime.queryInterface(XPropertySet.class, StdStyle); 612*cdf0e10cSrcweir 613*cdf0e10cSrcweir XHeaderFooterContent RPHFC = null; 614*cdf0e10cSrcweir 615*cdf0e10cSrcweir // get the header 616*cdf0e10cSrcweir System.out.println( "Creating a test environment" ); 617*cdf0e10cSrcweir try { 618*cdf0e10cSrcweir Object o = PropSet.getPropertyValue("RightPageHeaderContent"); 619*cdf0e10cSrcweir RPHFC = (XHeaderFooterContent)AnyConverter.toObject( 620*cdf0e10cSrcweir new com.sun.star.uno.Type(XHeaderFooterContent.class), o); 621*cdf0e10cSrcweir } catch(com.sun.star.lang.IllegalArgumentException e) { 622*cdf0e10cSrcweir fail(e.getMessage()); 623*cdf0e10cSrcweir } catch(com.sun.star.lang.WrappedTargetException e){ 624*cdf0e10cSrcweir fail(e.getMessage()); 625*cdf0e10cSrcweir return; 626*cdf0e10cSrcweir } catch(com.sun.star.beans.UnknownPropertyException e){ 627*cdf0e10cSrcweir fail(e.getMessage()); 628*cdf0e10cSrcweir return; 629*cdf0e10cSrcweir } 630*cdf0e10cSrcweir 631*cdf0e10cSrcweir // insert text into header 632*cdf0e10cSrcweir XText center = RPHFC.getCenterText(); 633*cdf0e10cSrcweir center.setString("First line \n\r Second line \n\r third line "); 634*cdf0e10cSrcweir try { 635*cdf0e10cSrcweir PropSet.setPropertyValue("RightPageHeaderContent",RPHFC); 636*cdf0e10cSrcweir } catch (com.sun.star.beans.UnknownPropertyException e) { 637*cdf0e10cSrcweir } catch (com.sun.star.beans.PropertyVetoException e) { 638*cdf0e10cSrcweir } catch (com.sun.star.lang.IllegalArgumentException e) { 639*cdf0e10cSrcweir } catch (com.sun.star.lang.WrappedTargetException e) {} 640*cdf0e10cSrcweir 641*cdf0e10cSrcweir // get footer 642*cdf0e10cSrcweir RPHFC = null; 643*cdf0e10cSrcweir try { 644*cdf0e10cSrcweir Object o = PropSet.getPropertyValue("RightPageFooterContent"); 645*cdf0e10cSrcweir RPHFC = (XHeaderFooterContent)AnyConverter.toObject( 646*cdf0e10cSrcweir new com.sun.star.uno.Type(XHeaderFooterContent.class), o); 647*cdf0e10cSrcweir } catch(com.sun.star.lang.IllegalArgumentException e) { 648*cdf0e10cSrcweir fail(e.getMessage()); 649*cdf0e10cSrcweir } catch(com.sun.star.lang.WrappedTargetException e){ 650*cdf0e10cSrcweir fail(e.getMessage()); 651*cdf0e10cSrcweir return; 652*cdf0e10cSrcweir } catch(com.sun.star.beans.UnknownPropertyException e){ 653*cdf0e10cSrcweir fail(e.getMessage()); 654*cdf0e10cSrcweir return; 655*cdf0e10cSrcweir } 656*cdf0e10cSrcweir 657*cdf0e10cSrcweir // insert text into footer 658*cdf0e10cSrcweir center = RPHFC.getCenterText(); 659*cdf0e10cSrcweir center.setString("Third last line\n\r Second last line\n\r last line"); 660*cdf0e10cSrcweir try { 661*cdf0e10cSrcweir PropSet.setPropertyValue("RightPageFooterContent",RPHFC); 662*cdf0e10cSrcweir } catch (com.sun.star.beans.UnknownPropertyException e) { 663*cdf0e10cSrcweir } catch (com.sun.star.beans.PropertyVetoException e) { 664*cdf0e10cSrcweir } catch (com.sun.star.lang.IllegalArgumentException e) { 665*cdf0e10cSrcweir } catch (com.sun.star.lang.WrappedTargetException e) {} 666*cdf0e10cSrcweir 667*cdf0e10cSrcweir // switching to 'Page Preview' mode 668*cdf0e10cSrcweir try { 669*cdf0e10cSrcweir XDispatchProvider xDispProv = 670*cdf0e10cSrcweir UnoRuntime.queryInterface(XDispatchProvider.class, xController); 671*cdf0e10cSrcweir XURLTransformer xParser = 672*cdf0e10cSrcweir UnoRuntime.queryInterface(XURLTransformer.class, 673*cdf0e10cSrcweir mXMSF.createInstance("com.sun.star.util.URLTransformer")); 674*cdf0e10cSrcweir // Because it's an in/out parameter we must use an 675*cdf0e10cSrcweir // array of URL objects. 676*cdf0e10cSrcweir URL[] aParseURL = new URL[1]; 677*cdf0e10cSrcweir aParseURL[0] = new URL(); 678*cdf0e10cSrcweir aParseURL[0].Complete = ".uno:PrintPreview"; 679*cdf0e10cSrcweir xParser.parseStrict(aParseURL); 680*cdf0e10cSrcweir URL aURL = aParseURL[0]; 681*cdf0e10cSrcweir XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); 682*cdf0e10cSrcweir if(xDispatcher != null) 683*cdf0e10cSrcweir { 684*cdf0e10cSrcweir xDispatcher.dispatch( aURL, null ); 685*cdf0e10cSrcweir } 686*cdf0e10cSrcweir } catch (com.sun.star.uno.Exception e) { 687*cdf0e10cSrcweir fail("Couldn't change mode"); 688*cdf0e10cSrcweir return; 689*cdf0e10cSrcweir } 690*cdf0e10cSrcweir 691*cdf0e10cSrcweir try { 692*cdf0e10cSrcweir Thread.sleep(500); 693*cdf0e10cSrcweir } catch (InterruptedException ex) {} 694*cdf0e10cSrcweir 695*cdf0e10cSrcweir System.out.println("Press any key after resizing "); 696*cdf0e10cSrcweir try{ 697*cdf0e10cSrcweir byte[]b = new byte[16]; 698*cdf0e10cSrcweir System.in.read(b); 699*cdf0e10cSrcweir } catch (Exception e) { 700*cdf0e10cSrcweir e.printStackTrace(); 701*cdf0e10cSrcweir } 702*cdf0e10cSrcweir 703*cdf0e10cSrcweir // get the accessible content 704*cdf0e10cSrcweir AccessibilityTools at = new AccessibilityTools(); 705*cdf0e10cSrcweir 706*cdf0e10cSrcweir XWindow xWindow = at.getCurrentWindow(mXMSF, aModel); 707*cdf0e10cSrcweir XAccessible xRoot = at.getAccessibleObject(xWindow); 708*cdf0e10cSrcweir XAccessible parent = null; 709*cdf0e10cSrcweir 710*cdf0e10cSrcweir try { 711*cdf0e10cSrcweir parent = at.getAccessibleObjectForRole 712*cdf0e10cSrcweir (xRoot, AccessibleRole.HEADER, "").getAccessibleChild(0); 713*cdf0e10cSrcweir oObj = parent.getAccessibleContext().getAccessibleChild(0); 714*cdf0e10cSrcweir } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { 715*cdf0e10cSrcweir fail(iabe.getMessage()); 716*cdf0e10cSrcweir return; 717*cdf0e10cSrcweir } 718*cdf0e10cSrcweir 719*cdf0e10cSrcweir System.out.println("ImplementationName " + utils.getImplName(oObj)); 720*cdf0e10cSrcweir 721*cdf0e10cSrcweir XAccessibleComponent accPC = 722*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleComponent.class, parent); 723*cdf0e10cSrcweir 724*cdf0e10cSrcweir System.out.println("Parent-BoundsX= "+accPC.getBounds().X); 725*cdf0e10cSrcweir System.out.println("Parent-BoundsY= "+accPC.getBounds().Y); 726*cdf0e10cSrcweir System.out.println("Parent-BoundsWidth= "+accPC.getBounds().Width); 727*cdf0e10cSrcweir System.out.println("Parent-BoundsHeight= "+accPC.getBounds().Height); 728*cdf0e10cSrcweir 729*cdf0e10cSrcweir XAccessibleComponent accPPC = 730*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleComponent.class, 731*cdf0e10cSrcweir parent.getAccessibleContext().getAccessibleParent()); 732*cdf0e10cSrcweir 733*cdf0e10cSrcweir System.out.println("P-Parent-BoundsX= "+accPPC.getBounds().X); 734*cdf0e10cSrcweir System.out.println("P-Parent-BoundsY= "+accPPC.getBounds().Y); 735*cdf0e10cSrcweir System.out.println("P-Parent-BoundsWidth= "+accPPC.getBounds().Width); 736*cdf0e10cSrcweir System.out.println("P-Parent-BoundsHeight= "+accPPC.getBounds().Height); 737*cdf0e10cSrcweir 738*cdf0e10cSrcweir try { 739*cdf0e10cSrcweir Thread.sleep(500); 740*cdf0e10cSrcweir } catch (InterruptedException ex) {} 741*cdf0e10cSrcweir 742*cdf0e10cSrcweir System.out.println("Press any key when the header is not visible."); 743*cdf0e10cSrcweir try{ 744*cdf0e10cSrcweir byte[]b = new byte[16]; 745*cdf0e10cSrcweir System.in.read(b); 746*cdf0e10cSrcweir } catch (Exception e) { 747*cdf0e10cSrcweir e.printStackTrace(); 748*cdf0e10cSrcweir } 749*cdf0e10cSrcweir 750*cdf0e10cSrcweir int childCount = 0; 751*cdf0e10cSrcweir childCount = 752*cdf0e10cSrcweir parent.getAccessibleContext().getAccessibleChildCount(); 753*cdf0e10cSrcweir System.out.println("ChildCount: "+childCount); 754*cdf0e10cSrcweir 755*cdf0e10cSrcweir if (childCount != 0) 756*cdf0e10cSrcweir { 757*cdf0e10cSrcweir fail("Could access header although it was not visible on page."); 758*cdf0e10cSrcweir } 759*cdf0e10cSrcweir 760*cdf0e10cSrcweir 761*cdf0e10cSrcweir try { 762*cdf0e10cSrcweir parent = at.getAccessibleObjectForRole 763*cdf0e10cSrcweir (xRoot, AccessibleRole.FOOTER, "").getAccessibleChild(0); 764*cdf0e10cSrcweir } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { 765*cdf0e10cSrcweir fail(iabe.getMessage()); 766*cdf0e10cSrcweir return; 767*cdf0e10cSrcweir } 768*cdf0e10cSrcweir 769*cdf0e10cSrcweir accPC = 770*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleComponent.class, parent); 771*cdf0e10cSrcweir 772*cdf0e10cSrcweir System.out.println("Press any key when the footer is not visible."); 773*cdf0e10cSrcweir try{ 774*cdf0e10cSrcweir byte[]b = new byte[16]; 775*cdf0e10cSrcweir System.in.read(b); 776*cdf0e10cSrcweir } catch (Exception e) { 777*cdf0e10cSrcweir e.printStackTrace(); 778*cdf0e10cSrcweir } 779*cdf0e10cSrcweir 780*cdf0e10cSrcweir childCount = 781*cdf0e10cSrcweir parent.getAccessibleContext().getAccessibleChildCount(); 782*cdf0e10cSrcweir System.out.println("ChildCount: "+childCount); 783*cdf0e10cSrcweir 784*cdf0e10cSrcweir if (childCount != 0) 785*cdf0e10cSrcweir { 786*cdf0e10cSrcweir fail("Could access footer although it was not visible on page."); 787*cdf0e10cSrcweir } 788*cdf0e10cSrcweir 789*cdf0e10cSrcweir XComponent xComp =UnoRuntime.queryInterface( 790*cdf0e10cSrcweir XComponent.class, xSpreadsheetDoc); 791*cdf0e10cSrcweir xComp.dispose(); 792*cdf0e10cSrcweir 793*cdf0e10cSrcweir } 794*cdf0e10cSrcweir 795*cdf0e10cSrcweir 796*cdf0e10cSrcweir 797*cdf0e10cSrcweir 798*cdf0e10cSrcweir /** 799*cdf0e10cSrcweir * Check the preview of header cells 800*cdf0e10cSrcweir */ 801*cdf0e10cSrcweir @Test public void checkPreviewHeaderCells() { 802*cdf0e10cSrcweir 803*cdf0e10cSrcweir XInterface oObj = null; 804*cdf0e10cSrcweir SOfficeFactory SOF = SOfficeFactory.getFactory( mXMSF); 805*cdf0e10cSrcweir XSpreadsheetDocument xSpreadsheetDoc = null; 806*cdf0e10cSrcweir 807*cdf0e10cSrcweir try { 808*cdf0e10cSrcweir System.out.println("Creating a spreadsheet document"); 809*cdf0e10cSrcweir xSpreadsheetDoc = SOF.createCalcDoc(null); 810*cdf0e10cSrcweir } catch (com.sun.star.uno.Exception e) { 811*cdf0e10cSrcweir fail(e.getMessage()); 812*cdf0e10cSrcweir return; 813*cdf0e10cSrcweir } 814*cdf0e10cSrcweir 815*cdf0e10cSrcweir XModel xModel = 816*cdf0e10cSrcweir UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc); 817*cdf0e10cSrcweir 818*cdf0e10cSrcweir XController xController = xModel.getCurrentController(); 819*cdf0e10cSrcweir 820*cdf0e10cSrcweir //setting value of cell A1 821*cdf0e10cSrcweir XCell xCell = null; 822*cdf0e10cSrcweir try { 823*cdf0e10cSrcweir System.out.println("Getting spreadsheet") ; 824*cdf0e10cSrcweir XSpreadsheets oSheets = xSpreadsheetDoc.getSheets() ; 825*cdf0e10cSrcweir XIndexAccess oIndexSheets = 826*cdf0e10cSrcweir UnoRuntime.queryInterface(XIndexAccess.class, oSheets); 827*cdf0e10cSrcweir Object o = oIndexSheets.getByIndex(0); 828*cdf0e10cSrcweir XSpreadsheet oSheet = (XSpreadsheet)AnyConverter.toObject( 829*cdf0e10cSrcweir new com.sun.star.uno.Type(XSpreadsheet.class), o); 830*cdf0e10cSrcweir 831*cdf0e10cSrcweir System.out.println("Getting a cell from sheet") ; 832*cdf0e10cSrcweir xCell = oSheet.getCellByPosition(0, 0); 833*cdf0e10cSrcweir } catch(com.sun.star.lang.IllegalArgumentException e) { 834*cdf0e10cSrcweir fail(e.getMessage()); 835*cdf0e10cSrcweir } catch (com.sun.star.lang.WrappedTargetException e) { 836*cdf0e10cSrcweir fail(e.getMessage()); 837*cdf0e10cSrcweir return; 838*cdf0e10cSrcweir } catch (com.sun.star.lang.IndexOutOfBoundsException e) { 839*cdf0e10cSrcweir fail(e.getMessage()); 840*cdf0e10cSrcweir return; 841*cdf0e10cSrcweir } 842*cdf0e10cSrcweir 843*cdf0e10cSrcweir xCell.setFormula("Value"); 844*cdf0e10cSrcweir 845*cdf0e10cSrcweir //setting property 'PrintHeaders' of the style 'Default' 846*cdf0e10cSrcweir XStyleFamiliesSupplier xSFS = 847*cdf0e10cSrcweir UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, 848*cdf0e10cSrcweir xSpreadsheetDoc); 849*cdf0e10cSrcweir XNameAccess xNA = xSFS.getStyleFamilies(); 850*cdf0e10cSrcweir XPropertySet xPropSet = null; 851*cdf0e10cSrcweir try { 852*cdf0e10cSrcweir Object oPageStyles = xNA.getByName("PageStyles"); 853*cdf0e10cSrcweir xNA = 854*cdf0e10cSrcweir UnoRuntime.queryInterface(XNameAccess.class, oPageStyles); 855*cdf0e10cSrcweir Object oDefStyle = xNA.getByName("Default"); 856*cdf0e10cSrcweir xPropSet = 857*cdf0e10cSrcweir UnoRuntime.queryInterface(XPropertySet.class, oDefStyle); 858*cdf0e10cSrcweir } catch(com.sun.star.lang.WrappedTargetException e) { 859*cdf0e10cSrcweir fail(e.getMessage()); 860*cdf0e10cSrcweir return; 861*cdf0e10cSrcweir } catch(com.sun.star.container.NoSuchElementException e) { 862*cdf0e10cSrcweir fail(e.getMessage()); 863*cdf0e10cSrcweir return; 864*cdf0e10cSrcweir } 865*cdf0e10cSrcweir 866*cdf0e10cSrcweir try { 867*cdf0e10cSrcweir xPropSet.setPropertyValue("PrintHeaders", new Boolean(true)); 868*cdf0e10cSrcweir } catch(com.sun.star.lang.WrappedTargetException e) { 869*cdf0e10cSrcweir fail(e.getMessage()); 870*cdf0e10cSrcweir return; 871*cdf0e10cSrcweir } catch(com.sun.star.lang.IllegalArgumentException e) { 872*cdf0e10cSrcweir fail(e.getMessage()); 873*cdf0e10cSrcweir return; 874*cdf0e10cSrcweir } catch(com.sun.star.beans.PropertyVetoException e) { 875*cdf0e10cSrcweir fail(e.getMessage()); 876*cdf0e10cSrcweir return; 877*cdf0e10cSrcweir } catch(com.sun.star.beans.UnknownPropertyException e) { 878*cdf0e10cSrcweir fail(e.getMessage()); 879*cdf0e10cSrcweir return; 880*cdf0e10cSrcweir } 881*cdf0e10cSrcweir 882*cdf0e10cSrcweir //switching to 'Print Preview' mode 883*cdf0e10cSrcweir try { 884*cdf0e10cSrcweir XDispatchProvider xDispProv = 885*cdf0e10cSrcweir UnoRuntime.queryInterface(XDispatchProvider.class, xController); 886*cdf0e10cSrcweir XURLTransformer xParser = 887*cdf0e10cSrcweir UnoRuntime.queryInterface(XURLTransformer.class, 888*cdf0e10cSrcweir mXMSF.createInstance("com.sun.star.util.URLTransformer")); 889*cdf0e10cSrcweir URL[] aParseURL = new URL[1]; 890*cdf0e10cSrcweir aParseURL[0] = new URL(); 891*cdf0e10cSrcweir aParseURL[0].Complete = ".uno:PrintPreview"; 892*cdf0e10cSrcweir xParser.parseStrict(aParseURL); 893*cdf0e10cSrcweir URL aURL = aParseURL[0]; 894*cdf0e10cSrcweir XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); 895*cdf0e10cSrcweir if(xDispatcher != null) 896*cdf0e10cSrcweir { 897*cdf0e10cSrcweir xDispatcher.dispatch( aURL, null ); 898*cdf0e10cSrcweir } 899*cdf0e10cSrcweir } catch (com.sun.star.uno.Exception e) { 900*cdf0e10cSrcweir fail(e.getMessage()); 901*cdf0e10cSrcweir return; 902*cdf0e10cSrcweir } 903*cdf0e10cSrcweir 904*cdf0e10cSrcweir try { 905*cdf0e10cSrcweir Thread.currentThread().sleep(500) ; 906*cdf0e10cSrcweir } catch (InterruptedException e) { 907*cdf0e10cSrcweir System.out.println("While waiting :" + e) ; 908*cdf0e10cSrcweir } 909*cdf0e10cSrcweir 910*cdf0e10cSrcweir AccessibilityTools at = new AccessibilityTools(); 911*cdf0e10cSrcweir 912*cdf0e10cSrcweir XWindow xWindow = at.getCurrentWindow(mXMSF, xModel); 913*cdf0e10cSrcweir XAccessible xRoot = at.getAccessibleObject(xWindow); 914*cdf0e10cSrcweir 915*cdf0e10cSrcweir // System.out.println("ImplementationName " + utils.getImplName(oObj)); 916*cdf0e10cSrcweir 917*cdf0e10cSrcweir System.out.println("Press any key when the header cell is on top."); 918*cdf0e10cSrcweir try{ 919*cdf0e10cSrcweir byte[]b = new byte[16]; 920*cdf0e10cSrcweir System.in.read(b); 921*cdf0e10cSrcweir } catch (Exception e) { 922*cdf0e10cSrcweir e.printStackTrace(); 923*cdf0e10cSrcweir } 924*cdf0e10cSrcweir 925*cdf0e10cSrcweir 926*cdf0e10cSrcweir XAccessible parent = null; 927*cdf0e10cSrcweir 928*cdf0e10cSrcweir try { 929*cdf0e10cSrcweir System.out.println("Count: " +at.getAccessibleObjectForRole 930*cdf0e10cSrcweir (xRoot, AccessibleRole.TABLE, "").getAccessibleChildCount()); 931*cdf0e10cSrcweir // parent = at.getAccessibleObjectForRole 932*cdf0e10cSrcweir // (xRoot, AccessibleRole.TABLE, "").getAccessibleChild(0); 933*cdf0e10cSrcweir // oObj = parent.getAccessibleContext().getAccessibleChild(1); 934*cdf0e10cSrcweir System.out.println("Getting child 2"); 935*cdf0e10cSrcweir oObj = at.getAccessibleObjectForRole 936*cdf0e10cSrcweir (xRoot, AccessibleRole.TABLE, "").getAccessibleChild(2); 937*cdf0e10cSrcweir } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { 938*cdf0e10cSrcweir fail(iabe.getMessage()); 939*cdf0e10cSrcweir return; 940*cdf0e10cSrcweir } 941*cdf0e10cSrcweir 942*cdf0e10cSrcweir System.out.println("*** DEBUG INFO ***"); 943*cdf0e10cSrcweir util.dbg.getSuppServices(oObj); 944*cdf0e10cSrcweir System.out.println("****** IFC ******"); 945*cdf0e10cSrcweir util.dbg.printInterfaces(oObj); 946*cdf0e10cSrcweir System.out.println("*****************"); 947*cdf0e10cSrcweir 948*cdf0e10cSrcweir 949*cdf0e10cSrcweir /* XAccessibleContext accCtx = (XAccessibleContext) 950*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleContext.class, oObj); 951*cdf0e10cSrcweir try { 952*cdf0e10cSrcweir System.out.println("Children now: " + accCtx.getAccessibleChild(0).getAccessibleContext().getAccessibleChildCount()); 953*cdf0e10cSrcweir } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) { 954*cdf0e10cSrcweir fail(iabe.getMessage()); 955*cdf0e10cSrcweir return; 956*cdf0e10cSrcweir } 957*cdf0e10cSrcweir */ 958*cdf0e10cSrcweir 959*cdf0e10cSrcweir XAccessibleValue accV = 960*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleValue.class, oObj); 961*cdf0e10cSrcweir Object o = accV.getCurrentValue(); 962*cdf0e10cSrcweir System.out.println("Getting the value: "+o + " is void " + util.utils.isVoid(o)); 963*cdf0e10cSrcweir 964*cdf0e10cSrcweir 965*cdf0e10cSrcweir XAccessibleComponent accC = 966*cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleComponent.class, oObj); 967*cdf0e10cSrcweir 968*cdf0e10cSrcweir System.out.println("BoundsX= "+accC.getBounds().X); 969*cdf0e10cSrcweir System.out.println("BoundsY= "+accC.getBounds().Y); 970*cdf0e10cSrcweir System.out.println("BoundsWidth= "+accC.getBounds().Width); 971*cdf0e10cSrcweir System.out.println("BoundsHeight= "+accC.getBounds().Height); 972*cdf0e10cSrcweir 973*cdf0e10cSrcweir XComponent xComp = UnoRuntime.queryInterface( 974*cdf0e10cSrcweir XComponent.class, xSpreadsheetDoc); 975*cdf0e10cSrcweir xComp.dispose(); 976*cdf0e10cSrcweir 977*cdf0e10cSrcweir } 978*cdf0e10cSrcweir 979*cdf0e10cSrcweir 980*cdf0e10cSrcweir 981*cdf0e10cSrcweir 982*cdf0e10cSrcweir 983*cdf0e10cSrcweir /** 984*cdf0e10cSrcweir * Check the preview of Shapes: load a document with shapes and see, if they 985*cdf0e10cSrcweir * are accessible. 986*cdf0e10cSrcweir */ 987*cdf0e10cSrcweir @Test public void checkPreviewShape() { 988*cdf0e10cSrcweir SOfficeFactory SOF = SOfficeFactory.getFactory( mXMSF ); 989*cdf0e10cSrcweir XSpreadsheetDocument xSpreadsheetDoc = null; 990*cdf0e10cSrcweir XComponent xComp = null; 991*cdf0e10cSrcweir XInterface oObj = null; 992*cdf0e10cSrcweir 993*cdf0e10cSrcweir try { 994*cdf0e10cSrcweir String docName = "calcshapes.sxc"; 995*cdf0e10cSrcweir System.out.println("Loading a spreadsheetdocument."); 996*cdf0e10cSrcweir // String url = utils.getFullURL((String)param.get("TestDocumentPath") + "/" + docName); 997*cdf0e10cSrcweir String url = TestDocument.getUrl(docName); 998*cdf0e10cSrcweir System.out.println("loading document '" + url + "'"); 999*cdf0e10cSrcweir xComp = SOF.loadDocument(url); 1000*cdf0e10cSrcweir assertNotNull(xComp); 1001*cdf0e10cSrcweir } 1002*cdf0e10cSrcweir catch (com.sun.star.uno.Exception e) { 1003*cdf0e10cSrcweir fail(e.getMessage()); 1004*cdf0e10cSrcweir return; 1005*cdf0e10cSrcweir } 1006*cdf0e10cSrcweir 1007*cdf0e10cSrcweir try { 1008*cdf0e10cSrcweir Thread.currentThread().sleep(500) ; 1009*cdf0e10cSrcweir } catch (InterruptedException e) { 1010*cdf0e10cSrcweir System.out.println("While waiting :" + e) ; 1011*cdf0e10cSrcweir } 1012*cdf0e10cSrcweir 1013*cdf0e10cSrcweir if (xComp == null) { 1014*cdf0e10cSrcweir fail("loading document failed."); 1015*cdf0e10cSrcweir return; 1016*cdf0e10cSrcweir } 1017*cdf0e10cSrcweir 1018*cdf0e10cSrcweir xSpreadsheetDoc = UnoRuntime.queryInterface( 1019*cdf0e10cSrcweir XSpreadsheetDocument.class, xComp); 1020*cdf0e10cSrcweir XModel aModel = 1021*cdf0e10cSrcweir UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc); 1022*cdf0e10cSrcweir 1023*cdf0e10cSrcweir XController xController = aModel.getCurrentController(); 1024*cdf0e10cSrcweir 1025*cdf0e10cSrcweir // switching to 'Page Preview' mode 1026*cdf0e10cSrcweir try { 1027*cdf0e10cSrcweir XDispatchProvider xDispProv = 1028*cdf0e10cSrcweir UnoRuntime.queryInterface(XDispatchProvider.class, xController); 1029*cdf0e10cSrcweir XURLTransformer xParser = 1030*cdf0e10cSrcweir UnoRuntime.queryInterface(XURLTransformer.class, 1031*cdf0e10cSrcweir mXMSF.createInstance("com.sun.star.util.URLTransformer")); 1032*cdf0e10cSrcweir // Because it's an in/out parameter we must use an 1033*cdf0e10cSrcweir // array of URL objects. 1034*cdf0e10cSrcweir URL[] aParseURL = new URL[1]; 1035*cdf0e10cSrcweir aParseURL[0] = new URL(); 1036*cdf0e10cSrcweir aParseURL[0].Complete = ".uno:PrintPreview"; 1037*cdf0e10cSrcweir xParser.parseStrict(aParseURL); 1038*cdf0e10cSrcweir URL aURL = aParseURL[0]; 1039*cdf0e10cSrcweir XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0); 1040*cdf0e10cSrcweir if(xDispatcher != null) 1041*cdf0e10cSrcweir { 1042*cdf0e10cSrcweir xDispatcher.dispatch( aURL, null ); 1043*cdf0e10cSrcweir } 1044*cdf0e10cSrcweir } catch (com.sun.star.uno.Exception e) { 1045*cdf0e10cSrcweir fail("Couldn't change mode"); 1046*cdf0e10cSrcweir return; 1047*cdf0e10cSrcweir } 1048*cdf0e10cSrcweir 1049*cdf0e10cSrcweir try { 1050*cdf0e10cSrcweir Thread.currentThread().sleep(500) ; 1051*cdf0e10cSrcweir } catch (InterruptedException e) { 1052*cdf0e10cSrcweir System.out.println("While waiting :" + e) ; 1053*cdf0e10cSrcweir } 1054*cdf0e10cSrcweir 1055*cdf0e10cSrcweir 1056*cdf0e10cSrcweir 1057*cdf0e10cSrcweir System.out.println("Press any key when a shape is on top."); 1058*cdf0e10cSrcweir try{ 1059*cdf0e10cSrcweir byte[]b = new byte[16]; 1060*cdf0e10cSrcweir System.in.read(b); 1061*cdf0e10cSrcweir } catch (Exception e) { 1062*cdf0e10cSrcweir e.printStackTrace(); 1063*cdf0e10cSrcweir } 1064*cdf0e10cSrcweir 1065*cdf0e10cSrcweir // get the accessible content 1066*cdf0e10cSrcweir AccessibilityTools at = new AccessibilityTools(); 1067*cdf0e10cSrcweir 1068*cdf0e10cSrcweir XWindow xWindow = at.getCurrentWindow(mXMSF, aModel); 1069*cdf0e10cSrcweir XAccessible xRoot = at.getAccessibleObject(xWindow); 1070*cdf0e10cSrcweir XAccessible parent = null; 1071*cdf0e10cSrcweir 1072*cdf0e10cSrcweir try { 1073*cdf0e10cSrcweir XAccessibleContext con = at.getAccessibleObjectForRole 1074*cdf0e10cSrcweir (xRoot, AccessibleRole.SHAPE, ""); 1075*cdf0e10cSrcweir System.out.println("Name of AccessibleContext: " + con.getAccessibleName()); 1076*cdf0e10cSrcweir oObj = con; 1077*cdf0e10cSrcweir } catch (Exception e) { 1078*cdf0e10cSrcweir fail(e.getMessage()); 1079*cdf0e10cSrcweir return; 1080*cdf0e10cSrcweir } 1081*cdf0e10cSrcweir 1082*cdf0e10cSrcweir System.out.println("ImplementationName: " + utils.getImplName(oObj)); 1083*cdf0e10cSrcweir util.dbg.printInterfaces(oObj); 1084*cdf0e10cSrcweir 1085*cdf0e10cSrcweir xComp.dispose(); 1086*cdf0e10cSrcweir } 1087*cdf0e10cSrcweir 1088*cdf0e10cSrcweir @BeforeClass public static void setUpConnection() throws Exception { 1089*cdf0e10cSrcweir connection.setUp(); 1090*cdf0e10cSrcweir } 1091*cdf0e10cSrcweir 1092*cdf0e10cSrcweir @AfterClass public static void tearDownConnection() 1093*cdf0e10cSrcweir throws InterruptedException, com.sun.star.uno.Exception 1094*cdf0e10cSrcweir { 1095*cdf0e10cSrcweir connection.tearDown(); 1096*cdf0e10cSrcweir } 1097*cdf0e10cSrcweir 1098*cdf0e10cSrcweir private static final OfficeConnection connection = new OfficeConnection(); 1099*cdf0e10cSrcweir 1100*cdf0e10cSrcweir } 1101*cdf0e10cSrcweir 1102*cdf0e10cSrcweir 1103