summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2021-11-22 16:34:32 +0530
committerAndras Timar <andras.timar@collabora.com>2022-02-14 11:25:43 +0100
commitb51b6676b1a89a7399e3938fc91524829cfab528 (patch)
treeb400a152525f6452d69ebcc74d9791ba70dce01d /editeng
parent265323743f395c1af203cb3adb7b22e4a3cacbeb (diff)
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.francis@collabora.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/impedit.cxx14
-rw-r--r--editeng/source/editeng/impedit.hxx2
2 files changed, 12 insertions, 4 deletions
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;