[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - desktop/source officecfg/registry sc/inc sc/sdi sc/source sc/uiconfig sfx2/source

Dennis Francis (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 24 13:22:09 UTC 2020


 desktop/source/lib/init.cxx                                       |    4 
 officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu |    4 
 sc/inc/document.hxx                                               |    5 
 sc/inc/table.hxx                                                  |    7 
 sc/sdi/scalc.sdi                                                  |    8 
 sc/sdi/tabvwsh.sdi                                                |    4 
 sc/source/core/data/document10.cxx                                |   35 +
 sc/source/core/data/table1.cxx                                    |    1 
 sc/source/core/data/table7.cxx                                    |   45 +
 sc/source/ui/inc/tabview.hxx                                      |    4 
 sc/source/ui/inc/viewdata.hxx                                     |   18 
 sc/source/ui/view/tabview.cxx                                     |   31 -
 sc/source/ui/view/tabvwsh3.cxx                                    |   47 +
 sc/source/ui/view/tabvwsha.cxx                                    |    9 
 sc/source/ui/view/viewdata.cxx                                    |  289 ++++++++--
 sc/uiconfig/scalc/menubar/menubar.xml                             |    4 
 sc/uiconfig/scalc/popupmenu/column_operations.xml                 |    2 
 sc/uiconfig/scalc/popupmenu/freezepanes.xml                       |    4 
 sc/uiconfig/scalc/popupmenu/row_operations.xml                    |    2 
 sc/uiconfig/scalc/ui/notebookbar.ui                               |    8 
 sfx2/source/control/unoctitm.cxx                                  |    4 
 21 files changed, 441 insertions(+), 94 deletions(-)

New commits:
commit 15856609795c57861dc950b93250fab953c3cb92
Author:     Dennis Francis <dennis.francis at collabora.com>
AuthorDate: Wed Jul 15 15:55:45 2020 +0530
Commit:     Dennis Francis <dennis.francis at collabora.com>
CommitDate: Fri Jul 24 15:21:31 2020 +0200

    lok-freezepanes: Generalize FreezePanes* uno-commands...
    
    to allow an integer parameter as the row/column index of the freeze and
    use them to set/get freeze indices (row/column) from the lok clients.
    The behaviour of the exisiting freeze/split-panes controls in desktop
    Calc is not affected, but new menu/notebookbar options can be added for
    freezing on a specific row/column in a follow-up commit.
    
    For now, the freeze-panes are shared between all views for each tab of
    the spreadsheet. "Private" freeze-panes support can also be added
    without much difficulty (for this we need another uno command for the
    private/shared flag, but that can be in a separate commit).
    
    Notes regarding compatibility:
    
    Since Online-Calc has support only for the freeze-panes functionality
    presently, any pre-exisiting 'real splits' in the spreadsheet (created
    using the native-desktop Calc or alternatives) are converted to
    equivalent 'freezes' on import, but on export, such 'freezes' are
    re-converted and written as 'real splits'. In case the spreadsheet has
    'freezes' on import, they are used/exported as such. In short, the type
    of sheet-window splits in the document is preserved.
    
    Change-Id: Ia990616f5cedfb2b5db820770c17ec7e209f0e48
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99352
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Dennis Francis <dennis.francis at collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index e97a4039118e..c010fcbfb2c7 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2767,7 +2767,9 @@ static void doc_iniUnoCommands ()
         OUString(".uno:ParaspaceDecrease"),
         OUString(".uno:AcceptTrackedChange"),
         OUString(".uno:RejectTrackedChange"),
-        OUString(".uno:ShowResolvedAnnotations")
+        OUString(".uno:ShowResolvedAnnotations"),
+        OUString(".uno:FreezePanesColumn"),
+        OUString(".uno:FreezePanesRow")
     };
 
     util::URL aCommandURL;
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index 099c1f249d21..ecef92cf83fa 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -99,7 +99,7 @@
           <value>1</value>
         </prop>
       </node>
-      <node oor:name=".uno:FreezePanesFirstColumn" oor:op="replace">
+      <node oor:name=".uno:FreezePanesColumn" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">Freeze First Column</value>
         </prop>
@@ -107,7 +107,7 @@
           <value>1</value>
         </prop>
       </node>
-      <node oor:name=".uno:FreezePanesFirstRow" oor:op="replace">
+      <node oor:name=".uno:FreezePanesRow" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">Freeze First Row</value>
         </prop>
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index d1df7f299660..6e5ba824d938 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2522,6 +2522,11 @@ public:
      */
     OString dumpSheetGeomData(SCTAB nTab, bool bColumns, SheetGeomType eGeomType);
 
+    SCCOL GetLOKFreezeCol(SCTAB nTab) const;
+    SCROW GetLOKFreezeRow(SCTAB nTab) const;
+    bool  SetLOKFreezeCol(SCCOL nFreezeCol, SCTAB nTab);
+    bool  SetLOKFreezeRow(SCROW nFreezeRow, SCTAB nTab);
+
 private:
 
     /**
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index d744ec5df174..93003911f8ae 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -224,6 +224,8 @@ private:
 
     std::unique_ptr<ScConditionalFormatList> mpCondFormatList;
 
+    ScAddress       maLOKFreezeCell;
+
     bool            bScenario:1;
     bool            bLayoutRTL:1;
     bool            bLoadingRTL:1;
@@ -1254,6 +1256,11 @@ private:
     /// Returns list-of-spans representation of the column/row groupings encoded as an OString.
     OString dumpColumnRowGroups(bool bColumns) const;
 
+    SCCOL GetLOKFreezeCol() const;
+    SCROW GetLOKFreezeRow() const;
+    bool  SetLOKFreezeCol(SCCOL nFreezeCol);
+    bool  SetLOKFreezeRow(SCROW nFreezeRow);
+
     /**
      * Use this to iterate through non-empty visible cells in a single column.
      */
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index b3b1d3258492..93a6b67be6e5 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -1911,8 +1911,8 @@ SfxVoidItem FreezePanes SID_WINDOW_FIX
     GroupId = SfxGroupId::View;
 ]
 
-SfxVoidItem FreezePanesFirstColumn SID_WINDOW_FIX_COL
-()
+SfxInt32Item FreezePanesColumn SID_WINDOW_FIX_COL
+
 [
     AutoUpdate = FALSE,
     FastCall = FALSE,
@@ -1928,8 +1928,8 @@ SfxVoidItem FreezePanesFirstColumn SID_WINDOW_FIX_COL
     GroupId = SfxGroupId::View;
 ]
 
