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 .
22 #include <textuno.hxx>
23 #include <address.hxx>
24 #include "viewdata.hxx"
25 #include <editeng/svxenum.hxx>
26 #include <svl/SfxBroadcaster.hxx>
31 class ScViewForwarder
;
32 class ScEditObjectViewForwarder
;
33 class ScPreviewViewForwarder
;
34 class ScEditViewForwarder
;
37 class ScCsvViewForwarder
;
38 class ScAccessibleCell
;
41 class ScAccessibleTextData
: public SfxListener
44 ScAccessibleTextData() {}
46 virtual ScAccessibleTextData
* Clone() const = 0;
48 virtual void Notify( SfxBroadcaster
& /* rBC */, const SfxHint
& /* rHint */ ) override
{}
50 virtual SvxTextForwarder
* GetTextForwarder() = 0;
51 virtual SvxViewForwarder
* GetViewForwarder() = 0;
52 virtual SvxEditViewForwarder
* GetEditViewForwarder( bool bCreate
) = 0;
53 SfxBroadcaster
& GetBroadcaster() const { return maBroadcaster
; }
55 virtual void UpdateData() = 0;
56 DECL_LINK( NotifyHdl
, EENotify
&, void );
59 mutable SfxBroadcaster maBroadcaster
;
63 class ScAccessibleCellBaseTextData
: public ScAccessibleTextData
,
67 ScAccessibleCellBaseTextData(ScDocShell
* pDocShellP
,
69 : ScCellTextData(pDocShellP
, rP
) {}
70 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
{ ScCellTextData::Notify(rBC
, rHint
); }
72 virtual void UpdateData() override
{ ScCellTextData::UpdateData(); }
75 // ScAccessibleCellTextData: shared data between sub objects of an accessible cell text object
77 class ScAccessibleCellTextData
: public ScAccessibleCellBaseTextData
80 ScAccessibleCellTextData(ScTabViewShell
* pViewShell
,
81 const ScAddress
& rP
, ScSplitPos eSplitPos
, ScAccessibleCell
* pAccCell
);
82 virtual ~ScAccessibleCellTextData() override
;
84 virtual ScAccessibleTextData
* Clone() const override
;
86 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
88 virtual SvxTextForwarder
* GetTextForwarder() override
;
89 virtual SvxViewForwarder
* GetViewForwarder() override
;
90 virtual SvxEditViewForwarder
* GetEditViewForwarder( bool bCreate
) override
;
93 std::unique_ptr
<ScViewForwarder
> mpViewForwarder
;
94 ScTabViewShell
* mpViewShell
;
95 ScSplitPos meSplitPos
;
96 ScAccessibleCell
* mpAccessibleCell
;
98 using ScAccessibleCellBaseTextData::GetDocShell
;
99 static ScDocShell
* GetDocShell(ScTabViewShell
* pViewShell
);
102 class ScAccessibleEditObjectTextData
: public ScAccessibleTextData
105 // Add a para to indicate whether the object is cloned
106 ScAccessibleEditObjectTextData(EditView
* pEditView
, OutputDevice
* pWin
, bool isClone
= false);
107 virtual ~ScAccessibleEditObjectTextData() override
;
109 virtual ScAccessibleTextData
* Clone() const override
;
111 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
113 virtual SvxTextForwarder
* GetTextForwarder() override
;
114 virtual SvxViewForwarder
* GetViewForwarder() override
;
115 virtual SvxEditViewForwarder
* GetEditViewForwarder( bool bCreate
) override
;
117 virtual void UpdateData() override
{ }
119 DECL_LINK( NotifyHdl
, EENotify
&, void );
121 std::unique_ptr
<ScEditObjectViewForwarder
> mpViewForwarder
;
122 std::unique_ptr
<ScEditViewForwarder
> mpEditViewForwarder
;
123 EditView
* mpEditView
;
124 EditEngine
* mpEditEngine
;
125 std::unique_ptr
<SvxEditEngineForwarder
> mpForwarder
;
126 VclPtr
<OutputDevice
> mpWindow
;
130 class ScAccessibleEditLineTextData
: public ScAccessibleEditObjectTextData
133 ScAccessibleEditLineTextData(EditView
* pEditView
,
135 ScTextWnd
* pTextWnd
);
136 virtual ~ScAccessibleEditLineTextData() override
;
138 virtual ScAccessibleTextData
* Clone() const override
;
140 virtual SvxTextForwarder
* GetTextForwarder() override
;
141 virtual SvxEditViewForwarder
* GetEditViewForwarder( bool bCreate
) override
;
148 void ResetEditMode();
151 bool mbEditEngineCreated
;
154 class ScAccessiblePreviewCellTextData
: public ScAccessibleCellBaseTextData
157 ScAccessiblePreviewCellTextData(ScPreviewShell
* pViewShell
,
158 const ScAddress
& rP
);
159 virtual ~ScAccessiblePreviewCellTextData() override
;
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 std::unique_ptr
<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 OUString aText
, const ScAddress
& rP
, bool bColHeader
, bool bRowHeader
);
182 virtual ~ScAccessiblePreviewHeaderCellTextData() override
;
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 std::unique_ptr
<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
, SvxAdjust eAdjust
);
208 virtual ~ScAccessibleHeaderTextData() override
;
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 std::unique_ptr
<ScPreviewViewForwarder
> mxViewForwarder
;
221 ScPreviewShell
* mpViewShell
;
222 std::unique_ptr
<ScEditEngineDefaulter
> mpEditEngine
;
223 std::unique_ptr
<SvxEditEngineForwarder
> mpForwarder
;
225 const EditTextObject
* mpEditObj
;
230 class ScAccessibleNoteTextData
: public ScAccessibleTextData
233 ScAccessibleNoteTextData(ScPreviewShell
* pViewShell
,
234 OUString sText
, const ScAddress
& aCellPos
, bool bMarkNote
);
235 virtual ~ScAccessibleNoteTextData() override
;
237 virtual ScAccessibleTextData
* Clone() const override
;
239 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
241 virtual SvxTextForwarder
* GetTextForwarder() override
;
242 virtual SvxViewForwarder
* GetViewForwarder() override
;
243 virtual SvxEditViewForwarder
* GetEditViewForwarder( bool /* bCreate */ ) override
{ return nullptr; }
245 virtual void UpdateData() override
{ }
247 std::unique_ptr
<ScPreviewViewForwarder
> mxViewForwarder
;
248 ScPreviewShell
* mpViewShell
;
249 std::unique_ptr
<ScEditEngineDefaulter
> mpEditEngine
;
250 std::unique_ptr
<SvxEditEngineForwarder
> mpForwarder
;
258 class ScAccessibleCsvTextData
: public ScAccessibleTextData
261 typedef ::std::unique_ptr
< SvxTextForwarder
> TextForwarderPtr
;
262 typedef ::std::unique_ptr
< ScCsvViewForwarder
> ViewForwarderPtr
;
264 VclPtr
<OutputDevice
> mpWindow
;
265 EditEngine
* mpEditEngine
;
266 TextForwarderPtr mpTextForwarder
;
267 ViewForwarderPtr mpViewForwarder
;
272 explicit ScAccessibleCsvTextData(
273 OutputDevice
* pWindow
,
274 EditEngine
* pEditEngine
,
276 const Size
& rCellSize
);
277 virtual ~ScAccessibleCsvTextData() override
;
279 virtual ScAccessibleTextData
* Clone() const override
;
281 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
283 virtual SvxTextForwarder
* GetTextForwarder() override
;
284 virtual SvxViewForwarder
* GetViewForwarder() override
;
285 virtual SvxEditViewForwarder
* GetEditViewForwarder( bool bCreate
) override
;
287 virtual void UpdateData() override
{}
290 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */