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

Jan Holesovsky kendy at collabora.com
Wed Mar 18 05:19:38 PDT 2015


 sc/source/ui/view/gridwin4.cxx |   32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

New commits:
commit 3a0ad5d902435a3b503d0e79a57cac57343a80e6
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Mar 18 13:11:36 2015 +0100

    sc tiled editing: Clear the right area behind the editeng.
    
    Based on a patch by Henry Castro.
    
    Change-Id: Ic463c97577d521e3c2e4d6bc904c517aa564edca

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 99a8f1c..6324933 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -866,13 +866,14 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
         }
     }
 
-    //  InPlace Edit-View
-    // moved after EndDrawLayers() to get it outside the overlay buffer and
-    // on top of everything
+    // In-place editing - when the user is typing, we need to paint the text
+    // using the editeng.
+    // It's being done after EndDrawLayers() to get it outside the overlay
+    // buffer and on top of everything.
     if ( bEditMode && (pViewData->GetRefTabNo() == pViewData->GetTabNo()) )
     {
-        //! use pContentDev for EditView?
-        rDevice.SetMapMode(MAP_PIXEL);
+        // get the coordinates of the area we need to clear (overpaint by
+        // the background)
         SCCOL nCol1 = pViewData->GetEditStartCol();
         SCROW nRow1 = pViewData->GetEditStartRow();
         SCCOL nCol2 = pViewData->GetEditEndCol();
@@ -882,12 +883,25 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
         Point aStart = pViewData->GetScrPos( nCol1, nRow1, eWhich );
         Point aEnd = pViewData->GetScrPos( nCol2+1, nRow2+1, eWhich );
 
+        // don't overwrite grid
         long nLayoutSign = bLayoutRTL ? -1 : 1;
-        aEnd.X() -= 2 * nLayoutSign;        // don't overwrite grid
+        aEnd.X() -= 2 * nLayoutSign;
         aEnd.Y() -= 2;
-        rDevice.DrawRect(Rectangle(aStart, aEnd));
 
-        rDevice.SetMapMode(bIsTiledRendering? aDrawMode: pViewData->GetLogicMode());
+        // set the correct mapmode
+        Rectangle aBackground(aStart, aEnd);
+        if (bIsTiledRendering)
+        {
+            aBackground += Point(nScrX, nScrY);
+            rDevice.SetMapMode(aDrawMode);
+        }
+        else
+            rDevice.SetMapMode(pViewData->GetLogicMode());
+
+        // paint the background
+        rDevice.DrawRect(rDevice.PixelToLogic(aBackground));
+
+        // paint the editeng text
         pEditView->Paint(rDevice.PixelToLogic(Rectangle(Point(nScrX, nScrY), Size(aOutputData.GetScrW(), aOutputData.GetScrH()))), &rDevice);
         rDevice.SetMapMode(MAP_PIXEL);
     }
commit b3ec7f96e7bc757a4deaf7f857500df84560c2b1
Author: Henry Castro <hcastro at collabora.com>
Date:   Wed Mar 18 12:08:47 2015 +0100

    sc tiled editing: Use the correct device for PixelToLogic.
    
    Change-Id: I55e4eb784694de889d7bb0a3a6043a5a2b74239c

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 3e4ce0f..99a8f1c 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -888,7 +888,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
         rDevice.DrawRect(Rectangle(aStart, aEnd));
 
         rDevice.SetMapMode(bIsTiledRendering? aDrawMode: pViewData->GetLogicMode());
-        pEditView->Paint(PixelToLogic(Rectangle(Point(nScrX, nScrY), Size(aOutputData.GetScrW(), aOutputData.GetScrH()))), &rDevice);
+        pEditView->Paint(rDevice.PixelToLogic(Rectangle(Point(nScrX, nScrY), Size(aOutputData.GetScrW(), aOutputData.GetScrH()))), &rDevice);
         rDevice.SetMapMode(MAP_PIXEL);
     }
 


More information about the Libreoffice-commits mailing list