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

Eike Rathke erack at redhat.com
Wed Sep 20 14:59:16 UTC 2017


 sc/source/ui/view/tabview.cxx  |    8 ++++++--
 sc/source/ui/view/tabvwsh3.cxx |   26 +++++++++++++++++---------
 2 files changed, 23 insertions(+), 11 deletions(-)

New commits:
commit ea572a4fc616721b2d77baf6242c48a371fdc489
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Sep 4 18:35:33 2017 +0200

    Resolves: tdf#99477 freeze first col/row always set a freeze
    
    The previous implementation had the odd behavior that Freeze First
    Column and Freeze First Row removed any frozen state (column or row) if
    there was one, instead of freezing the actually selected choice.
    
    Changed to
    * Freeze First Column
      * always freezes the first column
        * removes another column freeze if there was one
        * keeps a row freeze if there is one
        * checks the Freeze Rows and Columns toggle box
    * Freeze First Row
      * always freezes the first row
        * removes another row freeze if there was one
        * keeps a column freeze if there is one
        * checks the Freeze Rows and Columns toggle box
    * Freeze Rows and Columns
      * freezes at the current cell cursor position if there was no freeze
        (toggle box was unchecked)
      * removes any freeze if there was one (toggle box was checked)
    
    Change-Id: I38c4b6f0486ef8e93da0bb3a69a99e5c7709a21e
    Reviewed-on: https://gerrit.libreoffice.org/41908
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index ee238ffa9dac..bd963bc0d438 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -1962,9 +1962,13 @@ void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMetod)
             bool bLeft;
             bool bTop;
             aViewData.GetMouseQuadrant( aSplit, ePos, nPosX, nPosY, bLeft, bTop );
-            if (!bLeft)
+            if (eSplitMetod == SC_SPLIT_METHOD_FIRST_COL)
+                nPosX = 1;
+            else if (!bLeft)
                 ++nPosX;
-            if (!bTop)
+            if (eSplitMetod == SC_SPLIT_METHOD_FIRST_ROW)
+                nPosY = 1;
+            else if (!bTop)
                 ++nPosY;
         }
         else
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index a3c9efdf4259..36dc62070d65 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -945,23 +945,31 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
             break;
 
         case SID_WINDOW_FIX:
-        case SID_WINDOW_FIX_COL:
-        case SID_WINDOW_FIX_ROW:
             {
-                SplitMethod eSplitMethod = SC_SPLIT_METHOD_CURSOR;
-                if (nSlot == SID_WINDOW_FIX_COL)
-                    eSplitMethod = SC_SPLIT_METHOD_FIRST_COL;
-                else if (nSlot == SID_WINDOW_FIX_ROW)
-                    eSplitMethod = SC_SPLIT_METHOD_FIRST_ROW;
-
                 ScSplitMode eHSplit = GetViewData().GetHSplitMode();
                 ScSplitMode eVSplit = GetViewData().GetVSplitMode();
                 if ( eHSplit == SC_SPLIT_FIX || eVSplit == SC_SPLIT_FIX )           // remove
                     RemoveSplit();
                 else
-                    FreezeSplitters( true, eSplitMethod);        // create or fixate
+                    FreezeSplitters( true, SC_SPLIT_METHOD_CURSOR);        // create or fixate
+
                 rReq.Done();
+                InvalidateSplit();
+            }
+            break;
 
+        case SID_WINDOW_FIX_COL:
+            {
+                FreezeSplitters( true, SC_SPLIT_METHOD_FIRST_COL);
+                rReq.Done();
+                InvalidateSplit();
+            }
+            break;
+
+        case SID_WINDOW_FIX_ROW:
+            {
+                FreezeSplitters( true, SC_SPLIT_METHOD_FIRST_ROW);
+                rReq.Done();
                 InvalidateSplit();
             }
             break;


More information about the Libreoffice-commits mailing list