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 _SVX_ACCESSIBILITY_ACCESSIBLE_SHAPE_TREE_INFO_HXX
29 #define _SVX_ACCESSIBILITY_ACCESSIBLE_SHAPE_TREE_INFO_HXX
30 
31 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
32 #include <com/sun/star/beans/XPropertySet.hpp>
33 #include <com/sun/star/document/XEventBroadcaster.hpp>
34 #include <com/sun/star/frame/XController.hpp>
35 #include <svx/IAccessibleViewForwarder.hxx>
36 #include "svx/svxdllapi.h"
37 
38 class SdrView;
39 class Window;
40 
41 namespace accessibility {
42 
43 /** This class bundles all information that is passed down the tree of
44     accessible shapes so that each shape has access to that info.
45 
46     There are basically four members that can be set and queried:
47     <ul>
48     <li>The model broadcaster is used for getting notified about shape
49     changes.  Using this broadcaster makes in unnecessary to register at
50     each shape seperately.</li>
51     <li>The view forwarder is responsible for transformation between
52     coordinate systems and for providing the visible area both with respect
53     to a specific window.</li>
54     <li>The SdrView is used for creating accessible edit engines.</li>
55     <li>The Window is used for creating accessible edit engines.</li>
56     </ul>
57 */
58 class SVX_DLLPUBLIC AccessibleShapeTreeInfo
59 {
60 public:
61     /** Deprecated.  Don't use this constructor any more.
62     */
63     AccessibleShapeTreeInfo (
64         const ::com::sun::star::uno::Reference<
65             ::com::sun::star::accessibility::XAccessibleComponent>& rxDocumentWindow,
66         const ::com::sun::star::uno::Reference<
67             ::com::sun::star::document::XEventBroadcaster>& rxBroadcaster);
68 
69     /** Use this constructor to create an empty object that is filled later
70         with more meaningfull data.
71     */
72     AccessibleShapeTreeInfo (void);
73 
74     /** Create a copy of the given shape info.
75         @param rInfo
76             The shape tree info object to copy.
77     */
78     AccessibleShapeTreeInfo (const AccessibleShapeTreeInfo& rInfo);
79 
80     ~AccessibleShapeTreeInfo (void);
81 
82     AccessibleShapeTreeInfo& operator= (const AccessibleShapeTreeInfo& rInfo);
83 
84     /** Deprecated.  Don't use this method.
85     */
86     void SetDocumentWindow (const ::com::sun::star::uno::Reference<
87         ::com::sun::star::accessibility::XAccessibleComponent>& rxViewWindow);
88     /** Deprecated.  Don't use this method.
89     */
90     ::com::sun::star::uno::Reference<
91         ::com::sun::star::accessibility::XAccessibleComponent>
92         GetDocumentWindow (void) const;
93 
94     /** Deprecated.   Use the correctly named SetModelBroadcaster method
95         instead.
96     */
97     void SetControllerBroadcaster (const ::com::sun::star::uno::Reference<
98         ::com::sun::star::document::XEventBroadcaster>& rxControllerBroadcaster);
99     /** Deprecated.   Use the correctly named GetModelBroadcaster method
100         instead.
101     */
102     ::com::sun::star::uno::Reference<
103         ::com::sun::star::document::XEventBroadcaster>
104         GetControllerBroadcaster (void) const;
105 
106     /** Set a new broadcaster that sends events indicating shape changes.
107         The broadcaster usually is or belongs to a document model.
108         @param rxModelBroadcaster
109             The new broadcaster.  It replaces the current one.  An empty
110             reference may be passed to unset the broadcaster
111     */
112     void SetModelBroadcaster (const ::com::sun::star::uno::Reference<
113         ::com::sun::star::document::XEventBroadcaster>& rxModelBroadcaster);
114 
115     /** Return the current model broadcaster.
116         @return
117             The returned reference may be empty if the broadcaster has not
118             been set or has been set to an empty reference.
119     */
120     ::com::sun::star::uno::Reference<
121         ::com::sun::star::document::XEventBroadcaster>
122         GetModelBroadcaster (void) const;
123 
124     /** Set the view that will be used to construct SvxTextEditSources which
125         in turn are used to create accessible edit engines.
126         @param pView
127             The new SdrView that replaces the current one.  A NULL pointer
128             may be passed to unset the view.
129     */
130     void SetSdrView (SdrView* pView);
131 
132     /** Return the current SdrView.
133         @return
134             The returned value may be NULL.
135     */
136     SdrView* GetSdrView (void) const;
137 
138     /** Set a new controller.  This will usually but not necessarily
139         correspond to the SdrView.
140         @param rxController
141             The new controller that replaces the current one.  An empty
142             reference may be passed to unset the controller.
143     */
144     void SetController (const ::com::sun::star::uno::Reference<
145         ::com::sun::star::frame::XController>& rxController);
146 
147     /** Return the currently set controller.
148         @return
149             The reference to the currently set controller may be empty.
150     */
151     ::com::sun::star::uno::Reference<
152         ::com::sun::star::frame::XController>
153         GetController (void) const;
154 
155     /** Set the window that is used to construct SvxTextEditSources which in
156         turn is used to create accessible edit engines.
157     */
158     void SetWindow (Window* pWindow);
159 
160     /** Return the current Window.
161         @return
162             The returned value may be NULL.
163     */
164     Window* GetWindow (void) const;
165 
166     /** The view forwarder allows the transformation between internal
167         and pixel coordinates and can be asked for the visible area.
168         @param pViewForwarder
169             This view forwarder replaces the current one.
170     */
171     void SetViewForwarder (const IAccessibleViewForwarder* pViewForwarder);
172 
173     /** Return the current view forwarder.
174         @return
175             The returned pointer may be NULL.
176     */
177     const IAccessibleViewForwarder* GetViewForwarder (void) const;
178 
179 private:
180     /** Deprecated.
181     */
182     ::com::sun::star::uno::Reference<
183         ::com::sun::star::accessibility::XAccessibleComponent> mxDocumentWindow;
184 
185     /** this broadcaster sends events indicating shape changes.
186         The broadcaster usually is or belongs to a document model.
187 
188         This once was named mxControllerBroadcaster.
189     */
190     ::com::sun::star::uno::Reference<
191         ::com::sun::star::document::XEventBroadcaster> mxModelBroadcaster;
192 
193     /** This view is necessary to construct an SvxTextEditSource which in
194         turn is used to create an accessible edit engine.
195     */
196     SdrView* mpView;
197 
198     /** The controller is used e.g. for obtaining the selected shapes.
199     */
200     ::com::sun::star::uno::Reference<
201         ::com::sun::star::frame::XController> mxController;
202 
203     /** This window is necessary to construct an SvxTextEditSource which in
204         turn is used to create an accessible edit engine.
205     */
206     Window* mpWindow;
207 
208     /** The view forwarder allows the transformation between internal
209         and pixel coordinates and can be asked for the visible area.
210     */
211     const IAccessibleViewForwarder* mpViewForwarder;
212 };
213 
214 } // end of namespace accessibility
215 
216 #endif
217