Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_SVX_ACCESSIBLESHAPETREEINFO_HXX
21 : #define INCLUDED_SVX_ACCESSIBLESHAPETREEINFO_HXX
22 :
23 : #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
24 : #include <com/sun/star/beans/XPropertySet.hpp>
25 : #include <com/sun/star/document/XEventBroadcaster.hpp>
26 : #include <com/sun/star/frame/XController.hpp>
27 : #include <svx/IAccessibleViewForwarder.hxx>
28 : #include <svx/svxdllapi.h>
29 : #include <vcl/vclptr.hxx>
30 :
31 : class SdrView;
32 : namespace vcl { class Window; }
33 :
34 : namespace accessibility {
35 :
36 : /** This class bundles all information that is passed down the tree of
37 : accessible shapes so that each shape has access to that info.
38 :
39 : There are basically four members that can be set and queried:
40 : <ul>
41 : <li>The model broadcaster is used for getting notified about shape
42 : changes. Using this broadcaster makes in unnecessary to register at
43 : each shape separately.</li>
44 : <li>The view forwarder is responsible for transformation between
45 : coordinate systems and for providing the visible area both with respect
46 : to a specific window.</li>
47 : <li>The SdrView is used for creating accessible edit engines.</li>
48 : <li>The Window is used for creating accessible edit engines.</li>
49 : </ul>
50 : */
51 : class SVX_DLLPUBLIC AccessibleShapeTreeInfo
52 : {
53 : public:
54 : /** Use this constructor to create an empty object that is filled later
55 : with more meaningfull data.
56 : */
57 : AccessibleShapeTreeInfo();
58 :
59 : /** Create a copy of the given shape info.
60 : @param rInfo
61 : The shape tree info object to copy.
62 : */
63 : AccessibleShapeTreeInfo (const AccessibleShapeTreeInfo& rInfo);
64 :
65 : ~AccessibleShapeTreeInfo();
66 :
67 : AccessibleShapeTreeInfo& operator= (const AccessibleShapeTreeInfo& rInfo);
68 :
69 : /** Deprecated. Don't use this method.
70 : */
71 : void SetDocumentWindow (const ::com::sun::star::uno::Reference<
72 : ::com::sun::star::accessibility::XAccessibleComponent>& rxViewWindow);
73 :
74 : /** Deprecated. Don't use this method.
75 : */
76 : ::com::sun::star::uno::Reference<
77 : ::com::sun::star::accessibility::XAccessibleComponent>
78 0 : GetDocumentWindow() const { return mxDocumentWindow;}
79 :
80 : /** Set a new broadcaster that sends events indicating shape changes.
81 : The broadcaster usually is or belongs to a document model.
82 : @param rxModelBroadcaster
83 : The new broadcaster. It replaces the current one. An empty
84 : reference may be passed to unset the broadcaster
85 : */
86 : void SetModelBroadcaster (const ::com::sun::star::uno::Reference<
87 : ::com::sun::star::document::XEventBroadcaster>& rxModelBroadcaster);
88 :
89 : /** Return the current model broadcaster.
90 : @return
91 : The returned reference may be empty if the broadcaster has not
92 : been set or has been set to an empty reference.
93 : */
94 : ::com::sun::star::uno::Reference<
95 : ::com::sun::star::document::XEventBroadcaster>
96 64 : GetModelBroadcaster() const { return mxModelBroadcaster;}
97 :
98 : /** Set the view that will be used to construct SvxTextEditSources which
99 : in turn are used to create accessible edit engines.
100 : @param pView
101 : The new SdrView that replaces the current one. A NULL pointer
102 : may be passed to unset the view.
103 : */
104 : void SetSdrView (SdrView* pView);
105 :
106 : /** Return the current SdrView.
107 : @return
108 : The returned value may be NULL.
109 : */
110 26 : SdrView* GetSdrView() const { return mpView;}
111 :
112 : /** Set a new controller. This will usually but not necessarily
113 : correspond to the SdrView.
114 : @param rxController
115 : The new controller that replaces the current one. An empty
116 : reference may be passed to unset the controller.
117 : */
118 : void SetController (const ::com::sun::star::uno::Reference<
119 : ::com::sun::star::frame::XController>& rxController);
120 :
121 : /** Return the currently set controller.
122 : @return
123 : The reference to the currently set controller may be empty.
124 : */
125 : ::com::sun::star::uno::Reference<
126 : ::com::sun::star::frame::XController>
127 21 : GetController() const { return mxController;}
128 :
129 : /** Set the window that is used to construct SvxTextEditSources which in
130 : turn is used to create accessible edit engines.
131 : */
132 : void SetWindow (vcl::Window* pWindow);
133 :
134 : /** Return the current Window.
135 : @return
136 : The returned value may be NULL.
137 : */
138 17 : vcl::Window* GetWindow() const { return mpWindow;}
139 :
140 : /** The view forwarder allows the transformation between internal
141 : and pixel coordinates and can be asked for the visible area.
142 : @param pViewForwarder
143 : This view forwarder replaces the current one.
144 : */
145 : void SetViewForwarder (const IAccessibleViewForwarder* pViewForwarder);
146 :
147 : /** Return the current view forwarder.
148 : @return
149 : The returned pointer may be NULL.
150 : */
151 1748 : const IAccessibleViewForwarder* GetViewForwarder() const { return mpViewForwarder;}
152 :
153 : private:
154 : /** Deprecated.
155 : */
156 : ::com::sun::star::uno::Reference<
157 : ::com::sun::star::accessibility::XAccessibleComponent> mxDocumentWindow;
158 :
159 : /** this broadcaster sends events indicating shape changes.
160 : The broadcaster usually is or belongs to a document model.
161 :
162 : This once was named mxControllerBroadcaster.
163 : */
164 : ::com::sun::star::uno::Reference<
165 : ::com::sun::star::document::XEventBroadcaster> mxModelBroadcaster;
166 :
167 : /** This view is necessary to construct an SvxTextEditSource which in
168 : turn is used to create an accessible edit engine.
169 : */
170 : SdrView* mpView;
171 :
172 : /** The controller is used e.g. for obtaining the selected shapes.
173 : */
174 : ::com::sun::star::uno::Reference<
175 : ::com::sun::star::frame::XController> mxController;
176 :
177 : /** This window is necessary to construct an SvxTextEditSource which in
178 : turn is used to create an accessible edit engine.
179 : */
180 : VclPtr<vcl::Window> mpWindow;
181 :
182 : /** The view forwarder allows the transformation between internal
183 : and pixel coordinates and can be asked for the visible area.
184 : */
185 : const IAccessibleViewForwarder* mpViewForwarder;
186 : };
187 :
188 : } // end of namespace accessibility
189 :
190 : #endif
191 :
192 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|