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