[Libreoffice-commits] core.git: sc/source

Marco Cecchetti marco.cecchetti at collabora.com
Mon Oct 3 12:41:11 UTC 2016


 sc/source/ui/view/gridwin4.cxx |   39 +++++++++++++++------------------------
 1 file changed, 15 insertions(+), 24 deletions(-)

New commits:
commit ba64777045c9e34e24cccf83d74594092f6b0552
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Sun Oct 2 14:01:47 2016 +0200

    LOK: Calc: clear cell background in other views on editing
    
    Change-Id: Ia61bcdf7db0994b6681607403c56be707a9f17d9
    Reviewed-on: https://gerrit.libreoffice.org/29456
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
    Tested-by: Marco Cecchetti <mrcekets at gmail.com>
    (cherry picked from commit 1922c8b1d46e0067ed21a18d249f04da6f3b0160)
    Reviewed-on: https://gerrit.libreoffice.org/29489

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 0aa4322..2e66fef 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -972,7 +972,8 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
             pCrsr->Show();
     }
 
-    if (comphelper::LibreOfficeKit::isActive())
+    // paint in-place editing on other views
+    if (bIsTiledRendering)
     {
         ScTabViewShell* pThisViewShell = pViewData->GetViewShell();
         SfxViewShell* pViewShell = SfxViewShell::GetFirst();
@@ -999,14 +1000,6 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
                         EditView* pOtherEditView = rOtherViewData.GetEditView(eOtherWhich);
                         if (pOtherEditView)
                         {
-                            // TODO: implement the RTL layout case
-                            //Point aOtherScrPos = rOtherViewData.GetScrPos( nX1, nY1, eOtherWhich );
-                            //if ( bLayoutRTL )
-                            //{
-                            //    long nEndPixel = rOtherViewData.GetScrPos( nX2+1, maVisibleRange.mnRow1, eWhich ).X();
-                            //    aOtherScrPos.X() = nEndPixel + 1;
-                            //}
-
                             long nScreenX = aOutputData.nScrX;
                             long nScreenY = aOutputData.nScrY;
                             long nScreenW = aOutputData.GetScrW();
@@ -1024,27 +1017,25 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
 
                             Rectangle aBackground(aStart, aEnd);
 
-                            aBackground += Point(nScreenX, nScreenY);
+                            // Need to draw the background in absolute coords.
+                            auto aOrigin = aOriginalMode.GetOrigin();
+                            aOrigin.setX(aOrigin.getX() / TWIPS_PER_PIXEL + nScreenX);
+                            aOrigin.setY(aOrigin.getY() / TWIPS_PER_PIXEL + nScreenY);
+                            aBackground += aOrigin;
                             rDevice.SetMapMode(aDrawMode);
 
+                            static const double twipFactor = 15 * 1.76388889; // 26.45833335
+                            aOrigin = Point(aOrigin.getX() * twipFactor,
+                                            aOrigin.getY() * twipFactor);
+                            MapMode aNew = rDevice.GetMapMode();
+                            aNew.SetOrigin(aOrigin);
+                            rDevice.SetMapMode(aNew);
 
                             // paint the background
                             rDevice.DrawRect(rDevice.PixelToLogic(aBackground));
 
-                            if (bIsTiledRendering)
-                            {
-                                auto aOrigin = aOriginalMode.GetOrigin();
-                                aOrigin.setX(aOrigin.getX() / TWIPS_PER_PIXEL + nScrX);
-                                aOrigin.setY(aOrigin.getY() / TWIPS_PER_PIXEL + nScrY);
-                                static const double twipFactor = 15 * 1.76388889; // 26.45833335
-                                aOrigin = Point(aOrigin.getX() * twipFactor,
-                                                aOrigin.getY() * twipFactor);
-                                MapMode aNew = rDevice.GetMapMode();
-                                aNew.SetOrigin(aOrigin);
-                                rDevice.SetMapMode(aNew);
-                            }
-
-                            pOtherEditView->Paint(rDevice.PixelToLogic(Rectangle(Point(nScreenX, nScreenY), Size(nScreenW, nScreenH))), &rDevice);
+                            Rectangle aEditRect(Point(nScreenX, nScreenY), Size(nScreenW, nScreenH));
+                            pOtherEditView->Paint(rDevice.PixelToLogic(aEditRect), &rDevice);
                             rDevice.SetMapMode(MAP_PIXEL);
                         }
                     }


More information about the Libreoffice-commits mailing list