xref: /trunk/main/sw/source/core/access/accdoc.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #ifndef _ACCDOC_HXX
23 #define _ACCDOC_HXX
24 #ifndef _ACCCONTEXT_HXX
25 #include "acccontext.hxx"
26 #endif
27 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
28 #include <com/sun/star/document/XEventListener.hpp>
29 #include <accselectionhelper.hxx>
30 
31 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XAccessibleExtendedAttributes_HPP_
32 #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
33 #endif
34 
35 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEGETACCFLOWTO_HPP_
36 #include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp>
37 #endif
38 
39 class VclSimpleEvent;
40 
41 /**
42  * base class for SwAccessibleDocument (in this same header file) and
43  * SwAccessiblePreview
44  */
45 class SwAccessibleDocumentBase : public SwAccessibleContext
46 {
47     ::com::sun::star::uno::Reference<
48         ::com::sun::star::accessibility::XAccessible> mxParent;
49 
50     Window* mpChildWin; // protected by solar mutex
51 
52     using SwAccessibleFrame::SetVisArea;
53 
54 protected:
55 
56     virtual ~SwAccessibleDocumentBase();
57 
58 public:
59 
60     SwAccessibleDocumentBase( SwAccessibleMap* pInitMap );
61 
62     void SetVisArea();
63 
64     virtual void AddChild( Window *pWin, sal_Bool bFireEvent = sal_True );
65     virtual void RemoveChild( Window *pWin );
66 
67     //=====  XAccessibleContext  ==============================================
68 
69     /// Return the number of currently visible children.
70     virtual sal_Int32 SAL_CALL getAccessibleChildCount (void);
71 
72     /// Return the specified child or NULL if index is invalid.
73     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
74         getAccessibleChild (sal_Int32 nIndex);
75 
76     /// Return a reference to the parent.
77     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
78         getAccessibleParent (void);
79 
80     /// Return this objects index among the parents children.
81     virtual sal_Int32 SAL_CALL
82         getAccessibleIndexInParent (void);
83 
84     /// Return this object's description.
85     virtual ::rtl::OUString SAL_CALL
86         getAccessibleDescription (void);
87     virtual ::rtl::OUString SAL_CALL getAccessibleName (void);
88 
89     //=====  XAccessibleComponent  ==============================================
90     virtual sal_Bool SAL_CALL containsPoint(
91             const ::com::sun::star::awt::Point& aPoint );
92 
93     virtual ::com::sun::star::uno::Reference<
94         ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(
95                 const ::com::sun::star::awt::Point& aPoint );
96 
97     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds();
98 
99     virtual ::com::sun::star::awt::Point SAL_CALL getLocation();
100 
101     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen();
102 
103     virtual ::com::sun::star::awt::Size SAL_CALL getSize();
104 };
105 
106 
107 /**
108  * access to an accessible Writer document
109  */
110 class SwAccessibleDocument : public SwAccessibleDocumentBase,
111                              public com::sun::star::accessibility::XAccessibleSelection,
112                              public com::sun::star::document::XEventListener,
113                              public com::sun::star::accessibility::XAccessibleExtendedAttributes,
114                              public com::sun::star::accessibility::XAccessibleGetAccFlowTo
115 {
116     // Implementation for XAccessibleSelection interface
117     SwAccessibleSelectionHelper maSelectionHelper;
118 
119 protected:
120 
121     // Set states for getAccessibleStateSet.
122     // This derived class additionally sets MULTISELECTABLE(1)
123     virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet );
124 
125     virtual ~SwAccessibleDocument();
126 
127 public:
128 
129     SwAccessibleDocument( SwAccessibleMap* pInitMap );
130 
131     DECL_LINK( WindowChildEventListener, VclSimpleEvent* );
132     //=====  XEventListener====================================================
133     virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event );
134     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Event );
135 
136     //=====  XServiceInfo  ====================================================
137 
138     /** Returns an identifier for the implementation of this object.
139     */
140     virtual ::rtl::OUString SAL_CALL
141         getImplementationName (void);
142 
143     /** Return whether the specified service is supported by this class.
144     */
145     virtual sal_Bool SAL_CALL
146         supportsService (const ::rtl::OUString& sServiceName);
147 
148     /** Returns a list of all supported services.  In this case that is just
149         the AccessibleContext service.
150     */
151     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
152         getSupportedServiceNames (void);
153 
154     //=====  XInterface  ======================================================
155 
156     // XInterface is inherited through SwAcessibleContext and
157     // XAccessibleSelection. These methods are needed to avoid
158     // ambiguities.
159 
160     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
161         const ::com::sun::star::uno::Type& aType );
162 
acquire()163     virtual void SAL_CALL acquire(  ) throw ()
164         { SwAccessibleContext::acquire(); };
165 
release()166     virtual void SAL_CALL release(  ) throw ()
167         { SwAccessibleContext::release(); };
168 
169     //====== XTypeProvider ====================================================
170     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  );
171     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  );
172 
173     //=====  XAccessibleSelection  ============================================
174 
175     virtual void SAL_CALL selectAccessibleChild(
176         sal_Int32 nChildIndex );
177 
178     virtual sal_Bool SAL_CALL isAccessibleChildSelected(
179         sal_Int32 nChildIndex );
180     virtual void SAL_CALL clearAccessibleSelection(  );
181     virtual void SAL_CALL selectAllAccessibleChildren(  );
182     virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  );
183     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(
184         sal_Int32 nSelectedChildIndex );
185 
186     // --> OD 2004-11-16 #111714# - index has to be treated as global child index.
187     virtual void SAL_CALL deselectAccessibleChild(
188         sal_Int32 nChildIndex );
189 
190     virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes() ;
191     //====== thread safe C++ interface ========================================
192 
193     // The object is not visible an longer and should be destroyed
194     virtual void Dispose( sal_Bool bRecursive = sal_False );
195 
196     //=====  XAccessibleComponent  ============================================
197     sal_Int32 SAL_CALL getBackground();
198 
199     //=====  XAccessibleGetAccFlowTo  ============================================
200     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
201         SAL_CALL get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType);
202 };
203 
204 #endif
205 
206 /* vim: set noet sw=4 ts=4: */
207