fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / ui / inc / AccessibleText.hxx
blob649e79e17261a16f42c3f36e6b9cf34e77ca5c06
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_SOURCE_UI_INC_ACCESSIBLETEXT_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_ACCESSIBLETEXT_HXX
23 #include "textuno.hxx"
24 #include "global.hxx"
25 #include "viewdata.hxx"
26 #include <editeng/svxenum.hxx>
27 #include <svl/SfxBroadcaster.hxx>
29 #include <memory>
31 class ScDocShell;
32 class ScViewForwarder;
33 class ScEditObjectViewForwarder;
34 class ScPreviewViewForwarder;
35 class ScEditViewForwarder;
36 class ScPreviewShell;
37 class EditTextObject;
38 class ScCsvViewForwarder;
39 class ScAccessibleCell;
41 class ScAccessibleTextData : public SfxListener
43 public:
44 ScAccessibleTextData() {}
45 virtual ~ScAccessibleTextData() {}
47 virtual ScAccessibleTextData* Clone() const = 0;
49 virtual void Notify( SfxBroadcaster& /* rBC */, const SfxHint& /* rHint */ ) SAL_OVERRIDE {}
51 virtual SvxTextForwarder* GetTextForwarder() = 0;
52 virtual SvxViewForwarder* GetViewForwarder() = 0;
53 virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate ) = 0;
54 SfxBroadcaster& GetBroadcaster() const { return maBroadcaster; }
56 virtual void UpdateData() = 0;
57 virtual void SetDoUpdate(bool bValue) = 0;
58 virtual bool IsDirty() const = 0;
59 DECL_LINK( NotifyHdl, EENotify* );
61 private:
62 mutable SfxBroadcaster maBroadcaster;
66 class ScAccessibleCellBaseTextData : public ScAccessibleTextData,
67 public ScCellTextData
69 public:
70 ScAccessibleCellBaseTextData(ScDocShell* pDocShellP,
71 const ScAddress& rP)
72 : ScCellTextData(pDocShellP, rP) {}
73 virtual ~ScAccessibleCellBaseTextData() {}
74 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE { ScCellTextData::Notify(rBC, rHint); }
76 virtual void UpdateData() SAL_OVERRIDE { ScCellTextData::UpdateData(); }
77 virtual void SetDoUpdate(bool bValue) SAL_OVERRIDE { ScCellTextData::SetDoUpdate(bValue); }
78 virtual bool IsDirty() const SAL_OVERRIDE { return ScCellTextData::IsDirty(); }
81 // ScAccessibleCellTextData: shared data between sub objects of a accessible cell text object
83 class ScAccessibleCellTextData : public ScAccessibleCellBaseTextData
85 public:
86 ScAccessibleCellTextData(ScTabViewShell* pViewShell,
87 const ScAddress& rP, ScSplitPos eSplitPos, ScAccessibleCell* pAccCell);
88 virtual ~ScAccessibleCellTextData();
90 virtual ScAccessibleTextData* Clone() const SAL_OVERRIDE;
92 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
94 virtual SvxTextForwarder* GetTextForwarder() SAL_OVERRIDE;
95 virtual SvxViewForwarder* GetViewForwarder() SAL_OVERRIDE;
96 virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate ) SAL_OVERRIDE;
98 protected:
99 virtual void GetCellText(const ScAddress& rCellPos, OUString& rText) SAL_OVERRIDE;
100 private:
101 ScViewForwarder* mpViewForwarder;
102 ScEditViewForwarder* mpEditViewForwarder;
103 ScTabViewShell* mpViewShell;
104 ScSplitPos meSplitPos;
105 ScAccessibleCell* mpAccessibleCell;
107 using ScAccessibleCellBaseTextData::GetDocShell;
108 static ScDocShell* GetDocShell(ScTabViewShell* pViewShell);
111 class ScAccessibleEditObjectTextData : public ScAccessibleTextData
113 public:
114 // Add a para to indicate whether the object is cloned
115 ScAccessibleEditObjectTextData(EditView* pEditView, vcl::Window* pWin, bool isClone = false);
116 virtual ~ScAccessibleEditObjectTextData();
118 virtual ScAccessibleTextData* Clone() const SAL_OVERRIDE;
120 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
122 virtual SvxTextForwarder* GetTextForwarder() SAL_OVERRIDE;
123 virtual SvxViewForwarder* GetViewForwarder() SAL_OVERRIDE;
124 virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate ) SAL_OVERRIDE;
126 virtual void UpdateData() SAL_OVERRIDE { }
127 virtual void SetDoUpdate(bool /* bValue */) SAL_OVERRIDE { }
128 virtual bool IsDirty() const SAL_OVERRIDE { return false; }
130 DECL_LINK( NotifyHdl, EENotify* );
131 protected:
132 ScEditObjectViewForwarder* mpViewForwarder;
133 ScEditViewForwarder* mpEditViewForwarder;
134 EditView* mpEditView;
135 EditEngine* mpEditEngine;
136 SvxEditEngineForwarder* mpForwarder;
137 VclPtr<vcl::Window> mpWindow;
138 bool mbIsCloned;
141 class ScAccessibleEditLineTextData : public ScAccessibleEditObjectTextData
143 public:
144 ScAccessibleEditLineTextData(EditView* pEditView, vcl::Window* pWin);
145 virtual ~ScAccessibleEditLineTextData();
147 virtual ScAccessibleTextData* Clone() const SAL_OVERRIDE;
149 virtual SvxTextForwarder* GetTextForwarder() SAL_OVERRIDE;
150 virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate ) SAL_OVERRIDE;
152 void Dispose();
153 void TextChanged();
154 void StartEdit();
155 void EndEdit();
156 private:
157 void ResetEditMode();
159 bool mbEditEngineCreated;
162 class ScAccessiblePreviewCellTextData : public ScAccessibleCellBaseTextData
164 public:
165 ScAccessiblePreviewCellTextData(ScPreviewShell* pViewShell,
166 const ScAddress& rP);
167 virtual ~ScAccessiblePreviewCellTextData();
169 virtual ScAccessibleTextData* Clone() const SAL_OVERRIDE;
171 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
173 virtual SvxTextForwarder* GetTextForwarder() SAL_OVERRIDE;
174 virtual SvxViewForwarder* GetViewForwarder() SAL_OVERRIDE;
175 virtual SvxEditViewForwarder* GetEditViewForwarder( bool /* bCreate */ ) SAL_OVERRIDE { return NULL; }
177 private:
178 ScPreviewViewForwarder* mpViewForwarder;
179 ScPreviewShell* mpViewShell;
181 using ScAccessibleCellBaseTextData::GetDocShell;
182 static ScDocShell* GetDocShell(ScPreviewShell* pViewShell);
185 class ScAccessiblePreviewHeaderCellTextData : public ScAccessibleCellBaseTextData
187 public:
188 ScAccessiblePreviewHeaderCellTextData(ScPreviewShell* pViewShell,
189 const OUString& rText, const ScAddress& rP, bool bColHeader, bool bRowHeader);
190 virtual ~ScAccessiblePreviewHeaderCellTextData();
192 virtual ScAccessibleTextData* Clone() const SAL_OVERRIDE;
194 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
196 virtual SvxTextForwarder* GetTextForwarder() SAL_OVERRIDE;
197 virtual SvxViewForwarder* GetViewForwarder() SAL_OVERRIDE;
198 virtual SvxEditViewForwarder* GetEditViewForwarder( bool /* bCreate */ ) SAL_OVERRIDE { return NULL; }
200 private:
201 ScPreviewViewForwarder* mpViewForwarder;
202 ScPreviewShell* mpViewShell;
203 OUString maText;
204 bool mbColHeader;
205 bool mbRowHeader;
207 using ScAccessibleCellBaseTextData::GetDocShell;
208 static ScDocShell* GetDocShell(ScPreviewShell* pViewShell);
211 class ScAccessibleHeaderTextData : public ScAccessibleTextData
213 public:
214 ScAccessibleHeaderTextData(ScPreviewShell* pViewShell,
215 const EditTextObject* pEditObj, bool bHeader, SvxAdjust eAdjust);
216 virtual ~ScAccessibleHeaderTextData();
218 virtual ScAccessibleTextData* Clone() const SAL_OVERRIDE;
220 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
222 virtual SvxTextForwarder* GetTextForwarder() SAL_OVERRIDE;
223 virtual SvxViewForwarder* GetViewForwarder() SAL_OVERRIDE;
224 virtual SvxEditViewForwarder* GetEditViewForwarder( bool /* bCreate */ ) SAL_OVERRIDE { return NULL; }
226 virtual void UpdateData() SAL_OVERRIDE { }
227 virtual void SetDoUpdate(bool /* bValue */) SAL_OVERRIDE { }
228 virtual bool IsDirty() const SAL_OVERRIDE { return false; }
229 private:
230 ScPreviewViewForwarder* mpViewForwarder;
231 ScPreviewShell* mpViewShell;
232 ScEditEngineDefaulter* mpEditEngine;
233 SvxEditEngineForwarder* mpForwarder;
234 ScDocShell* mpDocSh;
235 const EditTextObject* mpEditObj;
236 bool mbHeader;
237 bool mbDataValid;
238 SvxAdjust meAdjust;
241 class ScAccessibleNoteTextData : public ScAccessibleTextData
243 public:
244 ScAccessibleNoteTextData(ScPreviewShell* pViewShell,
245 const OUString& sText, const ScAddress& aCellPos, bool bMarkNote);
246 virtual ~ScAccessibleNoteTextData();
248 virtual ScAccessibleTextData* Clone() const SAL_OVERRIDE;
250 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
252 virtual SvxTextForwarder* GetTextForwarder() SAL_OVERRIDE;
253 virtual SvxViewForwarder* GetViewForwarder() SAL_OVERRIDE;
254 virtual SvxEditViewForwarder* GetEditViewForwarder( bool /* bCreate */ ) SAL_OVERRIDE { return NULL; }
256 virtual void UpdateData() SAL_OVERRIDE { }
257 virtual void SetDoUpdate(bool /* bValue */) SAL_OVERRIDE { }
258 virtual bool IsDirty() const SAL_OVERRIDE { return false; }
259 private:
260 ScPreviewViewForwarder* mpViewForwarder;
261 ScPreviewShell* mpViewShell;
262 ScEditEngineDefaulter* mpEditEngine;
263 SvxEditEngineForwarder* mpForwarder;
264 ScDocShell* mpDocSh;
265 OUString msText;
266 ScAddress maCellPos;
267 bool mbMarkNote;
268 bool mbDataValid;
271 class ScAccessibleCsvTextData : public ScAccessibleTextData
273 private:
274 typedef ::std::unique_ptr< SvxTextForwarder > TextForwarderPtr;
275 typedef ::std::unique_ptr< ScCsvViewForwarder > ViewForwarderPtr;
277 VclPtr<vcl::Window> mpWindow;
278 EditEngine* mpEditEngine;
279 TextForwarderPtr mpTextForwarder;
280 ViewForwarderPtr mpViewForwarder;
281 OUString maCellText;
282 Rectangle maBoundBox;
283 Size maCellSize;
285 public:
286 explicit ScAccessibleCsvTextData(
287 vcl::Window* pWindow,
288 EditEngine* pEditEngine,
289 const OUString& rCellText,
290 const Rectangle& rBoundBox,
291 const Size& rCellSize );
292 virtual ~ScAccessibleCsvTextData();
294 virtual ScAccessibleTextData* Clone() const SAL_OVERRIDE;
296 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
298 virtual SvxTextForwarder* GetTextForwarder() SAL_OVERRIDE;
299 virtual SvxViewForwarder* GetViewForwarder() SAL_OVERRIDE;
300 virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate ) SAL_OVERRIDE;
302 virtual void UpdateData() SAL_OVERRIDE {}
303 virtual void SetDoUpdate( bool /* bValue */ ) SAL_OVERRIDE {}
304 virtual bool IsDirty() const SAL_OVERRIDE { return false; }
307 #endif
309 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */