Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SC_ACCESSIBLETEXT_HXX
30 : : #define _SC_ACCESSIBLETEXT_HXX
31 : :
32 : : #include "textuno.hxx"
33 : : #include "global.hxx"
34 : : #include "viewdata.hxx"
35 : : #include <editeng/svxenum.hxx>
36 : :
37 : : #include <memory>
38 : :
39 : : class ScDocShell;
40 : : class ScViewForwarder;
41 : : class ScEditObjectViewForwarder;
42 : : class ScPreviewViewForwarder;
43 : : class ScEditViewForwarder;
44 : : class ScPreviewShell;
45 : : class EditTextObject;
46 : : class ScCsvViewForwarder;
47 : : class ScAccessibleCell;
48 : :
49 : :
50 : : // ============================================================================
51 : :
52 : : class ScAccessibleTextData : public SfxListener
53 : : {
54 : : public:
55 [ + - ]: 59 : ScAccessibleTextData() {}
56 [ + - ][ - + ]: 48 : virtual ~ScAccessibleTextData() {}
57 : :
58 : : virtual ScAccessibleTextData* Clone() const = 0;
59 : :
60 : 0 : virtual void Notify( SfxBroadcaster& /* rBC */, const SfxHint& /* rHint */ ) {}
61 : :
62 : : virtual SvxTextForwarder* GetTextForwarder() = 0;
63 : : virtual SvxViewForwarder* GetViewForwarder() = 0;
64 : : virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate ) = 0;
65 : 92 : virtual SfxBroadcaster& GetBroadcaster() const { return maBroadcaster; }
66 : :
67 : : virtual void UpdateData() = 0;
68 : : virtual void SetDoUpdate(sal_Bool bValue) = 0;
69 : : virtual sal_Bool IsDirty() const = 0;
70 : :
71 : : private:
72 : : mutable SfxBroadcaster maBroadcaster;
73 : :
74 : : // prevent the using of this method of the base class
75 : : ScCellEditSource* GetOriginalSource() { return NULL; }
76 : : };
77 : :
78 : :
79 : : // ============================================================================
80 : :
81 : : class ScAccessibleCellBaseTextData : public ScAccessibleTextData,
82 : : public ScCellTextData
83 : : {
84 : : public:
85 : 41 : ScAccessibleCellBaseTextData(ScDocShell* pDocShellP,
86 : : const ScAddress& rP)
87 [ + - ]: 41 : : ScCellTextData(pDocShellP, rP) {}
88 [ + - ][ - + ]: 30 : virtual ~ScAccessibleCellBaseTextData() {}
89 : 58 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { ScCellTextData::Notify(rBC, rHint); }
90 : :
91 : 0 : virtual void UpdateData() { ScCellTextData::UpdateData(); }
92 : 0 : virtual void SetDoUpdate(sal_Bool bValue) { ScCellTextData::SetDoUpdate(bValue); }
93 : 0 : virtual sal_Bool IsDirty() const { return ScCellTextData::IsDirty(); }
94 : : };
95 : :
96 : :
97 : : // ============================================================================
98 : :
99 : : // ScAccessibleCellTextData: shared data between sub objects of a accessible cell text object
100 : :
101 : : class ScAccessibleCellTextData : public ScAccessibleCellBaseTextData
102 : : {
103 : : public:
104 : : ScAccessibleCellTextData(ScTabViewShell* pViewShell,
105 : : const ScAddress& rP, ScSplitPos eSplitPos, ScAccessibleCell* pAccCell);
106 : : virtual ~ScAccessibleCellTextData();
107 : :
108 : : virtual ScAccessibleTextData* Clone() const;
109 : :
110 : : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
111 : :
112 : : virtual SvxTextForwarder* GetTextForwarder();
113 : : virtual SvxViewForwarder* GetViewForwarder();
114 : : virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate );
115 : :
116 : : DECL_LINK( NotifyHdl, EENotify* );
117 : : protected:
118 : : virtual void GetCellText(const ScAddress& rCellPos, String& rText);
119 : : private:
120 : : ScViewForwarder* mpViewForwarder;
121 : : ScEditViewForwarder* mpEditViewForwarder;
122 : : ScTabViewShell* mpViewShell;
123 : : ScSplitPos meSplitPos;
124 : : sal_Bool mbViewEditEngine;
125 : : ScAccessibleCell* mpAccessibleCell;
126 : :
127 : : // prevent the using of this method of the base class
128 : : ScCellEditSource* GetOriginalSource() { return NULL; }
129 : :
130 : : using ScAccessibleCellBaseTextData::GetDocShell;
131 : : ScDocShell* GetDocShell(ScTabViewShell* pViewShell);
132 : : };
133 : :
134 : :
135 : : // ============================================================================
136 : :
137 : : class ScAccessibleEditObjectTextData : public ScAccessibleTextData
138 : : {
139 : : public:
140 : : ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin);
141 : : virtual ~ScAccessibleEditObjectTextData();
142 : :
143 : : virtual ScAccessibleTextData* Clone() const;
144 : :
145 : : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
146 : :
147 : : virtual SvxTextForwarder* GetTextForwarder();
148 : : virtual SvxViewForwarder* GetViewForwarder();
149 : : virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate );
150 : :
151 : 0 : virtual void UpdateData() { }
152 : 0 : virtual void SetDoUpdate(sal_Bool /* bValue */) { }
153 : 0 : virtual sal_Bool IsDirty() const { return false; }
154 : :
155 : : DECL_LINK( NotifyHdl, EENotify* );
156 : : protected:
157 : : ScEditObjectViewForwarder* mpViewForwarder;
158 : : ScEditViewForwarder* mpEditViewForwarder;
159 : : EditView* mpEditView;
160 : : EditEngine* mpEditEngine;
161 : : SvxEditEngineForwarder* mpForwarder;
162 : : Window* mpWindow;
163 : : };
164 : :
165 : :
166 : : // ============================================================================
167 : :
168 : : class ScAccessibleEditLineTextData : public ScAccessibleEditObjectTextData
169 : : {
170 : : public:
171 : : ScAccessibleEditLineTextData(EditView* pEditView, Window* pWin);
172 : : virtual ~ScAccessibleEditLineTextData();
173 : :
174 : : virtual ScAccessibleTextData* Clone() const;
175 : :
176 : : virtual SvxTextForwarder* GetTextForwarder();
177 : : virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate );
178 : :
179 : : void Dispose();
180 : : void TextChanged();
181 : : void StartEdit();
182 : : void EndEdit();
183 : : private:
184 : : void ResetEditMode();
185 : :
186 : : sal_Bool mbEditEngineCreated;
187 : : };
188 : :
189 : :
190 : : // ============================================================================
191 : :
192 : : class ScAccessiblePreviewCellTextData : public ScAccessibleCellBaseTextData
193 : : {
194 : : public:
195 : : ScAccessiblePreviewCellTextData(ScPreviewShell* pViewShell,
196 : : const ScAddress& rP);
197 : : virtual ~ScAccessiblePreviewCellTextData();
198 : :
199 : : virtual ScAccessibleTextData* Clone() const;
200 : :
201 : : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
202 : :
203 : : virtual SvxTextForwarder* GetTextForwarder();
204 : : virtual SvxViewForwarder* GetViewForwarder();
205 : 27 : virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool /* bCreate */ ) { return NULL; }
206 : :
207 : : private:
208 : : ScPreviewViewForwarder* mpViewForwarder;
209 : : ScPreviewShell* mpViewShell;
210 : :
211 : : // prevent the using of this method of the base class
212 : : ScCellEditSource* GetOriginalSource() { return NULL; }
213 : :
214 : : using ScAccessibleCellBaseTextData::GetDocShell;
215 : : ScDocShell* GetDocShell(ScPreviewShell* pViewShell);
216 : : };
217 : :
218 : :
219 : : // ============================================================================
220 : :
221 : : class ScAccessiblePreviewHeaderCellTextData : public ScAccessibleCellBaseTextData
222 : : {
223 : : public:
224 : : ScAccessiblePreviewHeaderCellTextData(ScPreviewShell* pViewShell,
225 : : const String& rText, const ScAddress& rP, sal_Bool bColHeader, sal_Bool bRowHeader);
226 : : virtual ~ScAccessiblePreviewHeaderCellTextData();
227 : :
228 : : virtual ScAccessibleTextData* Clone() const;
229 : :
230 : : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
231 : :
232 : : virtual SvxTextForwarder* GetTextForwarder();
233 : : virtual SvxViewForwarder* GetViewForwarder();
234 : 16 : virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool /* bCreate */ ) { return NULL; }
235 : :
236 : : private:
237 : : ScPreviewViewForwarder* mpViewForwarder;
238 : : ScPreviewShell* mpViewShell;
239 : : String maText;
240 : : sal_Bool mbColHeader;
241 : : sal_Bool mbRowHeader;
242 : :
243 : : // prevent the using of this method of the base class
244 : : ScCellEditSource* GetOriginalSource() { return NULL; }
245 : :
246 : : using ScAccessibleCellBaseTextData::GetDocShell;
247 : : ScDocShell* GetDocShell(ScPreviewShell* pViewShell);
248 : : };
249 : :
250 : :
251 : : // ============================================================================
252 : :
253 : : class ScAccessibleHeaderTextData : public ScAccessibleTextData
254 : : {
255 : : public:
256 : : ScAccessibleHeaderTextData(ScPreviewShell* pViewShell,
257 : : const EditTextObject* pEditObj, sal_Bool bHeader, SvxAdjust eAdjust);
258 : : virtual ~ScAccessibleHeaderTextData();
259 : :
260 : : virtual ScAccessibleTextData* Clone() const;
261 : :
262 : : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
263 : :
264 : : virtual SvxTextForwarder* GetTextForwarder();
265 : : virtual SvxViewForwarder* GetViewForwarder();
266 : 38 : virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool /* bCreate */ ) { return NULL; }
267 : :
268 : 0 : virtual void UpdateData() { }
269 : 0 : virtual void SetDoUpdate(sal_Bool /* bValue */) { }
270 : 0 : virtual sal_Bool IsDirty() const { return false; }
271 : : private:
272 : : ScPreviewViewForwarder* mpViewForwarder;
273 : : ScPreviewShell* mpViewShell;
274 : : ScEditEngineDefaulter* mpEditEngine;
275 : : SvxEditEngineForwarder* mpForwarder;
276 : : ScDocShell* mpDocSh;
277 : : const EditTextObject* mpEditObj;
278 : : sal_Bool mbHeader;
279 : : sal_Bool mbDataValid;
280 : : SvxAdjust meAdjust;
281 : : };
282 : :
283 : :
284 : : // ============================================================================
285 : :
286 : : class ScAccessibleNoteTextData : public ScAccessibleTextData
287 : : {
288 : : public:
289 : : ScAccessibleNoteTextData(ScPreviewShell* pViewShell,
290 : : const String& sText, const ScAddress& aCellPos, sal_Bool bMarkNote);
291 : : virtual ~ScAccessibleNoteTextData();
292 : :
293 : : virtual ScAccessibleTextData* Clone() const;
294 : :
295 : : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
296 : :
297 : : virtual SvxTextForwarder* GetTextForwarder();
298 : : virtual SvxViewForwarder* GetViewForwarder();
299 : 0 : virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool /* bCreate */ ) { return NULL; }
300 : :
301 : 0 : virtual void UpdateData() { }
302 : 0 : virtual void SetDoUpdate(sal_Bool /* bValue */) { }
303 : 0 : virtual sal_Bool IsDirty() const { return false; }
304 : : private:
305 : : ScPreviewViewForwarder* mpViewForwarder;
306 : : ScPreviewShell* mpViewShell;
307 : : ScEditEngineDefaulter* mpEditEngine;
308 : : SvxEditEngineForwarder* mpForwarder;
309 : : ScDocShell* mpDocSh;
310 : : String msText;
311 : : ScAddress maCellPos;
312 : : sal_Bool mbMarkNote;
313 : : sal_Bool mbDataValid;
314 : : };
315 : :
316 : :
317 : : // ============================================================================
318 : :
319 : : class ScAccessibleCsvTextData : public ScAccessibleTextData
320 : : {
321 : : private:
322 : : typedef ::std::auto_ptr< SvxTextForwarder > TextForwarderPtr;
323 : : typedef ::std::auto_ptr< ScCsvViewForwarder > ViewForwarderPtr;
324 : :
325 : : Window* mpWindow;
326 : : EditEngine* mpEditEngine;
327 : : TextForwarderPtr mpTextForwarder;
328 : : ViewForwarderPtr mpViewForwarder;
329 : : String maCellText;
330 : : Rectangle maBoundBox;
331 : : Size maCellSize;
332 : :
333 : : public:
334 : : explicit ScAccessibleCsvTextData(
335 : : Window* pWindow,
336 : : EditEngine* pEditEngine,
337 : : const String& rCellText,
338 : : const Rectangle& rBoundBox,
339 : : const Size& rCellSize );
340 : : virtual ~ScAccessibleCsvTextData();
341 : :
342 : : virtual ScAccessibleTextData* Clone() const;
343 : :
344 : : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
345 : :
346 : : virtual SvxTextForwarder* GetTextForwarder();
347 : : virtual SvxViewForwarder* GetViewForwarder();
348 : : virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate );
349 : :
350 : 0 : virtual void UpdateData() {}
351 : 0 : virtual void SetDoUpdate( sal_Bool /* bValue */ ) {}
352 : 0 : virtual sal_Bool IsDirty() const { return false; }
353 : : };
354 : :
355 : :
356 : : // ============================================================================
357 : :
358 : : #endif
359 : :
360 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|