2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 import java
.io
.PrintWriter
;
24 import lib
.TestEnvironment
;
25 import lib
.TestParameters
;
26 import util
.AccessibilityTools
;
27 import util
.DrawTools
;
28 import util
.SOfficeFactory
;
31 import com
.sun
.star
.accessibility
.AccessibleRole
;
32 import com
.sun
.star
.accessibility
.XAccessible
;
33 import com
.sun
.star
.awt
.XWindow
;
34 import com
.sun
.star
.beans
.XPropertySet
;
35 import com
.sun
.star
.drawing
.XDrawPage
;
36 import com
.sun
.star
.frame
.XModel
;
37 import com
.sun
.star
.lang
.XComponent
;
38 import com
.sun
.star
.uno
.UnoRuntime
;
39 import com
.sun
.star
.uno
.XInterface
;
41 public class AccessiblePageShape
extends TestCase
{
43 static XComponent xDrawDoc
;
47 protected void initialize( TestParameters tParam
, PrintWriter log
) throws Exception
{
48 SOfficeFactory SOF
= SOfficeFactory
.getFactory( tParam
.getMSF() );
49 log
.println( "creating a drawdoc" );
50 xDrawDoc
= SOF
.createDrawDoc(null);
51 aModel
= UnoRuntime
.queryInterface(XModel
.class, xDrawDoc
);
55 * Disposes the Draw document loaded before.
58 protected void cleanup( TestParameters tParam
, PrintWriter log
) {
59 log
.println( " disposing xDrawDoc " );
60 util
.DesktopTools
.closeDoc(xDrawDoc
);
64 protected TestEnvironment createTestEnvironment
65 (TestParameters tParam
, PrintWriter log
) {
67 XInterface oObj
= null;
68 //XShape oShape = null;
69 XDrawPage oPage
= null;
71 // creation of testobject here
72 // first we write what we are intend to do to log file
73 log
.println( "creating a test environment" );
75 XWindow xWindow
= AccessibilityTools
.getCurrentWindow (aModel
);
76 XAccessible xRoot
= AccessibilityTools
.getAccessibleObject(xWindow
);
78 AccessibilityTools
.printAccessibleTree(log
, xRoot
, tParam
.getBool(util
.PropertyName
.DEBUG_IS_ACTIVE
));
80 oObj
= AccessibilityTools
.getAccessibleObjectForRole(xRoot
, AccessibleRole
.UNKNOWN
, "PageShape");
82 // create test environment here
83 TestEnvironment tEnv
= new TestEnvironment( oObj
);
85 oPage
= DrawTools
.getDrawPage(xDrawDoc
,0);
86 final XPropertySet PageProps
= UnoRuntime
.queryInterface(XPropertySet
.class, oPage
);
88 tEnv
.addObjRelation("EventProducer",
89 new ifc
.accessibility
._XAccessibleEventBroadcaster
.EventProducer() {
90 public void fireEvent() {
92 PageProps
.setPropertyValue("Height",Integer
.valueOf(5000));
93 } catch (com
.sun
.star
.beans
.UnknownPropertyException upe
) {
94 System
.out
.println("Don't no the Property Height");
95 } catch (com
.sun
.star
.beans
.PropertyVetoException pve
) {
97 "PropertyVetoException Exception while changing Height");
98 } catch (com
.sun
.star
.lang
.IllegalArgumentException iae
) {
100 "IllegalArgumentException Exception while changing Height");
101 } catch (com
.sun
.star
.lang
.WrappedTargetException wte
) {
103 "WrappedTargetException Exception while changing Height");
108 log
.println("Implementation Name: " + utils
.getImplName(oObj
));
111 } // finish method getTestEnvironment