editeng/source/editeng/impedit.cxx | 14 +++++++++++--- editeng/source/editeng/impedit.hxx | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-)
New commits: commit 07e8233298965ed035bc4a285de19ca540e72246 Author: Dennis Francis <dennis.fran...@collabora.com> AuthorDate: Mon Nov 22 16:34:32 2021 +0530 Commit: Dennis Francis <dennis.fran...@collabora.com> CommitDate: Sat Jan 29 05:05:35 2022 +0100 lokCalcRTL: selection coords should be mirrored w.r.t output area Conflicts: editeng/source/editeng/impedit.cxx editeng/source/editeng/impedit.hxx Change-Id: I52bbbd4ca69a599c90c00d25513064b025f72bf4 (cherry picked from commit 04a48ea15b9e692ded4f3012b41e765451669e46) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128900 Tested-by: Jenkins Reviewed-by: Dennis Francis <dennis.fran...@collabora.com> diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 267045460073..1175c28661cd 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -525,6 +525,7 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion, bool bStartHandleVisible = false; bool bEndHandleVisible = false; + bool bLOKCalcRTL = mpLOKSpecialPositioning && pEditEngine->IsRightToLeft(nStartPara); auto DrawHighlight = [&, nStartLine = sal_Int32(0), nEndLine = sal_Int32(0)]( const ImpEditEngine::LineAreaInfo& rInfo) mutable { @@ -601,7 +602,7 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion, aTmpRect.SetRight(aLineXPosStartEnd.Max()); aTmpRect.Move(aLineOffset.Width(), 0); ImplDrawHighlightRect(rTarget, aTmpRect.TopLeft(), aTmpRect.BottomRight(), - pPolyPoly ? &*pPolyPoly : nullptr); + pPolyPoly ? &*pPolyPoly : nullptr, bLOKCalcRTL); } else { @@ -627,7 +628,7 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion, aTmpRect.Move(aLineOffset.Width(), 0); ImplDrawHighlightRect(rTarget, aTmpRect.TopLeft(), aTmpRect.BottomRight(), - pPolyPoly ? &*pPolyPoly : nullptr); + pPolyPoly ? &*pPolyPoly : nullptr, bLOKCalcRTL); nTmpStartIndex = nTmpEndIndex; } } @@ -664,7 +665,7 @@ void ImpEditView::GetSelectionRectangles(EditSelection aTmpSel, std::vector<tool aRegion.GetRegionRectangles(rLogicRects); } -void ImpEditView::ImplDrawHighlightRect( OutputDevice& rTarget, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, tools::PolyPolygon* pPolyPoly ) +void ImpEditView::ImplDrawHighlightRect( OutputDevice& rTarget, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, tools::PolyPolygon* pPolyPoly, bool bLOKCalcRTL ) { if ( rDocPosTopLeft.X() == rDocPosBottomRight.X() ) return; @@ -677,6 +678,13 @@ void ImpEditView::ImplDrawHighlightRect( OutputDevice& rTarget, const Point& rDo Point aRefPointLogical = GetOutputArea().TopLeft(); // Get the relative coordinates w.r.t refpoint in display units. aSelRect.Move(-aRefPointLogical.X(), -aRefPointLogical.Y()); + if (bLOKCalcRTL) + { + tools::Long nMirrorW = GetOutputArea().GetWidth(); + tools::Long nLeft = aSelRect.Left(), nRight = aSelRect.Right(); + aSelRect.SetLeft(nMirrorW - nRight); + aSelRect.SetRight(nMirrorW - nLeft); + } // Convert from display unit to twips. aSelRect = OutputDevice::LogicToLogic(aSelRect, MapMode(eDevUnit), MapMode(MapUnit::MapTwip)); diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 7e22687aba7c..fd130ffaf768 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -337,7 +337,7 @@ protected: void ShowDDCursor( const tools::Rectangle& rRect ); void HideDDCursor(); - void ImplDrawHighlightRect(OutputDevice& rTarget, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, tools::PolyPolygon* pPolyPoly); + void ImplDrawHighlightRect(OutputDevice& rTarget, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, tools::PolyPolygon* pPolyPoly, bool bLOKCalcRTL); tools::Rectangle ImplGetEditCursor(EditPaM& aPaM, GetCursorFlags nShowCursorFlags, sal_Int32& nTextPortionStart, const ParaPortion* pParaPortion) const;