summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2022-01-04 12:55:45 +0530
committerAndras Timar <andras.timar@collabora.com>2022-02-14 11:25:45 +0100
commit9e17c698b3a8ed396363661f9d42f1b488e51419 (patch)
tree25af1c25a0723c14fb44c6e66dc664a5fc019720 /editeng
parent28814af7a848d0f364fb8aac98cdc47caf946bfb (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.cxx27
-rw-r--r--editeng/source/editeng/impedit.cxx16
-rw-r--r--editeng/source/editeng/impedit.hxx4
3 files changed, 41 insertions, 6 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index c227cbc93182..9fc8514d7812 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -199,20 +199,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);
}
}
@@ -220,10 +230,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 );
}
}
}
@@ -1682,4 +1693,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; }
};