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