-SfxVoidItem FreezePanesFirstRow SID_WINDOW_FIX_ROW
-()
+SfxInt32Item FreezePanesRow SID_WINDOW_FIX_ROW
+
 [
     AutoUpdate = FALSE,
     FastCall = FALSE,
diff --git a/sc/sdi/tabvwsh.sdi b/sc/sdi/tabvwsh.sdi
index 965e8656d34d..d122321c856b 100644
--- a/sc/sdi/tabvwsh.sdi
+++ b/sc/sdi/tabvwsh.sdi
@@ -144,8 +144,8 @@ interface TableEditView
         SID_CURRENTDOC      [ ExecMethod = Execute; StateMethod = GetState; ]
     SID_WINDOW_SPLIT    [ ExecMethod = Execute; StateMethod = GetState; ]
     SID_WINDOW_FIX      [ ExecMethod = Execute; StateMethod = GetState; ]
-    SID_WINDOW_FIX_ROW  [ ExecMethod = Execute; ]
-    SID_WINDOW_FIX_COL  [ ExecMethod = Execute; ]
+    SID_WINDOW_FIX_ROW  [ ExecMethod = Execute; StateMethod = GetState; ]
+    SID_WINDOW_FIX_COL  [ ExecMethod = Execute; StateMethod = GetState; ]
     SID_SAVEDOC
     [
         ExecMethod = ExecuteSave ;
diff --git a/sc/source/core/data/document10.cxx b/sc/source/core/data/document10.cxx
index ae87f2e75b39..f0b1523690aa 100644
--- a/sc/source/core/data/document10.cxx
+++ b/sc/source/core/data/document10.cxx
@@ -977,4 +977,39 @@ OString ScDocument::dumpSheetGeomData(SCTAB nTab, bool bColumns, SheetGeomType e
     return pTab->dumpSheetGeomData(bColumns, eGeomType);
 }
 
+SCCOL ScDocument::GetLOKFreezeCol(SCTAB nTab) const
+{
+    const ScTable* pTab = FetchTable(nTab);
+    if (!pTab)
+        return -1;
+
+    return pTab->GetLOKFreezeCol();
+}
+SCROW ScDocument::GetLOKFreezeRow(SCTAB nTab) const
+{
+    const ScTable* pTab = FetchTable(nTab);
+    if (!pTab)
+        return -1;
+
+    return pTab->GetLOKFreezeRow();
+}
+
+bool ScDocument::SetLOKFreezeCol(SCCOL nFreezeCol, SCTAB nTab)
+{
+    ScTable* pTab = FetchTable(nTab);
+    if (!pTab)
+        return false;
+
+    return pTab->SetLOKFreezeCol(nFreezeCol);
+}
+
+bool ScDocument::SetLOKFreezeRow(SCROW nFreezeRow, SCTAB nTab)
+{
+    ScTable* pTab = FetchTable(nTab);
+    if (!pTab)
+        return false;
+
+    return pTab->SetLOKFreezeRow(nFreezeRow);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 6f1ff72b3654..98f2cd8b0fd7 100755
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -255,6 +255,7 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const OUString& rNewName,
     aTabBgColor( COL_AUTO ),
     nScenarioFlags(ScScenarioFlags::NONE),
     mpCondFormatList( new ScConditionalFormatList() ),
+    maLOKFreezeCell(-1, -1, nNewTab),
     bScenario(false),
     bLayoutRTL(false),
     bLoadingRTL(false),
diff --git a/sc/source/core/data/table7.cxx b/sc/source/core/data/table7.cxx
index 0a792102feec..89cffbbf5e59 100644
--- a/sc/source/core/data/table7.cxx
+++ b/sc/source/core/data/table7.cxx
@@ -20,6 +20,7 @@
 #include <drwlayer.hxx>
 #include <compressedarray.hxx>
 
+#include <sal/log.hxx>
 #include <tools/stream.hxx>
 
 bool ScTable::IsMerged( SCCOL nCol, SCROW nRow ) const
@@ -583,4 +584,48 @@ OString ScTable::dumpColumnRowGroups(bool bColumns) const
     return pOutlineTable->GetRowArray().dumpAsString();
 }
 
+SCCOL ScTable::GetLOKFreezeCol() const
+{
+    return maLOKFreezeCell.Col();
+}
+
+SCROW ScTable::GetLOKFreezeRow() const
+{
+    return maLOKFreezeCell.Row();
+}
+
+bool ScTable::SetLOKFreezeCol(SCCOL nFreezeCol)
+{
+    if (!ValidCol(nFreezeCol))
+    {
+        SAL_WARN("sc.core", "ScTable::SetLOKFreezeCol : invalid nFreezeCol = " << nFreezeCol);
+        return false;
+    }
+
+    if (maLOKFreezeCell.Col() != nFreezeCol)
+    {
+        maLOKFreezeCell.SetCol(nFreezeCol);
+        return true;
+    }
+
+    return false;
+}
+
+bool ScTable::SetLOKFreezeRow(SCROW nFreezeRow)
+{
+    if (!ValidRow(nFreezeRow))
+    {
+        SAL_WARN("sc.core", "ScTable::SetLOKFreezeRow : invalid nFreezeRow = " << nFreezeRow);
+        return false;
+    }
+
+    if (maLOKFreezeCell.Row() != nFreezeRow)
+    {
+        maLOKFreezeCell.SetRow(nFreezeRow);
+        return true;
+    }
+
+    return false;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index da1663cab83b..8d75d5137b92 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -288,7 +288,7 @@ public:
                     ScTabView( vcl::Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell );
                     ~ScTabView();
 
-    enum SplitMethod { SC_SPLIT_METHOD_FIRST_COL, SC_SPLIT_METHOD_FIRST_ROW, SC_SPLIT_METHOD_CURSOR };
+    enum SplitMethod { SC_SPLIT_METHOD_COL, SC_SPLIT_METHOD_ROW, SC_SPLIT_METHOD_CURSOR };
 
     void            MakeDrawLayer();
 
@@ -578,7 +578,7 @@ public:
 
     Point           GetMousePosPixel();
 
-    void            FreezeSplitters( bool bFreeze, SplitMethod eSplitMethod = SC_SPLIT_METHOD_CURSOR );
+    void            FreezeSplitters( bool bFreeze, SplitMethod eSplitMethod = SC_SPLIT_METHOD_CURSOR, SCCOLROW nFreezeIndex = -1 );
     void            RemoveSplit();
     void            SplitAtCursor();
     void            SplitAtPixel( const Point& rPixel );
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index b35724e4097e..58e8c1701d0e 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -250,7 +250,7 @@ private:
     void            InitData(ScDocument *pDoc);
     void            WriteUserDataSequence(
                         css::uno::Sequence <css::beans::PropertyValue>& rSettings,
-                        const ScViewData& rViewData ) const;
+                        const ScViewData& rViewData, SCTAB nTab ) const;
 
     void            ReadUserDataSequence(
                         const css::uno::Sequence <css::beans::PropertyValue>& rSettings,
@@ -396,8 +396,8 @@ public:
     SCCOL           MaxCol() const                          { return pDoc->MaxCol(); }
     SCROW           MaxRow() const                          { return pDoc->MaxRow(); }
     ScSplitPos      GetActivePart() const                   { return pThisTab->eWhichActive; }
-    SCCOL           GetPosX( ScHSplitPos eWhich ) const;
-    SCROW           GetPosY( ScVSplitPos eWhich ) const;
+    SCCOL           GetPosX( ScHSplitPos eWhich, SCTAB nForTab = -1 ) const;
+    SCROW           GetPosY( ScVSplitPos eWhich, SCTAB nForTab = -1 ) const;
     SCCOL           GetCurX() const                         { return pThisTab->nCurX; }
     SCROW           GetCurY() const                         { return pThisTab->nCurY; }
     SCCOL           GetCurXForTab( SCTAB nTabIndex ) const;
@@ -506,7 +506,7 @@ public:
     bool            GetMergeSizePrintTwips( SCCOL nX, SCROW nY, long& rSizeXTwips, long& rSizeYTwips ) const;
     void            GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
                                         SCCOL& rPosX, SCROW& rPosY,
-                                        bool bTestMerge = true, bool bRepair = false );
+                                        bool bTestMerge = true, bool bRepair = false, SCTAB nForTab = -1 );
     void            GetMouseQuadrant( const Point& rClickPos, ScSplitPos eWhich,
                                         SCCOL nPosX, SCROW nPosY, bool& rLeft, bool& rTop );
 
@@ -601,7 +601,7 @@ public:
     void            SetActivePart( ScSplitPos eNewActive );
 
     Point           GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
-                                bool bAllowNeg = false ) const;
+                                bool bAllowNeg = false, SCTAB nForTab = -1 ) const;
     Point           GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScHSplitPos eWhich ) const;
     Point           GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScVSplitPos eWhich ) const;
     /// returns the position (top-left corner) of the requested cell in print twips coordinates.
@@ -654,6 +654,14 @@ public:
 
     bool            IsSelCtrlMouseClick() const { return bSelCtrlMouseClick; }
 
+    SCCOLROW        GetLOKSheetFreezeIndex(bool bIsCol) const;
+    bool            SetLOKSheetFreezeIndex(const SCCOLROW nFreezeIndex, bool bIsCol, SCTAB nForTab = -1);
+    void            DeriveLOKFreezeAllSheets();
+    void            DeriveLOKFreezeIfNeeded(SCTAB nForTab);
+    void            OverrideWithLOKFreeze(ScSplitMode& eExHSplitMode, ScSplitMode& eExVSplitMode,
+                                          SCCOL& nExFixPosX, SCROW& nExFixPosY,
+                                          long& nExHSplitPos, long& nExVSplitPos, SCTAB nForTab) const;
+
     static inline long ToPixel( sal_uInt16 nTwips, double nFactor );
 
     /** while (rScrY <= nEndPixels && rPosY <= nEndRow) add pixels of row
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 3b11b23d7cf0..c1981307563a 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -1906,8 +1906,11 @@ Point ScTabView::GetMousePosPixel()
     return aPos;
 }
 
-void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMetod)
+void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMethod, SCCOLROW nFreezeIndex)
 {
+    if ((eSplitMethod == SC_SPLIT_METHOD_COL || eSplitMethod == SC_SPLIT_METHOD_ROW) && nFreezeIndex < 0)
+        nFreezeIndex = 0;
+
     ScSplitMode eOldH = aViewData.GetHSplitMode();
     ScSplitMode eOldV = aViewData.GetVSplitMode();
 
@@ -1928,10 +1931,10 @@ void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMetod)
         SCROW nPosY = 1;
         if (eOldV != SC_SPLIT_NONE || eOldH != SC_SPLIT_NONE)
         {
-            if ( eOldV != SC_SPLIT_NONE && (eSplitMetod == SC_SPLIT_METHOD_FIRST_ROW || eSplitMetod == SC_SPLIT_METHOD_CURSOR))
+            if ( eOldV != SC_SPLIT_NONE && (eSplitMethod == SC_SPLIT_METHOD_ROW || eSplitMethod == SC_SPLIT_METHOD_CURSOR))
                 aSplit.setY( aViewData.GetVSplitPos() - aWinStart.Y() );
 
-            if ( eOldH != SC_SPLIT_NONE && (eSplitMetod == SC_SPLIT_METHOD_FIRST_COL || eSplitMetod == SC_SPLIT_METHOD_CURSOR))
+            if ( eOldH != SC_SPLIT_NONE && (eSplitMethod == SC_SPLIT_METHOD_COL || eSplitMethod == SC_SPLIT_METHOD_CURSOR))
             {
                 long nSplitPos = aViewData.GetHSplitPos();
                 if ( bLayoutRTL )
@@ -1943,28 +1946,28 @@ void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMetod)
             bool bLeft;
             bool bTop;
             aViewData.GetMouseQuadrant( aSplit, ePos, nPosX, nPosY, bLeft, bTop );
-            if (eSplitMetod == SC_SPLIT_METHOD_FIRST_COL)
-                nPosX = 1;
+            if (eSplitMethod == SC_SPLIT_METHOD_COL)
+                nPosX = static_cast<SCCOL>(nFreezeIndex);
             else if (!bLeft)
                 ++nPosX;
-            if (eSplitMetod == SC_SPLIT_METHOD_FIRST_ROW)
-                nPosY = 1;
+            if (eSplitMethod == SC_SPLIT_METHOD_ROW)
+                nPosY = static_cast<SCROW>(nFreezeIndex);
             else if (!bTop)
                 ++nPosY;
         }
         else
         {
-            switch(eSplitMetod)
+            switch(eSplitMethod)
             {
-                case SC_SPLIT_METHOD_FIRST_ROW:
+                case SC_SPLIT_METHOD_ROW:
                 {
                     nPosX = 0;
-                    nPosY = 1;
+                    nPosY = static_cast<SCROW>(nFreezeIndex);
                 }
                 break;
-                case SC_SPLIT_METHOD_FIRST_COL:
+                case SC_SPLIT_METHOD_COL:
                 {
-                    nPosX = 1;
+                    nPosX = static_cast<SCCOL>(nFreezeIndex);
                     nPosY = 0;
                 }
                 break;
@@ -1982,7 +1985,7 @@ void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMetod)
         SCCOL nLeftPos = aViewData.GetPosX(SC_SPLIT_LEFT);
         SCCOL nRightPos = nPosX;
 
-        if (eSplitMetod == SC_SPLIT_METHOD_FIRST_ROW || eSplitMetod == SC_SPLIT_METHOD_CURSOR)
+        if (eSplitMethod == SC_SPLIT_METHOD_ROW || eSplitMethod == SC_SPLIT_METHOD_CURSOR)
         {
              if (eOldV != SC_SPLIT_NONE)
              {
@@ -2004,7 +2007,7 @@ void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMetod)
                  aViewData.SetVSplitMode( SC_SPLIT_NONE );
         }
 
-        if (eSplitMetod == SC_SPLIT_METHOD_FIRST_COL || eSplitMetod == SC_SPLIT_METHOD_CURSOR)
+        if (eSplitMethod == SC_SPLIT_METHOD_COL || eSplitMethod == SC_SPLIT_METHOD_CURSOR)
         {
             if (eOldH != SC_SPLIT_NONE)
             {
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 419c6bce7845..2f637eeca969 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -50,7 +50,9 @@
 
 #include <svx/zoomslideritem.hxx>
 #include <svx/svxdlg.hxx>
+#include <comphelper/lok.hxx>
 #include <comphelper/string.hxx>
+#include <sfx2/lokhelper.hxx>
 #include <scabstdlg.hxx>
 
 namespace
@@ -940,18 +942,43 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
             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();
+                bool bIsCol = (nSlot == SID_WINDOW_FIX_COL);
+                sal_Int32 nFreezeIndex = 1;
+                if (const SfxInt32Item* pItem = rReq.GetArg<SfxInt32Item>(nSlot))
+                {
+                    nFreezeIndex = pItem->GetValue();
+                    if (nFreezeIndex < 0)
+                        nFreezeIndex = 0;
+                }
+
+                if (comphelper::LibreOfficeKit::isActive())
+                {
+                    ScViewData& rViewData = GetViewData();
+                    SCTAB nThisTab = rViewData.GetTabNo();
+                    bool bChanged = rViewData.SetLOKSheetFreezeIndex(nFreezeIndex, bIsCol);
+                    rReq.Done();
+                    if (bChanged)
+                    {
+                        rBindings.Invalidate(nSlot);
+                        // Invalidate the slot for all views on the same tab of the document.
+                        SfxLokHelper::forEachOtherView(this, [nSlot, nThisTab](ScTabViewShell* pOther) {
+                            ScViewData& rOtherViewData = pOther->GetViewData();
+                            if (rOtherViewData.GetTabNo() != nThisTab)
+                                return;
+
+                            SfxBindings& rOtherBind = rOtherViewData.GetBindings();
+                            rOtherBind.Invalidate(nSlot);
+                        });
+                    }
+                }
+                else
+                {
+                    FreezeSplitters( true, bIsCol ? SC_SPLIT_METHOD_COL : SC_SPLIT_METHOD_ROW, nFreezeIndex);
+                    rReq.Done();
+                    InvalidateSplit();
+                }
             }
             break;
 
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 76b7e288c803..538897613053 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -417,6 +417,15 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
                             rViewData.GetVSplitMode() == SC_SPLIT_FIX ));
                 break;
 
+            case SID_WINDOW_FIX_COL:
+            case SID_WINDOW_FIX_ROW:
+                {
+                    bool bIsCol = (nWhich == SID_WINDOW_FIX_COL);
+                    sal_Int32 nFreezeIndex = rViewData.GetLOKSheetFreezeIndex(bIsCol);
+                    rSet.Put(SfxInt32Item(nWhich, nFreezeIndex));
+                }
+                break;
+
             case FID_CHG_SHOW:
                 {
                     if ( pDoc->GetChangeTrack() == nullptr || ( pDocShell && pDocShell->IsDocShared() ) )
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 6632e51ee918..8fd1d557c441 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -520,29 +520,43 @@ void ScViewDataTable::InitData(ScDocument *pDoc)
     aHeightHelper.setDocument(pDoc, false);
 }
 
-void ScViewDataTable::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>& rSettings, const ScViewData& rViewData) const
+void ScViewDataTable::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>& rSettings, const ScViewData& rViewData, SCTAB nTab) const
 {
     rSettings.realloc(SC_TABLE_VIEWSETTINGS_COUNT);
     beans::PropertyValue* pSettings = rSettings.getArray();
 
+    ScSplitMode eExHSplitMode = eHSplitMode;
+    ScSplitMode eExVSplitMode = eVSplitMode;
+    SCCOL nExFixPosX = nFixPosX;
+    SCROW nExFixPosY = nFixPosY;
+    long nExHSplitPos = nHSplitPos;
+    long nExVSplitPos = nVSplitPos;
+
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        rViewData.OverrideWithLOKFreeze(eExHSplitMode, eExVSplitMode,
+                                        nExFixPosX, nExFixPosY,
+                                        nExHSplitPos, nExVSplitPos, nTab);
+    }
+
     pSettings[SC_CURSOR_X].Name = SC_CURSORPOSITIONX;
     pSettings[SC_CURSOR_X].Value <<= sal_Int32(nCurX);
     pSettings[SC_CURSOR_Y].Name = SC_CURSORPOSITIONY;
     pSettings[SC_CURSOR_Y].Value <<= sal_Int32(nCurY);
     pSettings[SC_HORIZONTAL_SPLIT_MODE].Name = SC_HORIZONTALSPLITMODE;
-    pSettings[SC_HORIZONTAL_SPLIT_MODE].Value <<= sal_Int16(eHSplitMode);
+    pSettings[SC_HORIZONTAL_SPLIT_MODE].Value <<= sal_Int16(eExHSplitMode);
     pSettings[SC_VERTICAL_SPLIT_MODE].Name = SC_VERTICALSPLITMODE;
-    pSettings[SC_VERTICAL_SPLIT_MODE].Value <<= sal_Int16(eVSplitMode);
+    pSettings[SC_VERTICAL_SPLIT_MODE].Value <<= sal_Int16(eExVSplitMode);
     pSettings[SC_HORIZONTAL_SPLIT_POSITION].Name = SC_HORIZONTALSPLITPOSITION;
-    if (eHSplitMode == SC_SPLIT_FIX)
-        pSettings[SC_HORIZONTAL_SPLIT_POSITION].Value <<= sal_Int32(nFixPosX);
+    if (eExHSplitMode == SC_SPLIT_FIX)
+        pSettings[SC_HORIZONTAL_SPLIT_POSITION].Value <<= sal_Int32(nExFixPosX);
     else
-        pSettings[SC_HORIZONTAL_SPLIT_POSITION].Value <<= sal_Int32(nHSplitPos);
+        pSettings[SC_HORIZONTAL_SPLIT_POSITION].Value <<= sal_Int32(nExHSplitPos);
     pSettings[SC_VERTICAL_SPLIT_POSITION].Name = SC_VERTICALSPLITPOSITION;
-    if (eVSplitMode == SC_SPLIT_FIX)
-        pSettings[SC_VERTICAL_SPLIT_POSITION].Value <<= sal_Int32(nFixPosY);
+    if (eExVSplitMode == SC_SPLIT_FIX)
+        pSettings[SC_VERTICAL_SPLIT_POSITION].Value <<= sal_Int32(nExFixPosY);
     else
-        pSettings[SC_VERTICAL_SPLIT_POSITION].Value <<= sal_Int32(nVSplitPos);
+        pSettings[SC_VERTICAL_SPLIT_POSITION].Value <<= sal_Int32(nExVSplitPos);
     // Prevent writing odd settings that would make crash versions that
     // don't apply SanitizeWhichActive() when reading the settings.
     // See tdf#117093
@@ -1325,14 +1339,32 @@ void ScViewData::ResetOldCursor()
     pThisTab->mbOldCursorValid = false;
 }
 
-SCCOL ScViewData::GetPosX( ScHSplitPos eWhich ) const
+SCCOL ScViewData::GetPosX( ScHSplitPos eWhich, SCTAB nForTab ) const
 {
-    return comphelper::LibreOfficeKit::isActive() ? 0 : pThisTab->nPosX[eWhich];
+    if (comphelper::LibreOfficeKit::isActive())
+        return 0;
+
+    if (nForTab == -1)
+        return pThisTab->nPosX[eWhich];
+
+    if (!ValidTab(nForTab) || (nForTab >= static_cast<SCTAB>(maTabData.size())))
+        return -1;
+
+    return maTabData[nForTab]->nPosX[eWhich];
 }
 
-SCROW ScViewData::GetPosY( ScVSplitPos eWhich ) const
+SCROW ScViewData::GetPosY( ScVSplitPos eWhich, SCTAB nForTab ) const
 {
-    return comphelper::LibreOfficeKit::isActive() ? 0 : pThisTab->nPosY[eWhich];
+    if (comphelper::LibreOfficeKit::isActive())
+        return 0;
+
+    if (nForTab == -1)
+        return pThisTab->nPosY[eWhich];
+
+    if (!ValidTab(nForTab) || (nForTab >= static_cast<SCTAB>(maTabData.size())))
+        return -1;
+
+    return maTabData[nForTab]->nPosY[eWhich];
 }
 
 SCCOL ScViewData::GetCurXForTab( SCTAB nTabIndex ) const
@@ -2283,7 +2315,7 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScVSplitPos eWhich )
 }
 
 Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
-                                bool bAllowNeg ) const
+                                bool bAllowNeg, SCTAB nForTab ) const
 {
     ScHSplitPos eWhichX = SC_SPLIT_LEFT;
     ScVSplitPos eWhichY = SC_SPLIT_BOTTOM;
@@ -2307,6 +2339,18 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
             break;
     }
 
+    if (nForTab == -1)
+        nForTab = nTabNo;
+    bool bForCurTab = (nForTab == nTabNo);
+    if (!bForCurTab && (!ValidTab(nForTab) || (nForTab >= static_cast<SCTAB>(maTabData.size()))))
+    {
+        SAL_WARN("sc.viewdata", "ScViewData::GetScrPos :  invalid nForTab = " << nForTab);
+        nForTab = nTabNo;
+        bForCurTab = true;
+    }
+
+    ScViewDataTable* pViewTable = bForCurTab ? pThisTab : maTabData[nForTab].get();
+
     if (pView)
     {
         const_cast<ScViewData*>(this)->aScrSize.setWidth( pView->GetGridWidth(eWhichX) );
@@ -2317,7 +2361,7 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
     bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive();
 
 
-    SCCOL nPosX = GetPosX(eWhichX);
+    SCCOL nPosX = GetPosX(eWhichX, nForTab);
     long nScrPosX = 0;
 
     if (bAllowNeg || nWhereX >= nPosX)
@@ -2326,7 +2370,7 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
         if (bIsTiledRendering)
         {
             OSL_ENSURE(nPosX == 0, "Unsupported case.");
-            const auto& rNearest = pThisTab->aWidthHelper.getNearestByIndex(nWhereX - 1);
+            const auto& rNearest = pViewTable->aWidthHelper.getNearestByIndex(nWhereX - 1);
             nStartPosX = rNearest.first + 1;
             nScrPosX = rNearest.second;
         }
@@ -2339,7 +2383,7 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
                     nScrPosX = 0x7FFFFFFF;
                 else
                 {
-                    nTSize = pDoc->GetColWidth( nX, nTabNo );
+                    nTSize = pDoc->GetColWidth( nX, nForTab );
                     if (nTSize)
                     {
                         long nSizeXPix = ToPixel( nTSize, nPPTX );
@@ -2353,7 +2397,7 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
             for (SCCOL nX = nStartPosX; nX > nWhereX;)
             {
                 --nX;
-                nTSize = pDoc->GetColWidth( nX, nTabNo );
+                nTSize = pDoc->GetColWidth( nX, nForTab );
                 if (nTSize)
                 {
                     long nSizeXPix = ToPixel( nTSize, nPPTX );
@@ -2365,7 +2409,7 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
     }
 
 
-    SCROW nPosY = GetPosY(eWhichY);
+    SCROW nPosY = GetPosY(eWhichY, nForTab);
     long nScrPosY = 0;
 
     if (bAllowNeg || nWhereY >= nPosY)
@@ -2374,7 +2418,7 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
         if (bIsTiledRendering)
         {
             OSL_ENSURE(nPosY == 0, "Unsupported case.");
-            const auto& rNearest = pThisTab->aHeightHelper.getNearestByIndex(nWhereY - 1);
+            const auto& rNearest = pViewTable->aHeightHelper.getNearestByIndex(nWhereY - 1);
             nStartPosY = rNearest.first + 1;
             nScrPosY = rNearest.second;
         }
@@ -2387,13 +2431,13 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
                     nScrPosY = 0x7FFFFFFF;
                 else if (bAllowNeg || bIsTiledRendering)
                 {
-                    sal_uLong nSizeYPix = pDoc->GetScaledRowHeight( nStartPosY, nWhereY-1, nTabNo, nPPTY );
+                    sal_uLong nSizeYPix = pDoc->GetScaledRowHeight( nStartPosY, nWhereY-1, nForTab, nPPTY );
                     nScrPosY += nSizeYPix;
                 }
                 else
                 {
                     sal_uLong nMaxHeight = aScrSize.getHeight() - nScrPosY;
-                    sal_uLong nSizeYPix = pDoc->GetScaledRowHeight( nStartPosY, nWhereY-1, nTabNo, nPPTY, &nMaxHeight );
+                    sal_uLong nSizeYPix = pDoc->GetScaledRowHeight( nStartPosY, nWhereY-1, nForTab, nPPTY, &nMaxHeight );
                     nScrPosY += nSizeYPix;
                 }
             }
@@ -2403,7 +2447,7 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
             for (SCROW nY = nStartPosY; nY > nWhereY;)
             {
                 --nY;
-                nTSize = pDoc->GetRowHeight( nY, nTabNo );
+                nTSize = pDoc->GetRowHeight( nY, nForTab );
                 if (nTSize)
                 {
                     long nSizeYPix = ToPixel( nTSize, nPPTY );
@@ -2413,7 +2457,7 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
         }
     }
 
-    if ( pDoc->IsLayoutRTL( nTabNo ) )
+    if ( pDoc->IsLayoutRTL( nForTab ) )
     {
         //  mirror horizontal position
         nScrPosX = aScrSize.Width() - 1 - nScrPosX;
@@ -2653,14 +2697,24 @@ bool ScViewData::GetMergeSizePrintTwips(SCCOL nX, SCROW nY, long& rSizeXTwips, l
 
 void ScViewData::GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
                                         SCCOL& rPosX, SCROW& rPosY,
-                                        bool bTestMerge, bool bRepair )
+                                        bool bTestMerge, bool bRepair, SCTAB nForTab )
 {
     //  special handling of 0 is now in ScViewFunctionSet::SetCursorAtPoint
 
+    if (nForTab == -1)
+        nForTab = nTabNo;
+    bool bForCurTab = (nForTab == nTabNo);
+    if (!bForCurTab && (!ValidTab(nForTab) || (nForTab >= static_cast<SCTAB>(maTabData.size()))))
+    {
+        SAL_WARN("sc.viewdata", "ScViewData::GetPosFromPixel :  invalid nForTab = " << nForTab);
+        nForTab = nTabNo;
+        bForCurTab = true;
+    }
+
     ScHSplitPos eHWhich = WhichH(eWhich);
     ScVSplitPos eVWhich = WhichV(eWhich);
 
-    if ( pDoc->IsLayoutRTL( nTabNo ) )
+    if ( pDoc->IsLayoutRTL( nForTab ) )
     {
         //  mirror horizontal position
         if (pView)
@@ -2668,8 +2722,8 @@ void ScViewData::GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
         nClickX = aScrSize.Width() - 1 - nClickX;
     }
 
-    SCCOL nStartPosX = GetPosX(eHWhich);
-    SCROW nStartPosY = GetPosY(eVWhich);
+    SCCOL nStartPosX = GetPosX(eHWhich, nForTab);
+    SCROW nStartPosY = GetPosY(eVWhich, nForTab);
     rPosX = nStartPosX;
     rPosY = nStartPosY;
     long nScrX = 0;
@@ -2679,7 +2733,7 @@ void ScViewData::GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
     {
         while ( rPosX<=pDoc->MaxCol() && nClickX >= nScrX )
         {
-            nScrX += ToPixel( pDoc->GetColWidth( rPosX, nTabNo ), nPPTX );
+            nScrX += ToPixel( pDoc->GetColWidth( rPosX, nForTab ), nPPTX );
             ++rPosX;
         }
         --rPosX;
@@ -2689,19 +2743,19 @@ void ScViewData::GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
         while ( rPosX>0 && nClickX < nScrX )
         {
             --rPosX;
-            nScrX -= ToPixel( pDoc->GetColWidth( rPosX, nTabNo ), nPPTX );
+            nScrX -= ToPixel( pDoc->GetColWidth( rPosX, nForTab ), nPPTX );
         }
     }
 
     if (nClickY > 0)
-        AddPixelsWhile( nScrY, nClickY, rPosY, pDoc->MaxRow(), nPPTY, pDoc, nTabNo );
+        AddPixelsWhile( nScrY, nClickY, rPosY, pDoc->MaxRow(), nPPTY, pDoc, nForTab );
     else
     {
         /* TODO: could need some "SubPixelsWhileBackward" method */
         while ( rPosY>0 && nClickY < nScrY )
         {
             --rPosY;
-            nScrY -= ToPixel( pDoc->GetRowHeight( rPosY, nTabNo ), nPPTY );
+            nScrY -= ToPixel( pDoc->GetRowHeight( rPosY, nForTab ), nPPTY );
         }
     }
 
@@ -2726,7 +2780,7 @@ void ScViewData::GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
     if (rPosY<0) rPosY=0;
     if (rPosY>pDoc->MaxRow()) rPosY=pDoc->MaxRow();
 
-    if (bTestMerge)
+    if (bTestMerge && bForCurTab)
     {
         // public method to adapt position
         SCCOL nOrigX = rPosX;
@@ -3283,6 +3337,8 @@ void ScViewData::WriteExtOptions( ScExtDocOptions& rDocOpt ) const
     if( rDocSett.mfTabBarWidth < 0.0 )
         rDocSett.mfTabBarWidth = ScTabView::GetRelTabBarWidth();
 
+    bool bLOKActive = comphelper::LibreOfficeKit::isActive();
+
     // sheet settings
     for( SCTAB nTab = 0; nTab < static_cast<SCTAB>(maTabData.size()); ++nTab )
     {
@@ -3291,12 +3347,24 @@ void ScViewData::WriteExtOptions( ScExtDocOptions& rDocOpt ) const
             ScExtTabSettings& rTabSett = rDocOpt.GetOrCreateTabSettings( nTab );
 
             // split mode
-            ScSplitMode eHSplit = pViewTab->eHSplitMode;
-            ScSplitMode eVSplit = pViewTab->eVSplitMode;
-            bool bHSplit = eHSplit != SC_SPLIT_NONE;
-            bool bVSplit = eVSplit != SC_SPLIT_NONE;
-            bool bRealSplit = (eHSplit == SC_SPLIT_NORMAL) || (eVSplit == SC_SPLIT_NORMAL);
-            bool bFrozen    = (eHSplit == SC_SPLIT_FIX)    || (eVSplit == SC_SPLIT_FIX);
+            ScSplitMode eExHSplit = pViewTab->eHSplitMode;
+            ScSplitMode eExVSplit = pViewTab->eVSplitMode;
+            SCCOL nExFixPosX = pViewTab->nFixPosX;
+            SCROW nExFixPosY = pViewTab->nFixPosY;
+            long nExHSplitPos = pViewTab->nHSplitPos;
+            long nExVSplitPos = pViewTab->nVSplitPos;
+
+            if (bLOKActive)
+            {
+                OverrideWithLOKFreeze(eExHSplit, eExVSplit,
+                                      nExFixPosX, nExFixPosY,
+                                      nExHSplitPos, nExVSplitPos, nTab);
+            }
+
+            bool bHSplit = eExHSplit != SC_SPLIT_NONE;
+            bool bVSplit = eExVSplit != SC_SPLIT_NONE;
+            bool bRealSplit = (eExHSplit == SC_SPLIT_NORMAL) || (eExVSplit == SC_SPLIT_NORMAL);
+            bool bFrozen    = (eExHSplit == SC_SPLIT_FIX)    || (eExVSplit == SC_SPLIT_FIX);
             OSL_ENSURE( !bRealSplit || !bFrozen, "ScViewData::WriteExtOptions - split and freeze in same sheet" );
             rTabSett.mbFrozenPanes = !bRealSplit && bFrozen;
 
@@ -3306,15 +3374,15 @@ void ScViewData::WriteExtOptions( ScExtDocOptions& rDocOpt ) const
             if( bRealSplit )
             {
                 Point& rSplitPos = rTabSett.maSplitPos;
-                rSplitPos = Point( bHSplit ? pViewTab->nHSplitPos : 0, bVSplit ? pViewTab->nVSplitPos : 0 );
+                rSplitPos = Point( bHSplit ? nExHSplitPos : 0, bVSplit ? nExVSplitPos : 0 );
                 rSplitPos = Application::GetDefaultDevice()->PixelToLogic( rSplitPos, MapMode( MapUnit::MapTwip ) );
                 if( pDocShell )
                     rSplitPos.setX( static_cast<long>(static_cast<double>(rSplitPos.X()) / pDocShell->GetOutputFactor()) );
             }
             else if( bFrozen )
             {
-                if( bHSplit ) rTabSett.maFreezePos.SetCol( pViewTab->nFixPosX );
-                if( bVSplit ) rTabSett.maFreezePos.SetRow( pViewTab->nFixPosY );
+                if( bHSplit ) rTabSett.maFreezePos.SetCol( nExFixPosX );
+                if( bVSplit ) rTabSett.maFreezePos.SetRow( nExFixPosY );
             }
 
             // first visible cell in top-left and additional panes
@@ -3533,6 +3601,9 @@ void ScViewData::ReadExtOptions( const ScExtDocOptions& rDocOpt )
         }
     }
 
