LibreOffice Module sc (master)  1
AccessibleText.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #pragma once
21 
22 #include <textuno.hxx>
23 #include <address.hxx>
24 #include "viewdata.hxx"
25 #include <editeng/svxenum.hxx>
26 #include <svl/SfxBroadcaster.hxx>
27 
28 #include <memory>
29 
30 class ScDocShell;
31 class ScViewForwarder;
35 class ScPreviewShell;
36 class EditTextObject;
37 class ScCsvViewForwarder;
38 class ScAccessibleCell;
39 class ScTextWnd;
40 
42 {
43 public:
45 
46  virtual ScAccessibleTextData* Clone() const = 0;
47 
48  virtual void Notify( SfxBroadcaster& /* rBC */, const SfxHint& /* rHint */ ) override {}
49 
50  virtual SvxTextForwarder* GetTextForwarder() = 0;
51  virtual SvxViewForwarder* GetViewForwarder() = 0;
52  virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate ) = 0;
54 
55  virtual void UpdateData() = 0;
56  DECL_LINK( NotifyHdl, EENotify&, void );
57 
58 private:
60 
61 };
62 
64  public ScCellTextData
65 {
66 public:
68  const ScAddress& rP)
69  : ScCellTextData(pDocShellP, rP) {}
70  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override { ScCellTextData::Notify(rBC, rHint); }
71 
72  virtual void UpdateData() override { ScCellTextData::UpdateData(); }
73 };
74 
75 // ScAccessibleCellTextData: shared data between sub objects of an accessible cell text object
76 
78 {
79 public:
81  const ScAddress& rP, ScSplitPos eSplitPos, ScAccessibleCell* pAccCell);
82  virtual ~ScAccessibleCellTextData() override;
83 
84  virtual ScAccessibleTextData* Clone() const override;
85 
86  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
87 
88  virtual SvxTextForwarder* GetTextForwarder() override;
89  virtual SvxViewForwarder* GetViewForwarder() override;
90  virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate ) override;
91 
92 private:
93  std::unique_ptr<ScViewForwarder> mpViewForwarder;
97 
99  static ScDocShell* GetDocShell(ScTabViewShell* pViewShell);
100 };
101 
103 {
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;
108 
109  virtual ScAccessibleTextData* Clone() const override;
110 
111  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
112 
113  virtual SvxTextForwarder* GetTextForwarder() override;
114  virtual SvxViewForwarder* GetViewForwarder() override;
115  virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate ) override;
116 
117  virtual void UpdateData() override { }
118 
119  DECL_LINK( NotifyHdl, EENotify&, void );
120 protected:
121  std::unique_ptr<ScEditObjectViewForwarder> mpViewForwarder;
122  std::unique_ptr<ScEditViewForwarder> mpEditViewForwarder;
125  std::unique_ptr<SvxEditEngineForwarder> mpForwarder;
128 };
129 
131 {
132 public:
134  OutputDevice* pWin,
135  ScTextWnd* pTextWnd);
136  virtual ~ScAccessibleEditLineTextData() override;
137 
138  virtual ScAccessibleTextData* Clone() const override;
139 
140  virtual SvxTextForwarder* GetTextForwarder() override;
141  virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate ) override;
142 
143  void Dispose();
144  void TextChanged();
145  void StartEdit();
146  void EndEdit();
147 private:
148  void ResetEditMode();
149 
152 };
153 
155 {
156 public:
158  const ScAddress& rP);
159  virtual ~ScAccessiblePreviewCellTextData() override;
160 
161  virtual ScAccessibleTextData* Clone() const override;
162 
163  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
164 
165  virtual SvxTextForwarder* GetTextForwarder() override;
166  virtual SvxViewForwarder* GetViewForwarder() override;
167  virtual SvxEditViewForwarder* GetEditViewForwarder( bool /* bCreate */ ) override { return nullptr; }
168 
169 private:
170  std::unique_ptr<ScPreviewViewForwarder> mpViewForwarder;
172 
174  static ScDocShell* GetDocShell(ScPreviewShell* pViewShell);
175 };
176 
178 {
179 public:
181  const OUString& rText, const ScAddress& rP, bool bColHeader, bool bRowHeader);
182  virtual ~ScAccessiblePreviewHeaderCellTextData() override;
183 
184  virtual ScAccessibleTextData* Clone() const override;
185 
186  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
187 
188  virtual SvxTextForwarder* GetTextForwarder() override;
189  virtual SvxViewForwarder* GetViewForwarder() override;
190  virtual SvxEditViewForwarder* GetEditViewForwarder( bool /* bCreate */ ) override { return nullptr; }
191 
192 private:
193  std::unique_ptr<ScPreviewViewForwarder> mpViewForwarder;
195  OUString maText;
198 
200  static ScDocShell* GetDocShell(ScPreviewShell* pViewShell);
201 };
202 
204 {
205 public:
207  const EditTextObject* pEditObj, SvxAdjust eAdjust);
208  virtual ~ScAccessibleHeaderTextData() override;
209 
210  virtual ScAccessibleTextData* Clone() const override;
211 
212  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
213 
214  virtual SvxTextForwarder* GetTextForwarder() override;
215  virtual SvxViewForwarder* GetViewForwarder() override;
216  virtual SvxEditViewForwarder* GetEditViewForwarder( bool /* bCreate */ ) override { return nullptr; }
217 
218  virtual void UpdateData() override { }
219 private:
220  std::unique_ptr<ScPreviewViewForwarder> mxViewForwarder;
222  std::unique_ptr<ScEditEngineDefaulter> mpEditEngine;
223  std::unique_ptr<SvxEditEngineForwarder> mpForwarder;
228 };
229 
231 {
232 public:
234  const OUString& sText, const ScAddress& aCellPos, bool bMarkNote);
235  virtual ~ScAccessibleNoteTextData() override;
236 
237  virtual ScAccessibleTextData* Clone() const override;
238 
239  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
240 
241  virtual SvxTextForwarder* GetTextForwarder() override;
242  virtual SvxViewForwarder* GetViewForwarder() override;
243  virtual SvxEditViewForwarder* GetEditViewForwarder( bool /* bCreate */ ) override { return nullptr; }
244 
245  virtual void UpdateData() override { }
246 private:
247  std::unique_ptr<ScPreviewViewForwarder> mxViewForwarder;
249  std::unique_ptr<ScEditEngineDefaulter> mpEditEngine;
250  std::unique_ptr<SvxEditEngineForwarder> mpForwarder;
252  OUString msText;
256 };
257 
259 {
260 private:
261  typedef ::std::unique_ptr< SvxTextForwarder > TextForwarderPtr;
262  typedef ::std::unique_ptr< ScCsvViewForwarder > ViewForwarderPtr;
263 
266  TextForwarderPtr mpTextForwarder;
267  ViewForwarderPtr mpViewForwarder;
268  OUString maCellText;
270 
271 public:
272  explicit ScAccessibleCsvTextData(
273  OutputDevice* pWindow,
274  EditEngine* pEditEngine,
275  const OUString& rCellText,
276  const Size& rCellSize );
277  virtual ~ScAccessibleCsvTextData() override;
278 
279  virtual ScAccessibleTextData* Clone() const override;
280 
281  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
282 
283  virtual SvxTextForwarder* GetTextForwarder() override;
284  virtual SvxViewForwarder* GetViewForwarder() override;
285  virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate ) override;
286 
287  virtual void UpdateData() override {}
288 };
289 
290 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScAccessibleCell * mpAccessibleCell
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
std::unique_ptr< ScPreviewViewForwarder > mxViewForwarder
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
virtual ~ScAccessibleCellTextData() override
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
DECL_LINK(NotifyHdl, EENotify &, void)
std::unique_ptr< ScPreviewViewForwarder > mpViewForwarder
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
virtual ScAccessibleTextData * Clone() const override
virtual SvxTextForwarder * GetTextForwarder() override
virtual SvxEditViewForwarder * GetEditViewForwarder(bool bCreate) override
std::unique_ptr< SvxEditEngineForwarder > mpForwarder
virtual SvxEditViewForwarder * GetEditViewForwarder(bool) override
ScAccessiblePreviewCellTextData(ScPreviewShell *pViewShell, const ScAddress &rP)
std::unique_ptr< ScEditViewForwarder > mpEditViewForwarder
virtual SvxEditViewForwarder * GetEditViewForwarder(bool bCreate) override
virtual ~ScAccessibleNoteTextData() override
std::unique_ptr< ScEditEngineDefaulter > mpEditEngine
virtual ScAccessibleTextData * Clone() const override
virtual ScAccessibleTextData * Clone() const override
virtual SvxEditViewForwarder * GetEditViewForwarder(bool) override
std::unique_ptr< ScPreviewViewForwarder > mpViewForwarder
std::unique_ptr< ScViewForwarder > mpViewForwarder
virtual void UpdateData() override
ScPreviewShell * mpViewShell
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
virtual SvxEditViewForwarder * GetEditViewForwarder(bool bCreate) override
const EditTextObject * mpEditObj
virtual SvxViewForwarder * GetViewForwarder() override
SfxBroadcaster & GetBroadcaster() const
virtual SvxViewForwarder * GetViewForwarder() override
std::unique_ptr< SvxEditEngineForwarder > mpForwarder
std::unique_ptr< SvxEditEngineForwarder > mpForwarder
ScSplitPos
Definition: viewdata.hxx:44
virtual SvxTextForwarder * GetTextForwarder()=0
virtual ~ScAccessibleCsvTextData() override
virtual SvxEditViewForwarder * GetEditViewForwarder(bool) override
virtual SvxViewForwarder * GetViewForwarder()=0
virtual ScAccessibleTextData * Clone() const override
virtual SvxViewForwarder * GetViewForwarder() override
TextForwarderPtr mpTextForwarder
ScTabViewShell * mpViewShell
virtual ~ScAccessiblePreviewHeaderCellTextData() override
virtual SvxTextForwarder * GetTextForwarder() override
std::unique_ptr< ScEditEngineDefaulter > mpEditEngine
void UpdateData()
Definition: textuno.cxx:839
ScAccessibleCsvTextData(OutputDevice *pWindow, EditEngine *pEditEngine, const OUString &rCellText, const Size &rCellSize)
std::unique_ptr< ScPreviewViewForwarder > mxViewForwarder
VclPtr< OutputDevice > mpWindow
virtual SvxViewForwarder * GetViewForwarder() override
virtual SvxTextForwarder * GetTextForwarder() override
SvxAdjust
virtual void UpdateData() override
virtual SvxViewForwarder * GetViewForwarder() override
virtual ScAccessibleTextData * Clone() const override
virtual SvxTextForwarder * GetTextForwarder() override
virtual SvxTextForwarder * GetTextForwarder() override
virtual SvxTextForwarder * GetTextForwarder() override
virtual ScAccessibleTextData * Clone() const override
virtual void UpdateData() override
This base class provides an implementation of the AccessibleCell service.
virtual ~ScAccessibleEditLineTextData() override
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
virtual ~ScAccessibleEditObjectTextData() override
virtual void Notify(SfxBroadcaster &, const SfxHint &) override
virtual SvxTextForwarder * GetTextForwarder() override
VclPtr< OutputDevice > mpWindow
virtual SvxEditViewForwarder * GetEditViewForwarder(bool bCreate)=0
virtual SvxViewForwarder * GetViewForwarder() override
::std::unique_ptr< ScCsvViewForwarder > ViewForwarderPtr
virtual ~ScAccessiblePreviewCellTextData() override
ScAccessibleEditObjectTextData(EditView *pEditView, OutputDevice *pWin, bool isClone=false)
virtual SvxEditViewForwarder * GetEditViewForwarder(bool) override
SfxBroadcaster maBroadcaster
DECL_LINK(NotifyHdl, EENotify &, void)
virtual void UpdateData()=0
virtual ScAccessibleTextData * Clone() const override
virtual SvxTextForwarder * GetTextForwarder() override
virtual SvxViewForwarder * GetViewForwarder() override
virtual ScAccessibleTextData * Clone() const =0
virtual ScAccessibleTextData * Clone() const override
virtual void UpdateData() override
ScAccessiblePreviewHeaderCellTextData(ScPreviewShell *pViewShell, const OUString &rText, const ScAddress &rP, bool bColHeader, bool bRowHeader)
ScAccessibleHeaderTextData(ScPreviewShell *pViewShell, const EditTextObject *pEditObj, SvxAdjust eAdjust)
ScAccessibleNoteTextData(ScPreviewShell *pViewShell, const OUString &sText, const ScAddress &aCellPos, bool bMarkNote)
std::unique_ptr< ScEditObjectViewForwarder > mpViewForwarder
virtual ~ScAccessibleHeaderTextData() override
ViewForwarderPtr mpViewForwarder
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
ScDocShell * GetDocShell() const
Definition: textuno.hxx:353
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: textuno.cxx:860
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
virtual SvxEditViewForwarder * GetEditViewForwarder(bool bCreate) override
ScAccessibleCellTextData(ScTabViewShell *pViewShell, const ScAddress &rP, ScSplitPos eSplitPos, ScAccessibleCell *pAccCell)
ScAccessibleCellBaseTextData(ScDocShell *pDocShellP, const ScAddress &rP)
::std::unique_ptr< SvxTextForwarder > TextForwarderPtr
ScAccessibleEditLineTextData(EditView *pEditView, OutputDevice *pWin, ScTextWnd *pTextWnd)
virtual void UpdateData() override