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