diff options
author | Dennis Francis <dennis.francis@collabora.com> | 2022-01-04 12:55:45 +0530 |
---|---|---|
committer | Dennis Francis <dennis.francis@collabora.com> | 2022-02-04 19:21:53 +0100 |
commit | 226847e385d021bf2feacdfa796b3eb7023d6f0f (patch) | |
tree | 66e2a6d1f4b2bc25c691f4f289d764971df8ee2e /editeng | |
parent | 0be8060a856f86fdfb42372e58073586b29c93fa (diff) |
lokCalcRTL: fix editing of shape text
Inform editeng that negated document x coordinates are used in this case
and ensure that editeng generated invalidation rectangles always have
positive X coordinates.
Conflicts:
sc/source/ui/view/gridwin4.cxx
Change-Id: I2e450707ce02f7bcd8e4d299f857c37ebbd5e2c6
(cherry picked from commit 0fe02bb99e5dfa8379a49de75683fc350e4c4dbd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129360
Tested-by: Jenkins
Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/editview.cxx | 27 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 16 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 4 |
3 files changed, 41 insertions, 6 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 0c2f8f43b2a9..c8d12f0388d3 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -195,20 +195,30 @@ tools::Rectangle EditView::GetInvalidateRect() const } } +namespace { + +tools::Rectangle lcl_negateRectX(const tools::Rectangle& rRect) +{ + return tools::Rectangle(-rRect.Right(), rRect.Top(), -rRect.Left(), rRect.Bottom()); +} + +} + void EditView::InvalidateWindow(const tools::Rectangle& rClipRect) { + bool bNegativeX = IsNegativeX(); if (EditViewCallbacks* pEditViewCallbacks = pImpEditView->getEditViewCallbacks()) { // do not invalidate and trigger a global repaint, but forward // the need for change to the applied EditViewCallback, can e.g. // be used to visualize the active edit text in an OverlayObject - pEditViewCallbacks->EditViewInvalidate(rClipRect); + pEditViewCallbacks->EditViewInvalidate(bNegativeX ? lcl_negateRectX(rClipRect) : rClipRect); } else { // classic mode: invalidate and trigger full repaint // of the changed area - GetWindow()->Invalidate(rClipRect); + GetWindow()->Invalidate(bNegativeX ? lcl_negateRectX(rClipRect) : rClipRect); } } @@ -216,10 +226,11 @@ void EditView::InvalidateOtherViewWindows( const tools::Rectangle& rInvRect ) { if (comphelper::LibreOfficeKit::isActive()) { + bool bNegativeX = IsNegativeX(); for (auto& pWin : pImpEditView->aOutWindowSet) { if (pWin) - pWin->Invalidate( rInvRect ); + pWin->Invalidate( bNegativeX ? lcl_negateRectX(rInvRect) : rInvRect ); } } } @@ -1678,4 +1689,14 @@ bool EditView::IsSuppressLOKMessages() const return pImpEditView->IsSuppressLOKMessages(); } +void EditView::SetNegativeX(bool bSet) +{ + pImpEditView->SetNegativeX(bSet); +} + +bool EditView::IsNegativeX() const +{ + return pImpEditView->IsNegativeX(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 1175c28661cd..cfd6eb5758dc 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -198,7 +198,8 @@ ImpEditView::ImpEditView( EditView* pView, EditEngine* pEng, vcl::Window* pWindo eAnchorMode(EEAnchorMode::TopLeft), mpEditViewCallbacks(nullptr), mbBroadcastLOKViewCursor(comphelper::LibreOfficeKit::isActive()), - mbSuppressLOKMessages(false) + mbSuppressLOKMessages(false), + mbNegativeX(false) { aEditSelection.Min() = pEng->GetEditDoc().GetStartPaM(); aEditSelection.Max() = pEng->GetEditDoc().GetEndPaM(); @@ -875,6 +876,15 @@ void ImpEditView::SetOutputArea( const tools::Rectangle& rRect ) SetScrollDiffX( static_cast<sal_uInt16>(aOutArea.GetWidth()) * 2 / 10 ); } +namespace { + +tools::Rectangle lcl_negateRectX(const tools::Rectangle& rRect) +{ + return tools::Rectangle(-rRect.Right(), rRect.Top(), -rRect.Left(), rRect.Bottom()); +} + +} + void ImpEditView::InvalidateAtWindow(const tools::Rectangle& rRect) { if (EditViewCallbacks* pCallbacks = getEditViewCallbacks()) @@ -882,13 +892,13 @@ void ImpEditView::InvalidateAtWindow(const tools::Rectangle& rRect) // do not invalidate and trigger a global repaint, but forward // the need for change to the applied EditViewCallback, can e.g. // be used to visualize the active edit text in an OverlayObject - pCallbacks->EditViewInvalidate(rRect); + pCallbacks->EditViewInvalidate(mbNegativeX ? lcl_negateRectX(rRect) : rRect); } else { // classic mode: invalidate and trigger full repaint // of the changed area - GetWindow()->Invalidate(rRect); + GetWindow()->Invalidate(mbNegativeX ? lcl_negateRectX(rRect) : rRect); } } diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index fd130ffaf768..eb8176561cb1 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -302,6 +302,7 @@ private: std::unique_ptr<LOKSpecialPositioning> mpLOKSpecialPositioning; bool mbBroadcastLOKViewCursor:1; bool mbSuppressLOKMessages:1; + bool mbNegativeX:1; EditViewCallbacks* getEditViewCallbacks() const { @@ -468,6 +469,9 @@ public: void SuppressLOKMessages(bool bSet) { mbSuppressLOKMessages = bSet; } bool IsSuppressLOKMessages() const { return mbSuppressLOKMessages; } + + void SetNegativeX(bool bSet) { mbNegativeX = bSet; } + bool IsNegativeX() const { return mbNegativeX; } }; |