+    if (comphelper::LibreOfficeKit::isActive())
+        DeriveLOKFreezeAllSheets();
+
     // RecalcPixPos or so - also nMPos - also for ReadUserData ??!?!
 }
 
@@ -3553,7 +3624,7 @@ void ScViewData::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>& rSe
         if (maTabData[nTab])
         {
             uno::Sequence <beans::PropertyValue> aTableViewSettings;
-            maTabData[nTab]->WriteUserDataSequence(aTableViewSettings, *this);
+            maTabData[nTab]->WriteUserDataSequence(aTableViewSettings, *this, nTab);
             OUString sTabName;
             GetDocument()->GetName( nTab, sTabName );
             try
@@ -3805,6 +3876,9 @@ void ScViewData::ReadUserDataSequence(const uno::Sequence <beans::PropertyValue>
 
     // #i47426# write view options to document, needed e.g. for Excel export
     pDoc->SetViewOptions( *pOptions );
+
+    if (comphelper::LibreOfficeKit::isActive())
+        DeriveLOKFreezeAllSheets();
 }
 
 void ScViewData::SetOptions( const ScViewOptions& rOpt )
@@ -4036,4 +4110,133 @@ void ScViewData::AddPixelsWhileBackward( long & rScrY, long nEndPixels,
     rPosY = nRow;
 }
 
+SCCOLROW ScViewData::GetLOKSheetFreezeIndex(bool bIsCol) const
+{
+    SCCOLROW nFreezeIndex = bIsCol ? pDoc->GetLOKFreezeCol(nTabNo) : pDoc->GetLOKFreezeRow(nTabNo);
+    return nFreezeIndex >= 0 ? nFreezeIndex : 0;
+}
+
+bool ScViewData::SetLOKSheetFreezeIndex(const SCCOLROW nFreezeIndex, bool bIsCol, SCTAB nForTab)
+{
+    if (nForTab == -1)
+    {
+        nForTab = nTabNo;
+    }
+    else if (!ValidTab(nForTab) || (nForTab >= static_cast<SCTAB>(maTabData.size())))
+    {
+        SAL_WARN("sc.viewdata", "ScViewData::SetLOKSheetFreezeIndex :  invalid nForTab = " << nForTab);
+        return false;
+    }
+
+    return bIsCol ?
+        pDoc->SetLOKFreezeCol(static_cast<SCCOL>(nFreezeIndex), nForTab) :
+        pDoc->SetLOKFreezeRow(static_cast<SCROW>(nFreezeIndex), nForTab);
+}
+
+void ScViewData::DeriveLOKFreezeAllSheets()
+{
+    SCTAB nMaxTab = static_cast<SCTAB>(maTabData.size()) - 1;
+    for (SCTAB nTab = 0; nTab <= nMaxTab; ++nTab)
+        DeriveLOKFreezeIfNeeded(nTab);
+}
+
+void ScViewData::DeriveLOKFreezeIfNeeded(SCTAB nForTab)
+{
+    if (!ValidTab(nForTab) || (nForTab >= static_cast<SCTAB>(maTabData.size())))
+    {
+        SAL_WARN("sc.viewdata", "ScViewData::DeriveLOKFreezeIfNeeded :  invalid nForTab = " << nForTab);
+        return;
+    }
+
+    ScViewDataTable* pViewTable = maTabData[nForTab].get();
+    assert(pViewTable);
+
+    bool bConvertToFreezeX = false;
+    bool bConvertToFreezeY = false;
+    SCCOL nFreezeCol = pDoc->GetLOKFreezeCol(nForTab);
+    SCROW nFreezeRow = pDoc->GetLOKFreezeRow(nForTab);
+
+    if (nFreezeCol == -1)
+    {
+        ScSplitMode eSplitMode = pViewTable->eHSplitMode;
+        if (eSplitMode == SC_SPLIT_FIX)
+            nFreezeCol = pViewTable->nFixPosX;
+        else if (eSplitMode == SC_SPLIT_NORMAL)
+            bConvertToFreezeX = true;
+        else
+            nFreezeCol = 0;
+    }
+
+    if (nFreezeRow == -1)
+    {
+        ScSplitMode eSplitMode = pViewTable->eVSplitMode;
+        if (eSplitMode == SC_SPLIT_FIX)
+            nFreezeRow = pViewTable->nFixPosY;
+        else if (eSplitMode == SC_SPLIT_NORMAL)
+            bConvertToFreezeY = true;
+        else
+            nFreezeRow = 0;
+    }
+
+    if (bConvertToFreezeX || bConvertToFreezeY)
+    {
+        SCCOL nCol;
+        SCROW nRow;
+        GetPosFromPixel(bConvertToFreezeX ? pViewTable->nHSplitPos : 0,
+                        bConvertToFreezeY ? pViewTable->nVSplitPos : 0,
+                        SC_SPLIT_BOTTOMLEFT, nCol, nRow,
+                        false /* bTestMerge */, false /* bRepair */,
+                        nForTab);
+        if (bConvertToFreezeX)
+            nFreezeCol = nCol;
+        if (bConvertToFreezeY)
+            nFreezeRow = nRow;
+    }
+
+    pDoc->SetLOKFreezeCol(nFreezeCol, nForTab);
+    pDoc->SetLOKFreezeRow(nFreezeRow, nForTab);
+}
+
+void ScViewData::OverrideWithLOKFreeze(ScSplitMode& eExHSplitMode, ScSplitMode& eExVSplitMode,
+                                       SCCOL& nExFixPosX, SCROW& nExFixPosY,
+                                       long& nExHSplitPos, long& nExVSplitPos, SCTAB nForTab) const
+{
+    SCCOL nFreezeCol = pDoc->GetLOKFreezeCol(nForTab);
+    SCROW nFreezeRow = pDoc->GetLOKFreezeRow(nForTab);
+
+    bool bConvertToScrPosX = false;
+    bool bConvertToScrPosY = false;
+
+    if (nFreezeCol >= 0)
+    {
+        if (eExHSplitMode == SC_SPLIT_NONE)
+            eExHSplitMode = SC_SPLIT_FIX;
+
+        if (eExHSplitMode == SC_SPLIT_FIX)
+            nExFixPosX = nFreezeCol;
+        else
+            bConvertToScrPosX = true;
+    }
+
+    if (nFreezeRow >= 0)
+    {
+        if (eExVSplitMode == SC_SPLIT_NONE)
+            eExVSplitMode = SC_SPLIT_FIX;
+
+        if (eExVSplitMode == SC_SPLIT_FIX)
+            nExFixPosY = nFreezeRow;
+        else
+            bConvertToScrPosY = true;
+    }
+
+    if (bConvertToScrPosX || bConvertToScrPosY)
+    {
+        Point aExSplitPos = GetScrPos(nFreezeCol, nFreezeRow, SC_SPLIT_BOTTOMLEFT, true, nForTab);
+        if (bConvertToScrPosX)
+            nExHSplitPos = aExSplitPos.X();
+        if (bConvertToScrPosY)
+            nExVSplitPos = aExSplitPos.Y();
+    }
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml
index ac0092ad062b..156ccc5f1212 100644
--- a/sc/uiconfig/scalc/menubar/menubar.xml
+++ b/sc/uiconfig/scalc/menubar/menubar.xml
@@ -168,8 +168,8 @@
       <menu:menuitem menu:id=".uno:FreezePanes"/>
       <menu:menu menu:id=".uno:FreezeCellsMenu">
         <menu:menupopup>
-          <menu:menuitem menu:id=".uno:FreezePanesFirstColumn"/>
-          <menu:menuitem menu:id=".uno:FreezePanesFirstRow"/>
+          <menu:menuitem menu:id=".uno:FreezePanesColumn"/>
+          <menu:menuitem menu:id=".uno:FreezePanesRow"/>
         </menu:menupopup>
       </menu:menu>
       <menu:menuseparator/>
diff --git a/sc/uiconfig/scalc/popupmenu/column_operations.xml b/sc/uiconfig/scalc/popupmenu/column_operations.xml
index 3ed8eda5f892..2abb5c49d20f 100644
--- a/sc/uiconfig/scalc/popupmenu/column_operations.xml
+++ b/sc/uiconfig/scalc/popupmenu/column_operations.xml
@@ -28,5 +28,5 @@
   <menu:menuitem menu:id=".uno:FillSeries"/>
   <menu:menuitem menu:id=".uno:RandomNumberGeneratorDialog"/>
   <menu:menuseparator/>
-  <menu:menuitem menu:id=".uno:FreezePanesFirstColumn"/>
+  <menu:menuitem menu:id=".uno:FreezePanesColumn"/>
 </menu:menupopup>
diff --git a/sc/uiconfig/scalc/popupmenu/freezepanes.xml b/sc/uiconfig/scalc/popupmenu/freezepanes.xml
index cc6d3147a446..de32001b8fa1 100644
--- a/sc/uiconfig/scalc/popupmenu/freezepanes.xml
+++ b/sc/uiconfig/scalc/popupmenu/freezepanes.xml
@@ -8,6 +8,6 @@
  *
 -->
 <menu:menupopup xmlns:menu="http://openoffice.org/2001/menu">
-  <menu:menuitem menu:id=".uno:FreezePanesFirstColumn"/>
-  <menu:menuitem menu:id=".uno:FreezePanesFirstRow"/>
+  <menu:menuitem menu:id=".uno:FreezePanesColumn"/>
+  <menu:menuitem menu:id=".uno:FreezePanesRow"/>
 </menu:menupopup>
diff --git a/sc/uiconfig/scalc/popupmenu/row_operations.xml b/sc/uiconfig/scalc/popupmenu/row_operations.xml
index f3ebed07e4e4..84a2470cff1e 100644
--- a/sc/uiconfig/scalc/popupmenu/row_operations.xml
+++ b/sc/uiconfig/scalc/popupmenu/row_operations.xml
@@ -28,5 +28,5 @@
   <menu:menuitem menu:id=".uno:FillSeries"/>
   <menu:menuitem menu:id=".uno:RandomNumberGeneratorDialog"/>
   <menu:menuseparator/>
-  <menu:menuitem menu:id=".uno:FreezePanesFirstRow"/>
+  <menu:menuitem menu:id=".uno:FreezePanesRow"/>
 </menu:menupopup>
diff --git a/sc/uiconfig/scalc/ui/notebookbar.ui b/sc/uiconfig/scalc/ui/notebookbar.ui
index c6c08c077de4..bab2bfdc456f 100644
--- a/sc/uiconfig/scalc/ui/notebookbar.ui
+++ b/sc/uiconfig/scalc/ui/notebookbar.ui
@@ -10013,10 +10013,10 @@
                                     <property name="toolbar_style">icons</property>
                                     <property name="show_arrow">False</property>
                                     <child>
-                                      <object class="GtkToolButton" id="View-FreezePanesFirstColumn">
+                                      <object class="GtkToolButton" id="View-FreezePanesColumn">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="action_name">.uno:FreezePanesFirstColumn</property>
+                                        <property name="action_name">.uno:FreezePanesColumn</property>
                                       </object>
                                       <packing>
                                         <property name="expand">True</property>
@@ -10039,10 +10039,10 @@
                                     <property name="toolbar_style">both-horiz</property>
                                     <property name="show_arrow">False</property>
                                     <child>
-                                      <object class="GtkToolButton" id="View-FreezePanesFirstRow">
+                                      <object class="GtkToolButton" id="View-FreezePanesRow">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="action_name">.uno:FreezePanesFirstRow</property>
+                                        <property name="action_name">.uno:FreezePanesRow</property>
                                       </object>
                                       <packing>
                                         <property name="expand">True</property>
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index edc07fb0416a..0eff07c01bec 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -1144,7 +1144,9 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra
              aEvent.FeatureURL.Path == "StatusSelectionMode" ||
              aEvent.FeatureURL.Path == "Signature" ||
              aEvent.FeatureURL.Path == "SelectionMode" ||
-             aEvent.FeatureURL.Path == "StatusBarFunc")
+             aEvent.FeatureURL.Path == "StatusBarFunc" ||
+             aEvent.FeatureURL.Path == "FreezePanesColumn" ||
+             aEvent.FeatureURL.Path == "FreezePanesRow")
     {
         sal_Int32 aInt32;
 


More information about the Libreoffice-commits mailing list