tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / inc / AccessibleText.hxx
blobb4706a09c85809fc158938055ab3df038d4deaf1
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 #pragma once
22 #include <textuno.hxx>
23 #include <address.hxx>
24 #include "viewdata.hxx"
25 #include <editeng/svxenum.hxx>
26 #include <svl/SfxBroadcaster.hxx>
28 #include <memory>
30 class ScDocShell;
31 class ScViewForwarder;
32 class ScEditObjectViewForwarder;
33 class ScPreviewViewForwarder;
34 class ScEditViewForwarder;
35 class ScPreviewShell;
36 class EditTextObject;
37 class ScCsvViewForwarder;
38 class ScAccessibleCell;
39 class ScTextWnd;
41 class ScAccessibleTextData : public SfxListener
43 public:
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 );
58 private:
59 mutable SfxBroadcaster maBroadcaster;
63 class ScAccessibleCellBaseTextData : public ScAccessibleTextData,
64 public ScCellTextData
66 public:
67 ScAccessibleCellBaseTextData(ScDocShell* pDocShellP,
68 const ScAddress& rP)
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
79 public:
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;
92 private:
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
104 public:
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 );
120 protected:
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;
127 bool mbIsCloned;
130 class ScAccessibleEditLineTextData : public ScAccessibleEditObjectTextData
132 public:
133 ScAccessibleEditLineTextData(EditView* pEditView,
134 OutputDevice* pWin,
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;
143 void Dispose();
144 void TextChanged();
145 void StartEdit();
146 void EndEdit();
147 private:
148 void ResetEditMode();
150 ScTextWnd* mpTxtWnd;
151 bool mbEditEngineCreated;
154 class ScAccessiblePreviewCellTextData : public ScAccessibleCellBaseTextData
156 public:
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; }
169 private:
170 std::unique_ptr<ScPreviewViewForwarder> mpViewForwarder;
171 ScPreviewShell* mpViewShell;
173 using ScAccessibleCellBaseTextData::GetDocShell;
174 static ScDocShell* GetDocShell(ScPreviewShell* pViewShell);
177 class ScAccessiblePreviewHeaderCellTextData : public ScAccessibleCellBaseTextData
179 public:
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; }
192 private:
193 std::unique_ptr<ScPreviewViewForwarder> mpViewForwarder;
194 ScPreviewShell* mpViewShell;
195 OUString maText;
196 bool mbColHeader;
197 bool mbRowHeader;
199 using ScAccessibleCellBaseTextData::GetDocShell;
200 static ScDocShell* GetDocShell(ScPreviewShell* pViewShell);
203 class ScAccessibleHeaderTextData : public ScAccessibleTextData
205 public:
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 { }
219 private:
220 std::unique_ptr<ScPreviewViewForwarder> mxViewForwarder;
221 ScPreviewShell* mpViewShell;
222 std::unique_ptr<ScEditEngineDefaulter> mpEditEngine;
223 std::unique_ptr<SvxEditEngineForwarder> mpForwarder;
224 ScDocShell* mpDocSh;
225 const EditTextObject* mpEditObj;
226 bool mbDataValid;
227 SvxAdjust meAdjust;
230 class ScAccessibleNoteTextData : public ScAccessibleTextData
232 public:
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 { }
246 private:
247 std::unique_ptr<ScPreviewViewForwarder> mxViewForwarder;
248 ScPreviewShell* mpViewShell;
249 std::unique_ptr<ScEditEngineDefaulter> mpEditEngine;
250 std::unique_ptr<SvxEditEngineForwarder> mpForwarder;
251 ScDocShell* mpDocSh;
252 OUString msText;
253 ScAddress maCellPos;
254 bool mbMarkNote;
255 bool mbDataValid;
258 class ScAccessibleCsvTextData : public ScAccessibleTextData
260 private:
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;
268 OUString maCellText;
269 Size maCellSize;
271 public:
272 explicit ScAccessibleCsvTextData(
273 OutputDevice* pWindow,
274 EditEngine* pEditEngine,
275 OUString aCellText,
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: */