1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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"
36 #include "viewdata.hxx"
37 #include <svx/svxenum.hxx>
42 class ScViewForwarder
;
43 class ScEditObjectViewForwarder
;
44 class ScPreviewViewForwarder
;
45 class ScEditViewForwarder
;
48 class ScCsvViewForwarder
;
49 class ScAccessibleCell
;
52 // ============================================================================
54 class ScAccessibleTextData
: public SfxListener
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;
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
,
87 ScAccessibleCellBaseTextData(ScDocShell
* pDocShellP
,
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
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
* );
120 virtual void GetCellText(const ScAddress
& rCellPos
, String
& rText
);
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
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
* );
159 ScEditObjectViewForwarder
* mpViewForwarder
;
160 ScEditViewForwarder
* mpEditViewForwarder
;
161 EditView
* mpEditView
;
162 EditEngine
* mpEditEngine
;
163 SvxEditEngineForwarder
* mpForwarder
;
168 // ============================================================================
170 class ScAccessibleEditLineTextData
: public ScAccessibleEditObjectTextData
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
);
186 void ResetEditMode();
188 sal_Bool mbEditEngineCreated
;
192 // ============================================================================
194 class ScAccessiblePreviewCellTextData
: public ScAccessibleCellBaseTextData
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* );
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
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* );
241 ScPreviewViewForwarder
* mpViewForwarder
;
242 ScPreviewShell
* mpViewShell
;
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
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
; }
276 ScPreviewViewForwarder
* mpViewForwarder
;
277 ScPreviewShell
* mpViewShell
;
278 ScEditEngineDefaulter
* mpEditEngine
;
279 SvxEditEngineForwarder
* mpForwarder
;
281 const EditTextObject
* mpEditObj
;
283 sal_Bool mbDataValid
;
288 // ============================================================================
290 class ScAccessibleNoteTextData
: public ScAccessibleTextData
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
; }
309 ScPreviewViewForwarder
* mpViewForwarder
;
310 ScPreviewShell
* mpViewShell
;
311 ScEditEngineDefaulter
* mpEditEngine
;
312 SvxEditEngineForwarder
* mpForwarder
;
317 sal_Bool mbDataValid
;
321 // ============================================================================
323 class ScAccessibleCsvTextData
: public ScAccessibleTextData
326 typedef ::std::auto_ptr
< SvxTextForwarder
> TextForwarderPtr
;
327 typedef ::std::auto_ptr
< ScCsvViewForwarder
> ViewForwarderPtr
;
330 EditEngine
* mpEditEngine
;
331 TextForwarderPtr mpTextForwarder
;
332 ViewForwarderPtr mpViewForwarder
;
334 Rectangle maBoundBox
;
338 explicit ScAccessibleCsvTextData(
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 // ============================================================================