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