sc/source/ui/undo/undoblk.cxx  |    4 ++--
 sc/source/ui/undo/undoblk2.cxx |    4 ++--
 sc/source/ui/undo/undodat.cxx  |   40 ++++++++++++++++++++--------------------
 sc/source/ui/view/cliputil.cxx |    2 +-
 sc/source/ui/view/dbfunc.cxx   |    6 +++---
 sc/source/ui/view/dbfunc3.cxx  |   20 ++++++++++----------
 sc/source/ui/view/tabview4.cxx |    2 +-
 sc/source/ui/view/viewfun2.cxx |    9 ++++-----
 sc/source/ui/view/viewfun3.cxx |    3 +++
 sc/source/ui/view/viewfunc.cxx |   14 +++++++-------
 10 files changed, 53 insertions(+), 51 deletions(-)

New commits:
commit 9f68149f5fe717324ae307b7659c0f83c13b627b
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Thu Oct 23 15:03:47 2025 +0900
Commit:     Caolán McNamara <[email protected]>
CommitDate: Thu Oct 23 17:20:03 2025 +0200

    sc: sheet geometry and header invalid. needs the actual tab
    
    This fixes row/column header invalidation when using the sheet
    view. Previously, because the wrong tab number was passed, the
    invalidation was not performed and the header didn't reflect the
    cells. This was especially apparent when changing the auto-filter.
    
    In the change all the sheet geometry and header invalidations are
    changed so it should also fix some other - not yet noticed bugs.
    
    Change-Id: Ia382882fedce18750dfc812793501573fff19093
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192887
    Tested-by: Caolán McNamara <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index c44b9e7a1ebd..e1d2176f3cbd 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -273,7 +273,7 @@ void ScUndoInsertCells::DoChange( const bool bUndo )
     if (!comphelper::LibreOfficeKit::isActive())
         return;
 
-    SCTAB nTab = pViewShell->GetViewData().CurrentTabForData();
+    SCTAB nTab = pViewShell->GetViewData().GetTabNumber();
     bool bColsAffected = (eCmd == INS_INSCOLS_BEFORE || eCmd == 
INS_INSCOLS_AFTER || eCmd == INS_CELLSRIGHT);
     bool bRowsAffected = (eCmd == INS_INSROWS_BEFORE || eCmd == 
INS_INSROWS_AFTER || eCmd == INS_CELLSDOWN);
 
@@ -544,7 +544,7 @@ void ScUndoDeleteCells::DoChange( const bool bUndo )
     if (!comphelper::LibreOfficeKit::isActive())
         return;
 
-    SCTAB nTab = pViewShell->GetViewData().CurrentTabForData();
+    SCTAB nTab = pViewShell->GetViewData().GetTabNumber();
     bool bColsAffected = (eCmd == DelCellCmd::Cols || eCmd == 
DelCellCmd::CellsLeft);
     bool bRowsAffected = (eCmd == DelCellCmd::Rows || eCmd == 
DelCellCmd::CellsUp);
 
diff --git a/sc/source/ui/undo/undoblk2.cxx b/sc/source/ui/undo/undoblk2.cxx
index 17aff9b2f9f1..61d18647d809 100644
--- a/sc/source/ui/undo/undoblk2.cxx
+++ b/sc/source/ui/undo/undoblk2.cxx
@@ -125,7 +125,7 @@ void ScUndoWidthOrHeight::Undo()
 
     if (pViewShell)
     {
-        SCTAB nCurrentTab = pViewShell->GetViewData().CurrentTabForData();
+        SCTAB nCurrentTab = pViewShell->GetViewData().GetTabNumber();
         bool bAffectsVisibility = (eMode != SC_SIZE_ORIGINAL && eMode != 
SC_SIZE_VISOPT);
         ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
                 pViewShell, bWidth /* bColumns */, !bWidth /* bRows */,
@@ -156,7 +156,7 @@ void ScUndoWidthOrHeight::Redo()
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     if (pViewShell)
     {
-        SCTAB nTab = pViewShell->GetViewData().CurrentTabForData();
+        SCTAB nTab = pViewShell->GetViewData().GetTabNumber();
         if ( nTab < nStartTab || nTab > nEndTab )
             pViewShell->SetTabNo( nStartTab );
 
diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
index f3f3156a2664..203c64e8672b 100644
--- a/sc/source/ui/undo/undodat.cxx
+++ b/sc/source/ui/undo/undodat.cxx
@@ -87,7 +87,7 @@ void ScUndoDoOutline::Undo()
 
     // sheet has to be switched over (#46952#)!
 
-    SCTAB nVisTab = pViewShell->GetViewData().CurrentTabForData();
+    SCTAB nVisTab = pViewShell->GetViewData().GetTabNumber();
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
@@ -125,7 +125,7 @@ void ScUndoDoOutline::Redo()
 
     // sheet has to be switched over (#46952#)!
 
-    SCTAB nVisTab = pViewShell->GetViewData().CurrentTabForData();
+    SCTAB nVisTab = pViewShell->GetViewData().GetTabNumber();
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
@@ -186,7 +186,7 @@ void ScUndoMakeOutline::Undo()
 
     rDoc.SetOutlineTable( nTab, pUndoTable.get() );
 
-    SCTAB nVisTab = pViewShell->GetViewData().CurrentTabForData();
+    SCTAB nVisTab = pViewShell->GetViewData().GetTabNumber();
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
@@ -291,7 +291,7 @@ void ScUndoOutlineLevel::Undo()
             true /* bGroups */, nTab);
     pViewShell->UpdateScrollBars();
 
-    SCTAB nVisTab = pViewShell->GetViewData().CurrentTabForData();
+    SCTAB nVisTab = pViewShell->GetViewData().GetTabNumber();
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
@@ -310,7 +310,7 @@ void ScUndoOutlineLevel::Redo()
 
     // sheet has to be switched on or off before this (#46952#) !!!
 
-    SCTAB nVisTab = pViewShell->GetViewData().CurrentTabForData();
+    SCTAB nVisTab = pViewShell->GetViewData().GetTabNumber();
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
@@ -391,7 +391,7 @@ void ScUndoOutlineBlock::Undo()
             true /* bGroups */, nTab);
     pViewShell->UpdateScrollBars();
 
-    SCTAB nVisTab = pViewShell->GetViewData().CurrentTabForData();
+    SCTAB nVisTab = pViewShell->GetViewData().GetTabNumber();
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
@@ -483,7 +483,7 @@ void ScUndoRemoveAllOutlines::Undo()
 
     pViewShell->UpdateScrollBars();
 
-    SCTAB nVisTab = pViewShell->GetViewData().CurrentTabForData();
+    SCTAB nVisTab = pViewShell->GetViewData().GetTabNumber();
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
@@ -510,7 +510,7 @@ void ScUndoRemoveAllOutlines::Redo()
     // sheet has to be switched over (#46952#)!
 
     SCTAB nTab = aBlockStart.Tab();
-    SCTAB nVisTab = pViewShell->GetViewData().CurrentTabForData();
+    SCTAB nVisTab = pViewShell->GetViewData().GetTabNumber();
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
@@ -579,7 +579,7 @@ void ScUndoAutoOutline::Undo()
         pViewShell->UpdateScrollBars();
     }
 
-    SCTAB nVisTab = pViewShell->GetViewData().CurrentTabForData();
+    SCTAB nVisTab = pViewShell->GetViewData().GetTabNumber();
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
@@ -599,7 +599,7 @@ void ScUndoAutoOutline::Redo()
     SCTAB nTab = aBlockStart.Tab();
     // sheet has to be switched on or off before this (#46952#) !!!
 
-    SCTAB nVisTab = pViewShell->GetViewData().CurrentTabForData();
+    SCTAB nVisTab = pViewShell->GetViewData().GetTabNumber();
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
@@ -709,7 +709,7 @@ void ScUndoSubTotals::Undo()
     if (xUndoDB)
         rDoc.SetDBCollection(std::unique_ptr<ScDBCollection>(new 
ScDBCollection(*xUndoDB)), true);
 
-    SCTAB nVisTab = pViewShell->GetViewData().CurrentTabForData();
+    SCTAB nVisTab = pViewShell->GetViewData().GetTabNumber();
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
@@ -727,7 +727,7 @@ void ScUndoSubTotals::Redo()
 
     BeginRedo();
 
