summaryrefslogtreecommitdiff
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-01-11 11:18:09 +0100
commit0fe02bb99e5dfa8379a49de75683fc350e4c4dbd (patch)
tree4601ca376bccbf779e73cb7b34eea20f2adaae68
parentbb37b46182bcff2f10edcc590cedbc4bb5820c4b (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. Change-Id: I2e450707ce02f7bcd8e4d299f857c37ebbd5e2c6
-rw-r--r--editeng/source/editeng/editview.cxx27
-rw-r--r--editeng/source/editeng/impedit.cxx16
-rw-r--r--editeng/source/editeng/impedit.hxx4
-rw-r--r--include/editeng/editview.hxx4
-rw-r--r--sc/source/ui/view/gridwin4.cxx6
-rw-r--r--svx/source/svdraw/svdedxv.cxx3
6 files changed, 53 insertions, 7 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 98a5da7c93e7..15743ad73c68 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -201,20 +201,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);
}
}
@@ -222,10 +232,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 );
}
}
}
@@ -1688,4 +1699,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 f37d0456cf77..bb1a1ae00d47 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -197,7 +197,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();
@@ -868,6 +869,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())
@@ -875,13 +885,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 b9f5628b1881..753ce82a1f4b 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -301,6 +301,7 @@ private:
std::unique_ptr<LOKSpecialPositioning> mpLOKSpecialPositioning;
bool mbBroadcastLOKViewCursor:1;
bool mbSuppressLOKMessages:1;
+ bool mbNegativeX:1;
EditViewCallbacks* getEditViewCallbacks() const
{
@@ -469,6 +470,9 @@ public:
void SuppressLOKMessages(bool bSet) { mbSuppressLOKMessages = bSet; }
bool IsSuppressLOKMessages() const { return mbSuppressLOKMessages; }
+
+ void SetNegativeX(bool bSet) { mbNegativeX = bSet; }
+ bool IsNegativeX() const { return mbNegativeX; }
};
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index 117cc68b7c99..2c073de906f4 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -361,6 +361,10 @@ public:
void SuppressLOKMessages(bool bSet);
bool IsSuppressLOKMessages() const;
+
+ /// To inform editeng that negated x document coordinates are in use.
+ void SetNegativeX(bool bSet);
+ bool IsNegativeX() const;
};
#endif // INCLUDED_EDITENG_EDITVIEW_HXX
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 8aae4a10b6d9..9de8604f2bfd 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1027,7 +1027,11 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
if (bIsTiledRendering)
{
Point aOrigin = aOriginalMode.GetOrigin();
- aOrigin.setX(aOrigin.getX() / TWIPS_PER_PIXEL + aOutputData.nScrX);
+ if (bLayoutRTL)
+ aOrigin.setX(-aOrigin.getX() / TWIPS_PER_PIXEL + aOutputData.nScrX + aOutputData.GetScrW());
+ else
+ aOrigin.setX(aOrigin.getX() / TWIPS_PER_PIXEL + aOutputData.nScrX);
+
aOrigin.setY(aOrigin.getY() / TWIPS_PER_PIXEL + aOutputData.nScrY);
const double twipFactor = 15 * 1.76388889; // 26.45833335
aOrigin = Point(aOrigin.getX() * twipFactor,
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index a4d43f97b8c6..c6af7e8c409e 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -868,6 +868,9 @@ OutlinerView* SdrObjEditView::ImpMakeOutlinerView(vcl::Window* pWin, OutlinerVie
pOutlView->SetWindow(pWin);
}
+ if (mbNegativeX)
+ pOutlView->GetEditView().SetNegativeX(mbNegativeX);
+
// disallow scrolling
EVControlBits nStat = pOutlView->GetControlWord();
nStat &= ~EVControlBits::AUTOSCROLL;