1*c45d927aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*c45d927aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*c45d927aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*c45d927aSAndrew Rist  * distributed with this work for additional information
6*c45d927aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*c45d927aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*c45d927aSAndrew Rist  * "License"); you may not use this file except in compliance
9*c45d927aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*c45d927aSAndrew Rist  *
11*c45d927aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*c45d927aSAndrew Rist  *
13*c45d927aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*c45d927aSAndrew Rist  * software distributed under the License is distributed on an
15*c45d927aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*c45d927aSAndrew Rist  * KIND, either express or implied.  See the License for the
17*c45d927aSAndrew Rist  * specific language governing permissions and limitations
18*c45d927aSAndrew Rist  * under the License.
19*c45d927aSAndrew Rist  *
20*c45d927aSAndrew Rist  *************************************************************/
21*c45d927aSAndrew Rist 
22*c45d927aSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #ifndef _SD_ACCESSIBILITY_ACCESSIBLE_PAGE_SHAPE_HXX
26cdf0e10cSrcweir #define _SD_ACCESSIBILITY_ACCESSIBLE_PAGE_SHAPE_HXX
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <svx/AccessibleShape.hxx>
29cdf0e10cSrcweir #include <svx/AccessibleShapeTreeInfo.hxx>
30cdf0e10cSrcweir #include <svx/IAccessibleViewForwarderListener.hxx>
31cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessible.hpp>
32cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
33cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp>
34cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPage.hpp>
35cdf0e10cSrcweir #include <com/sun/star/lang/XEventListener.hpp>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include <svx/AccessibleTextHelper.hxx>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir namespace accessibility {
40cdf0e10cSrcweir 
41cdf0e10cSrcweir /** A page shape represents the actual page as seen on the screen.
42cdf0e10cSrcweir */
43cdf0e10cSrcweir class AccessiblePageShape
44cdf0e10cSrcweir     :	public AccessibleShape
45cdf0e10cSrcweir {
46cdf0e10cSrcweir public:
47cdf0e10cSrcweir 	//=====  internal  ========================================================
48cdf0e10cSrcweir 
49cdf0e10cSrcweir     /** Create a new accessible object that makes the given shape accessible.
50cdf0e10cSrcweir         @param rxParent
51cdf0e10cSrcweir             The accessible parent object.  It will be used, for example when
52cdf0e10cSrcweir             the <member>getIndexInParent</member> method is called.
53cdf0e10cSrcweir         @param rShapeTreeInfo
54cdf0e10cSrcweir             Bundel of information passed to this shape and all of its desendants.
55cdf0e10cSrcweir         @param nIndex
56cdf0e10cSrcweir             Index used to disambiguate between objects that have the same
57cdf0e10cSrcweir             name.  Passing a value of -1 leads to the use of the object's
58cdf0e10cSrcweir             z-order instead.  Because that is not a good substitute, better
59cdf0e10cSrcweir             pass an ever increasing counter.
60cdf0e10cSrcweir         @attention
61cdf0e10cSrcweir             Always call the <member>init</member> method after creating a
62cdf0e10cSrcweir             new accessible shape.  This is one way to overcome the potential
63cdf0e10cSrcweir             problem of registering the new object with e.g. event
64cdf0e10cSrcweir             broadcasters.  That would delete the new object if a broadcaster
65cdf0e10cSrcweir             would not keep a strong reference to the new object.
66cdf0e10cSrcweir     */
67cdf0e10cSrcweir 	AccessiblePageShape (
68cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
69cdf0e10cSrcweir             ::com::sun::star::drawing::XDrawPage>& rxPage,
70cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
71cdf0e10cSrcweir             ::com::sun::star::accessibility::XAccessible>& rxParent,
72cdf0e10cSrcweir         const AccessibleShapeTreeInfo& rShapeTreeInfo,
73cdf0e10cSrcweir         long nIndex = -1);
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 	virtual ~AccessiblePageShape (void);
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     /** Initialize a new shape.  See the documentation of the constructor
78cdf0e10cSrcweir         for the reason of this method's existence.
79cdf0e10cSrcweir     */
80cdf0e10cSrcweir     virtual void Init (void);
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 	//=====  XAccessibleContext  ==============================================
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     ///	Returns always 0 because there can be no children.
85cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
86cdf0e10cSrcweir     	getAccessibleChildCount (void)
87cdf0e10cSrcweir         throw ();
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     /**	Return the specified child.
90cdf0e10cSrcweir         @param nIndex
91cdf0e10cSrcweir             Index of the requested child.
92cdf0e10cSrcweir         @return
93cdf0e10cSrcweir             Reference of the requested child which is the accessible object
94cdf0e10cSrcweir             of a visible shape.
95cdf0e10cSrcweir         @raises IndexOutOfBoundsException
96cdf0e10cSrcweir             Throws always an exception because there are no children.
97cdf0e10cSrcweir     */
98cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
99cdf0e10cSrcweir             ::com::sun::star::accessibility::XAccessible> SAL_CALL
100cdf0e10cSrcweir     	getAccessibleChild (sal_Int32 nIndex)
101cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 
104cdf0e10cSrcweir     //=====  XAccessibleComponent  ============================================
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds (void)
107cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
108cdf0e10cSrcweir 
109cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getForeground (void)
110cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getBackground (void)
113cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     //=====  XComponent  ======================================================
116cdf0e10cSrcweir 
117cdf0e10cSrcweir     virtual void SAL_CALL
118cdf0e10cSrcweir         dispose (void)
119cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	//=====  XServiceInfo  ====================================================
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL
125cdf0e10cSrcweir     	getImplementationName (void)
126cdf0e10cSrcweir 	    throw (::com::sun::star::uno::RuntimeException);
127cdf0e10cSrcweir 
128cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
129cdf0e10cSrcweir         getSupportedServiceNames (void)
130cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 
133cdf0e10cSrcweir     //=====  lang::XEventListener  ============================================
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     virtual void SAL_CALL
136cdf0e10cSrcweir         disposing (const ::com::sun::star::lang::EventObject& Source)
137cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 	using AccessibleShape::disposing;
141cdf0e10cSrcweir 
142cdf0e10cSrcweir protected:
143cdf0e10cSrcweir     /**	Create a base name string that contains the accessible name.
144cdf0e10cSrcweir     */
145cdf0e10cSrcweir 	virtual ::rtl::OUString
146cdf0e10cSrcweir     	CreateAccessibleBaseName (void)
147cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 	virtual ::rtl::OUString
150cdf0e10cSrcweir     	CreateAccessibleName (void)
151cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
152cdf0e10cSrcweir 
153cdf0e10cSrcweir     ///	Create a description string that contains the accessible description.
154cdf0e10cSrcweir 	virtual ::rtl::OUString
155cdf0e10cSrcweir     	CreateAccessibleDescription (void)
156cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
157cdf0e10cSrcweir 
158cdf0e10cSrcweir private:
159cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
160cdf0e10cSrcweir         ::com::sun::star::drawing::XDrawPage> mxPage;
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     /** Don't use the default constructor.  Use the public constructor that
163cdf0e10cSrcweir         takes the original shape and the parent as arguments instead.
164cdf0e10cSrcweir     */
165cdf0e10cSrcweir     explicit AccessiblePageShape (void);
166cdf0e10cSrcweir     /// Don't use the copy constructor.  Is there any use for it?
167cdf0e10cSrcweir     explicit AccessiblePageShape (const AccessiblePageShape&);
168cdf0e10cSrcweir     /// Don't use the assignment operator.  Do we need this?
169cdf0e10cSrcweir     AccessibleShape& operator= (const AccessiblePageShape&);
170cdf0e10cSrcweir };
171cdf0e10cSrcweir 
172cdf0e10cSrcweir } // end of namespace accessibility
173cdf0e10cSrcweir 
174cdf0e10cSrcweir #endif
175