1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
25 #include "viewdata.hxx"
26 #include <editeng/svxenum.hxx>
27 #include <svl/SfxBroadcaster.hxx>
32 class ScViewForwarder
;
33 class ScEditObjectViewForwarder
;
34 class ScPreviewViewForwarder
;
35 class ScEditViewForwarder
;
38 class ScCsvViewForwarder
;
39 class ScAccessibleCell
;
41 class ScAccessibleTextData
: public SfxListener
44 ScAccessibleTextData() {}
45 virtual ~ScAccessibleTextData() {}
47 virtual ScAccessibleTextData
* Clone() const = 0;
49 virtual void Notify( SfxBroadcaster
& /* rBC */, const SfxHint
& /* rHint */ ) 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 DECL_LINK_TYPED( NotifyHdl
, EENotify
&, void );
60 mutable SfxBroadcaster maBroadcaster
;
64 class ScAccessibleCellBaseTextData
: public ScAccessibleTextData
,
68 ScAccessibleCellBaseTextData(ScDocShell
* pDocShellP
,
70 : ScCellTextData(pDocShellP
, rP
) {}
71 virtual ~ScAccessibleCellBaseTextData() {}
72 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
{ ScCellTextData::Notify(rBC
, rHint
); }
74 virtual void UpdateData() override
{ ScCellTextData::UpdateData(); }
77 // ScAccessibleCellTextData: shared data between sub objects of a accessible cell text object
79 class ScAccessibleCellTextData
: public ScAccessibleCellBaseTextData
82 ScAccessibleCellTextData(ScTabViewShell
* pViewShell
,
83 const ScAddress
& rP
, ScSplitPos eSplitPos
, ScAccessibleCell
* pAccCell
);
84 virtual ~ScAccessibleCellTextData();
86 virtual ScAccessibleTextData
* Clone() const override
;
88 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
90 virtual SvxTextForwarder
* GetTextForwarder() override
;
91 virtual SvxViewForwarder
* GetViewForwarder() override
;
92 virtual SvxEditViewForwarder
* GetEditViewForwarder( bool bCreate
) override
;
95 ScViewForwarder
* mpViewForwarder
;
96 ScEditViewForwarder
* mpEditViewForwarder
;
97 ScTabViewShell
* mpViewShell
;
98 ScSplitPos meSplitPos
;
99 ScAccessibleCell
* mpAccessibleCell
;
101 using ScAccessibleCellBaseTextData::GetDocShell
;
102 static ScDocShell
* GetDocShell(ScTabViewShell
* pViewShell
);
105 class ScAccessibleEditObjectTextData
: public ScAccessibleTextData
108 // Add a para to indicate whether the object is cloned
109 ScAccessibleEditObjectTextData(EditView
* pEditView
, vcl::Window
* pWin
, bool isClone
= false);
110 virtual ~ScAccessibleEditObjectTextData();
112 virtual ScAccessibleTextData
* Clone() const override
;
114 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
116 virtual SvxTextForwarder
* GetTextForwarder() override
;
117 virtual SvxViewForwarder
* GetViewForwarder() override
;
118 virtual SvxEditViewForwarder
* GetEditViewForwarder( bool bCreate
) override
;
120 virtual void UpdateData() override
{ }
122 DECL_LINK_TYPED( NotifyHdl
, EENotify
&, void );
124 ScEditObjectViewForwarder
* mpViewForwarder
;
125 ScEditViewForwarder
* mpEditViewForwarder
;
126 EditView
* mpEditView
;
127 EditEngine
* mpEditEngine
;
128 SvxEditEngineForwarder
* mpForwarder
;
129 VclPtr
<vcl::Window
> mpWindow
;
133 class ScAccessibleEditLineTextData
: public ScAccessibleEditObjectTextData
136 ScAccessibleEditLineTextData(EditView
* pEditView
, vcl::Window
* pWin
);
137 virtual ~ScAccessibleEditLineTextData();
139 virtual ScAccessibleTextData
* Clone() const override
;
141 virtual SvxTextForwarder
* GetTextForwarder() override
;
142 virtual SvxEditViewForwarder
* GetEditViewForwarder( bool bCreate
) override
;
149 void ResetEditMode();
151 bool mbEditEngineCreated
;
154 class ScAccessiblePreviewCellTextData
: public ScAccessibleCellBaseTextData
157 ScAccessiblePreviewCellTextData(ScPreviewShell
* pViewShell
,
158 const ScAddress
& rP
);
159 virtual ~ScAccessiblePreviewCellTextData();
161 virtual ScAccessibleTextData
* Clone() const override
;
163 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
165 virtual SvxTextForwarder
* GetTextForwarder() override
;
166 virtual SvxViewForwarder
* GetViewForwarder() override
;
167 virtual SvxEditViewForwarder
* GetEditViewForwarder( bool /* bCreate */ ) override
{ return nullptr; }
170 ScPreviewViewForwarder
* mpViewForwarder
;
171 ScPreviewShell
* mpViewShell
;
173 using ScAccessibleCellBaseTextData::GetDocShell
;
174 static ScDocShell
* GetDocShell(ScPreviewShell
* pViewShell
);
177 class ScAccessiblePreviewHeaderCellTextData
: public ScAccessibleCellBaseTextData
180 ScAccessiblePreviewHeaderCellTextData(ScPreviewShell
* pViewShell
,
181 const OUString
& rText
, const ScAddress
& rP
, bool bColHeader
, bool bRowHeader
);
182 virtual ~ScAccessiblePreviewHeaderCellTextData();
184 virtual ScAccessibleTextData
* Clone() const override
;
186 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
188 virtual SvxTextForwarder
* GetTextForwarder() override
;
189 virtual SvxViewForwarder
* GetViewForwarder() override
;
190 virtual SvxEditViewForwarder
* GetEditViewForwarder( bool /* bCreate */ ) override
{ return nullptr; }
193 ScPreviewViewForwarder
* mpViewForwarder
;
194 ScPreviewShell
* mpViewShell
;
199 using ScAccessibleCellBaseTextData::GetDocShell
;
200 static ScDocShell
* GetDocShell(ScPreviewShell
* pViewShell
);
203 class ScAccessibleHeaderTextData
: public ScAccessibleTextData
206 ScAccessibleHeaderTextData(ScPreviewShell
* pViewShell
,
207 const EditTextObject
* pEditObj
, bool bHeader
, SvxAdjust eAdjust
);
208 virtual ~ScAccessibleHeaderTextData();
210 virtual ScAccessibleTextData
* Clone() const override
;
212 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
214 virtual SvxTextForwarder
* GetTextForwarder() override
;
215 virtual SvxViewForwarder
* GetViewForwarder() override
;
216 virtual SvxEditViewForwarder
* GetEditViewForwarder( bool /* bCreate */ ) override
{ return nullptr; }
218 virtual void UpdateData() override
{ }
220 ScPreviewViewForwarder
* mpViewForwarder
;
221 ScPreviewShell
* mpViewShell
;
222 ScEditEngineDefaulter
* mpEditEngine
;
223 SvxEditEngineForwarder
* mpForwarder
;
225 const EditTextObject
* mpEditObj
;
231 class ScAccessibleNoteTextData
: public ScAccessibleTextData
234 ScAccessibleNoteTextData(ScPreviewShell
* pViewShell
,
235 const OUString
& sText
, const ScAddress
& aCellPos
, bool bMarkNote
);
236 virtual ~ScAccessibleNoteTextData();
238 virtual ScAccessibleTextData
* Clone() const override
;
240 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
242 virtual SvxTextForwarder
* GetTextForwarder() override
;
243 virtual SvxViewForwarder
* GetViewForwarder() override
;
244 virtual SvxEditViewForwarder
* GetEditViewForwarder( bool /* bCreate */ ) override
{ return nullptr; }
246 virtual void UpdateData() override
{ }
248 ScPreviewViewForwarder
* mpViewForwarder
;
249 ScPreviewShell
* mpViewShell
;
250 ScEditEngineDefaulter
* mpEditEngine
;
251 SvxEditEngineForwarder
* mpForwarder
;
259 class ScAccessibleCsvTextData
: public ScAccessibleTextData
262 typedef ::std::unique_ptr
< SvxTextForwarder
> TextForwarderPtr
;
263 typedef ::std::unique_ptr
< ScCsvViewForwarder
> ViewForwarderPtr
;
265 VclPtr
<vcl::Window
> mpWindow
;
266 EditEngine
* mpEditEngine
;
267 TextForwarderPtr mpTextForwarder
;
268 ViewForwarderPtr mpViewForwarder
;
270 Rectangle maBoundBox
;
274 explicit ScAccessibleCsvTextData(
275 vcl::Window
* pWindow
,
276 EditEngine
* pEditEngine
,
277 const OUString
& rCellText
,
278 const Rectangle
& rBoundBox
,
279 const Size
& rCellSize
);
280 virtual ~ScAccessibleCsvTextData();
282 virtual ScAccessibleTextData
* Clone() const override
;
284 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
286 virtual SvxTextForwarder
* GetTextForwarder() override
;
287 virtual SvxViewForwarder
* GetViewForwarder() override
;
288 virtual SvxEditViewForwarder
* GetEditViewForwarder( bool bCreate
) override
;
290 virtual void UpdateData() override
{}
295 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */