1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SD_ACCESSIBILITY_ACCESSIBLE_DRAW_DOCUMENT_VIEW_HXX
29 #define _SD_ACCESSIBILITY_ACCESSIBLE_DRAW_DOCUMENT_VIEW_HXX
30 
31 #include "AccessibleDocumentViewBase.hxx"
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 {
47 public:
48     //=====  internal  ========================================================
49 
50     AccessibleDrawDocumentView (::sd::Window* pSdWindow,
51         ::sd::ViewShell* pViewShell,
52 	    const ::com::sun::star::uno::Reference<
53 	    ::com::sun::star::frame::XController>& rxController,
54 	    const ::com::sun::star::uno::Reference<
55 	    ::com::sun::star::accessibility::XAccessible>& rxParent);
56 
57     virtual ~AccessibleDrawDocumentView	(void);
58 
59     /** Complete the initialization begun in the constructor.
60     */
61     virtual void Init (void);
62 
63 
64     //=====  IAccessibleViewForwarderListener  ================================
65 
66     virtual void ViewForwarderChanged (ChangeType aChangeType,
67         const IAccessibleViewForwarder* pViewForwarder);
68 
69     //=====  XAccessibleContext  ==============================================
70 
71     virtual sal_Int32 SAL_CALL
72         getAccessibleChildCount (void)
73         throw (::com::sun::star::uno::RuntimeException);
74 
75     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
76         getAccessibleChild (sal_Int32 nIndex)
77         throw (::com::sun::star::uno::RuntimeException,
78             ::com::sun::star::lang::IndexOutOfBoundsException);
79 
80 
81     //=====  lang::XEventListener  ============================================
82 
83 	virtual void SAL_CALL
84 		disposing (const ::com::sun::star::lang::EventObject& rEventObject)
85         throw (::com::sun::star::uno::RuntimeException);
86 
87 
88     //=====  XPropertyChangeListener  =========================================
89 
90 	virtual void SAL_CALL
91 		propertyChange (const ::com::sun::star::beans::PropertyChangeEvent& rEventObject)
92         throw (::com::sun::star::uno::RuntimeException);
93 
94 protected:
95 
96     //=====  XServiceInfo  ====================================================
97 
98     virtual ::rtl::OUString SAL_CALL
99     	getImplementationName (void)
100 	    throw (::com::sun::star::uno::RuntimeException);
101 
102     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
103         getSupportedServiceNames (void)
104         throw (::com::sun::star::uno::RuntimeException);
105 
106 
107 	virtual sal_Bool
108         implIsSelected( sal_Int32 nAccessibleChildIndex )
109         throw (::com::sun::star::uno::RuntimeException);
110 
111     /** Select or deselect the specified child or all children if the given
112         index has the special value ACCESSIBLE_SELECTION_CHILD_ALL.
113         Selecting or deselecting a child sets or resets the
114         <const>SELECTED</const> state and selects or deslects the UNO shape
115         beeing made accessible by the child.
116         @param nAccessibleChildIndex
117             Index of the child to select or deselect.  If the parameter has
118             the value ACCESSIBLE_SELECTION_CHILD_ALL then all children are
119             selected or deslected.
120         @param bSelect
121             Indicates whether to select or deselect the specified child
122             reps. children.
123     */
124     virtual void
125         implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bSelect )
126         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
127 
128 protected:
129     /** This object manages the shapes of the represented draw page.  It is
130         responsible to determine the visible shapes and create on demand the
131         accessible objects representing them.
132     */
133     ChildrenManager* mpChildrenManager;
134 
135     // This method is called from the component helper base class while
136     // disposing.
137     virtual void SAL_CALL disposing (void);
138 
139     /** Create a shape the represents the page as seen on the screen.
140     */
141     AccessiblePageShape* CreateDrawPageShape (void);
142 
143     ///	Create an accessible name that contains the current view mode.
144     virtual ::rtl::OUString
145     	CreateAccessibleName ()
146         throw (::com::sun::star::uno::RuntimeException);
147 
148     /**	Create an accessible description that contains the current
149     	view mode.
150     */
151     virtual ::rtl::OUString
152     	CreateAccessibleDescription ()
153         throw (::com::sun::star::uno::RuntimeException);
154 
155     /** Make sure that the currently focused shape sends a FOCUSED state
156         change event indicating that it has (regained) the focus.
157     */
158     virtual void Activated (void);
159 
160     /** Make sure that the currently focused shape sends a FOCUSED state
161         change event indicating that it has lost the focus.
162     */
163     virtual void Deactivated (void);
164 
165     virtual void impl_dispose (void);
166 
167 private:
168     void UpdateAccessibleName (void);
169 };
170 
171 } // end of namespace accessibility
172 
173 #endif
174