summaryrefslogtreecommitdiffstats
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-01-11 11:18:07 +0100
commit04a48ea15b9e692ded4f3012b41e765451669e46 (patch)
treece167aa8090c255ebbb2888d1e19a481bb0a312d
parentlokCalcRTL: fix editcell painting from other views as well (diff)
downloadcore-04a48ea15b9e692ded4f3012b41e765451669e46.tar.gz
core-04a48ea15b9e692ded4f3012b41e765451669e46.zip
lokCalcRTL: selection coords should be mirrored w.r.t output area
Change-Id: I52bbbd4ca69a599c90c00d25513064b025f72bf4
-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 55486adf6ac4..f37d0456cf77 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -518,6 +518,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 {
@@ -594,7 +595,7 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion,
aTmpRect.SetRight(aLineXPosStartEnd.Max());
aTmpRect.Move(aLineOffset.Width(), 0);
ImplDrawHighlightRect(pTarget, aTmpRect.TopLeft(), aTmpRect.BottomRight(),
- pPolyPoly.get());
+ pPolyPoly.get(), bLOKCalcRTL);
}
else
{
@@ -620,7 +621,7 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion,
aTmpRect.Move(aLineOffset.Width(), 0);
ImplDrawHighlightRect(pTarget, aTmpRect.TopLeft(), aTmpRect.BottomRight(),
- pPolyPoly.get());
+ pPolyPoly.get(), bLOKCalcRTL);
nTmpStartIndex = nTmpEndIndex;
}
}
@@ -657,7 +658,7 @@ void ImpEditView::GetSelectionRectangles(EditSelection aTmpSel, std::vector<tool
aRegion.GetRegionRectangles(rLogicRects);
}
-void ImpEditView::ImplDrawHighlightRect( OutputDevice* _pTarget, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, tools::PolyPolygon* pPolyPoly )
+void ImpEditView::ImplDrawHighlightRect( OutputDevice* _pTarget, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, tools::PolyPolygon* pPolyPoly, bool bLOKCalcRTL )
{
if ( rDocPosTopLeft.X() == rDocPosBottomRight.X() )
return;
@@ -670,6 +671,13 @@ void ImpEditView::ImplDrawHighlightRect( OutputDevice* _pTarget, const Point& rD
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 362df78817cc..b9f5628b1881 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* _pTarget, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, tools::PolyPolygon* pPolyPoly );
+ void ImplDrawHighlightRect( OutputDevice* _pTarget, 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;