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

Marco Cecchetti marco.cecchetti at collabora.com
Sun Oct 9 20:55:46 UTC 2016


 sc/source/ui/view/gridwin4.cxx |  140 ++++++++++++++++++++---------------------
 sc/source/ui/view/viewdata.cxx |    4 +
 2 files changed, 74 insertions(+), 70 deletions(-)

New commits:
commit 68dbf69cdbd822d4ce3bb1fc116b24db7ad5f6ff
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Sun Oct 9 22:06:40 2016 +0200

    LOK: Calc: an edit view may be not displayed when a 2nd one is killed
    
    - description: when in view #1 text editing of a cell is over (edit
    view killed) a cell still text edited in view #2 can stop to be
    painted correctly;
    
    - reason: when an edit view is killed an
    ScTabViewShell::UpdateFormulas is broadcasted to all views which in
    turn ends by invoking ScViewData::SetEditEngine for already existent
    edit views: if the needed output area size for the actual text content
    is less then the actual output area size (once grown, output area is
    never shrunk) leads to this issue;
    
    - solution: skip to invoke ScViewData::SetEditEngine when LOK is
    active and the related view is not the current view.
    
    Change-Id: I2a97966c7c04701f0a5443aaaeb74760b622045d
    Reviewed-on: https://gerrit.libreoffice.org/29627
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
    Tested-by: Marco Cecchetti <mrcekets at gmail.com>

diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 0bf45ea..f61b5d7 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -943,6 +943,10 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
                                 ScEditEngineDefaulter* pNewEngine,
                                 vcl::Window* pWin, SCCOL nNewX, SCROW nNewY )
 {
+    if (comphelper::LibreOfficeKit::isActive()
+        && GetViewShell() != SfxViewShell::Current())
+        return;
+
     bool bLayoutRTL = pDoc->IsLayoutRTL( nTabNo );
     ScHSplitPos eHWhich = WhichH(eWhich);
 
commit 0502385b00d49588044abd638bb66c8326b06b87
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Sun Oct 9 21:58:40 2016 +0200

    LOK: Calc: if text of 2 cells overlaps, painting occurs in wrong order
    
    - description: when text content of two near cells (edited in 2
    different views) overlaps, the input content showed is the one entered
    in the other view;
    
    - reason: the edit view of other views was painted after the edit view
    owned by the current view;
    
    Change-Id: I7c47f63bc46f7ce43fc494f018167918d44314b6
    Reviewed-on: https://gerrit.libreoffice.org/29626
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
    Tested-by: Marco Cecchetti <mrcekets at gmail.com>

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 800cc9e..bc35620 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -902,76 +902,6 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
         }
     }
 
-    // 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()) )
-    {
-        // 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();
-        SCROW nRow2 = pViewData->GetEditEndRow();
-        rDevice.SetLineColor();
-        rDevice.SetFillColor(pEditView->GetBackgroundColor());
-        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;
-        aEnd.Y() -= 2;
-
-        // toggle the cursor off if its on to ensure the cursor invert
-        // background logic remains valid after the background is cleared on
-        // the next cursor flash
-        vcl::Cursor* pCrsr = pEditView->GetCursor();
-        const bool bVisCursor = pCrsr && pCrsr->IsVisible();
-        if (bVisCursor)
-            pCrsr->Hide();
-
-        // set the correct mapmode
-        Rectangle aBackground(aStart, aEnd);
-        if (bIsTiledRendering)
-        {
-            // Need to draw the background in absolute coords.
-            auto aOrigin = aOriginalMode.GetOrigin();
-            aOrigin.setX(aOrigin.getX() / TWIPS_PER_PIXEL + nScrX);
-            aOrigin.setY(aOrigin.getY() / TWIPS_PER_PIXEL + nScrY);
-            aBackground += aOrigin;
-            rDevice.SetMapMode(aDrawMode);
-        }
-        else
-            rDevice.SetMapMode(pViewData->GetLogicMode());
-
-        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);
-        }
-
-        // paint the background
-        rDevice.DrawRect(rDevice.PixelToLogic(aBackground));
-
-        // paint the editeng text
-        Rectangle aEditRect(Point(nScrX, nScrY), Size(aOutputData.GetScrW(), aOutputData.GetScrH()));
-        pEditView->Paint(rDevice.PixelToLogic(aEditRect), &rDevice);
-        rDevice.SetMapMode(MAP_PIXEL);
-
-        // restore the cursor it was originally visible
-        if (bVisCursor)
-            pCrsr->Show();
-    }
-
     // paint in-place editing on other views
     if (bIsTiledRendering)
     {
@@ -1047,6 +977,76 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
 
     }
 
+    // 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()) )
+    {
+        // 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();
+        SCROW nRow2 = pViewData->GetEditEndRow();
+        rDevice.SetLineColor();
+        rDevice.SetFillColor(pEditView->GetBackgroundColor());
+        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;
+        aEnd.Y() -= 2;
+
+        // toggle the cursor off if its on to ensure the cursor invert
+        // background logic remains valid after the background is cleared on
+        // the next cursor flash
+        vcl::Cursor* pCrsr = pEditView->GetCursor();
+        const bool bVisCursor = pCrsr && pCrsr->IsVisible();
+        if (bVisCursor)
+            pCrsr->Hide();
+
+        // set the correct mapmode
+        Rectangle aBackground(aStart, aEnd);
+        if (bIsTiledRendering)
+        {
+            // Need to draw the background in absolute coords.
+            auto aOrigin = aOriginalMode.GetOrigin();
+            aOrigin.setX(aOrigin.getX() / TWIPS_PER_PIXEL + nScrX);
+            aOrigin.setY(aOrigin.getY() / TWIPS_PER_PIXEL + nScrY);
+            aBackground += aOrigin;
+            rDevice.SetMapMode(aDrawMode);
+        }
+        else
+            rDevice.SetMapMode(pViewData->GetLogicMode());
+
+        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);
+        }
+
+        // paint the background
+        rDevice.DrawRect(rDevice.PixelToLogic(aBackground));
+
+        // paint the editeng text
+        Rectangle aEditRect(Point(nScrX, nScrY), Size(aOutputData.GetScrW(), aOutputData.GetScrH()));
+        pEditView->Paint(rDevice.PixelToLogic(aEditRect), &rDevice);
+        rDevice.SetMapMode(MAP_PIXEL);
+
+        // restore the cursor it was originally visible
+        if (bVisCursor)
+            pCrsr->Show();
+    }
+
     if (pViewData->HasEditView(eWhich))
     {
         // flush OverlayManager before changing the MapMode


More information about the Libreoffice-commits mailing list