-    SCTAB nVisTab = pViewShell->GetViewData().CurrentTabForData();
+    SCTAB nVisTab = pViewShell->GetViewData().GetTabNumber();
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
@@ -863,7 +863,7 @@ void ScUndoQuery::Undo()
 
     DoSdrUndoAction( pDrawUndo.get(), &rDoc );
 
-    SCTAB nVisTab = pViewShell->GetViewData().CurrentTabForData();
+    SCTAB nVisTab = pViewShell->GetViewData().GetTabNumber();
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
@@ -911,7 +911,7 @@ void ScUndoQuery::Redo()
 
     BeginRedo();
 
-    SCTAB nVisTab = pViewShell->GetViewData().CurrentTabForData();
+    SCTAB nVisTab = pViewShell->GetViewData().GetTabNumber();
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
@@ -1174,7 +1174,7 @@ void ScUndoImportData::Undo()
         ScUndoUtil::MarkSimpleBlock( pDocShell, nCol1, nRow1, nTable, nCol2, 
nRow2, nTable );
     }
 
-    SCTAB nVisTab = pViewShell->GetViewData().CurrentTabForData();
+    SCTAB nVisTab = pViewShell->GetViewData().GetTabNumber();
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
@@ -1246,7 +1246,7 @@ void ScUndoImportData::Redo()
         ScUndoUtil::MarkSimpleBlock( pDocShell, nCol1, nRow1, nTable, nCol2, 
nRow2, nTable );
     }
 
-    SCTAB nVisTab = pViewShell->GetViewData().CurrentTabForData();
+    SCTAB nVisTab = pViewShell->GetViewData().GetTabNumber();
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
@@ -1409,7 +1409,7 @@ void ScUndoRepeatDB::Undo()
             false /* bSizes*/, true /* bHidden */, true /* bFiltered */,
             false /* bGroups */, nTab);
 
-    SCTAB nVisTab = pViewShell->GetViewData().CurrentTabForData();
+    SCTAB nVisTab = pViewShell->GetViewData().GetTabNumber();
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
@@ -1429,7 +1429,7 @@ void ScUndoRepeatDB::Redo()
 
     SCTAB nTab = aBlockStart.Tab();
 
-    SCTAB nVisTab = pViewShell->GetViewData().CurrentTabForData();
+    SCTAB nVisTab = pViewShell->GetViewData().GetTabNumber();
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
@@ -1687,7 +1687,7 @@ void ScUndoConsolidate::Undo()
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     if (pViewShell)
     {
-        SCTAB nViewTab = pViewShell->GetViewData().CurrentTabForData();
+        SCTAB nViewTab = pViewShell->GetViewData().GetTabNumber();
         if ( nViewTab != nTab )
             pViewShell->SetTabNo( nTab );
     }
@@ -1704,7 +1704,7 @@ void ScUndoConsolidate::Redo()
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     if (pViewShell)
     {
-        SCTAB nViewTab = pViewShell->GetViewData().CurrentTabForData();
+        SCTAB nViewTab = pViewShell->GetViewData().GetTabNumber();
         if ( nViewTab != aParam.nTab )
             pViewShell->SetTabNo( aParam.nTab );
     }
diff --git a/sc/source/ui/view/cliputil.cxx b/sc/source/ui/view/cliputil.cxx
index 4e96ecfd6608..583d93976fdc 100644
--- a/sc/source/ui/view/cliputil.cxx
+++ b/sc/source/ui/view/cliputil.cxx
@@ -135,7 +135,7 @@ void ScClipUtil::PasteFromClipboard( ScViewData& rViewData, 
ScTabViewShell* pTab
 
             ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
                 pTabViewShell, true /* bColumns */, true /* bRows */, true /* 
bSizes*/,
-                true /* bHidden */, true /* bFiltered */, true /* bGroups */, 
nThisTab);
+                true /* bHidden */, true /* bFiltered */, true /* bGroups */, 
rViewData.GetTabNumber());
         }
     }
     pTabViewShell->CellContentChanged();        // => PasteFromSystem() ???
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index ba1908d43f17..8692bd1152bf 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -263,7 +263,7 @@ void ScDBFunc::Query( const ScQueryParam& rQueryParam, 
const ScRange* pAdvSource
             GetViewData().GetViewShell(),
             false /* bColumns */, true /* bRows */,
             false /* bSizes*/, true /* bHidden */, true /* bFiltered */,
-            false /* bGroups */, nTab);
+            false /* bGroups */, GetViewData().GetTabNumber());
         UpdateScrollBars(ROW_HEADER);
         SelectionChanged();     // for attribute states (filtered rows are 
ignored)
     }
@@ -302,7 +302,7 @@ void ScDBFunc::ToggleAutoFilter()
             bHasAuto = false;
     }
 
-    if (bHasAuto)                               // remove
+    if (bHasAuto) // remove
     {
         //  hide filter buttons
 
@@ -452,7 +452,7 @@ bool ScDBFunc::ImportData( const ScImportParam& rParam )
 {
     ScDocument& rDoc = GetViewData().GetDocument();
 
-    ScEditableTester aTester = ScEditableTester::CreateAndTestBlock(rDoc, 
GetViewData().CurrentTabForData(), 
+    ScEditableTester aTester = ScEditableTester::CreateAndTestBlock(rDoc, 
GetViewData().CurrentTabForData(),
                                     rParam.nCol1, rParam.nRow1, rParam.nCol2, 
rParam.nRow2);
     if ( !aTester.IsEditable() )
     {
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index 55fa29a66cf0..4db20cabb81d 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -94,11 +94,11 @@ void ScDBFunc::MakeOutline( bool bColumns, bool bRecord )
         ScOutlineDocFunc aFunc(*pDocSh);
         aFunc.MakeOutline( aRange, bColumns, bRecord, false );
 
-        
ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), 
bColumns ? COLUMN_HEADER : ROW_HEADER, GetViewData().CurrentTabForData());
+        
ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), 
bColumns ? COLUMN_HEADER : ROW_HEADER, GetViewData().GetTabNumber());
         
ScTabViewShell::notifyAllViewsSheetGeomInvalidation(GetViewData().GetViewShell(),
                                                             bColumns, 
!bColumns, false /* bSizes*/,
                                                             false /* bHidden 
*/, false /* bFiltered */,
-                                                            true /* bGroups 
*/, GetViewData().CurrentTabForData());
+                                                            true /* bGroups 
*/, GetViewData().GetTabNumber());
     }
     else
         ErrorMessage(STR_NOMULTISELECT);
@@ -115,11 +115,11 @@ void ScDBFunc::RemoveOutline( bool bColumns, bool bRecord 
)
         ScOutlineDocFunc aFunc(*pDocSh);
         aFunc.RemoveOutline( aRange, bColumns, bRecord, false );
 
-        
ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), 
bColumns ? COLUMN_HEADER : ROW_HEADER, GetViewData().CurrentTabForData());
+        
ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), 
bColumns ? COLUMN_HEADER : ROW_HEADER, GetViewData().GetTabNumber());
         
ScTabViewShell::notifyAllViewsSheetGeomInvalidation(GetViewData().GetViewShell(),
                                                             bColumns, 
!bColumns, false /* bSizes*/,
                                                             true /* bHidden 
*/, true /* bFiltered */,
-                                                            true /* bGroups 
*/, GetViewData().CurrentTabForData());
+                                                            true /* bGroups 
*/, GetViewData().GetTabNumber());
     }
     else
         ErrorMessage(STR_NOMULTISELECT);
@@ -203,7 +203,7 @@ void ScDBFunc::RemoveAllOutlines( bool bRecord )
         
ScTabViewShell::notifyAllViewsSheetGeomInvalidation(GetViewData().GetViewShell(),
                                                             true /* bColumns 
*/, true /* bRows */, false /* bSizes*/,
                                                             true /* bHidden 
*/, true /* bFiltered */,
-                                                            true /* bGroups 
*/, nTab);
+                                                            true /* bGroups 
*/, GetViewData().GetTabNumber());
         UpdateScrollBars(BOTH_HEADERS);
     }
 }
@@ -242,7 +242,7 @@ void ScDBFunc::SelectLevel( bool bColumns, sal_uInt16 
nLevel, bool bRecord )
         
ScTabViewShell::notifyAllViewsSheetGeomInvalidation(GetViewData().GetViewShell(),
                                                             bColumns, 
!bColumns, false /* bSizes*/,
                                                             true /* bHidden 
*/, true /* bFiltered */,
-                                                            true /* bGroups 
*/, nTab);
+                                                            true /* bGroups 
*/, GetViewData().GetTabNumber());
         UpdateScrollBars(bColumns ? COLUMN_HEADER : ROW_HEADER);
     }
 }
@@ -276,7 +276,7 @@ void ScDBFunc::ShowOutline( bool bColumns, sal_uInt16 
nLevel, sal_uInt16 nEntry,
         
ScTabViewShell::notifyAllViewsSheetGeomInvalidation(GetViewData().GetViewShell(),
                                                             bColumns, 
!bColumns, false /* bSizes*/,
                                                             true /* bHidden 
*/, true /* bFiltered */,
-                                                            true /* bGroups 
*/, nTab);
+                                                            true /* bGroups 
*/, GetViewData().GetTabNumber());
         UpdateScrollBars(bColumns ? COLUMN_HEADER : ROW_HEADER);
     }
 }
@@ -296,7 +296,7 @@ void ScDBFunc::HideOutline( bool bColumns, sal_uInt16 
nLevel, sal_uInt16 nEntry,
         
ScTabViewShell::notifyAllViewsSheetGeomInvalidation(GetViewData().GetViewShell(),
                                                             bColumns, 
!bColumns, false /* bSizes*/,
                                                             true /* bHidden 
*/, true /* bFiltered */,
-                                                            true /* bGroups 
*/, nTab);
+                                                            true /* bGroups 
*/, GetViewData().GetTabNumber());
         UpdateScrollBars(bColumns ? COLUMN_HEADER : ROW_HEADER);
     }
 }
@@ -394,7 +394,7 @@ void ScDBFunc::ShowMarkedOutlines( bool bRecord )
             ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
                 GetViewData().GetViewShell(), true, true,
                 false /* bSizes*/, true /* bHidden */, true /* bFiltered */,
-                true /* bGroups */, GetViewData().CurrentTabForData());
+                true /* bGroups */, GetViewData().GetTabNumber());
             UpdateScrollBars();
         }
     }
@@ -417,7 +417,7 @@ void ScDBFunc::HideMarkedOutlines( bool bRecord )
             ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
                 GetViewData().GetViewShell(), true, true,
                 false /* bSizes*/, true /* bHidden */, true /* bFiltered */,
-                true /* bGroups */, GetViewData().CurrentTabForData());
+                true /* bGroups */, GetViewData().GetTabNumber());
             UpdateScrollBars();
         }
     }
diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx
index ff646046628f..72b8e5d21a47 100644
--- a/sc/source/ui/view/tabview4.cxx
+++ b/sc/source/ui/view/tabview4.cxx
@@ -469,7 +469,7 @@ static tools::Long lcl_GetScrollRange( SCCOLROW nDocEnd, 
SCCOLROW nPos, SCCOLROW
 
 void ScTabView::UpdateScrollBars( HeaderType eHeaderType )
 {
-    
ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), 
eHeaderType, GetViewData().CurrentTabForData());
+    
ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), 
eHeaderType, GetViewData().GetTabNumber());
 
     tools::Long        nDiff;
     bool        bTop =   ( aViewData.GetVSplitMode() != SC_SPLIT_NONE );
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index ce2197b062fb..62172a3030ff 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -180,13 +180,12 @@ bool ScViewFunc::AdjustBlockHeight( bool bPaint, 
ScMarkData* pMarkData, bool bRa
 
     if (comphelper::LibreOfficeKit::isActive())
     {
-        SCTAB nTab = GetViewData().CurrentTabForData();
         ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
                 GetViewData().GetViewShell(),
                 bRangeWidthChanged /* bColumns */, true /* bRows */,
                 true /* bSizes*/, false /* bHidden */, false /* bFiltered */,
-                false /* bGroups */, nTab);
-        
ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), 
ROW_HEADER, nTab);
+                false /* bGroups */, GetViewData().GetTabNumber());
+        
ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), 
ROW_HEADER, GetViewData().GetTabNumber());
     }
 
     return bAnyChanged;
@@ -241,8 +240,8 @@ bool ScViewFunc::AdjustRowHeight( SCROW nStartRow, SCROW 
nEndRow, bool bApi )
                 GetViewData().GetViewShell(),
                 false /* bColumns */, true /* bRows */,
                 true /* bSizes*/, false /* bHidden */, false /* bFiltered */,
-                false /* bGroups */, nTab);
-        
ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), 
ROW_HEADER, GetViewData().CurrentTabForData());
+                false /* bGroups */, GetViewData().GetTabNumber());
+        
ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), 
ROW_HEADER, GetViewData().GetTabNumber());
     }
 
     return bChanged;
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 2d3dd8f9c918..3339766ece64 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -69,6 +69,7 @@
 #include <sfx2/lokhelper.hxx>
 #include <sc.hrc>
 #include <sfx2/bindings.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 using namespace com::sun::star;
 
@@ -2077,6 +2078,8 @@ void ScViewFunc::SheetViewChanged()
     {
         ScModelObj* pModel = 
comphelper::getFromUnoTunnel<ScModelObj>(pViewShell->GetCurrentDocument());
         SfxLokHelper::notifyViewRenderState(pViewShell, pModel);
+        pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_HEADER, 
"all"_ostr);
+        
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY, 
"all"_ostr);
     }
     SfxBindings& rBindings = rViewData.GetBindings();
     rBindings.Invalidate(FID_CURRENT_SHEET_VIEW);
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index e61fec76d6c6..730e58c2ca42 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1966,15 +1966,15 @@ bool ScViewFunc::InsertCells( InsCellCmd eCmd, bool 
bRecord, bool bPartOfPaste,
             if (comphelper::LibreOfficeKit::isActive())
             {
                 if (bInsertCols)
-                    
ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), 
COLUMN_HEADER, GetViewData().CurrentTabForData());
+                    
ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), 
COLUMN_HEADER, GetViewData().GetTabNumber());
 
                 if (bInsertRows)
-                    
ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), 
ROW_HEADER, GetViewData().CurrentTabForData());
+                    
ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), 
ROW_HEADER, GetViewData().GetTabNumber());
 
                 
ScTabViewShell::notifyAllViewsSheetGeomInvalidation(GetViewData().GetViewShell(),
                                                                     
bInsertCols, bInsertRows, true /* bSizes*/,
                                                                     true /* 
bHidden */, true /* bFiltered */,
-                                                                    true /* 
bGroups */, GetViewData().CurrentTabForData());
+                                                                    true /* 
bGroups */, GetViewData().GetTabNumber());
             }
         }
         else
@@ -2056,15 +2056,15 @@ void ScViewFunc::DeleteCells( DelCellCmd eCmd )
             bool bColsDeleted = (eCmd == DelCellCmd::Cols);
             bool bRowsDeleted = (eCmd == DelCellCmd::Rows);
             if (bColsDeleted)
-                
ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), 
COLUMN_HEADER, GetViewData().CurrentTabForData());
+                
ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), 
COLUMN_HEADER, GetViewData().GetTabNumber());
 
             if (bRowsDeleted)
-                
ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), 
ROW_HEADER, GetViewData().CurrentTabForData());
+                
ScTabViewShell::notifyAllViewsHeaderInvalidation(GetViewData().GetViewShell(), 
ROW_HEADER, GetViewData().GetTabNumber());
 
             
ScTabViewShell::notifyAllViewsSheetGeomInvalidation(GetViewData().GetViewShell(),
                                                                 bColsDeleted, 
bRowsDeleted, true /* bSizes*/,
                                                                 true /* 
bHidden */, true /* bFiltered */,
-                                                                true /* 
bGroups */, GetViewData().CurrentTabForData());
+                                                                true /* 
bGroups */, GetViewData().GetTabNumber());
         }
     }
     else
@@ -2639,7 +2639,7 @@ void ScViewFunc::SetWidthOrHeight(
     
ScTabViewShell::notifyAllViewsSheetGeomInvalidation(GetViewData().GetViewShell(),
             bWidth /* bColumns */, !bWidth /* bRows */,
             true /* bSizes*/, bAffectsVisibility /* bHidden */, 
bAffectsVisibility /* bFiltered */,
-            false /* bGroups */, nCurTab);
+            false /* bGroups */, GetViewData().GetTabNumber());
     GetViewData().GetView()->UpdateScrollBars(bWidth ? COLUMN_HEADER : 
ROW_HEADER);
 
     {

Reply via email to