update dev300-m58
[ooovba.git] / sc / source / ui / inc / AccessibleText.hxx
blobc500fd7beabeb7775377236bfe9aa1e089be9236
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: AccessibleText.hxx,v $
10 * $Revision: 1.19.32.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SC_ACCESSIBLETEXT_HXX
32 #define _SC_ACCESSIBLETEXT_HXX
34 #include "textuno.hxx"
35 #include "global.hxx"
36 #include "viewdata.hxx"
37 #include <svx/svxenum.hxx>
39 #include <memory>
41 class ScDocShell;
42 class ScViewForwarder;
43 class ScEditObjectViewForwarder;
44 class ScPreviewViewForwarder;
45 class ScEditViewForwarder;
46 class ScPreviewShell;
47 class EditTextObject;
48 class ScCsvViewForwarder;
49 class ScAccessibleCell;
52 // ============================================================================
54 class ScAccessibleTextData : public SfxListener
56 public:
57 ScAccessibleTextData() {}
58 virtual ~ScAccessibleTextData() {}
60 virtual ScAccessibleTextData* Clone() const = 0;
62 virtual void Notify( SfxBroadcaster& /* rBC */, const SfxHint& /* rHint */ ) {}
64 virtual SvxTextForwarder* GetTextForwarder() = 0;
65 virtual SvxViewForwarder* GetViewForwarder() = 0;
66 virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate ) = 0;
67 virtual SfxBroadcaster& GetBroadcaster() const { return maBroadcaster; }
69 virtual void UpdateData() = 0;
70 virtual void SetDoUpdate(sal_Bool bValue) = 0;
71 virtual sal_Bool IsDirty() const = 0;
73 private:
74 mutable SfxBroadcaster maBroadcaster;
76 // prevent the using of this method of the base class
77 ScSharedCellEditSource* GetOriginalSource() { return NULL; }
81 // ============================================================================
83 class ScAccessibleCellBaseTextData : public ScAccessibleTextData,
84 public ScCellTextData
86 public:
87 ScAccessibleCellBaseTextData(ScDocShell* pDocShellP,
88 const ScAddress& rP)
89 : ScCellTextData(pDocShellP, rP) {}
90 virtual ~ScAccessibleCellBaseTextData() {}
91 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { ScCellTextData::Notify(rBC, rHint); }
93 virtual void UpdateData() { ScCellTextData::UpdateData(); }
94 virtual void SetDoUpdate(sal_Bool bValue) { ScCellTextData::SetDoUpdate(bValue); }
95 virtual sal_Bool IsDirty() const { return ScCellTextData::IsDirty(); }
99 // ============================================================================
101 // ScAccessibleCellTextData: shared data between sub objects of a accessible cell text object
103 class ScAccessibleCellTextData : public ScAccessibleCellBaseTextData
105 public:
106 ScAccessibleCellTextData(ScTabViewShell* pViewShell,
107 const ScAddress& rP, ScSplitPos eSplitPos, ScAccessibleCell* pAccCell);
108 virtual ~ScAccessibleCellTextData();
110 virtual ScAccessibleTextData* Clone() const;
112 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
114 virtual SvxTextForwarder* GetTextForwarder();
115 virtual SvxViewForwarder* GetViewForwarder();
116 virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate );
118 DECL_LINK( NotifyHdl, EENotify* );
119 protected:
120 virtual void GetCellText(const ScAddress& rCellPos, String& rText);
121 private:
122 ScViewForwarder* mpViewForwarder;
123 ScEditViewForwarder* mpEditViewForwarder;
124 ScTabViewShell* mpViewShell;
125 ScSplitPos meSplitPos;
126 sal_Bool mbViewEditEngine;
127 ScAccessibleCell* mpAccessibleCell;
129 // prevent the using of this method of the base class
130 ScSharedCellEditSource* GetOriginalSource() { return NULL; }
132 using ScAccessibleCellBaseTextData::GetDocShell;
133 ScDocShell* GetDocShell(ScTabViewShell* pViewShell);
137 // ============================================================================
139 class ScAccessibleEditObjectTextData : public ScAccessibleTextData
141 public:
142 ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin);
143 virtual ~ScAccessibleEditObjectTextData();
145 virtual ScAccessibleTextData* Clone() const;
147 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
149 virtual SvxTextForwarder* GetTextForwarder();
150 virtual SvxViewForwarder* GetViewForwarder();
151 virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate );
153 virtual void UpdateData() { }
154 virtual void SetDoUpdate(sal_Bool /* bValue */) { }
155 virtual sal_Bool IsDirty() const { return sal_False; }
157 DECL_LINK( NotifyHdl, EENotify* );
158 protected:
159 ScEditObjectViewForwarder* mpViewForwarder;
160 ScEditViewForwarder* mpEditViewForwarder;
161 EditView* mpEditView;
162 EditEngine* mpEditEngine;
163 SvxEditEngineForwarder* mpForwarder;
164 Window* mpWindow;
168 // ============================================================================
170 class ScAccessibleEditLineTextData : public ScAccessibleEditObjectTextData
172 public:
173 ScAccessibleEditLineTextData(EditView* pEditView, Window* pWin);
174 virtual ~ScAccessibleEditLineTextData();
176 virtual ScAccessibleTextData* Clone() const;
178 virtual SvxTextForwarder* GetTextForwarder();
179 virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate );
181 void Dispose();
182 void TextChanged();
183 void StartEdit();
184 void EndEdit();
185 private:
186 void ResetEditMode();
188 sal_Bool mbEditEngineCreated;
192 // ============================================================================
194 class ScAccessiblePreviewCellTextData : public ScAccessibleCellBaseTextData
196 public:
197 ScAccessiblePreviewCellTextData(ScPreviewShell* pViewShell,
198 const ScAddress& rP);
199 virtual ~ScAccessiblePreviewCellTextData();
201 virtual ScAccessibleTextData* Clone() const;
203 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
205 virtual SvxTextForwarder* GetTextForwarder();
206 virtual SvxViewForwarder* GetViewForwarder();
207 virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool /* bCreate */ ) { return NULL; }
209 //UNUSED2008-05 DECL_LINK( NotifyHdl, EENotify* );
210 private:
211 ScPreviewViewForwarder* mpViewForwarder;
212 ScPreviewShell* mpViewShell;
214 // prevent the using of this method of the base class
215 ScSharedCellEditSource* GetOriginalSource() { return NULL; }
217 using ScAccessibleCellBaseTextData::GetDocShell;
218 ScDocShell* GetDocShell(ScPreviewShell* pViewShell);
222 // ============================================================================
224 class ScAccessiblePreviewHeaderCellTextData : public ScAccessibleCellBaseTextData
226 public:
227 ScAccessiblePreviewHeaderCellTextData(ScPreviewShell* pViewShell,
228 const String& rText, const ScAddress& rP, sal_Bool bColHeader, sal_Bool bRowHeader);
229 virtual ~ScAccessiblePreviewHeaderCellTextData();
231 virtual ScAccessibleTextData* Clone() const;
233 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
235 virtual SvxTextForwarder* GetTextForwarder();
236 virtual SvxViewForwarder* GetViewForwarder();
237 virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool /* bCreate */ ) { return NULL; }
239 //UNUSED2008-05 DECL_LINK( NotifyHdl, EENotify* );
240 private:
241 ScPreviewViewForwarder* mpViewForwarder;
242 ScPreviewShell* mpViewShell;
243 String maText;
244 sal_Bool mbColHeader;
245 sal_Bool mbRowHeader;
247 // prevent the using of this method of the base class
248 ScSharedCellEditSource* GetOriginalSource() { return NULL; }
250 using ScAccessibleCellBaseTextData::GetDocShell;
251 ScDocShell* GetDocShell(ScPreviewShell* pViewShell);
255 // ============================================================================
257 class ScAccessibleHeaderTextData : public ScAccessibleTextData
259 public:
260 ScAccessibleHeaderTextData(ScPreviewShell* pViewShell,
261 const EditTextObject* pEditObj, sal_Bool bHeader, SvxAdjust eAdjust);
262 virtual ~ScAccessibleHeaderTextData();
264 virtual ScAccessibleTextData* Clone() const;
266 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
268 virtual SvxTextForwarder* GetTextForwarder();
269 virtual SvxViewForwarder* GetViewForwarder();
270 virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool /* bCreate */ ) { return NULL; }
272 virtual void UpdateData() { }
273 virtual void SetDoUpdate(sal_Bool /* bValue */) { }
274 virtual sal_Bool IsDirty() const { return sal_False; }
275 private:
276 ScPreviewViewForwarder* mpViewForwarder;
277 ScPreviewShell* mpViewShell;
278 ScEditEngineDefaulter* mpEditEngine;
279 SvxEditEngineForwarder* mpForwarder;
280 ScDocShell* mpDocSh;
281 const EditTextObject* mpEditObj;
282 sal_Bool mbHeader;
283 sal_Bool mbDataValid;
284 SvxAdjust meAdjust;
288 // ============================================================================
290 class ScAccessibleNoteTextData : public ScAccessibleTextData
292 public:
293 ScAccessibleNoteTextData(ScPreviewShell* pViewShell,
294 const String& sText, const ScAddress& aCellPos, sal_Bool bMarkNote);
295 virtual ~ScAccessibleNoteTextData();
297 virtual ScAccessibleTextData* Clone() const;
299 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
301 virtual SvxTextForwarder* GetTextForwarder();
302 virtual SvxViewForwarder* GetViewForwarder();
303 virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool /* bCreate */ ) { return NULL; }
305 virtual void UpdateData() { }
306 virtual void SetDoUpdate(sal_Bool /* bValue */) { }
307 virtual sal_Bool IsDirty() const { return sal_False; }
308 private:
309 ScPreviewViewForwarder* mpViewForwarder;
310 ScPreviewShell* mpViewShell;
311 ScEditEngineDefaulter* mpEditEngine;
312 SvxEditEngineForwarder* mpForwarder;
313 ScDocShell* mpDocSh;
314 String msText;
315 ScAddress maCellPos;
316 sal_Bool mbMarkNote;
317 sal_Bool mbDataValid;
321 // ============================================================================
323 class ScAccessibleCsvTextData : public ScAccessibleTextData
325 private:
326 typedef ::std::auto_ptr< SvxTextForwarder > TextForwarderPtr;
327 typedef ::std::auto_ptr< ScCsvViewForwarder > ViewForwarderPtr;
329 Window* mpWindow;
330 EditEngine* mpEditEngine;
331 TextForwarderPtr mpTextForwarder;
332 ViewForwarderPtr mpViewForwarder;
333 String maCellText;
334 Rectangle maBoundBox;
335 Size maCellSize;
337 public:
338 explicit ScAccessibleCsvTextData(
339 Window* pWindow,
340 EditEngine* pEditEngine,
341 const String& rCellText,
342 const Rectangle& rBoundBox,
343 const Size& rCellSize );
344 virtual ~ScAccessibleCsvTextData();
346 virtual ScAccessibleTextData* Clone() const;
348 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
350 virtual SvxTextForwarder* GetTextForwarder();
351 virtual SvxViewForwarder* GetViewForwarder();
352 virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate );
354 virtual void UpdateData() {}
355 virtual void SetDoUpdate( sal_Bool /* bValue */ ) {}
356 virtual sal_Bool IsDirty() const { return sal_False; }
360 // ============================================================================
362 #endif