[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - sc/source

Marco Cecchetti marco.cecchetti at collabora.com
Fri Sep 30 21:35:41 UTC 2016


 sc/source/ui/view/gridwin4.cxx |   79 +++++++++++++++++++++--------------------
 sc/source/ui/view/tabview3.cxx |    4 +-
 2 files changed, 43 insertions(+), 40 deletions(-)

New commits:
commit eeac6e6cc5f343193bf2942f203237d09c070eec
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Fri Sep 30 23:31:15 2016 +0200

    Calc: fixed bug in parallel cell editing
    
    The background color by the wrong edit view was used causing a
    segmentation fault.
    
    Change-Id: Ife489989e382d6f4f905f0ca305928e64bbce588

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 1adf3f0..a3a171c 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -993,55 +993,58 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
                     if (bOtherEditMode && rOtherViewData.GetRefTabNo() == nTab)
                     {
                         EditView* pOtherEditView = rOtherViewData.GetEditView(eOtherWhich);
-                        Point aOtherScrPos = rOtherViewData.GetScrPos( nX1, nY1, eOtherWhich );
-                        if ( bLayoutRTL )
+                        if (pOtherEditView)
                         {
-                            long nEndPixel = pViewData->GetScrPos( nX2+1, maVisibleRange.mnRow1, eWhich ).X();
-                            aOtherScrPos.X() = nEndPixel + 1;
-                        }
+                            // 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();
-                        long nScreenH = aOutputData.GetScrH();
+                            long nScreenX = aOutputData.nScrX;
+                            long nScreenY = aOutputData.nScrY;
+                            long nScreenW = aOutputData.GetScrW();
+                            long nScreenH = aOutputData.GetScrH();
 
-                        rDevice.SetLineColor();
-                        rDevice.SetFillColor(pEditView->GetBackgroundColor());
-                        Point aStart = rOtherViewData.GetScrPos( nCol1, nRow1, eOtherWhich );
-                        Point aEnd = rOtherViewData.GetScrPos( nCol2+1, nRow2+1, eOtherWhich );
+                            rDevice.SetLineColor();
+                            rDevice.SetFillColor(pOtherEditView->GetBackgroundColor());
+                            Point aStart = rOtherViewData.GetScrPos( nCol1, nRow1, eOtherWhich );
+                            Point aEnd = rOtherViewData.GetScrPos( nCol2+1, nRow2+1, eOtherWhich );
 
-                        // don't overwrite grid
-                        long nLayoutSign = bLayoutRTL ? -1 : 1;
-                        aEnd.X() -= 2 * nLayoutSign;
-                        aEnd.Y() -= 2;
+                            // don't overwrite grid
+                            long nLayoutSign = bLayoutRTL ? -1 : 1;
+                            aEnd.X() -= 2 * nLayoutSign;
+                            aEnd.Y() -= 2;
 
-                        Rectangle aBackground(aStart, aEnd);
+                            Rectangle aBackground(aStart, aEnd);
 
-                        aBackground += Point(nScreenX, nScreenY);
-                        rDevice.SetMapMode(aDrawMode);
+                            aBackground += Point(nScreenX, nScreenY);
+                            rDevice.SetMapMode(aDrawMode);
 
 
-                        // paint the background
-                        rDevice.DrawRect(rDevice.PixelToLogic(aBackground));
+                            // 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);
-                        }
+                            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);
-                        rDevice.SetMapMode(MAP_PIXEL);
+                            pOtherEditView->Paint(rDevice.PixelToLogic(Rectangle(Point(nScreenX, nScreenY), Size(nScreenW, nScreenH))), &rDevice);
+                            rDevice.SetMapMode(MAP_PIXEL);
+                        }
                     }
-
-                 }
+                }
             }
 
             pViewShell = SfxViewShell::GetNext(*pViewShell);
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index a8b2102..af57d3a 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -1900,7 +1900,7 @@ private:
         {}
         void SetEditView(EditView* pOtherEditView) { mpOtherEditView = pOtherEditView; }
         void SetWindow(ScGridWindow* pWindow) { mpWindow = pWindow; }
-        bool operator() (EditView* pView)
+        bool operator() (const EditView* pView) const
         {
             return ( pView != nullptr
                   && pView->GetWindow() == mpWindow
@@ -1932,7 +1932,7 @@ private:
                     maSameEditViewChecker.SetEditView(mpOtherEditView);
                     for (int i = 0; i < 4; ++i)
                     {
-                        (this->*fHandler)(mpGridWin[i]);
+                        (this->*fHandler)(mpGridWin[i].get());
                     }
                 }
             }


More information about the Libreoffice-commits mailing list