[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - editeng/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Mar 23 04:20:08 PDT 2015


 editeng/source/editeng/impedit.cxx |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 58afab1123d16af5270a97cafb05d13fd9538a68
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Mar 23 12:17:29 2015 +0100

    editeng tiled rendering: fix selection overlay in Impress
    
    The map mode is twips in Writer, that's why it worked there. For
    Impress, we need a conversion to always have twips output.
    
    Change-Id: I53c64b961180b6ff9b4ee75e3c5aa775416e7ae7

diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 7593b80..8c86f0a 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -324,6 +324,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou
 
         if (isTiledRendering())
         {
+            bool bMm100ToTwip = pOutWin->GetMapMode().GetMapUnit() == MAP_100TH_MM;
             OString sRectangle;
             // If we are not in selection mode, then the exported selection should be empty.
             if (pEditEngine->pImpEditEngine->IsInSelectionMode())
@@ -335,19 +336,25 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou
                 {
                     Rectangle& rStart = aRectangles.front();
                     Rectangle aStart = Rectangle(rStart.Left(), rStart.Top(), rStart.Left() + 1, rStart.Bottom());
+                    if (bMm100ToTwip)
+                        aStart = OutputDevice::LogicToLogic(aStart, MAP_100TH_MM, MAP_TWIP);
                     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);
                     libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr());
                 }
 
                 std::stringstream ss;
                 for (size_t i = 0; i < aRectangles.size(); ++i)
                 {
-                    const Rectangle& rRectangle = aRectangles[i];
+                    Rectangle& rRectangle = aRectangles[i];
                     if (i)
                         ss << "; ";
+                    if (bMm100ToTwip)
+                        rRectangle = OutputDevice::LogicToLogic(rRectangle, MAP_100TH_MM, MAP_TWIP);
                     ss << rRectangle.toString().getStr();
                 }
                 sRectangle = ss.str().c_str();


More information about the Libreoffice-commits mailing list