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