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 
23 
24 #ifndef _SD_ACCESSIBILITY_ACCESSIBLE_DRAW_DOCUMENT_VIEW_HXX
25 #define _SD_ACCESSIBILITY_ACCESSIBLE_DRAW_DOCUMENT_VIEW_HXX
26 
27 #include "AccessibleDocumentViewBase.hxx"
28 
29 //IAccessibility2 Implementation 2009-----
30 #include <com/sun/star/accessibility/XAccessibleGroupPosition.hpp>
31 //-----IAccessibility2 Implementation 2009
32 
33 namespace accessibility {
34 
35 
36 /** This class makes draw documents in the general view modes
37     accessible.  It passes all shapes on the current draw page to a
38     children manager and additionally creates a new shape that
39     represents the actual draw page.
40 
41     Please see the documentation of the base class for further
42     explanations of the individual methods.
43 */
44 class AccessibleDrawDocumentView :
45     public AccessibleDocumentViewBase
46 //IAccessibility2 Implementation 2009-----
47     ,public ::com::sun::star::accessibility::XAccessibleGroupPosition
48 //-----IAccessibility2 Implementation 2009
49 {
50 public:
51     //=====  internal  ========================================================
52 
53     AccessibleDrawDocumentView (::sd::Window* pSdWindow,
54         ::sd::ViewShell* pViewShell,
55 	    const ::com::sun::star::uno::Reference<
56 	    ::com::sun::star::frame::XController>& rxController,
57 	    const ::com::sun::star::uno::Reference<
58 	    ::com::sun::star::accessibility::XAccessible>& rxParent);
59 
60     virtual ~AccessibleDrawDocumentView	(void);
61 
62     /** Complete the initialization begun in the constructor.
63     */
64     virtual void Init (void);
65 
66 
67     //=====  IAccessibleViewForwarderListener  ================================
68 
69     virtual void ViewForwarderChanged (ChangeType aChangeType,
70         const IAccessibleViewForwarder* pViewForwarder);
71 
72     //=====  XAccessibleContext  ==============================================
73 
74     virtual sal_Int32 SAL_CALL
75         getAccessibleChildCount (void)
76         throw (::com::sun::star::uno::RuntimeException);
77 
78     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
79         getAccessibleChild (sal_Int32 nIndex)
80         throw (::com::sun::star::uno::RuntimeException,
81             ::com::sun::star::lang::IndexOutOfBoundsException);
82 
83 //IAccessibility2 Implementation 2009-----
84 	virtual ::rtl::OUString SAL_CALL
85 		getAccessibleName(void)
86 		throw (::com::sun::star::uno::RuntimeException);
87 //-----IAccessibility2 Implementation 2009
88 
89     //=====  lang::XEventListener  ============================================
90 
91 	virtual void SAL_CALL
92 		disposing (const ::com::sun::star::lang::EventObject& rEventObject)
93         throw (::com::sun::star::uno::RuntimeException);
94 
95 
96     //=====  XPropertyChangeListener  =========================================
97 
98 	virtual void SAL_CALL
99 		propertyChange (const ::com::sun::star::beans::PropertyChangeEvent& rEventObject)
100         throw (::com::sun::star::uno::RuntimeException);
101 //IAccessibility2 Implementation 2009-----
102     //=====  XInterface  ======================================================
103 
104     virtual com::sun::star::uno::Any SAL_CALL
105 		queryInterface (const com::sun::star::uno::Type & rType)
106         throw (::com::sun::star::uno::RuntimeException);
107 
108     virtual void SAL_CALL
109         acquire (void)
110         throw ();
111 
112     virtual void SAL_CALL
113         release (void)
114         throw ();
115 
116     //=====  XAccessibleGroupPosition  =========================================
117 	virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
118 		getGroupPosition( const ::com::sun::star::uno::Any& rAny )
119         throw (::com::sun::star::uno::RuntimeException);
120 	virtual ::rtl::OUString SAL_CALL getObjectLink( const ::com::sun::star::uno::Any& accoject )
121         throw (::com::sun::star::uno::RuntimeException);
122 //-----IAccessibility2 Implementation 2009
123 
124 protected:
125 
126     //=====  XServiceInfo  ====================================================
127 
128     virtual ::rtl::OUString SAL_CALL
129     	getImplementationName (void)
130 	    throw (::com::sun::star::uno::RuntimeException);
131 
132     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
133         getSupportedServiceNames (void)
134         throw (::com::sun::star::uno::RuntimeException);
135 
136 
137 	virtual sal_Bool
138         implIsSelected( sal_Int32 nAccessibleChildIndex )
139         throw (::com::sun::star::uno::RuntimeException);
140 
141     /** Select or deselect the specified child or all children if the given
142         index has the special value ACCESSIBLE_SELECTION_CHILD_ALL.
143         Selecting or deselecting a child sets or resets the
144         <const>SELECTED</const> state and selects or deslects the UNO shape
145         beeing made accessible by the child.
146         @param nAccessibleChildIndex
147             Index of the child to select or deselect.  If the parameter has
148             the value ACCESSIBLE_SELECTION_CHILD_ALL then all children are
149             selected or deslected.
150         @param bSelect
151             Indicates whether to select or deselect the specified child
152             reps. children.
153     */
154     virtual void
155         implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bSelect )
156         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
157 //IAccessibility2 Implementation 2009-----
158 private:
159 	::sd::ViewShell* mpSdViewSh;
160 //-----IAccessibility2 Implementation 2009
161 
162 protected:
163     /** This object manages the shapes of the represented draw page.  It is
164         responsible to determine the visible shapes and create on demand the
165         accessible objects representing them.
166     */
167     ChildrenManager* mpChildrenManager;
168 
169     // This method is called from the component helper base class while
170     // disposing.
171     virtual void SAL_CALL disposing (void);
172 
173     /** Create a shape the represents the page as seen on the screen.
174     */
175     AccessiblePageShape* CreateDrawPageShape (void);
176 
177     ///	Create an accessible name that contains the current view mode.
178     virtual ::rtl::OUString
179     	CreateAccessibleName ()
180         throw (::com::sun::star::uno::RuntimeException);
181 
182     /**	Create an accessible description that contains the current
183     	view mode.
184     */
185     virtual ::rtl::OUString
186     	CreateAccessibleDescription ()
187         throw (::com::sun::star::uno::RuntimeException);
188 
189     /** Make sure that the currently focused shape sends a FOCUSED state
190         change event indicating that it has (regained) the focus.
191     */
192     virtual void Activated (void);
193 
194     /** Make sure that the currently focused shape sends a FOCUSED state
195         change event indicating that it has lost the focus.
196     */
197     virtual void Deactivated (void);
198 
199     virtual void impl_dispose (void);
200 
201 //IAccessibility2 Implementation 2009-----
202     //=====  XAccessibleGetAccFromXShape  ============================================
203 	::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
204 		SAL_CALL get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType)
205 		throw ( ::com::sun::star::uno::RuntimeException );
206 	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
207 		GetSelAccContextInTable();
208 //-----IAccessibility2 Implementation 2009
209 
210 private:
211     void UpdateAccessibleName (void);
212 };
213 
214 } // end of namespace accessibility
215 
216 #endif
217