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
235 aViewInformation2D.setViewTransformation(rRenderContext.GetViewTransformation());
236 aViewInformation2D.setViewport(vcl::unotools::b2DRectangleFromRectangle(rRect));
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 OUString GetStyleSheet(sal_Int32 nPara) const override;
375 virtual void SetStyleSheet(sal_Int32 nPara, const OUString& rStyleName) override;
376
377 virtual SfxItemState GetItemState(const ESelection& rSel, sal_uInt16 nWhich) const override;
378 virtual SfxItemState GetItemState(sal_Int32 nPara, sal_uInt16 nWhich) const override;
379
380 virtual void QuickInsertText(const OUString& rText, const ESelection& rSel) override;
381 virtual void QuickInsertField(const SvxFieldItem& rFld, const ESelection& rSel) override;
382 virtual void QuickSetAttribs(const SfxItemSet& rSet, const ESelection& rSel) override;
383 virtual void QuickInsertLineBreak(const ESelection& rSel) override;
384
385 virtual SfxItemPool* GetPool() const override;
386
387 virtual OUString CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos,
388 std::optional<Color>& rpTxtColor,
389 std::optional<Color>& rpFldColor,
390 std::optional<FontLineStyle>& rpFldLineStyle) override;
391 virtual void FieldClicked(const SvxFieldItem&) override;
392 virtual bool IsValid() const override;
393
394 virtual LanguageType GetLanguage(sal_Int32, sal_Int32) const override;
395 virtual sal_Int32 GetFieldCount(sal_Int32 nPara) const override;
396 virtual EFieldInfo GetFieldInfo(sal_Int32 nPara, sal_uInt16 nField) const override;
397 virtual EBulletInfo GetBulletInfo(sal_Int32 nPara) const override;
398 virtual tools::Rectangle GetCharBounds(sal_Int32 nPara, sal_Int32 nIndex) const override;
399 virtual tools::Rectangle GetParaBounds(sal_Int32 nPara) const override;
400 virtual MapMode GetMapMode() const override;
401 virtual OutputDevice* GetRefDevice() const override;
402 virtual bool GetIndexAtPoint(const Point&, sal_Int32& nPara, sal_Int32& nIndex) const override;
403 virtual bool GetWordIndices(sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart,
404 sal_Int32& nEnd) const override;
405 virtual bool GetAttributeRun(sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara,
406 sal_Int32 nIndex, bool bInCell = false) const override;
407 virtual sal_Int32 GetLineCount(sal_Int32 nPara) const override;
408 virtual sal_Int32 GetLineLen(sal_Int32 nPara, sal_Int32 nLine) const override;
409 virtual void GetLineBoundaries(/*out*/ sal_Int32& rStart, /*out*/ sal_Int32& rEnd,
410 sal_Int32 nParagraph, sal_Int32 nLine) const override;
411 virtual sal_Int32 GetLineNumberAtIndex(sal_Int32 nPara, sal_Int32 nLine) const override;
412 virtual bool Delete(const ESelection&) override;
413 virtual bool InsertText(const OUString&, const ESelection&) override;
414 virtual bool QuickFormatDoc(bool bFull = false) override;
415
416 virtual sal_Int16 GetDepth(sal_Int32 nPara) const override;
417 virtual bool SetDepth(sal_Int32 nPara, sal_Int16 nNewDepth) override;
418
419 virtual const SfxItemSet* GetEmptyItemSetPtr() override;
420 // implementation functions for XParagraphAppend and XTextPortionAppend
421 virtual void AppendParagraph() override;
422 virtual sal_Int32 AppendTextPortion(sal_Int32 nPara, const OUString& rText,
423 const SfxItemSet& rSet) override;
424
425 virtual void CopyText(const SvxTextForwarder& rSource) override;
426};
427
428/* analog to SvxEditEngineViewForwarder */
429class WeldEditViewForwarder : public SvxEditViewForwarder
430{
431 WeldEditAccessible& m_rEditAcc;
432
433 WeldEditViewForwarder(const WeldEditViewForwarder&) = delete;
434 WeldEditViewForwarder& operator=(const WeldEditViewForwarder&) = delete;
435
436public:
437 explicit WeldEditViewForwarder(WeldEditAccessible& rAcc);
438
439 virtual bool IsValid() const override;
440
441 virtual Point LogicToPixel(const Point& rPoint, const MapMode& rMapMode) const override;
442 virtual Point PixelToLogic(const Point& rPoint, const MapMode& rMapMode) const override;
443
444 virtual bool GetSelection(ESelection& rSelection) const override;
445 virtual bool SetSelection(const ESelection& rSelection) override;
446 virtual bool Copy() override;
447 virtual bool Cut() override;
448 virtual bool Paste() override;
449};
450
451class WeldEditSource : public SvxEditSource
452{
453 SfxBroadcaster m_aBroadCaster;
454 WeldViewForwarder m_aViewFwd;
455 WeldTextForwarder m_aTextFwd;
456 WeldEditViewForwarder m_aEditViewFwd;
457 WeldEditAccessible& m_rEditAcc;
458
459 WeldEditSource(const WeldEditSource& rSrc)
460 : SvxEditSource()
461 , m_aViewFwd(rSrc.m_rEditAcc)
462 , m_aTextFwd(rSrc.m_rEditAcc, *this)
463 , m_aEditViewFwd(rSrc.m_rEditAcc)
464 , m_rEditAcc(rSrc.m_rEditAcc)
465 {
466 }
467
468 WeldEditSource& operator=(const WeldEditSource&) = delete;
469
470public:
471 WeldEditSource(WeldEditAccessible& rAcc)
472 : m_aViewFwd(rAcc)
473 , m_aTextFwd(rAcc, *this)
474 , m_aEditViewFwd(rAcc)
475 , m_rEditAcc(rAcc)
476 {
477 }
478
479 virtual std::unique_ptr<SvxEditSource> Clone() const override
480 {
481 return std::unique_ptr<SvxEditSource>(new WeldEditSource(*this));
482 }
483
484 virtual SvxTextForwarder* GetTextForwarder() override { return &m_aTextFwd; }
485
486 virtual SvxViewForwarder* GetViewForwarder() override { return &m_aViewFwd; }
487
488 virtual SvxEditViewForwarder* GetEditViewForwarder(bool /*bCreate*/) override
489 {
490 return &m_aEditViewFwd;
491 }
492
493 virtual void UpdateData() override
494 {
495 // would possibly only by needed if the XText interface is implemented
496 // and its text needs to be updated.
497 }
498 virtual SfxBroadcaster& GetBroadcaster() const override
499 {
500 return const_cast<WeldEditSource*>(this)->m_aBroadCaster;
501 }
502};
503}
504
505typedef cppu::WeakImplHelper<css::lang::XServiceInfo, css::accessibility::XAccessible,
506 css::accessibility::XAccessibleComponent,
507 css::accessibility::XAccessibleContext,
508 css::accessibility::XAccessibleEventBroadcaster>
510
512{
516 std::unique_ptr<::accessibility::AccessibleTextHelper> m_xTextHelper;
517
518public:
520 : m_pController(pController)
521 , m_pEditEngine(nullptr)
522 , m_pEditView(nullptr)
523 {
524 }
525
527
528 void Init(EditEngine* pEditEngine, EditView* pEditView)
529 {
530 m_pEditEngine = pEditEngine;
531 m_pEditView = pEditView;
532 m_xTextHelper.reset(
533 new ::accessibility::AccessibleTextHelper(std::make_unique<WeldEditSource>(*this)));
534 m_xTextHelper->SetEventSource(this);
535 }
536
539
540 void ClearWin()
541 {
542 // remove handler before current object gets destroyed
543 // (avoid handler being called for already dead object)
545
546 m_pEditEngine = nullptr;
547 m_pEditView = nullptr;
548 m_pController = nullptr; // implicitly results in AccessibleStateType::DEFUNC set
549
551 m_xTextHelper->SetEditSource(::std::unique_ptr<SvxEditSource>());
552
555 m_xTextHelper->Dispose();
556 m_xTextHelper.reset();
557 }
558
559 // XAccessible
560 virtual css::uno::Reference<css::accessibility::XAccessibleContext>
561 SAL_CALL getAccessibleContext() override
562 {
563 return this;
564 }
565
566 // XAccessibleComponent
567 virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point& rPoint) override
568 {
571 SolarMutexGuard aGuard;
572 if (!m_pController)
573 throw css::uno::RuntimeException();
574
576 return rPoint.X >= 0 && rPoint.Y >= 0 && rPoint.X < aSz.Width() && rPoint.Y < aSz.Height();
577 }
578
579 virtual css::uno::Reference<css::accessibility::XAccessible>
580 SAL_CALL getAccessibleAtPoint(const css::awt::Point& rPoint) override
581 {
582 SolarMutexGuard aGuard;
583 if (!m_xTextHelper)
584 throw css::uno::RuntimeException();
585
586 return m_xTextHelper->GetAt(rPoint);
587 }
588
589 virtual css::awt::Rectangle SAL_CALL getBounds() override
590 {
591 SolarMutexGuard aGuard;
592 if (!m_pController)
593 throw css::uno::RuntimeException();
594
595 const Point aOutPos;
596 const Size aOutSize(m_pController->GetOutputSizePixel());
597 css::awt::Rectangle aRet;
598
599 aRet.X = aOutPos.X();
600 aRet.Y = aOutPos.Y();
601 aRet.Width = aOutSize.Width();
602 aRet.Height = aOutSize.Height();
603
604 return aRet;
605 }
606
607 virtual css::awt::Point SAL_CALL getLocation() override
608 {
609 SolarMutexGuard aGuard;
610 if (!m_pController)
611 throw css::uno::RuntimeException();
612
613 const css::awt::Rectangle aRect(getBounds());
614 css::awt::Point aRet;
615
616 aRet.X = aRect.X;
617 aRet.Y = aRect.Y;
618
619 return aRet;
620 }
621
622 virtual css::awt::Point SAL_CALL getLocationOnScreen() override
623 {
624 SolarMutexGuard aGuard;
625 if (!m_pController)
626 throw css::uno::RuntimeException();
627
628 css::awt::Point aScreenLoc(0, 0);
629
630 if (weld::DrawingArea* pDrawingArea = m_pController->GetDrawingArea())
631 {
632 Point aPos = pDrawingArea->get_accessible_location_on_screen();
633 aScreenLoc.X = aPos.X();
634 aScreenLoc.Y = aPos.Y();
635 }
636
637 return aScreenLoc;
638 }
639
640 virtual css::awt::Size SAL_CALL getSize() override
641 {
642 SolarMutexGuard aGuard;
643 if (!m_pController)
644 throw css::uno::RuntimeException();
645
647 return css::awt::Size(aSz.Width(), aSz.Height());
648 }
649
650 virtual void SAL_CALL grabFocus() override { m_pController->GrabFocus(); }
651
652 virtual sal_Int32 SAL_CALL getForeground() override
653 {
654 SolarMutexGuard aGuard;
655 if (!m_pController)
656 throw css::uno::RuntimeException();
657
659 return static_cast<sal_Int32>(nCol);
660 }
661
662 virtual sal_Int32 SAL_CALL getBackground() override
663 {
664 SolarMutexGuard aGuard;
665 if (!m_pController)
666 throw css::uno::RuntimeException();
667
669 return static_cast<sal_Int32>(nCol);
670 }
671
672 // XAccessibleContext
673 virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
674 {
675 if (m_xTextHelper)
676 return m_xTextHelper->GetChildCount();
677 return 0;
678 }
679
680 virtual css::uno::Reference<css::accessibility::XAccessible>
681 SAL_CALL getAccessibleChild(sal_Int64 i) override
682 {
683 if (m_xTextHelper)
684 return m_xTextHelper->GetChild(i);
685 throw css::lang::IndexOutOfBoundsException(); // there is no child...
686 }
687
688 virtual css::uno::Reference<css::accessibility::XAccessible>
689 SAL_CALL getAccessibleParent() override
690 {
691 SolarMutexGuard aGuard;
692 if (!m_pController)
693 throw css::uno::RuntimeException();
694
696 }
697
698 virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override
699 {
700 SolarMutexGuard aGuard;
701 if (!m_pController)
702 throw css::uno::RuntimeException();
703
704 // -1 for child not found/no parent (according to specification)
705 sal_Int64 nRet = -1;
706
707 css::uno::Reference<css::accessibility::XAccessible> xParent(getAccessibleParent());
708 if (!xParent)
709 return nRet;
710
711 try
712 {
713 css::uno::Reference<css::accessibility::XAccessibleContext> xParentContext(
714 xParent->getAccessibleContext());
715
716 // iterate over parent's children and search for this object
717 if (xParentContext.is())
718 {
719 sal_Int64 nChildCount = xParentContext->getAccessibleChildCount();
720 for (sal_Int64 nChild = 0; (nChild < nChildCount) && (-1 == nRet); ++nChild)
721 {
722 css::uno::Reference<css::accessibility::XAccessible> xChild(
723 xParentContext->getAccessibleChild(nChild));
724 if (xChild.get() == this)
725 nRet = nChild;
726 }
727 }
728 }
729 catch (const css::uno::Exception&)
730 {
731 TOOLS_WARN_EXCEPTION("svx", "WeldEditAccessible::getAccessibleIndexInParent");
732 }
733
734 return nRet;
735 }
736
737 virtual sal_Int16 SAL_CALL getAccessibleRole() override
738 {
739 return css::accessibility::AccessibleRole::TEXT_FRAME;
740 }
741
742 virtual OUString SAL_CALL getAccessibleDescription() override
743 {
744 SolarMutexGuard aGuard;
745
746 OUString aRet;
747
748 if (m_pController)
749 {
751 }
752
753 return aRet;
754 }
755
756 virtual OUString SAL_CALL getAccessibleName() override
757 {
758 SolarMutexGuard aGuard;
759
760 OUString aRet;
761
762 if (m_pController)
763 {
765 }
766
767 return aRet;
768 }
769
770 virtual css::uno::Reference<css::accessibility::XAccessibleRelationSet>
771 SAL_CALL getAccessibleRelationSet() override
772 {
773 SolarMutexGuard aGuard;
774 if (!m_pController)
775 throw css::uno::RuntimeException();
776
778 }
779
780 virtual sal_Int64 SAL_CALL getAccessibleStateSet() override
781 {
782 SolarMutexGuard aGuard;
783 sal_Int64 nStateSet = 0;
784
786 nStateSet |= css::accessibility::AccessibleStateType::DEFUNC;
787 else
788 {
789 nStateSet |= css::accessibility::AccessibleStateType::MULTI_LINE;
790 nStateSet |= css::accessibility::AccessibleStateType::ENABLED;
791 nStateSet |= css::accessibility::AccessibleStateType::EDITABLE;
792 nStateSet |= css::accessibility::AccessibleStateType::FOCUSABLE;
793 nStateSet |= css::accessibility::AccessibleStateType::SELECTABLE;
794 if (m_pController->HasFocus())
795 nStateSet |= css::accessibility::AccessibleStateType::FOCUSED;
796 if (m_pController->IsActive())
797 nStateSet |= css::accessibility::AccessibleStateType::ACTIVE;
799 nStateSet |= css::accessibility::AccessibleStateType::SHOWING;
801 nStateSet |= css::accessibility::AccessibleStateType::VISIBLE;
803 nStateSet |= css::accessibility::AccessibleStateType::OPAQUE;
804 }
805
806 return nStateSet;
807 }
808
809 virtual css::lang::Locale SAL_CALL getLocale() override
810 {
811 SolarMutexGuard aGuard;
813 }
814
815 // XAccessibleEventBroadcaster
816 virtual void SAL_CALL addAccessibleEventListener(
817 const css::uno::Reference<css::accessibility::XAccessibleEventListener>& rListener) override
818 {
819 if (!m_xTextHelper) // not disposing (about to destroy view shell)
820 return;
821 m_xTextHelper->AddEventListener(rListener);
822 }
823
824 virtual void SAL_CALL removeAccessibleEventListener(
825 const css::uno::Reference<css::accessibility::XAccessibleEventListener>& rListener) override
826 {
827 if (!m_xTextHelper) // not disposing (about to destroy view shell)
828 return;
829 m_xTextHelper->RemoveEventListener(rListener);
830 }
831
832 virtual OUString SAL_CALL getImplementationName() override { return "WeldEditAccessible"; }
833
834 virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override
835 {
836 return cppu::supportsService(this, rServiceName);
837 }
838
839 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override
840 {
841 return { "css::accessibility::Accessible", "css::accessibility::AccessibleComponent",
842 "css::accessibility::AccessibleContext" };
843 }
844};
845
846css::uno::Reference<css::accessibility::XAccessible> WeldEditView::CreateAccessible()
847{
848#if !ENABLE_WASM_STRIP_ACCESSIBILITY
849 if (!m_xAccessible.is())
850 m_xAccessible.set(new WeldEditAccessible(this));
851#endif
852 return m_xAccessible;
853}
854
856{
857#if !ENABLE_WASM_STRIP_ACCESSIBILITY
858 if (m_xAccessible.is())
859 {
860 m_xAccessible->ClearWin(); // make Accessible nonfunctional
861 m_xAccessible.clear();
862 }
863#endif
864}
865
866bool WeldViewForwarder::IsValid() const { return m_rEditAcc.GetEditView() != nullptr; }
867
868Point WeldViewForwarder::LogicToPixel(const Point& rPoint, const MapMode& rMapMode) const
869{
870 EditView* pEditView = m_rEditAcc.GetEditView();
871 if (!pEditView)
872 return Point();
873 OutputDevice& rOutDev = pEditView->GetOutputDevice();
874 MapMode aMapMode(rOutDev.GetMapMode());
875 Point aPoint(OutputDevice::LogicToLogic(rPoint, rMapMode, MapMode(aMapMode.GetMapUnit())));
876 aMapMode.SetOrigin(Point());
877 return rOutDev.LogicToPixel(aPoint, aMapMode);
878}
879
880Point WeldViewForwarder::PixelToLogic(const Point& rPoint, const MapMode& rMapMode) const
881{
882 EditView* pEditView = m_rEditAcc.GetEditView();
883 if (!pEditView)
884 return Point();
885 OutputDevice& rOutDev = pEditView->GetOutputDevice();
886 MapMode aMapMode(rOutDev.GetMapMode());
887 aMapMode.SetOrigin(Point());
888 Point aPoint(rOutDev.PixelToLogic(rPoint, aMapMode));
889 return OutputDevice::LogicToLogic(aPoint, MapMode(aMapMode.GetMapUnit()), rMapMode);
890}
891
892WeldTextForwarder::WeldTextForwarder(WeldEditAccessible& rAcc, WeldEditSource& rSource)
893 : m_rEditAcc(rAcc)
894 , m_rEditSource(rSource)
895{
896 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
897 if (pEditEngine)
898 pEditEngine->SetNotifyHdl(LINK(this, WeldTextForwarder, NotifyHdl));
899}
900
901WeldTextForwarder::~WeldTextForwarder()
902{
903 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
904 if (pEditEngine)
905 pEditEngine->SetNotifyHdl(Link<EENotify&, void>());
906}
907
908IMPL_LINK(WeldTextForwarder, NotifyHdl, EENotify&, rNotify, void)
909{
910 if (EditEngine* pEditEngine = m_rEditAcc.GetEditEngine())
911 {
912 if (rNotify.eNotificationType == EE_NOTIFY_PROCESSNOTIFICATIONS
913 && !pEditEngine->IsUpdateLayout())
914 {
915 // tdf#143088 an UpdateMode of false will just to on to cause
916 // AccessibleTextHelper_Impl::GetTextForwarder to throw an
917 // exception as a Frozen EditEngine is considered Invalid so return
918 // early instead
919 return;
920 }
921 }
922
923 ::std::unique_ptr<SfxHint> aHint = SvxEditSourceHelper::EENotification2Hint(&rNotify);
924 if (aHint)
925 m_rEditSource.GetBroadcaster().Broadcast(*aHint);
926}
927
928sal_Int32 WeldTextForwarder::GetParagraphCount() const
929{
930 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
931 return pEditEngine ? pEditEngine->GetParagraphCount() : 0;
932}
933
934sal_Int32 WeldTextForwarder::GetTextLen(sal_Int32 nParagraph) const
935{
936 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
937 return pEditEngine ? pEditEngine->GetTextLen(nParagraph) : 0;
938}
939
940OUString WeldTextForwarder::GetText(const ESelection& rSel) const
941{
942 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
943 OUString aRet;
944 if (pEditEngine)
945 aRet = pEditEngine->GetText(rSel);
946 return convertLineEnd(aRet, GetSystemLineEnd());
947}
948
949SfxItemSet WeldTextForwarder::GetAttribs(const ESelection& rSel,
950 EditEngineAttribs nOnlyHardAttrib) const
951{
952 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
953 assert(pEditEngine && "EditEngine missing");
954 if (rSel.nStartPara == rSel.nEndPara)
955 {
956 GetAttribsFlags nFlags = GetAttribsFlags::NONE;
957 switch (nOnlyHardAttrib)
958 {
959 case EditEngineAttribs::All:
960 nFlags = GetAttribsFlags::ALL;
961 break;
962 case EditEngineAttribs::OnlyHard:
963 nFlags = GetAttribsFlags::CHARATTRIBS;
964 break;
965 default:
966 SAL_WARN("svx", "unknown flags for WeldTextForwarder::GetAttribs");
967 }
968
969 return pEditEngine->GetAttribs(rSel.nStartPara, rSel.nStartPos, rSel.nEndPos, nFlags);
970 }
971 else
972 {
973 return pEditEngine->GetAttribs(rSel, nOnlyHardAttrib);
974 }
975}
976
977SfxItemSet WeldTextForwarder::GetParaAttribs(sal_Int32 nPara) const
978{
979 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
980 assert(pEditEngine && "EditEngine missing");
981
982 SfxItemSet aSet(pEditEngine->GetParaAttribs(nPara));
983
984 sal_uInt16 nWhich = EE_PARA_START;
985 while (nWhich <= EE_PARA_END)
986 {
987 if (aSet.GetItemState(nWhich) != SfxItemState::SET)
988 {
989 if (pEditEngine->HasParaAttrib(nPara, nWhich))
990 aSet.Put(pEditEngine->GetParaAttrib(nPara, nWhich));
991 }
992 nWhich++;
993 }
994
995 return aSet;
996}
997
998void WeldTextForwarder::SetParaAttribs(sal_Int32 nPara, const SfxItemSet& rSet)
999{
1000 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1001 if (pEditEngine)
1002 pEditEngine->SetParaAttribs(nPara, rSet);
1003}
1004
1005SfxItemPool* WeldTextForwarder::GetPool() const
1006{
1007 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1008 return pEditEngine ? pEditEngine->GetEmptyItemSet().GetPool() : nullptr;
1009}
1010
1011void WeldTextForwarder::RemoveAttribs(const ESelection& rSelection)
1012{
1013 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1014 if (pEditEngine)
1015 pEditEngine->RemoveAttribs(rSelection, false /*bRemoveParaAttribs*/, 0);
1016}
1017
1018void WeldTextForwarder::GetPortions(sal_Int32 nPara, std::vector<sal_Int32>& rList) const
1019{
1020 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1021 if (pEditEngine)
1022 pEditEngine->GetPortions(nPara, rList);
1023}
1024
1025OUString WeldTextForwarder::GetStyleSheet(sal_Int32 nPara) const
1026{
1027 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1028 if (auto pStyle = pEditEngine ? pEditEngine->GetStyleSheet(nPara) : nullptr)
1029 return pStyle->GetName();
1030 return OUString();
1031}
1032
1033void WeldTextForwarder::SetStyleSheet(sal_Int32 nPara, const OUString& rStyleName)
1034{
1035 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1036 auto pStyleSheetPool = pEditEngine ? pEditEngine->GetStyleSheetPool() : nullptr;
1037 if (auto pStyle
1038 = pStyleSheetPool ? pStyleSheetPool->Find(rStyleName, SfxStyleFamily::Para) : nullptr)
1039 pEditEngine->SetStyleSheet(nPara, static_cast<SfxStyleSheet*>(pStyle));
1040}
1041
1042void WeldTextForwarder::QuickInsertText(const OUString& rText, const ESelection& rSel)
1043{
1044 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1045 if (pEditEngine)
1046 pEditEngine->QuickInsertText(rText, rSel);
1047}
1048
1049void WeldTextForwarder::QuickInsertLineBreak(const ESelection& rSel)
1050{
1051 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1052 if (pEditEngine)
1053 pEditEngine->QuickInsertLineBreak(rSel);
1054}
1055
1056void WeldTextForwarder::QuickInsertField(const SvxFieldItem& rFld, const ESelection& rSel)
1057{
1058 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1059 if (pEditEngine)
1060 pEditEngine->QuickInsertField(rFld, rSel);
1061}
1062
1063void WeldTextForwarder::QuickSetAttribs(const SfxItemSet& rSet, const ESelection& rSel)
1064{
1065 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1066 if (pEditEngine)
1067 pEditEngine->QuickSetAttribs(rSet, rSel);
1068}
1069
1070bool WeldTextForwarder::IsValid() const
1071{
1072 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1073 // cannot reliably query EditEngine state
1074 // while in the middle of an update
1075 return pEditEngine && pEditEngine->IsUpdateLayout();
1076}
1077
1078OUString WeldTextForwarder::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara,
1079 sal_Int32 nPos, std::optional<Color>& rpTxtColor,
1080 std::optional<Color>& rpFldColor,
1081 std::optional<FontLineStyle>& rpFldLineStyle)
1082{
1083 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1084 return pEditEngine ? pEditEngine->CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor,
1085 rpFldLineStyle)
1086 : OUString();
1087}
1088
1089void WeldTextForwarder::FieldClicked(const SvxFieldItem&) {}
1090
1091static SfxItemState GetSvxEditEngineItemState(EditEngine const& rEditEngine, const ESelection& rSel,
1092 sal_uInt16 nWhich)
1093{
1094 std::vector<EECharAttrib> aAttribs;
1095
1096 const SfxPoolItem* pLastItem = nullptr;
1097
1098 SfxItemState eState = SfxItemState::DEFAULT;
1099
1100 // check all paragraphs inside the selection
1101 for (sal_Int32 nPara = rSel.nStartPara; nPara <= rSel.nEndPara; nPara++)
1102 {
1103 SfxItemState eParaState = SfxItemState::DEFAULT;
1104
1105 // calculate start and endpos for this paragraph
1106 sal_Int32 nPos = 0;
1107 if (rSel.nStartPara == nPara)
1108 nPos = rSel.nStartPos;
1109
1110 sal_Int32 nEndPos = rSel.nEndPos;
1111 if (rSel.nEndPara != nPara)
1112 nEndPos = rEditEngine.GetTextLen(nPara);
1113
1114 // get list of char attribs
1115 rEditEngine.GetCharAttribs(nPara, aAttribs);
1116
1117 bool bEmpty = true; // we found no item inside the selection of this paragraph
1118 bool bGaps = false; // we found items but there are gaps between them
1119 sal_Int32 nLastEnd = nPos;
1120
1121 const SfxPoolItem* pParaItem = nullptr;
1122
1123 for (const auto& rAttrib : aAttribs)
1124 {
1125 OSL_ENSURE(rAttrib.pAttr, "GetCharAttribs gives corrupt data");
1126
1127 const bool bEmptyPortion = (rAttrib.nStart == rAttrib.nEnd);
1128 if ((!bEmptyPortion && (rAttrib.nStart >= nEndPos))
1129 || (bEmptyPortion && (rAttrib.nStart > nEndPos)))
1130 break; // break if we are already behind our selection
1131
1132 if ((!bEmptyPortion && (rAttrib.nEnd <= nPos))
1133 || (bEmptyPortion && (rAttrib.nEnd < nPos)))
1134 continue; // or if the attribute ends before our selection
1135
1136 if (rAttrib.pAttr->Which() != nWhich)
1137 continue; // skip if is not the searched item
1138
1139 // if we already found an item
1140 if (pParaItem)
1141 {
1142 // ... and its different to this one than the state is don't care
1143 if (*pParaItem != *(rAttrib.pAttr))
1144 return SfxItemState::DONTCARE;
1145 }
1146 else
1147 {
1148 pParaItem = rAttrib.pAttr;
1149 }
1150
1151 if (bEmpty)
1152 bEmpty = false;
1153
1154 if (!bGaps && rAttrib.nStart > nLastEnd)
1155 bGaps = true;
1156
1157 nLastEnd = rAttrib.nEnd;
1158 }
1159
1160 if (!bEmpty && !bGaps && nLastEnd < (nEndPos - 1))
1161 bGaps = true;
1162 if (bEmpty)
1163 eParaState = SfxItemState::DEFAULT;
1164 else if (bGaps)
1165 eParaState = SfxItemState::DONTCARE;
1166 else
1167 eParaState = SfxItemState::SET;
1168
1169 // if we already found an item check if we found the same
1170 if (pLastItem)
1171 {
1172 if ((pParaItem == nullptr) || (*pLastItem != *pParaItem))
1173 return SfxItemState::DONTCARE;
1174 }
1175 else
1176 {
1177 pLastItem = pParaItem;
1178 eState = eParaState;
1179 }
1180 }
1181
1182 return eState;
1183}
1184
1185SfxItemState WeldTextForwarder::GetItemState(const ESelection& rSel, sal_uInt16 nWhich) const
1186{
1187 SfxItemState nState = SfxItemState::DISABLED;
1188 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1189 if (pEditEngine)
1190 nState = GetSvxEditEngineItemState(*pEditEngine, rSel, nWhich);
1191 return nState;
1192}
1193
1194SfxItemState WeldTextForwarder::GetItemState(sal_Int32 nPara, sal_uInt16 nWhich) const
1195{
1196 SfxItemState nState = SfxItemState::DISABLED;
1197 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1198 if (pEditEngine)
1199 {
1200 const SfxItemSet& rSet = pEditEngine->GetParaAttribs(nPara);
1201 nState = rSet.GetItemState(nWhich);
1202 }
1203 return nState;
1204}
1205
1206LanguageType WeldTextForwarder::GetLanguage(sal_Int32 nPara, sal_Int32 nIndex) const
1207{
1208 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1209 return pEditEngine ? pEditEngine->GetLanguage(nPara, nIndex).nLang : LANGUAGE_NONE;
1210}
1211
1212sal_Int32 WeldTextForwarder::GetFieldCount(sal_Int32 nPara) const
1213{
1214 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1215 return pEditEngine ? pEditEngine->GetFieldCount(nPara) : 0;
1216}
1217
1218EFieldInfo WeldTextForwarder::GetFieldInfo(sal_Int32 nPara, sal_uInt16 nField) const
1219{
1220 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1221 return pEditEngine ? pEditEngine->GetFieldInfo(nPara, nField) : EFieldInfo();
1222}
1223
1224EBulletInfo WeldTextForwarder::GetBulletInfo(sal_Int32 /*nPara*/) const { return EBulletInfo(); }
1225
1226tools::Rectangle WeldTextForwarder::GetCharBounds(sal_Int32 nPara, sal_Int32 nIndex) const
1227{
1228 tools::Rectangle aRect(0, 0, 0, 0);
1229 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1230
1231 if (pEditEngine)
1232 {
1233 // Handle virtual position one-past-the end of the string
1234 if (nIndex >= pEditEngine->GetTextLen(nPara))
1235 {
1236 if (nIndex)
1237 aRect = pEditEngine->GetCharacterBounds(EPosition(nPara, nIndex - 1));
1238
1239 aRect.Move(aRect.Right() - aRect.Left(), 0);
1240 aRect.SetSize(Size(1, pEditEngine->GetTextHeight()));
1241 }
1242 else
1243 {
1244 aRect = pEditEngine->GetCharacterBounds(EPosition(nPara, nIndex));
1245 }
1246 }
1247 return aRect;
1248}
1249
1250tools::Rectangle WeldTextForwarder::GetParaBounds(sal_Int32 nPara) const
1251{
1252 tools::Rectangle aRect(0, 0, 0, 0);
1253 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1254
1255 if (pEditEngine)
1256 {
1257 const Point aPnt = pEditEngine->GetDocPosTopLeft(nPara);
1258 const sal_Int32 nWidth = pEditEngine->CalcTextWidth();
1259 const sal_Int32 nHeight = pEditEngine->GetTextHeight(nPara);
1260 aRect = tools::Rectangle(aPnt.X(), aPnt.Y(), aPnt.X() + nWidth, aPnt.Y() + nHeight);
1261 }
1262
1263 return aRect;
1264}
1265
1266MapMode WeldTextForwarder::GetMapMode() const
1267{
1268 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1269 return pEditEngine ? pEditEngine->GetRefMapMode() : MapMode(MapUnit::Map100thMM);
1270}
1271
1272OutputDevice* WeldTextForwarder::GetRefDevice() const
1273{
1274 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1275 return pEditEngine ? pEditEngine->GetRefDevice() : nullptr;
1276}
1277
1278bool WeldTextForwarder::GetIndexAtPoint(const Point& rPos, sal_Int32& nPara,
1279 sal_Int32& nIndex) const
1280{
1281 bool bRes = false;
1282 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1283 if (pEditEngine)
1284 {
1285 EPosition aDocPos = pEditEngine->FindDocPosition(rPos);
1286 nPara = aDocPos.nPara;
1287 nIndex = aDocPos.nIndex;
1288 bRes = true;
1289 }
1290 return bRes;
1291}
1292
1293bool WeldTextForwarder::GetWordIndices(sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart,
1294 sal_Int32& nEnd) const
1295{
1296 bool bRes = false;
1297 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1298 if (pEditEngine)
1299 {
1300 ESelection aRes = pEditEngine->GetWord(ESelection(nPara, nIndex, nPara, nIndex),
1301 css::i18n::WordType::DICTIONARY_WORD);
1302
1303 if (aRes.nStartPara == nPara && aRes.nStartPara == aRes.nEndPara)
1304 {
1305 nStart = aRes.nStartPos;
1306 nEnd = aRes.nEndPos;
1307
1308 bRes = true;
1309 }
1310 }
1311
1312 return bRes;
1313}
1314
1315bool WeldTextForwarder::GetAttributeRun(sal_Int32& nStartIndex, sal_Int32& nEndIndex,
1316 sal_Int32 nPara, sal_Int32 nIndex, bool bInCell) const
1317{
1318 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1319 if (!pEditEngine)
1320 return false;
1321 SvxEditSourceHelper::GetAttributeRun(nStartIndex, nEndIndex, *pEditEngine, nPara, nIndex,
1322 bInCell);
1323 return true;
1324}
1325
1326sal_Int32 WeldTextForwarder::GetLineCount(sal_Int32 nPara) const
1327{
1328 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1329 return pEditEngine ? pEditEngine->GetLineCount(nPara) : 0;
1330}
1331
1332sal_Int32 WeldTextForwarder::GetLineLen(sal_Int32 nPara, sal_Int32 nLine) const
1333{
1334 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1335 return pEditEngine ? pEditEngine->GetLineLen(nPara, nLine) : 0;
1336}
1337
1338void WeldTextForwarder::GetLineBoundaries(/*out*/ sal_Int32& rStart, /*out*/ sal_Int32& rEnd,
1339 sal_Int32 nPara, sal_Int32 nLine) const
1340{
1341 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1342 if (pEditEngine)
1343 pEditEngine->GetLineBoundaries(rStart, rEnd, nPara, nLine);
1344 else
1345 rStart = rEnd = 0;
1346}
1347
1348sal_Int32 WeldTextForwarder::GetLineNumberAtIndex(sal_Int32 nPara, sal_Int32 nIndex) const
1349{
1350 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1351 return pEditEngine ? pEditEngine->GetLineNumberAtIndex(nPara, nIndex) : 0;
1352}
1353
1354bool WeldTextForwarder::QuickFormatDoc(bool /*bFull*/)
1355{
1356 bool bRes = false;
1357 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1358 if (pEditEngine)
1359 {
1360 pEditEngine->QuickFormatDoc();
1361 bRes = true;
1362 }
1363 return bRes;
1364}
1365
1366sal_Int16 WeldTextForwarder::GetDepth(sal_Int32 /*nPara*/) const
1367{
1368 // math has no outliner...
1369 return -1;
1370}
1371
1372bool WeldTextForwarder::SetDepth(sal_Int32 /*nPara*/, sal_Int16 nNewDepth)
1373{
1374 // math has no outliner...
1375 return -1 == nNewDepth; // is it the value from 'GetDepth' ?
1376}
1377
1378bool WeldTextForwarder::Delete(const ESelection& rSelection)
1379{
1380 bool bRes = false;
1381 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1382 if (pEditEngine)
1383 {
1384 pEditEngine->QuickDelete(rSelection);
1385 pEditEngine->QuickFormatDoc();
1386 bRes = true;
1387 }
1388 return bRes;
1389}
1390
1391bool WeldTextForwarder::InsertText(const OUString& rStr, const ESelection& rSelection)
1392{
1393 bool bRes = false;
1394 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1395 if (pEditEngine)
1396 {
1397 pEditEngine->QuickInsertText(rStr, rSelection);
1398 pEditEngine->QuickFormatDoc();
1399 bRes = true;
1400 }
1401 return bRes;
1402}
1403
1404const SfxItemSet* WeldTextForwarder::GetEmptyItemSetPtr()
1405{
1406 const SfxItemSet* pItemSet = nullptr;
1407 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1408 if (pEditEngine)
1409 {
1410 pItemSet = &pEditEngine->GetEmptyItemSet();
1411 }
1412 return pItemSet;
1413}
1414
1415void WeldTextForwarder::AppendParagraph()
1416{
1417 // append an empty paragraph
1418 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1419 if (pEditEngine)
1420 {
1421 sal_Int32 nParaCount = pEditEngine->GetParagraphCount();
1422 pEditEngine->InsertParagraph(nParaCount, OUString());
1423 }
1424}
1425
1426sal_Int32 WeldTextForwarder::AppendTextPortion(sal_Int32 nPara, const OUString& rText,
1427 const SfxItemSet& rSet)
1428{
1429 sal_uInt16 nRes = 0;
1430 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1431 if (pEditEngine && nPara < pEditEngine->GetParagraphCount())
1432 {
1433 // append text
1434 ESelection aSel(nPara, pEditEngine->GetTextLen(nPara));
1435 pEditEngine->QuickInsertText(rText, aSel);
1436
1437 // set attributes for new appended text
1438 nRes = aSel.nEndPos = pEditEngine->GetTextLen(nPara);
1439 pEditEngine->QuickSetAttribs(rSet, aSel);
1440 }
1441 return nRes;
1442}
1443
1444void WeldTextForwarder::CopyText(const SvxTextForwarder& rSource)
1445{
1446 const WeldTextForwarder* pSourceForwarder = dynamic_cast<const WeldTextForwarder*>(&rSource);
1447 if (!pSourceForwarder)
1448 return;
1449 EditEngine* pSourceEditEngine = pSourceForwarder->m_rEditAcc.GetEditEngine();
1450 EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
1451 if (pEditEngine && pSourceEditEngine)
1452 {
1453 std::unique_ptr<EditTextObject> pNewTextObject = pSourceEditEngine->CreateTextObject();
1454 pEditEngine->SetText(*pNewTextObject);
1455 }
1456}
1457
1458WeldEditViewForwarder::WeldEditViewForwarder(WeldEditAccessible& rAcc)
1459 : m_rEditAcc(rAcc)
1460{
1461}
1462
1463bool WeldEditViewForwarder::IsValid() const { return m_rEditAcc.GetEditView() != nullptr; }
1464
1465Point WeldEditViewForwarder::LogicToPixel(const Point& rPoint, const MapMode& rMapMode) const
1466{
1467 EditView* pEditView = m_rEditAcc.GetEditView();
1468 if (!pEditView)
1469 return Point();
1470 OutputDevice& rOutDev = pEditView->GetOutputDevice();
1471 MapMode aMapMode(rOutDev.GetMapMode());
1472 Point aPoint(OutputDevice::LogicToLogic(rPoint, rMapMode, MapMode(aMapMode.GetMapUnit())));
1473 aMapMode.SetOrigin(Point());
1474 return rOutDev.LogicToPixel(aPoint, aMapMode);
1475}
1476
1477Point WeldEditViewForwarder::PixelToLogic(const Point& rPoint, const MapMode& rMapMode) const
1478{
1479 EditView* pEditView = m_rEditAcc.GetEditView();
1480 if (!pEditView)
1481 return Point();
1482 OutputDevice& rOutDev = pEditView->GetOutputDevice();
1483 MapMode aMapMode(rOutDev.GetMapMode());
1484 aMapMode.SetOrigin(Point());
1485 Point aPoint(rOutDev.PixelToLogic(rPoint, aMapMode));
1486 return OutputDevice::LogicToLogic(aPoint, MapMode(aMapMode.GetMapUnit()), rMapMode);
1487}
1488
1489bool WeldEditViewForwarder::GetSelection(ESelection& rSelection) const
1490{
1491 bool bRes = false;
1492 EditView* pEditView = m_rEditAcc.GetEditView();
1493 if (pEditView)
1494 {
1495 rSelection = pEditView->GetSelection();
1496 bRes = true;
1497 }
1498 return bRes;
1499}
1500
1501bool WeldEditViewForwarder::SetSelection(const ESelection& rSelection)
1502{
1503 bool bRes = false;
1504 EditView* pEditView = m_rEditAcc.GetEditView();
1505 if (pEditView)
1506 {
1507 pEditView->SetSelection(rSelection);
1508 bRes = true;
1509 }
1510 return bRes;
1511}
1512
1513bool WeldEditViewForwarder::Copy()
1514{
1515 bool bRes = false;
1516 EditView* pEditView = m_rEditAcc.GetEditView();
1517 if (pEditView)
1518 {
1519 pEditView->Copy();
1520 bRes = true;
1521 }
1522 return bRes;
1523}
1524
1525bool WeldEditViewForwarder::Cut()
1526{
1527 bool bRes = false;
1528 EditView* pEditView = m_rEditAcc.GetEditView();
1529 if (pEditView)
1530 {
1531 pEditView->Cut();
1532 bRes = true;
1533 }
1534 return bRes;
1535}
1536
1537bool WeldEditViewForwarder::Paste()
1538{
1539 bool bRes = false;
1540 EditView* pEditView = m_rEditAcc.GetEditView();
1541 if (pEditView)
1542 {
1543 pEditView->Paste();
1544 bRes = true;
1545 }
1546 return bRes;
1547}
1548
1550{
1551 Size aSize(pDrawingArea->get_size_request());
1552 if (aSize.Width() == -1)
1553 aSize.setWidth(500);
1554 if (aSize.Height() == -1)
1555 aSize.setHeight(100);
1556 pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
1557
1558 SetOutputSizePixel(aSize);
1559
1561
1562 EnableRTL(false);
1563
1564 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
1565 Color aBgColor = rStyleSettings.GetWindowColor();
1566
1567 OutputDevice& rDevice = pDrawingArea->get_ref_device();
1568
1569 rDevice.SetMapMode(MapMode(MapUnit::MapTwip));
1570 rDevice.SetBackground(aBgColor);
1571
1572 Size aOutputSize(rDevice.PixelToLogic(aSize));
1573
1575 m_xEditEngine->SetPaperSize(aOutputSize);
1576 m_xEditEngine->SetRefDevice(&rDevice);
1577
1578 m_xEditEngine->SetControlWord(m_xEditEngine->GetControlWord() | EEControlBits::MARKFIELDS);
1579
1580 m_xEditView.reset(new EditView(m_xEditEngine.get(), nullptr));
1581 m_xEditView->setEditViewCallbacks(this);
1582 m_xEditView->SetOutputArea(tools::Rectangle(Point(0, 0), aOutputSize));
1583
1584 m_xEditView->SetBackgroundColor(aBgColor);
1585 m_xEditEngine->SetBackgroundColor(aBgColor);
1586 m_xEditEngine->InsertView(m_xEditView.get());
1587
1588 pDrawingArea->set_cursor(PointerStyle::Text);
1589
1590#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1592#endif
1593}
1594
1595#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1597{
1598 if (m_xAccessible.is())
1600}
1601#endif
1602
1603int WeldEditView::GetSurroundingText(OUString& rSurrounding)
1604{
1605 EditView* pEditView = GetEditView();
1606 if (!pEditView)
1607 return -1;
1608 rSurrounding = pEditView->GetSurroundingText();
1609 return pEditView->GetSurroundingTextSelection().Min();
1610}
1611
1613{
1614 EditView* pEditView = GetEditView();
1615 if (!pEditView)
1616 return false;
1617 return pEditView->DeleteSurroundingText(rRange);
1618}
1619
1621{
1622 EditView* pEditView = GetEditView();
1623 if (pEditView)
1624 {
1625 pEditView->ShowCursor(false);
1626 Invalidate(); // redraw with cursor
1627 }
1628
1630
1631#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1632 if (m_xAccessible.is())
1633 {
1634 // Note: will implicitly send the AccessibleStateType::FOCUSED event
1635 ::accessibility::AccessibleTextHelper* pHelper = m_xAccessible->GetTextHelper();
1636 if (pHelper)
1637 pHelper->SetFocus();
1638 }
1639#endif
1640}
1641
1643{
1645 Invalidate(); // redraw without cursor
1646
1647#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1648 if (m_xAccessible.is())
1649 {
1650 // Note: will implicitly send the AccessibleStateType::FOCUSED event
1651 ::accessibility::AccessibleTextHelper* pHelper = m_xAccessible->GetTextHelper();
1652 if (pHelper)
1653 pHelper->SetFocus(false);
1654 }
1655#endif
1656}
1657
1658bool WeldEditView::CanFocus() const { return true; }
1659
1660css::uno::Reference<css::datatransfer::dnd::XDropTarget> WeldEditView::GetDropTarget()
1661{
1662 if (!m_xDropTarget)
1664 return m_xDropTarget;
1665}
1666
1667css::uno::Reference<css::datatransfer::clipboard::XClipboard> WeldEditView::GetClipboard() const
1668{
1670}
1671
1672namespace
1673{
1674class WeldEditViewUIObject final : public DrawingAreaUIObject
1675{
1676private:
1677 WeldEditView* mpEditView;
1678
1679public:
1680 WeldEditViewUIObject(const VclPtr<vcl::Window>& rDrawingArea)
1681 : DrawingAreaUIObject(rDrawingArea)
1682 , mpEditView(static_cast<WeldEditView*>(mpController))
1683 {
1684 }
1685
1686 static std::unique_ptr<UIObject> create(vcl::Window* pWindow)
1687 {
1688 return std::unique_ptr<UIObject>(new WeldEditViewUIObject(pWindow));
1689 }
1690
1691 virtual StringMap get_state() override
1692 {
1694 aMap["Text"] = mpEditView->GetText();
1695 return aMap;
1696 }
1697
1698private:
1699 virtual OUString get_name() const override { return "WeldEditViewUIObject"; }
1700};
1701}
1702
1703FactoryFunction WeldEditView::GetUITestFactory() const { return WeldEditViewUIObject::create; }
1704
1705/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::rtl::Reference< IEventProcessor > xProcessor
std::map< OUString, OUString > StringMap
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
virtual OUString CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_Int32 nPos, std::optional< Color > &rTxtColor, std::optional< Color > &rFldColor, std::optional< FontLineStyle > &rFldLineStyle)
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
void SetStyleSheet(const EditSelection &aSel, SfxStyleSheet *pStyle)
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
SfxStyleSheetPool * GetStyleSheetPool()
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
void SetNotifyHdl(const Link< EENotify &, void > &rLink)
LanguageType GetDefaultLanguage() const
const SfxStyleSheet * GetStyleSheet(sal_Int32 nPara) 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()
constexpr tools::Long Y() const
constexpr tools::Long X() const
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 MapMode GetMapMode() const=0
virtual void QuickInsertLineBreak(const ESelection &rSel)=0
virtual void SetStyleSheet(sal_Int32 nPara, const OUString &rStyleName)=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 OUString GetStyleSheet(sal_Int32 nPara) 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 OUString CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_Int32 nPos, std::optional< Color > &rpTxtColor, std::optional< Color > &rpFldColor, std::optional< FontLineStyle > &rpFldLineStyle)=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.
void setViewport(const basegfx::B2DRange &rNew)
void setViewTransformation(const basegfx::B2DHomMatrix &rNew)
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
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)