summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-11-13 14:42:35 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-11-16 11:38:25 +0100
commitcac5525f29c686caf1701b793d854784deadee56 (patch)
tree9521668921c44baa9fd4eab6de5d3d1e76dedff1 /editeng
parenta792468f017fcd7fc040affe288bd058c1ba6523 (diff)
editeng lok: respect origin of map mode for TEXT_SELECTION
With this, selections of Writer comment text show up at the correct position, not at the top left corner of the window. Change-Id: If865503d9a02a27730e382d65c42c706dd533a93 (cherry picked from commit 22e97c130868fe7d7529cfcfb2a240f775bd8916)
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/impedit.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 19a9bb2294c1..8f60669bcf8d 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -328,6 +328,12 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou
if (isTiledRendering() && !pOldRegion)
{
bool bMm100ToTwip = pOutWin->GetMapMode().GetMapUnit() == MAP_100TH_MM;
+
+ Point aOrigin;
+ if (pOutWin->GetMapMode().GetMapUnit() == MAP_TWIP)
+ // Writer comments: they use editeng, but are separate widgets.
+ aOrigin = pOutWin->GetMapMode().GetOrigin();
+
OString sRectangle;
// If we are not in selection mode, then the exported selection should be empty.
if (pEditEngine->pImpEditEngine->IsInSelectionMode())
@@ -341,12 +347,14 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou
Rectangle aStart = Rectangle(rStart.Left(), rStart.Top(), rStart.Left() + 1, rStart.Bottom());
if (bMm100ToTwip)
aStart = OutputDevice::LogicToLogic(aStart, MAP_100TH_MM, MAP_TWIP);
+ aStart.Move(aOrigin.getX(), aOrigin.getY());
libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, aStart.toString().getStr());
Rectangle& rEnd = aRectangles.back();
Rectangle aEnd = Rectangle(rEnd.Right() - 1, rEnd.Top(), rEnd.Right(), rEnd.Bottom());
if (bMm100ToTwip)
aEnd = OutputDevice::LogicToLogic(aEnd, MAP_100TH_MM, MAP_TWIP);
+ aEnd.Move(aOrigin.getX(), aOrigin.getY());
libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr());
}
@@ -356,6 +364,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou
Rectangle& rRectangle = aRectangles[i];
if (bMm100ToTwip)
rRectangle = OutputDevice::LogicToLogic(rRectangle, MAP_100TH_MM, MAP_TWIP);
+ rRectangle.Move(aOrigin.getX(), aOrigin.getY());
v.push_back(rRectangle.toString().getStr());
}
sRectangle = comphelper::string::join("; ", v);