LibreOffice Module svx (master)  1
weldeditview.cxx
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 #include <com/sun/star/accessibility/AccessibleRole.hpp>
21 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
22 #include <com/sun/star/accessibility/XAccessible.hpp>
23 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
24 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
25 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
26 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
27 #include <editeng/eeitem.hxx>
28 #include <editeng/fhgtitem.hxx>
29 #include <editeng/fontitem.hxx>
30 #include <editeng/outliner.hxx>
31 #include <editeng/unoedhlp.hxx>
32 #include <editeng/unoedsrc.hxx>
34 #include <osl/diagnose.h>
35 #include <svl/itemset.hxx>
36 #include <sal/log.hxx>
38 #include <svx/weldeditview.hxx>
39 #include <tools/diagnose_ex.h>
41 #include <vcl/cursor.hxx>
42 #include <vcl/event.hxx>
43 #include <vcl/ptrstyle.hxx>
44 #include <vcl/settings.hxx>
45 #include <vcl/svapp.hxx>
46 #include <vcl/uitest/uiobject.hxx>
47 
49 
50 // tdf#127033 want to use UI font so override makeEditEngine to enable that
52 {
53  SfxItemPool* pItemPool = EditEngine::CreatePool();
54 
55  vcl::Font aAppFont(Application::GetSettings().GetStyleSettings().GetAppFont());
56 
57  pItemPool->SetPoolDefaultItem(SvxFontItem(aAppFont.GetFamilyType(), aAppFont.GetFamilyName(),
58  "", PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW,
60  pItemPool->SetPoolDefaultItem(SvxFontItem(aAppFont.GetFamilyType(), aAppFont.GetFamilyName(),
61  "", PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW,
63  pItemPool->SetPoolDefaultItem(SvxFontItem(aAppFont.GetFamilyType(), aAppFont.GetFamilyName(),
64  "", PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW,
66 
67  pItemPool->SetPoolDefaultItem(
68  SvxFontHeightItem(aAppFont.GetFontHeight() * 20, 100, EE_CHAR_FONTHEIGHT));
69  pItemPool->SetPoolDefaultItem(
71  pItemPool->SetPoolDefaultItem(
73 
74  m_xEditEngine.reset(new EditEngine(pItemPool));
75 }
76 
78 {
79  if (m_xEditView)
80  {
82  Size aOutputSize(rDevice.PixelToLogic(GetOutputSizePixel()));
83  Size aSize(aOutputSize);
84  m_xEditEngine->SetPaperSize(aSize);
85  m_xEditView->SetOutputArea(tools::Rectangle(Point(0, 0), aOutputSize));
86  }
88 }
89 
90 void WeldEditView::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
91 {
92  rRenderContext.Push(PushFlags::ALL);
93  rRenderContext.SetClipRegion();
94 
95  const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
96  Color aBgColor = rStyleSettings.GetWindowColor();
97 
98  rRenderContext.SetBackground(aBgColor);
99 
100  std::vector<tools::Rectangle> aLogicRects;
101 
102  if (m_xEditView)
103  {
104  m_xEditView->SetBackgroundColor(aBgColor);
105 
106  m_xEditView->Paint(rRect, &rRenderContext);
107 
108  if (HasFocus())
109  {
110  m_xEditView->ShowCursor(false);
111  vcl::Cursor* pCursor = m_xEditView->GetCursor();
112  pCursor->DrawToDevice(rRenderContext);
113  }
114 
115  // get logic selection
116  m_xEditView->GetSelectionRectangles(aLogicRects);
117  }
118 
119  rRenderContext.SetLineColor();
120  rRenderContext.SetFillColor(COL_BLACK);
121  rRenderContext.SetRasterOp(RasterOp::Invert);
122 
123  for (const auto& rSelectionRect : aLogicRects)
124  rRenderContext.DrawRect(rSelectionRect);
125 
126  rRenderContext.Pop();
127 }
128 
130 {
131  return m_xEditView && m_xEditView->MouseMove(rMEvt);
132 }
133 
135 {
136  if (!IsMouseCaptured())
137  CaptureMouse();
138 
139  if (!HasFocus())
140  GrabFocus();
141 
142  return m_xEditView && m_xEditView->MouseButtonDown(rMEvt);
143 }
144 
146 {
147  if (IsMouseCaptured())
148  ReleaseMouse();
149  return m_xEditView && m_xEditView->MouseButtonUp(rMEvt);
150 }
151 
153 {
154  sal_uInt16 nKey = rKEvt.GetKeyCode().GetCode();
155 
156  if (nKey == KEY_TAB)
157  {
158  return false;
159  }
160  else if (m_xEditView && !m_xEditView->PostKeyEvent(rKEvt))
161  {
162  if (rKEvt.GetKeyCode().IsMod1() && !rKEvt.GetKeyCode().IsMod2())
163  {
164  if (nKey == KEY_A)
165  {
166  sal_Int32 nPar = m_xEditEngine->GetParagraphCount();
167  if (nPar)
168  {
169  sal_Int32 nLen = m_xEditEngine->GetTextLen(nPar - 1);
170  m_xEditView->SetSelection(ESelection(0, 0, nPar - 1, nLen));
171  }
172  return true;
173  }
174  }
175 
176  return false;
177  }
178 
179  return true;
180 }
181 
183 {
184  if (!m_xEditView)
185  return false;
186  m_xEditView->Command(rCEvt);
187  return true;
188 }
189 
190 class WeldEditAccessible;
191 
192 namespace
193 {
194 class WeldViewForwarder : public SvxViewForwarder
195 {
196  WeldEditAccessible& m_rEditAcc;
197 
198  WeldViewForwarder(const WeldViewForwarder&) = delete;
199  WeldViewForwarder& operator=(const WeldViewForwarder&) = delete;
200 
201 public:
202  explicit WeldViewForwarder(WeldEditAccessible& rAcc)
203  : m_rEditAcc(rAcc)
204  {
205  }
206 
207  virtual bool IsValid() const override;
208  virtual Point LogicToPixel(const Point& rPoint, const MapMode& rMapMode) const override;
209  virtual Point PixelToLogic(const Point& rPoint, const MapMode& rMapMode) const override;
210 };
211 }
212 
213 class WeldEditAccessible;
214 
215 namespace
216 {
217 class WeldEditSource;
218 
219 /* analog to SvxEditEngineForwarder */
220 class WeldTextForwarder : public SvxTextForwarder
221 {
222  WeldEditAccessible& m_rEditAcc;
223  WeldEditSource& m_rEditSource;
224 
225  DECL_LINK(NotifyHdl, EENotify&, void);
226 
227  WeldTextForwarder(const WeldTextForwarder&) = delete;
228  WeldTextForwarder& operator=(const WeldTextForwarder&) = delete;
229 
230 public:
231  WeldTextForwarder(WeldEditAccessible& rAcc, WeldEditSource& rSource);
232  virtual ~WeldTextForwarder() override;
233 
234  virtual sal_Int32 GetParagraphCount() const override;
235  virtual sal_Int32 GetTextLen(sal_Int32 nParagraph) const override;
236  virtual OUString GetText(const ESelection& rSel) const override;
237  virtual SfxItemSet GetAttribs(const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib
238  = EditEngineAttribs::All) const override;
239  virtual SfxItemSet GetParaAttribs(sal_Int32 nPara) const override;
240  virtual void SetParaAttribs(sal_Int32 nPara, const SfxItemSet& rSet) override;
241  virtual void RemoveAttribs(const ESelection& rSelection) override;
242  virtual void GetPortions(sal_Int32 nPara, std::vector<sal_Int32>& rList) const override;
243 
244  virtual SfxItemState GetItemState(const ESelection& rSel, sal_uInt16 nWhich) const override;
245  virtual SfxItemState GetItemState(sal_Int32 nPara, sal_uInt16 nWhich) const override;
246 
247  virtual void QuickInsertText(const OUString& rText, const ESelection& rSel) override;
248  virtual void QuickInsertField(const SvxFieldItem& rFld, const ESelection& rSel) override;
249  virtual void QuickSetAttribs(const SfxItemSet& rSet, const ESelection& rSel) override;
250  virtual void QuickInsertLineBreak(const ESelection& rSel) override;
251 
252  virtual SfxItemPool* GetPool() const override;
253 
254  virtual OUString CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos,
255  std::optional<Color>& rpTxtColor,
256  std::optional<Color>& rpFldColor) override;
257  virtual void FieldClicked(const SvxFieldItem&) override;
258  virtual bool IsValid() const override;
259 
260  virtual LanguageType GetLanguage(sal_Int32, sal_Int32) const override;
261  virtual sal_Int32 GetFieldCount(sal_Int32 nPara) const override;
262  virtual EFieldInfo GetFieldInfo(sal_Int32 nPara, sal_uInt16 nField) const override;
263  virtual EBulletInfo GetBulletInfo(sal_Int32 nPara) const override;
264  virtual tools::Rectangle GetCharBounds(sal_Int32 nPara, sal_Int32 nIndex) const override;
265  virtual tools::Rectangle GetParaBounds(sal_Int32 nPara) const override;
266  virtual MapMode GetMapMode() const override;
267  virtual OutputDevice* GetRefDevice() const override;
268  virtual bool GetIndexAtPoint(const Point&, sal_Int32& nPara, sal_Int32& nIndex) const override;
269  virtual bool GetWordIndices(sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart,
270  sal_Int32& nEnd) const override;
271  virtual bool GetAttributeRun(sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara,
272  sal_Int32 nIndex, bool bInCell = false) const override;
273  virtual sal_Int32 GetLineCount(sal_Int32 nPara) const override;
274  virtual sal_Int32 GetLineLen(sal_Int32 nPara, sal_Int32 nLine) const override;
275  virtual void GetLineBoundaries(/*out*/ sal_Int32& rStart, /*out*/ sal_Int32& rEnd,
276  sal_Int32 nParagraph, sal_Int32 nLine) const override;
277  virtual sal_Int32 GetLineNumberAtIndex(sal_Int32 nPara, sal_Int32 nLine) const override;
278  virtual bool Delete(const ESelection&) override;
279  virtual bool InsertText(const OUString&, const ESelection&) override;
280  virtual bool QuickFormatDoc(bool bFull = false) override;
281 
282  virtual sal_Int16 GetDepth(sal_Int32 nPara) const override;
283  virtual bool SetDepth(sal_Int32 nPara, sal_Int16 nNewDepth) override;
284 
285  virtual const SfxItemSet* GetEmptyItemSetPtr() override;
286  // implementation functions for XParagraphAppend and XTextPortionAppend
287  virtual void AppendParagraph() override;
288  virtual sal_Int32 AppendTextPortion(sal_Int32 nPara, const OUString& rText,
289  const SfxItemSet& rSet) override;
290 
291  virtual void CopyText(const SvxTextForwarder& rSource) override;
292 };
293 
294 /* analog to SvxEditEngineViewForwarder */
295 class WeldEditViewForwarder : public SvxEditViewForwarder
296 {
297  WeldEditAccessible& m_rEditAcc;
298 
299  WeldEditViewForwarder(const WeldEditViewForwarder&) = delete;
300  WeldEditViewForwarder& operator=(const WeldEditViewForwarder&) = delete;
301 
302 public:
303  explicit WeldEditViewForwarder(WeldEditAccessible& rAcc);
304 
305  virtual bool IsValid() const override;
306 
307  virtual Point LogicToPixel(const Point& rPoint, const MapMode& rMapMode) const override;
308  virtual Point PixelToLogic(const Point& rPoint, const MapMode& rMapMode) const override;
309 
310  virtual bool GetSelection(ESelection& rSelection) const override;
311  virtual bool SetSelection(const ESelection& rSelection) override;
312  virtual bool Copy() override;
313  virtual bool Cut() override;
314  virtual bool Paste() override;
315 };
316 
317 class WeldEditSource : public SvxEditSource
318 {
319  SfxBroadcaster m_aBroadCaster;
320  WeldViewForwarder m_aViewFwd;
321  WeldTextForwarder m_aTextFwd;
322  WeldEditViewForwarder m_aEditViewFwd;
323  WeldEditAccessible& m_rEditAcc;
324 
325  WeldEditSource(const WeldEditSource& rSrc)
326  : SvxEditSource()
327  , m_aViewFwd(rSrc.m_rEditAcc)
328  , m_aTextFwd(rSrc.m_rEditAcc, *this)
329  , m_aEditViewFwd(rSrc.m_rEditAcc)
330  , m_rEditAcc(rSrc.m_rEditAcc)
331  {
332  }
333 
334  WeldEditSource& operator=(const WeldEditSource&) = delete;
335 
336 public:
337  WeldEditSource(WeldEditAccessible& rAcc)
338  : m_aViewFwd(rAcc)
339  , m_aTextFwd(rAcc, *this)
340  , m_aEditViewFwd(rAcc)
341  , m_rEditAcc(rAcc)
342  {
343  }
344 
345  virtual std::unique_ptr<SvxEditSource> Clone() const override
346  {
347  return std::unique_ptr<SvxEditSource>(new WeldEditSource(*this));
348  }
349 
350  virtual SvxTextForwarder* GetTextForwarder() override { return &m_aTextFwd; }
351 
352  virtual SvxViewForwarder* GetViewForwarder() override { return &m_aViewFwd; }
353 
354  virtual SvxEditViewForwarder* GetEditViewForwarder(bool /*bCreate*/) override
355  {
356  return &m_aEditViewFwd;
357  }
358 
359  virtual void UpdateData() override
360  {
361  // would possibly only by needed if the XText interface is implemented
362  // and its text needs to be updated.
363  }
364  virtual SfxBroadcaster& GetBroadcaster() const override
365  {
366  return const_cast<WeldEditSource*>(this)->m_aBroadCaster;
367  }
368 };
369 }
370 
371 typedef cppu::WeakImplHelper<
372  css::accessibility::XAccessible, css::accessibility::XAccessibleComponent,
373  css::accessibility::XAccessibleContext, css::accessibility::XAccessibleEventBroadcaster>
375 
377 {
381  std::unique_ptr<::accessibility::AccessibleTextHelper> m_xTextHelper;
382 
383 public:
385  : m_pController(pController)
386  , m_pEditEngine(nullptr)
387  , m_pEditView(nullptr)
388  {
389  }
390 
391  ::accessibility::AccessibleTextHelper* GetTextHelper() { return m_xTextHelper.get(); }
392 
393  void Init(EditEngine* pEditEngine, EditView* pEditView)
394  {
395  m_pEditEngine = pEditEngine;
396  m_pEditView = pEditView;
397  m_xTextHelper.reset(
398  new ::accessibility::AccessibleTextHelper(std::make_unique<WeldEditSource>(*this)));
399  m_xTextHelper->SetEventSource(this);
400  }
401 
404 
405  void ClearWin()
406  {
407  // remove handler before current object gets destroyed
408  // (avoid handler being called for already dead object)
409  m_pEditEngine->SetNotifyHdl(Link<EENotify&, void>());
410 
411  m_pEditEngine = nullptr;
412  m_pEditView = nullptr;
413  m_pController = nullptr; // implicitly results in AccessibleStateType::DEFUNC set
414 
416  m_xTextHelper->SetEditSource(::std::unique_ptr<SvxEditSource>());
417 
420  m_xTextHelper->Dispose();
421  m_xTextHelper.reset();
422  }
423 
424  // XAccessible
425  virtual css::uno::Reference<css::accessibility::XAccessibleContext>
426  SAL_CALL getAccessibleContext() override
427  {
428  return this;
429  }
430 
431  // XAccessibleComponent
432  virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point& rPoint) override
433  {
436  SolarMutexGuard aGuard;
437  if (!m_pController)
438  throw css::uno::RuntimeException();
439 
440  Size aSz(m_pController->GetOutputSizePixel());
441  return rPoint.X >= 0 && rPoint.Y >= 0 && rPoint.X < aSz.Width() && rPoint.Y < aSz.Height();
442  }
443 
444  virtual css::uno::Reference<css::accessibility::XAccessible>
445  SAL_CALL getAccessibleAtPoint(const css::awt::Point& rPoint) override
446  {
447  SolarMutexGuard aGuard;
448  if (!m_xTextHelper)
449  throw css::uno::RuntimeException();
450 
451  return m_xTextHelper->GetAt(rPoint);
452  }
453 
454  virtual css::awt::Rectangle SAL_CALL getBounds() override
455  {
456  SolarMutexGuard aGuard;
457  if (!m_pController)
458  throw css::uno::RuntimeException();
459 
460  const Point aOutPos;
461  const Size aOutSize(m_pController->GetOutputSizePixel());
462  css::awt::Rectangle aRet;
463 
464  aRet.X = aOutPos.X();
465  aRet.Y = aOutPos.Y();
466  aRet.Width = aOutSize.Width();
467  aRet.Height = aOutSize.Height();
468 
469  return aRet;
470  }
471 
472  virtual css::awt::Point SAL_CALL getLocation() override
473  {
474  SolarMutexGuard aGuard;
475  if (!m_pController)
476  throw css::uno::RuntimeException();
477 
478  const css::awt::Rectangle aRect(getBounds());
479  css::awt::Point aRet;
480 
481  aRet.X = aRect.X;
482  aRet.Y = aRect.Y;
483 
484  return aRet;
485  }
486 
487  virtual css::awt::Point SAL_CALL getLocationOnScreen() override
488  {
489  SolarMutexGuard aGuard;
490  if (!m_pController)
491  throw css::uno::RuntimeException();
492 
493  css::awt::Point aScreenLoc(0, 0);
494 
495  css::uno::Reference<css::accessibility::XAccessible> xParent(getAccessibleParent());
496  if (xParent)
497  {
498  css::uno::Reference<css::accessibility::XAccessibleContext> xParentContext(
499  xParent->getAccessibleContext());
500  css::uno::Reference<css::accessibility::XAccessibleComponent> xParentComponent(
501  xParentContext, css::uno::UNO_QUERY);
502  OSL_ENSURE(xParentComponent.is(),
503  "WeldEditAccessible::getLocationOnScreen: no parent component!");
504  if (xParentComponent.is())
505  {
506  css::awt::Point aParentScreenLoc(xParentComponent->getLocationOnScreen());
507  css::awt::Point aOwnRelativeLoc(getLocation());
508  aScreenLoc.X = aParentScreenLoc.X + aOwnRelativeLoc.X;
509  aScreenLoc.Y = aParentScreenLoc.Y + aOwnRelativeLoc.Y;
510  }
511  }
512 
513  return aScreenLoc;
514  }
515 
516  virtual css::awt::Size SAL_CALL getSize() override
517  {
518  SolarMutexGuard aGuard;
519  if (!m_pController)
520  throw css::uno::RuntimeException();
521 
522  Size aSz(m_pController->GetOutputSizePixel());
523  return css::awt::Size(aSz.Width(), aSz.Height());
524  }
525 
526  virtual void SAL_CALL grabFocus() override { m_pController->GrabFocus(); }
527 
528  virtual sal_Int32 SAL_CALL getForeground() override
529  {
530  SolarMutexGuard aGuard;
531  if (!m_pController)
532  throw css::uno::RuntimeException();
533 
534  Color nCol = m_pEditEngine->GetAutoColor();
535  return static_cast<sal_Int32>(nCol);
536  }
537 
538  virtual sal_Int32 SAL_CALL getBackground() override
539  {
540  SolarMutexGuard aGuard;
541  if (!m_pController)
542  throw css::uno::RuntimeException();
543 
544  Color nCol = m_pEditEngine->GetBackgroundColor();
545  return static_cast<sal_Int32>(nCol);
546  }
547 
548  // XAccessibleContext
549  virtual sal_Int32 SAL_CALL getAccessibleChildCount() override
550  {
551  if (m_xTextHelper)
552  return m_xTextHelper->GetChildCount();
553  return 0;
554  }
555 
556  virtual css::uno::Reference<css::accessibility::XAccessible>
557  SAL_CALL getAccessibleChild(sal_Int32 i) override
558  {
559  if (m_xTextHelper)
560  return m_xTextHelper->GetChild(i);
561  throw css::lang::IndexOutOfBoundsException(); // there is no child...
562  }
563 
564  virtual css::uno::Reference<css::accessibility::XAccessible>
565  SAL_CALL getAccessibleParent() override
566  {
567  SolarMutexGuard aGuard;
568  if (!m_pController)
569  throw css::uno::RuntimeException();
570 
571  return m_pController->GetDrawingArea()->get_accessible_parent();
572  }
573 
574  virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() override
575  {
576  SolarMutexGuard aGuard;
577  if (!m_pController)
578  throw css::uno::RuntimeException();
579 
580  // -1 for child not found/no parent (according to specification)
581  sal_Int32 nRet = -1;
582 
583  css::uno::Reference<css::accessibility::XAccessible> xParent(getAccessibleParent());
584  if (!xParent)
585  return nRet;
586 
587  try
588  {
589  css::uno::Reference<css::accessibility::XAccessibleContext> xParentContext(
590  xParent->getAccessibleContext());
591 
592  // iterate over parent's children and search for this object
593  if (xParentContext.is())
594  {
595  sal_Int32 nChildCount = xParentContext->getAccessibleChildCount();
596  for (sal_Int32 nChild = 0; (nChild < nChildCount) && (-1 == nRet); ++nChild)
597  {
598  css::uno::Reference<css::accessibility::XAccessible> xChild(
599  xParentContext->getAccessibleChild(nChild));
600  if (xChild.get() == this)
601  nRet = nChild;
602  }
603  }
604  }
605  catch (const css::uno::Exception&)
606  {
607  TOOLS_WARN_EXCEPTION("svx", "WeldEditAccessible::getAccessibleIndexInParent");
608  }
609 
610  return nRet;
611  }
612 
613  virtual sal_Int16 SAL_CALL getAccessibleRole() override
614  {
615  return css::accessibility::AccessibleRole::TEXT_FRAME;
616  }
617 
618  virtual OUString SAL_CALL getAccessibleDescription() override
619  {
620  SolarMutexGuard aGuard;
621 
622  OUString aRet;
623 
624  if (m_pController)
625  {
626  aRet = m_pController->GetAccessibleDescription();
627  }
628 
629  return aRet;
630  }
631 
632  virtual OUString SAL_CALL getAccessibleName() override
633  {
634  SolarMutexGuard aGuard;
635 
636  OUString aRet;
637 
638  if (m_pController)
639  {
640  aRet = m_pController->GetAccessibleName();
641  }
642 
643  return aRet;
644  }
645 
646  virtual css::uno::Reference<css::accessibility::XAccessibleRelationSet>
647  SAL_CALL getAccessibleRelationSet() override
648  {
649  SolarMutexGuard aGuard;
650  if (!m_pController)
651  throw css::uno::RuntimeException();
652 
653  return m_pController->GetDrawingArea()->get_accessible_relation_set();
654  }
655 
656  virtual css::uno::Reference<css::accessibility::XAccessibleStateSet>
657  SAL_CALL getAccessibleStateSet() override
658  {
659  SolarMutexGuard aGuard;
660  ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper;
661 
662  css::uno::Reference<css::accessibility::XAccessibleStateSet> xStateSet(pStateSet);
663 
664  if (!m_pController || !m_xTextHelper)
665  pStateSet->AddState(css::accessibility::AccessibleStateType::DEFUNC);
666  else
667  {
668  pStateSet->AddState(css::accessibility::AccessibleStateType::MULTI_LINE);
669  pStateSet->AddState(css::accessibility::AccessibleStateType::ENABLED);
670  pStateSet->AddState(css::accessibility::AccessibleStateType::EDITABLE);
671  pStateSet->AddState(css::accessibility::AccessibleStateType::FOCUSABLE);
672  pStateSet->AddState(css::accessibility::AccessibleStateType::SELECTABLE);
673  if (m_pController->HasFocus())
674  pStateSet->AddState(css::accessibility::AccessibleStateType::FOCUSED);
675  if (m_pController->IsActive())
676  pStateSet->AddState(css::accessibility::AccessibleStateType::ACTIVE);
677  if (m_pController->IsVisible())
678  pStateSet->AddState(css::accessibility::AccessibleStateType::SHOWING);
679  if (m_pController->IsReallyVisible())
680  pStateSet->AddState(css::accessibility::AccessibleStateType::VISIBLE);
681  if (COL_TRANSPARENT != m_pEditEngine->GetBackgroundColor())
682  pStateSet->AddState(css::accessibility::AccessibleStateType::OPAQUE);
683  }
684 
685  return xStateSet;
686  }
687 
688  virtual css::lang::Locale SAL_CALL getLocale() override
689  {
690  SolarMutexGuard aGuard;
691  return LanguageTag(m_pEditEngine->GetDefaultLanguage()).getLocale();
692  }
693 
694  // XAccessibleEventBroadcaster
695  virtual void SAL_CALL addAccessibleEventListener(
696  const css::uno::Reference<css::accessibility::XAccessibleEventListener>& rListener) override
697  {
698  if (!m_xTextHelper) // not disposing (about to destroy view shell)
699  return;
700  m_xTextHelper->AddEventListener(rListener);
701  }
702 
703  virtual void SAL_CALL removeAccessibleEventListener(
704  const css::uno::Reference<css::accessibility::XAccessibleEventListener>& rListener) override
705  {
706  if (!m_xTextHelper) // not disposing (about to destroy view shell)
707  return;
708  m_xTextHelper->RemoveEventListener(rListener);
709  }
710 };
711 
712 css::uno::Reference<css::accessibility::XAccessible> WeldEditView::CreateAccessible()
713 {
714  if (!m_xAccessible.is())
715  m_xAccessible.set(new WeldEditAccessible(this));
716  return css::uno::Reference<css::accessibility::XAccessible>(m_xAccessible.get());
717 }
718 
720 {
721  if (m_xAccessible.is())
722  {
723  m_xAccessible->ClearWin(); // make Accessible nonfunctional
724  m_xAccessible.clear();
725  }
726 }
727 
728 bool WeldViewForwarder::IsValid() const { return m_rEditAcc.GetEditView() != nullptr; }
729 
730 Point WeldViewForwarder::LogicToPixel(const Point& rPoint, const MapMode& rMapMode) const
731 {
732  EditView* pEditView = m_rEditAcc.GetEditView();
733  OutputDevice* pOutDev = pEditView ? pEditView->GetWindow() : nullptr;
734 
735  if (pOutDev)
736  {
737  MapMode aMapMode(pOutDev->GetMapMode());
738  Point aPoint(OutputDevice::LogicToLogic(rPoint, rMapMode, MapMode(aMapMode.GetMapUnit())));
739  aMapMode.SetOrigin(Point());
740  return pOutDev->LogicToPixel(aPoint, aMapMode);
741  }
742 
743  return Point();
744 }
745 
746 Point WeldViewForwarder::PixelToLogic(const Point& rPoint, const MapMode& rMapMode) const
747 {
748  EditView* pEditView = m_rEditAcc.GetEditView();
749  OutputDevice* pOutDev = pEditView ? pEditView->GetWindow() : nullptr;
750 
751  if (pOutDev)
752  {
753  MapMode aMapMode(pOutDev->GetMapMode());
754  aMapMode.SetOrigin(Point());
755  Point aPoint(pOutDev->PixelToLogic(rPoint, aMapMode));
756  return OutputDevice::LogicToLogic(aPoint, MapMode(aMapMode.GetMapUnit()), rMapMode);
757  }
758 
759  return Point();
760 }
761 
762 WeldTextForwarder::WeldTextForwarder(WeldEditAccessible& rAcc, WeldEditSource& rSource)
763  : m_rEditAcc(rAcc)
764  , m_rEditSource(rSource)
765 {
766  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
767  if (pEditEngine)
768  pEditEngine->SetNotifyHdl(LINK(this, WeldTextForwarder, NotifyHdl));
769 }
770 
771 WeldTextForwarder::~WeldTextForwarder()
772 {
773  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
774  if (pEditEngine)
775  pEditEngine->SetNotifyHdl(Link<EENotify&, void>());
776 }
777 
778 IMPL_LINK(WeldTextForwarder, NotifyHdl, EENotify&, rNotify, void)
779 {
780  ::std::unique_ptr<SfxHint> aHint = SvxEditSourceHelper::EENotification2Hint(&rNotify);
781  if (aHint)
782  m_rEditSource.GetBroadcaster().Broadcast(*aHint);
783 }
784 
785 sal_Int32 WeldTextForwarder::GetParagraphCount() const
786 {
787  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
788  return pEditEngine ? pEditEngine->GetParagraphCount() : 0;
789 }
790 
791 sal_Int32 WeldTextForwarder::GetTextLen(sal_Int32 nParagraph) const
792 {
793  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
794  return pEditEngine ? pEditEngine->GetTextLen(nParagraph) : 0;
795 }
796 
797 OUString WeldTextForwarder::GetText(const ESelection& rSel) const
798 {
799  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
800  OUString aRet;
801  if (pEditEngine)
802  aRet = pEditEngine->GetText(rSel);
803  return convertLineEnd(aRet, GetSystemLineEnd());
804 }
805 
806 SfxItemSet WeldTextForwarder::GetAttribs(const ESelection& rSel,
807  EditEngineAttribs nOnlyHardAttrib) const
808 {
809  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
810  assert(pEditEngine && "EditEngine missing");
811  if (rSel.nStartPara == rSel.nEndPara)
812  {
813  GetAttribsFlags nFlags = GetAttribsFlags::NONE;
814  switch (nOnlyHardAttrib)
815  {
816  case EditEngineAttribs::All:
817  nFlags = GetAttribsFlags::ALL;
818  break;
819  case EditEngineAttribs::OnlyHard:
820  nFlags = GetAttribsFlags::CHARATTRIBS;
821  break;
822  default:
823  SAL_WARN("svx", "unknown flags for WeldTextForwarder::GetAttribs");
824  }
825 
826  return pEditEngine->GetAttribs(rSel.nStartPara, rSel.nStartPos, rSel.nEndPos, nFlags);
827  }
828  else
829  {
830  return pEditEngine->GetAttribs(rSel, nOnlyHardAttrib);
831  }
832 }
833 
834 SfxItemSet WeldTextForwarder::GetParaAttribs(sal_Int32 nPara) const
835 {
836  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
837  assert(pEditEngine && "EditEngine missing");
838 
839  SfxItemSet aSet(pEditEngine->GetParaAttribs(nPara));
840 
841  sal_uInt16 nWhich = EE_PARA_START;
842  while (nWhich <= EE_PARA_END)
843  {
844  if (aSet.GetItemState(nWhich) != SfxItemState::SET)
845  {
846  if (pEditEngine->HasParaAttrib(nPara, nWhich))
847  aSet.Put(pEditEngine->GetParaAttrib(nPara, nWhich));
848  }
849  nWhich++;
850  }
851 
852  return aSet;
853 }
854 
855 void WeldTextForwarder::SetParaAttribs(sal_Int32 nPara, const SfxItemSet& rSet)
856 {
857  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
858  if (pEditEngine)
859  pEditEngine->SetParaAttribs(nPara, rSet);
860 }
861 
862 SfxItemPool* WeldTextForwarder::GetPool() const
863 {
864  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
865  return pEditEngine ? pEditEngine->GetEmptyItemSet().GetPool() : nullptr;
866 }
867 
868 void WeldTextForwarder::RemoveAttribs(const ESelection& rSelection)
869 {
870  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
871  if (pEditEngine)
872  pEditEngine->RemoveAttribs(rSelection, false /*bRemoveParaAttribs*/, 0);
873 }
874 
875 void WeldTextForwarder::GetPortions(sal_Int32 nPara, std::vector<sal_Int32>& rList) const
876 {
877  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
878  if (pEditEngine)
879  pEditEngine->GetPortions(nPara, rList);
880 }
881 
882 void WeldTextForwarder::QuickInsertText(const OUString& rText, const ESelection& rSel)
883 {
884  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
885  if (pEditEngine)
886  pEditEngine->QuickInsertText(rText, rSel);
887 }
888 
889 void WeldTextForwarder::QuickInsertLineBreak(const ESelection& rSel)
890 {
891  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
892  if (pEditEngine)
893  pEditEngine->QuickInsertLineBreak(rSel);
894 }
895 
896 void WeldTextForwarder::QuickInsertField(const SvxFieldItem& rFld, const ESelection& rSel)
897 {
898  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
899  if (pEditEngine)
900  pEditEngine->QuickInsertField(rFld, rSel);
901 }
902 
903 void WeldTextForwarder::QuickSetAttribs(const SfxItemSet& rSet, const ESelection& rSel)
904 {
905  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
906  if (pEditEngine)
907  pEditEngine->QuickSetAttribs(rSet, rSel);
908 }
909 
910 bool WeldTextForwarder::IsValid() const
911 {
912  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
913  // cannot reliably query EditEngine state
914  // while in the middle of an update
915  return pEditEngine && pEditEngine->GetUpdateMode();
916 }
917 
918 OUString WeldTextForwarder::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara,
919  sal_Int32 nPos, std::optional<Color>& rpTxtColor,
920  std::optional<Color>& rpFldColor)
921 {
922  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
923  return pEditEngine ? pEditEngine->CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor)
924  : OUString();
925 }
926 
927 void WeldTextForwarder::FieldClicked(const SvxFieldItem&) {}
928 
929 static SfxItemState GetSvxEditEngineItemState(EditEngine const& rEditEngine, const ESelection& rSel,
930  sal_uInt16 nWhich)
931 {
932  std::vector<EECharAttrib> aAttribs;
933 
934  const SfxPoolItem* pLastItem = nullptr;
935 
936  SfxItemState eState = SfxItemState::DEFAULT;
937 
938  // check all paragraphs inside the selection
939  for (sal_Int32 nPara = rSel.nStartPara; nPara <= rSel.nEndPara; nPara++)
940  {
941  SfxItemState eParaState = SfxItemState::DEFAULT;
942 
943  // calculate start and endpos for this paragraph
944  sal_Int32 nPos = 0;
945  if (rSel.nStartPara == nPara)
946  nPos = rSel.nStartPos;
947 
948  sal_Int32 nEndPos = rSel.nEndPos;
949  if (rSel.nEndPara != nPara)
950  nEndPos = rEditEngine.GetTextLen(nPara);
951 
952  // get list of char attribs
953  rEditEngine.GetCharAttribs(nPara, aAttribs);
954 
955  bool bEmpty = true; // we found no item inside the selection of this paragraph
956  bool bGaps = false; // we found items but there are gaps between them
957  sal_Int32 nLastEnd = nPos;
958 
959  const SfxPoolItem* pParaItem = nullptr;
960 
961  for (const auto& rAttrib : aAttribs)
962  {
963  OSL_ENSURE(rAttrib.pAttr, "GetCharAttribs gives corrupt data");
964 
965  const bool bEmptyPortion = (rAttrib.nStart == rAttrib.nEnd);
966  if ((!bEmptyPortion && (rAttrib.nStart >= nEndPos))
967  || (bEmptyPortion && (rAttrib.nStart > nEndPos)))
968  break; // break if we are already behind our selection
969 
970  if ((!bEmptyPortion && (rAttrib.nEnd <= nPos))
971  || (bEmptyPortion && (rAttrib.nEnd < nPos)))
972  continue; // or if the attribute ends before our selection
973 
974  if (rAttrib.pAttr->Which() != nWhich)
975  continue; // skip if is not the searched item
976 
977  // if we already found an item
978  if (pParaItem)
979  {
980  // ... and its different to this one than the state is don't care
981  if (*pParaItem != *(rAttrib.pAttr))
982  return SfxItemState::DONTCARE;
983  }
984  else
985  {
986  pParaItem = rAttrib.pAttr;
987  }
988 
989  if (bEmpty)
990  bEmpty = false;
991 
992  if (!bGaps && rAttrib.nStart > nLastEnd)
993  bGaps = true;
994 
995  nLastEnd = rAttrib.nEnd;
996  }
997 
998  if (!bEmpty && !bGaps && nLastEnd < (nEndPos - 1))
999  bGaps = true;
1000  if (bEmpty)
1001  eParaState = SfxItemState::DEFAULT;
1002  else if (bGaps)
1003  eParaState = SfxItemState::DONTCARE;
1004  else
1005  eParaState = SfxItemState::SET;
1006 
1007  // if we already found an item check if we found the same
1008  if (pLastItem)
1009  {
1010  if ((pParaItem == nullptr) || (*pLastItem != *pParaItem))
1011  return SfxItemState::DONTCARE;
1012  }
1013  else
1014  {
1015  pLastItem = pParaItem;
1016  eState = eParaState;
1017  }
1018  }
1019 
1020  return eState;
1021 }
1022 
1023 SfxItemState WeldTextForwarder::GetItemState(const ESelection& rSel, sal_uInt16 nWhich) const
1024 {
1025  SfxItemState nState = SfxItemState::DISABLED;
1026  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1027  if (pEditEngine)
1028  nState = GetSvxEditEngineItemState(*pEditEngine, rSel, nWhich);
1029  return nState;
1030 }
1031 
1032 SfxItemState WeldTextForwarder::GetItemState(sal_Int32 nPara, sal_uInt16 nWhich) const
1033 {
1034  SfxItemState nState = SfxItemState::DISABLED;
1035  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1036  if (pEditEngine)
1037  {
1038  const SfxItemSet& rSet = pEditEngine->GetParaAttribs(nPara);
1039  nState = rSet.GetItemState(nWhich);
1040  }
1041  return nState;
1042 }
1043 
1044 LanguageType WeldTextForwarder::GetLanguage(sal_Int32 nPara, sal_Int32 nIndex) const
1045 {
1046  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1047  return pEditEngine ? pEditEngine->GetLanguage(nPara, nIndex) : LANGUAGE_NONE;
1048 }
1049 
1050 sal_Int32 WeldTextForwarder::GetFieldCount(sal_Int32 nPara) const
1051 {
1052  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1053  return pEditEngine ? pEditEngine->GetFieldCount(nPara) : 0;
1054 }
1055 
1056 EFieldInfo WeldTextForwarder::GetFieldInfo(sal_Int32 nPara, sal_uInt16 nField) const
1057 {
1058  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1059  return pEditEngine ? pEditEngine->GetFieldInfo(nPara, nField) : EFieldInfo();
1060 }
1061 
1062 EBulletInfo WeldTextForwarder::GetBulletInfo(sal_Int32 /*nPara*/) const { return EBulletInfo(); }
1063 
1064 tools::Rectangle WeldTextForwarder::GetCharBounds(sal_Int32 nPara, sal_Int32 nIndex) const
1065 {
1066  tools::Rectangle aRect(0, 0, 0, 0);
1067  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1068 
1069  if (pEditEngine)
1070  {
1071  // Handle virtual position one-past-the end of the string
1072  if (nIndex >= pEditEngine->GetTextLen(nPara))
1073  {
1074  if (nIndex)
1075  aRect = pEditEngine->GetCharacterBounds(EPosition(nPara, nIndex - 1));
1076 
1077  aRect.Move(aRect.Right() - aRect.Left(), 0);
1078  aRect.SetSize(Size(1, pEditEngine->GetTextHeight()));
1079  }
1080  else
1081  {
1082  aRect = pEditEngine->GetCharacterBounds(EPosition(nPara, nIndex));
1083  }
1084  }
1085  return aRect;
1086 }
1087 
1088 tools::Rectangle WeldTextForwarder::GetParaBounds(sal_Int32 nPara) const
1089 {
1090  tools::Rectangle aRect(0, 0, 0, 0);
1091  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1092 
1093  if (pEditEngine)
1094  {
1095  const Point aPnt = pEditEngine->GetDocPosTopLeft(nPara);
1096  const sal_Int32 nWidth = pEditEngine->CalcTextWidth();
1097  const sal_Int32 nHeight = pEditEngine->GetTextHeight(nPara);
1098  aRect = tools::Rectangle(aPnt.X(), aPnt.Y(), aPnt.X() + nWidth, aPnt.Y() + nHeight);
1099  }
1100 
1101  return aRect;
1102 }
1103 
1104 MapMode WeldTextForwarder::GetMapMode() const
1105 {
1106  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1107  return pEditEngine ? pEditEngine->GetRefMapMode() : MapMode(MapUnit::Map100thMM);
1108 }
1109 
1110 OutputDevice* WeldTextForwarder::GetRefDevice() const
1111 {
1112  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1113  return pEditEngine ? pEditEngine->GetRefDevice() : nullptr;
1114 }
1115 
1116 bool WeldTextForwarder::GetIndexAtPoint(const Point& rPos, sal_Int32& nPara,
1117  sal_Int32& nIndex) const
1118 {
1119  bool bRes = false;
1120  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1121  if (pEditEngine)
1122  {
1123  EPosition aDocPos = pEditEngine->FindDocPosition(rPos);
1124  nPara = aDocPos.nPara;
1125  nIndex = aDocPos.nIndex;
1126  bRes = true;
1127  }
1128  return bRes;
1129 }
1130 
1131 bool WeldTextForwarder::GetWordIndices(sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart,
1132  sal_Int32& nEnd) const
1133 {
1134  bool bRes = false;
1135  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1136  if (pEditEngine)
1137  {
1138  ESelection aRes = pEditEngine->GetWord(ESelection(nPara, nIndex, nPara, nIndex),
1139  css::i18n::WordType::DICTIONARY_WORD);
1140 
1141  if (aRes.nStartPara == nPara && aRes.nStartPara == aRes.nEndPara)
1142  {
1143  nStart = aRes.nStartPos;
1144  nEnd = aRes.nEndPos;
1145 
1146  bRes = true;
1147  }
1148  }
1149 
1150  return bRes;
1151 }
1152 
1153 bool WeldTextForwarder::GetAttributeRun(sal_Int32& nStartIndex, sal_Int32& nEndIndex,
1154  sal_Int32 nPara, sal_Int32 nIndex, bool bInCell) const
1155 {
1156  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1157  if (!pEditEngine)
1158  return false;
1159  SvxEditSourceHelper::GetAttributeRun(nStartIndex, nEndIndex, *pEditEngine, nPara, nIndex,
1160  bInCell);
1161  return true;
1162 }
1163 
1164 sal_Int32 WeldTextForwarder::GetLineCount(sal_Int32 nPara) const
1165 {
1166  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1167  return pEditEngine ? pEditEngine->GetLineCount(nPara) : 0;
1168 }
1169 
1170 sal_Int32 WeldTextForwarder::GetLineLen(sal_Int32 nPara, sal_Int32 nLine) const
1171 {
1172  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1173  return pEditEngine ? pEditEngine->GetLineLen(nPara, nLine) : 0;
1174 }
1175 
1176 void WeldTextForwarder::GetLineBoundaries(/*out*/ sal_Int32& rStart, /*out*/ sal_Int32& rEnd,
1177  sal_Int32 nPara, sal_Int32 nLine) const
1178 {
1179  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1180  if (pEditEngine)
1181  pEditEngine->GetLineBoundaries(rStart, rEnd, nPara, nLine);
1182  else
1183  rStart = rEnd = 0;
1184 }
1185 
1186 sal_Int32 WeldTextForwarder::GetLineNumberAtIndex(sal_Int32 nPara, sal_Int32 nIndex) const
1187 {
1188  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1189  return pEditEngine ? pEditEngine->GetLineNumberAtIndex(nPara, nIndex) : 0;
1190 }
1191 
1192 bool WeldTextForwarder::QuickFormatDoc(bool /*bFull*/)
1193 {
1194  bool bRes = false;
1195  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1196  if (pEditEngine)
1197  {
1198  pEditEngine->QuickFormatDoc();
1199  bRes = true;
1200  }
1201  return bRes;
1202 }
1203 
1204 sal_Int16 WeldTextForwarder::GetDepth(sal_Int32 /*nPara*/) const
1205 {
1206  // math has no outliner...
1207  return -1;
1208 }
1209 
1210 bool WeldTextForwarder::SetDepth(sal_Int32 /*nPara*/, sal_Int16 nNewDepth)
1211 {
1212  // math has no outliner...
1213  return -1 == nNewDepth; // is it the value from 'GetDepth' ?
1214 }
1215 
1216 bool WeldTextForwarder::Delete(const ESelection& rSelection)
1217 {
1218  bool bRes = false;
1219  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1220  if (pEditEngine)
1221  {
1222  pEditEngine->QuickDelete(rSelection);
1223  pEditEngine->QuickFormatDoc();
1224  bRes = true;
1225  }
1226  return bRes;
1227 }
1228 
1229 bool WeldTextForwarder::InsertText(const OUString& rStr, const ESelection& rSelection)
1230 {
1231  bool bRes = false;
1232  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1233  if (pEditEngine)
1234  {
1235  pEditEngine->QuickInsertText(rStr, rSelection);
1236  pEditEngine->QuickFormatDoc();
1237  bRes = true;
1238  }
1239  return bRes;
1240 }
1241 
1242 const SfxItemSet* WeldTextForwarder::GetEmptyItemSetPtr()
1243 {
1244  const SfxItemSet* pItemSet = nullptr;
1245  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1246  if (pEditEngine)
1247  {
1248  pItemSet = &pEditEngine->GetEmptyItemSet();
1249  }
1250  return pItemSet;
1251 }
1252 
1253 void WeldTextForwarder::AppendParagraph()
1254 {
1255  // append an empty paragraph
1256  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1257  if (pEditEngine)
1258  {
1259  sal_Int32 nParaCount = pEditEngine->GetParagraphCount();
1260  pEditEngine->InsertParagraph(nParaCount, OUString());
1261  }
1262 }
1263 
1264 sal_Int32 WeldTextForwarder::AppendTextPortion(sal_Int32 nPara, const OUString& rText,
1265  const SfxItemSet& rSet)
1266 {
1267  sal_uInt16 nRes = 0;
1268  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1269  if (pEditEngine && nPara < pEditEngine->GetParagraphCount())
1270  {
1271  // append text
1272  ESelection aSel(nPara, pEditEngine->GetTextLen(nPara));
1273  pEditEngine->QuickInsertText(rText, aSel);
1274 
1275  // set attributes for new appended text
1276  nRes = aSel.nEndPos = pEditEngine->GetTextLen(nPara);
1277  pEditEngine->QuickSetAttribs(rSet, aSel);
1278  }
1279  return nRes;
1280 }
1281 
1282 void WeldTextForwarder::CopyText(const SvxTextForwarder& rSource)
1283 {
1284  const WeldTextForwarder* pSourceForwarder = dynamic_cast<const WeldTextForwarder*>(&rSource);
1285  if (!pSourceForwarder)
1286  return;
1287  EditEngine* pSourceEditEngine = pSourceForwarder->m_rEditAcc.GetEditEngine();
1288  EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1289  if (pEditEngine && pSourceEditEngine)
1290  {
1291  std::unique_ptr<EditTextObject> pNewTextObject = pSourceEditEngine->CreateTextObject();
1292  pEditEngine->SetText(*pNewTextObject);
1293  }
1294 }
1295 
1296 WeldEditViewForwarder::WeldEditViewForwarder(WeldEditAccessible& rAcc)
1297  : m_rEditAcc(rAcc)
1298 {
1299 }
1300 
1301 bool WeldEditViewForwarder::IsValid() const { return m_rEditAcc.GetEditView() != nullptr; }
1302 
1303 Point WeldEditViewForwarder::LogicToPixel(const Point& rPoint, const MapMode& rMapMode) const
1304 {
1305  EditView* pEditView = m_rEditAcc.GetEditView();
1306  OutputDevice* pOutDev = pEditView ? pEditView->GetWindow() : nullptr;
1307 
1308  if (pOutDev)
1309  {
1310  MapMode aMapMode(pOutDev->GetMapMode());
1311  Point aPoint(OutputDevice::LogicToLogic(rPoint, rMapMode, MapMode(aMapMode.GetMapUnit())));
1312  aMapMode.SetOrigin(Point());
1313  return pOutDev->LogicToPixel(aPoint, aMapMode);
1314  }
1315 
1316  return Point();
1317 }
1318 
1319 Point WeldEditViewForwarder::PixelToLogic(const Point& rPoint, const MapMode& rMapMode) const
1320 {
1321  EditView* pEditView = m_rEditAcc.GetEditView();
1322  OutputDevice* pOutDev = pEditView ? pEditView->GetWindow() : nullptr;
1323 
1324  if (pOutDev)
1325  {
1326  MapMode aMapMode(pOutDev->GetMapMode());
1327  aMapMode.SetOrigin(Point());
1328  Point aPoint(pOutDev->PixelToLogic(rPoint, aMapMode));
1329  return OutputDevice::LogicToLogic(aPoint, MapMode(aMapMode.GetMapUnit()), rMapMode);
1330  }
1331 
1332  return Point();
1333 }
1334 
1335 bool WeldEditViewForwarder::GetSelection(ESelection& rSelection) const
1336 {
1337  bool bRes = false;
1338  EditView* pEditView = m_rEditAcc.GetEditView();
1339  if (pEditView)
1340  {
1341  rSelection = pEditView->GetSelection();
1342  bRes = true;
1343  }
1344  return bRes;
1345 }
1346 
1347 bool WeldEditViewForwarder::SetSelection(const ESelection& rSelection)
1348 {
1349  bool bRes = false;
1350  EditView* pEditView = m_rEditAcc.GetEditView();
1351  if (pEditView)
1352  {
1353  pEditView->SetSelection(rSelection);
1354  bRes = true;
1355  }
1356  return bRes;
1357 }
1358 
1359 bool WeldEditViewForwarder::Copy()
1360 {
1361  bool bRes = false;
1362  EditView* pEditView = m_rEditAcc.GetEditView();
1363  if (pEditView)
1364  {
1365  pEditView->Copy();
1366  bRes = true;
1367  }
1368  return bRes;
1369 }
1370 
1371 bool WeldEditViewForwarder::Cut()
1372 {
1373  bool bRes = false;
1374  EditView* pEditView = m_rEditAcc.GetEditView();
1375  if (pEditView)
1376  {
1377  pEditView->Cut();
1378  bRes = true;
1379  }
1380  return bRes;
1381 }
1382 
1383 bool WeldEditViewForwarder::Paste()
1384 {
1385  bool bRes = false;
1386  EditView* pEditView = m_rEditAcc.GetEditView();
1387  if (pEditView)
1388  {
1389  pEditView->Paste();
1390  bRes = true;
1391  }
1392  return bRes;
1393 }
1394 
1396 {
1397  Size aSize(pDrawingArea->get_size_request());
1398  if (aSize.Width() == -1)
1399  aSize.setWidth(500);
1400  if (aSize.Height() == -1)
1401  aSize.setHeight(100);
1402  pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
1403 
1404  SetOutputSizePixel(aSize);
1405 
1407 
1408  EnableRTL(false);
1409 
1410  const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
1411  Color aBgColor = rStyleSettings.GetWindowColor();
1412 
1413  OutputDevice& rDevice = pDrawingArea->get_ref_device();
1414 
1415  rDevice.SetMapMode(MapMode(MapUnit::MapTwip));
1416  rDevice.SetBackground(aBgColor);
1417 
1418  Size aOutputSize(rDevice.PixelToLogic(aSize));
1419  aSize = aOutputSize;
1420  aSize.setHeight(aSize.Height());
1421 
1422  makeEditEngine();
1423  m_xEditEngine->SetPaperSize(aSize);
1424  m_xEditEngine->SetRefDevice(&rDevice);
1425 
1426  m_xEditEngine->SetControlWord(m_xEditEngine->GetControlWord() | EEControlBits::MARKFIELDS);
1427 
1428  m_xEditView.reset(new EditView(m_xEditEngine.get(), nullptr));
1429  m_xEditView->setEditViewCallbacks(this);
1430  m_xEditView->SetOutputArea(tools::Rectangle(Point(0, 0), aOutputSize));
1431 
1432  m_xEditView->SetBackgroundColor(aBgColor);
1433  m_xEditEngine->InsertView(m_xEditView.get());
1434 
1435  pDrawingArea->set_cursor(PointerStyle::Text);
1436 
1437  if (m_xAccessible.is())
1438  m_xAccessible->Init(m_xEditEngine.get(), m_xEditView.get());
1439 }
1440 
1441 int WeldEditView::GetSurroundingText(OUString& rSurrounding)
1442 {
1443  if (!m_xEditView)
1444  return -1;
1445  rSurrounding = m_xEditView->GetSurroundingText();
1446  return m_xEditView->GetSurroundingTextSelection().Min();
1447 }
1448 
1450 {
1451  if (!m_xEditView)
1452  return false;
1453  return m_xEditView->DeleteSurroundingText(rRange);
1454 }
1455 
1457 {
1458  if (m_xEditView)
1459  m_xEditView->ShowCursor(false);
1460 
1462 
1463  if (m_xAccessible.is())
1464  {
1465  // Note: will implicitly send the AccessibleStateType::FOCUSED event
1466  ::accessibility::AccessibleTextHelper* pHelper = m_xAccessible->GetTextHelper();
1467  if (pHelper)
1468  pHelper->SetFocus();
1469  }
1470 }
1471 
1473 {
1475  Invalidate(); // redraw without cursor
1476 
1477  if (m_xAccessible.is())
1478  {
1479  // Note: will implicitly send the AccessibleStateType::FOCUSED event
1480  ::accessibility::AccessibleTextHelper* pHelper = m_xAccessible->GetTextHelper();
1481  if (pHelper)
1482  pHelper->SetFocus(false);
1483  }
1484 }
1485 
1486 namespace
1487 {
1488 class WeldEditViewUIObject final : public DrawingAreaUIObject
1489 {
1490 private:
1491  WeldEditView* mpEditView;
1492 
1493 public:
1494  WeldEditViewUIObject(const VclPtr<vcl::Window>& rDrawingArea)
1495  : DrawingAreaUIObject(rDrawingArea)
1496  , mpEditView(static_cast<WeldEditView*>(mpController))
1497  {
1498  }
1499 
1500  static std::unique_ptr<UIObject> create(vcl::Window* pWindow)
1501  {
1502  return std::unique_ptr<UIObject>(new WeldEditViewUIObject(pWindow));
1503  }
1504 
1505  virtual StringMap get_state() override
1506  {
1508  aMap["Text"] = mpEditView->GetText();
1509  return aMap;
1510  }
1511 
1512 private:
1513  virtual OUString get_name() const override { return "WeldEditViewUIObject"; }
1514 };
1515 }
1516 
1517 FactoryFunction WeldEditView::GetUITestFactory() const { return WeldEditViewUIObject::create; }
1518 
1519 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetClipRegion()
OUString GetText() const
void QuickInsertLineBreak(const ESelection &rSel)
#define LANGUAGE_NONE
OUString GetText(LineEnd eEnd=LINEEND_LF) const
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CJK(EE_CHAR_START+17)
sal_Int32 nStartPara
virtual tools::Rectangle GetParaBounds(sal_Int32 nPara) const =0
virtual css::awt::Point SAL_CALL getLocation() override
Color GetAutoColor() const
virtual tools::Rectangle GetCharBounds(sal_Int32 nPara, sal_Int32 nIndex) const =0
virtual bool IsValid() const =0
TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd)
OUString GetWord(sal_Int32 nPara, sal_Int32 nIndex)
void DrawToDevice(OutputDevice &rRenderContext)
virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() override
virtual OUString SAL_CALL getAccessibleName() override
const OUString & GetFamilyName() const
virtual std::unique_ptr< SvxEditSource > Clone() const =0
virtual void FieldClicked(const SvxFieldItem &rField)=0
virtual OUString CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_Int32 nPos, std::optional< Color > &rTxtColor, std::optional< Color > &rFldColor)
void Cut()
virtual void Resize() override
void setWidth(tools::Long nWidth)
virtual a11yref get_accessible_parent()=0
Helper class for objects containing EditEngine/Outliner text.
const SfxItemSet & GetEmptyItemSet() const
virtual void AppendParagraph()=0
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
MapMode const & GetRefMapMode() const
virtual SvxEditViewForwarder * GetEditViewForwarder(bool bCreate=false)
virtual void QuickInsertField(const SvxFieldItem &rFld, const ESelection &rSel)=0
virtual SfxItemState GetItemState(const ESelection &rSel, sal_uInt16 nWhich) const =0
void QuickInsertField(const SvxFieldItem &rFld, const ESelection &rSel)
sal_Int32 GetLineNumberAtIndex(sal_Int32 nPara, sal_Int32 nIndex) const
virtual sal_Int32 GetLineNumberAtIndex(sal_Int32 nPara, sal_Int32 nIndex) const =0
virtual bool GetSelection(ESelection &rSelection) const =0
static SfxItemState GetSvxEditEngineItemState(EditEngine const &rEditEngine, const ESelection &rSel, sal_uInt16 nWhich)
virtual bool Paste()=0
static::std::unique_ptr< SfxHint > EENotification2Hint(EENotify const *aNotify)
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
OUString GetAccessibleDescription() const
constexpr sal_uInt16 KEY_A
LanguageType GetDefaultLanguage() const
SvxTableController * mpController
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
sal_Int32 GetLineCount(sal_Int32 nParagraph) const
virtual void QuickInsertLineBreak(const ESelection &rSel)=0
virtual bool DeleteSurroundingText(const Selection &rRange) override
const MapMode & GetMapMode() const
sal_uInt16 GetCode() const
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int32 i) override
virtual bool Copy()=0
virtual sal_Int32 SAL_CALL getAccessibleChildCount() override
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override
IMPL_LINK(WeldTextForwarder, NotifyHdl, EENotify &, rNotify, void)
virtual a11yrelationset get_accessible_relation_set()=0
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
LanguageType GetLanguage(const EditPaM &rPaM) const
void SetMapMode()
EditEngineAttribs
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
virtual OUString get_name() const
std::unique_ptr<::accessibility::AccessibleTextHelper > m_xTextHelper
SfxItemSet GetAttribs(sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags=GetAttribsFlags::ALL) const
Size const & GetOutputSizePixel() const
EditEngine * m_pEditEngine
FontFamily GetFamilyType()
tools::Long GetFontHeight() const
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
GetAttribsFlags
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
SvxEditSource & operator=(SvxEditSource const &)=default
bool HasParaAttrib(sal_Int32 nPara, sal_uInt16 nWhich) const
HashMap_OWString_Interface aMap
Color const & GetBackgroundColor() const
virtual sal_Int16 SAL_CALL getAccessibleRole() override
WeldEditAccessible(weld::CustomWidgetController *pController)
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &rPoint) override
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
constexpr::Color COL_TRANSPARENT(0xFF, 0xFF, 0xFF, 0xFF)
::accessibility::AccessibleTextHelper * GetTextHelper()
void SetBackground()
void Copy()
virtual sal_Int32 AppendTextPortion(sal_Int32 nPara, const OUString &rText, const SfxItemSet &rSet)=0
virtual bool InsertText(const OUString &rText, const ESelection &rSel)=0
virtual StringMap get_state() override
void SetText(const OUString &rStr)
tools::Rectangle GetCharacterBounds(const EPosition &rPos) const
virtual bool SetDepth(sal_Int32 nPara, sal_Int16 nNewDepth)=0
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
virtual bool Cut()=0
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CTL(EE_CHAR_START+18)
virtual SfxItemSet GetParaAttribs(sal_Int32 nPara) const =0
LineEnd GetSystemLineEnd()
EPosition FindDocPosition(const Point &rDocPos) const
virtual bool QuickFormatDoc(bool bFull=false)=0
virtual void CopyText(const SvxTextForwarder &rSource)=0
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
weld::CustomWidgetController * m_pController
virtual OutputDevice & get_ref_device()=0
sal_Int32 nEndPos
virtual sal_Int32 SAL_CALL getForeground() override
void SetNotifyHdl(const Link< EENotify &, void > &rLink)
void DrawRect(const tools::Rectangle &rRect)
virtual EBulletInfo GetBulletInfo(sal_Int32 nPara) const =0
virtual FactoryFunction GetUITestFactory() const override
void QuickFormatDoc(bool bFull=false)
virtual LanguageType GetLanguage(sal_Int32 nPara, sal_Int32 nIndex) const =0
virtual void GetLineBoundaries(sal_Int32 &rStart, sal_Int32 &rEnd, sal_Int32 nParagraph, sal_Int32 nLine) const =0
virtual css::awt::Point SAL_CALL getLocationOnScreen() override
void SetLineColor()
virtual void set_cursor(PointerStyle ePointerStyle)=0
sal_Int32 nEndPara
#define TOOLS_WARN_EXCEPTION(area, stream)
virtual void SetParaAttribs(sal_Int32 nPara, const SfxItemSet &rSet)=0
virtual SfxBroadcaster & GetBroadcaster() const
virtual OutputDevice * GetRefDevice() const =0
void GetCharAttribs(sal_Int32 nPara, std::vector< EECharAttrib > &rLst) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Point GetDocPosTopLeft(sal_Int32 nParagraph)
sal_Int32 nIndex
virtual Size get_size_request() const =0
sal_Int32 GetLineLen(sal_Int32 nParagraph, sal_Int32 nLine) const
constexpr sal_uInt16 EE_PARA_START(EE_ITEMS_START+0)
sal_uInt32 GetTextLen() const
OUString GetAccessibleName() const
sal_Int32 nPara
virtual MapMode GetMapMode() const =0
virtual SfxItemPool * GetPool() const =0
EditView * m_pEditView
virtual sal_Int16 GetDepth(sal_Int32 nPara) const =0
void SetFillColor()
tools::Long Width() const
std::unique_ptr< EditTextObject > CreateTextObject()
virtual css::lang::Locale SAL_CALL getLocale() override
unsigned char sal_Bool
virtual SvxTextForwarder * GetTextForwarder()=0
vcl::Window * GetWindow() const
std::map< const OUString, OUString > StringMap
virtual bool GetAttributeRun(sal_Int32 &nStartIndex, sal_Int32 &nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell=false) const =0
virtual bool MouseMove(const MouseEvent &rMEvt) override
void GetLineBoundaries(sal_Int32 &rStart, sal_Int32 &rEnd, sal_Int32 nParagraph, sal_Int32 nLine) const
virtual SvxViewForwarder * GetViewForwarder()
PITCH_DONTKNOW
std::unique_ptr< EditView > m_xEditView
virtual sal_Int32 GetFieldCount(sal_Int32 nPara) const =0
virtual void GetFocus() override
virtual EFieldInfo GetFieldInfo(sal_Int32 nPara, sal_uInt16 nField) const =0
virtual void SAL_CALL addAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &rListener) override
SfxItemPool * GetPool() const
sal_uInt16 GetFieldCount(sal_Int32 nPara) const
void SetOutputSizePixel(const Size &rSize)
virtual css::awt::Rectangle SAL_CALL getBounds() override
sal_Int32 GetParagraphCount() const
virtual Point LogicToPixel(const Point &rPoint, const MapMode &rMapMode) const =0
virtual sal_Int32 GetLineLen(sal_Int32 nPara, sal_Int32 nLine) const =0
virtual css::awt::Size SAL_CALL getSize() override
static SfxItemPool * CreatePool()
virtual Point PixelToLogic(const Point &rPoint, const MapMode &rMapMode) const =0
static void GetAttributeRun(sal_Int32 &nStartIndex, sal_Int32 &nEndIndex, const EditEngine &rEE, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell=false)
Point PixelToLogic(const Point &rDevicePt) const
Point LogicToPixel(const Point &rLogicPt) const
virtual void SAL_CALL grabFocus() override
virtual int GetSurroundingText(OUString &rSurrounding) override
void Init(EditEngine *pEditEngine, EditView *pEditView)
virtual sal_Int32 GetLineCount(sal_Int32 nPara) const =0
virtual bool KeyInput(const KeyEvent &rKEvt) override
const vcl::KeyCode & GetKeyCode() const
virtual bool GetWordIndices(sal_Int32 nPara, sal_Int32 nIndex, sal_Int32 &rStart, sal_Int32 &rEnd) const =0
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
weld::DrawingArea * GetDrawingArea() const
SfxItemState
cppu::WeakImplHelper< css::accessibility::XAccessible, css::accessibility::XAccessibleComponent, css::accessibility::XAccessibleContext, css::accessibility::XAccessibleEventBroadcaster > WeldEditAccessibleBaseClass
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CTL(EE_CHAR_START+20)
EditView * GetEditView()
virtual ~WeldEditView() override
bool GetUpdateMode() const
virtual void SAL_CALL removeAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &rListener) override
void InsertParagraph(sal_Int32 nPara, const EditTextObject &rTxtObj, const bool bAppend=false)
void RemoveAttribs(const ESelection &rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich)
virtual bool Delete(const ESelection &rSelection)=0
void GetPortions(sal_Int32 nPara, std::vector< sal_Int32 > &rList)
void SetRasterOp(RasterOp eRasterOp)
sal_uInt32 GetTextHeight() const
virtual bool GetIndexAtPoint(const Point &rPoint, sal_Int32 &rPara, sal_Int32 &rIndex) const =0
bool IsMod1() const
virtual void makeEditEngine()
virtual SfxItemSet GetAttribs(const ESelection &rSel, EditEngineAttribs nOnlyHardAttrib=EditEngineAttribs::All) const =0
virtual sal_Int32 SAL_CALL getBackground() override
virtual bool IsValid() const =0
void QuickDelete(const ESelection &rSel)
void QuickSetAttribs(const SfxItemSet &rSet, const ESelection &rSel)
rtl::Reference< WeldEditAccessible > m_xAccessible
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea)
EFieldInfo GetFieldInfo(sal_Int32 nPara, sal_uInt16 nField) const
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
virtual void RemoveAttribs(const ESelection &rSelection)=0
const Color & GetWindowColor() const
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
virtual sal_Int32 GetTextLen(sal_Int32 nParagraph) const =0
OutputDevice * GetRefDevice() const
void SetSelection(const ESelection &rNewSel)
void setHeight(tools::Long nHeight)
virtual void SetParaAttribs(sal_Int32 nPara, const SfxItemSet &rSet)
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
virtual void QuickInsertText(const OUString &rText, const ESelection &rSel)=0
std::unique_ptr< EditEngine > m_xEditEngine
virtual void GetPortions(sal_Int32 nPara, std::vector< sal_Int32 > &rList) const =0
virtual const SfxItemSet * GetEmptyItemSetPtr()=0
virtual void LoseFocus() override
#define SAL_WARN(area, stream)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
ESelection GetSelection() const
void QuickInsertText(const OUString &rText, const ESelection &rSel)
sal_uInt32 CalcTextWidth()
virtual OUString CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_Int32 nPos, std::optional< Color > &rpTxtColor, std::optional< Color > &rpFldColor)=0
virtual bool Command(const CommandEvent &rCEvt) override
void SetFocus(bool bHaveFocus=true)
Set the focus state of the accessibility object.
virtual void set_size_request(int nWidth, int nHeight)=0
virtual OUString SAL_CALL getAccessibleDescription() override
virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point &rPoint) override
void Push(PushFlags nFlags=PushFlags::ALL)
virtual sal_Int32 GetParagraphCount() const =0
void AddState(sal_Int16 aState)
void Paste()
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
sal_Int32 nState
EditEngine * GetEditEngine()
virtual void UpdateData()=0
const SfxPoolItem & GetParaAttrib(sal_Int32 nPara, sal_uInt16 nWhich)
const SfxItemSet & GetParaAttribs(sal_Int32 nPara) const
virtual bool SetSelection(const ESelection &rSelection)=0
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
constexpr sal_uInt16 KEY_TAB
void SetPoolDefaultItem(const SfxPoolItem &)
virtual void QuickSetAttribs(const SfxItemSet &rSet, const ESelection &rSel)=0
virtual OUString GetText(const ESelection &rSel) const =0
void EnableRTL(bool bEnable)
bool IsMod2() const
sal_Int32 nStartPos