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-13 17:30:53 +0100
commit22e97c130868fe7d7529cfcfb2a240f775bd8916 (patch)
tree87046a4f4c67a5e84c568db1840bc301423bfc1a /editeng
parentccd363e8d7d9c71d565c9364b5b518b3e72634ea (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
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 eb68e3168c34..df875edba6f7 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -327,6 +327,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())
@@ -340,12 +346,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());
}
@@ -355,6 +363,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);