officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu |    5 -
 sc/inc/sc.hrc                                                     |    3 
 sc/sdi/scalc.sdi                                                  |   24 
+------
 sc/sdi/tabvwsh.sdi                                                |    1 
 sc/source/ui/app/scdll.cxx                                        |    2 
 sc/source/ui/cctrl/SheetViewBox.cxx                               |    4 -
 sc/source/ui/cctrl/SheetViewControl.cxx                           |   15 ----
 sc/source/ui/view/tabview3.cxx                                    |    2 
 sc/source/ui/view/tabvwsh3.cxx                                    |   34 
++++------
 sc/source/ui/view/tabvwsha.cxx                                    |   10 --
 sc/source/ui/view/viewfun3.cxx                                    |    2 
 sc/uiconfig/scalc/ui/notebookbar_online.ui                        |    6 -
 12 files changed, 32 insertions(+), 76 deletions(-)

New commits:
commit d36194148926b7e8a1b27ebf165e8b3aa584f969
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Mon Mar 2 04:51:58 2026 +0000
Commit:     Miklos Vajna <[email protected]>
CommitDate: Tue Mar 3 09:17:21 2026 +0100

    sc: remove UNO command CurrentSheetView for SelectSheetView
    
    CurrentSheetView is used mainly for the combo box on the ToolBar,
    where you can change the sheet view used in the current sheet.
    But we already have SelectSheetView UNO command, which is used
    to show a dialog with all the sheet views. This merges the
    functionality from CurrentSheetView with SelectSheetView and
    changes the code to use SelectSheetView for the ToolBar as well.
    All the uses for CurrentSheetView command have been removed.
    
    This also removes the hack to force an update, as this is not
    needed anymore with the changes in the SheetViewControl.
    
    Change-Id: Id1b429fff6b01bfb69e3f5c0eb16f1ac6f27f901
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200754
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index 8b7c974ca840..76c5da087f84 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -35,11 +35,6 @@
           <value xml:lang="en-US">Number Format Type</value>
         </prop>
       </node>
-      <node oor:name=".uno:CurrentSheetView" oor:op="replace">
-        <prop oor:name="Label" oor:type="xs:string">
-          <value xml:lang="en-US">Current Sheet View</value>
-        </prop>
-      </node>
       <node oor:name=".uno:ObjectMirrorHorizontal" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">Flip Horizontally</value>
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 62726acdab6b..eba67b4b3c40 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -291,8 +291,7 @@ class SvxZoomSliderItem;
 // FREE (VIEW_MENU_START + 14)
 #define FID_EXIT_SHEET_VIEW     (VIEW_MENU_START + 15)
 #define FID_SELECT_SHEET_VIEW   (VIEW_MENU_START + 16)
-#define FID_CURRENT_SHEET_VIEW TypedWhichId<SfxInt32Item>(VIEW_MENU_START + 17)
-
+// FREE (VIEW_MENU_START + 17)
 
 #define FID_CHG_ACCEPT          (VIEW_MENU_START + 18)// DANGER DIRTY ID
 #define FID_CHG_COMMENT         (VIEW_MENU_START + 19)// DANGER DIRTY ID
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index e81d361c30af..8743f3c8fe89 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -6051,23 +6051,6 @@ SfxBoolItem ToggleFormula   FID_TOGGLEFORMULA
     GroupId = SfxGroupId::View
 ]
 
-SfxInt32Item CurrentSheetVIew FID_CURRENT_SHEET_VIEW
-[
-    AutoUpdate = FALSE,
-    FastCall = FALSE,
-    ReadOnlyDoc = TRUE,
-    Toggle = FALSE,
-    Container = FALSE,
-    RecordAbsolute = FALSE,
-    RecordPerSet;
-
-
-    AccelConfig = FALSE,
-    MenuConfig = FALSE,
-    ToolBoxConfig = TRUE,
-    GroupId = SfxGroupId::Format;
-]
-
 SfxBoolItem NewSheetView FID_NEW_SHEET_VIEW
 [
     /* flags */
@@ -6104,12 +6087,13 @@ SfxBoolItem RemoveSheetView FID_REMOVE_SHEET_VIEW
     GroupId = SfxGroupId::View
 ]
 
-SfxBoolItem SelectSheetView FID_SELECT_SHEET_VIEW
+SfxVoidItem SelectSheetView FID_SELECT_SHEET_VIEW
+(SfxInt32Item SheetViewID FN_PARAM_1)
 [
     /* flags */
     AutoUpdate = FALSE,
-    FastCall = FALSE,
-    ReadOnlyDoc = TRUE,
+    FastCall = TRUE,
+    ReadOnlyDoc = FALSE,
     Toggle = FALSE,
     Container = FALSE,
     RecordAbsolute = FALSE,
diff --git a/sc/sdi/tabvwsh.sdi b/sc/sdi/tabvwsh.sdi
index 38644a2ed760..f74cb86c14e7 100644
--- a/sc/sdi/tabvwsh.sdi
+++ b/sc/sdi/tabvwsh.sdi
@@ -181,7 +181,6 @@ interface TableEditView
     FID_REMOVE_SHEET_VIEW [ ExecMethod = Execute; StateMethod = GetState; ]
     FID_EXIT_SHEET_VIEW [ ExecMethod = Execute; StateMethod = GetState; ]
     FID_SELECT_SHEET_VIEW [ ExecMethod = Execute; StateMethod = GetState; ]
-    FID_CURRENT_SHEET_VIEW [ ExecMethod = Execute; StateMethod = GetState; ]
     FID_NORMALVIEWMODE  [ ExecMethod = Execute; StateMethod = GetState; ]
     FID_PAGEBREAKMODE   [ ExecMethod = Execute; StateMethod = GetState; ]
     SID_REPAINT         [ ExecMethod = Execute; StateMethod = GetState; ]
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 5766417d13ad..6b6efcc44376 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -152,7 +152,7 @@ void ScDLL::Init()
     SvxClipBoardControl             ::RegisterControl(SID_PASTE_UNFORMATTED,   
 pMod );
     svx::FormatPaintBrushToolBoxControl::RegisterControl(SID_FORMATPAINTBRUSH, 
 pMod );
     sc::ScNumberFormatControl       ::RegisterControl(SID_NUMBER_TYPE_FORMAT,  
 pMod );
-    sc::SheetViewControl::RegisterControl(FID_CURRENT_SHEET_VIEW, pMod);
+    sc::SheetViewControl::RegisterControl(FID_SELECT_SHEET_VIEW, pMod);
     sc::TableStylesControl          ::RegisterControl(SID_DATABASE_SETTINGS,   
 pMod);
 
     SvxGrafModeToolBoxControl       ::RegisterControl(SID_ATTR_GRAF_MODE,      
 pMod);
diff --git a/sc/source/ui/cctrl/SheetViewBox.cxx 
b/sc/source/ui/cctrl/SheetViewBox.cxx
index 0323c05d5706..703f9412b431 100644
--- a/sc/source/ui/cctrl/SheetViewBox.cxx
+++ b/sc/source/ui/cctrl/SheetViewBox.cxx
@@ -86,8 +86,8 @@ IMPL_STATIC_LINK(SheetViewBox, SelectHdl, weld::ComboBox&, 
rComboBox, void)
         return;
 
     const OUString sValue = rComboBox.get_active_id();
-    SfxInt32Item aItem(FID_CURRENT_SHEET_VIEW, sValue.toInt32());
-    pDispatcher->ExecuteList(FID_CURRENT_SHEET_VIEW, SfxCallMode::RECORD, { 
&aItem });
+    SfxInt32Item aItem(FN_PARAM_1, sValue.toInt32());
+    pDispatcher->ExecuteList(FID_SELECT_SHEET_VIEW, SfxCallMode::RECORD, { 
&aItem });
 
     pViewFrame->GetWindow().GrabFocus();
 }
diff --git a/sc/source/ui/cctrl/SheetViewControl.cxx 
b/sc/source/ui/cctrl/SheetViewControl.cxx
index 934fcd266c50..ca367dd5ee8c 100644
--- a/sc/source/ui/cctrl/SheetViewControl.cxx
+++ b/sc/source/ui/cctrl/SheetViewControl.cxx
@@ -13,10 +13,11 @@
 #include <svl/intitem.hxx>
 #include <vcl/toolbox.hxx>
 #include <sfx2/viewsh.hxx>
+#include <svl/voiditem.hxx>
 
 using namespace sc;
 
-SFX_IMPL_TOOLBOX_CONTROL(SheetViewControl, SfxInt32Item);
+SFX_IMPL_TOOLBOX_CONTROL(SheetViewControl, SfxVoidItem);
 
 SheetViewControl::SheetViewControl(sal_uInt16 nSlotId, ToolBoxItemId nId, 
ToolBox& rTbx)
     : SfxToolBoxControl(nSlotId, nId, rTbx)
@@ -47,17 +48,7 @@ void 
SheetViewControl::StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemStat
 
     rToolBox.EnableItem(nId, SfxItemState::DISABLED != eState);
 
-    switch (eState)
-    {
-        case SfxItemState::DEFAULT:
-        {
-            pSheetViewBox->Update(rViewData);
-            break;
-        }
-
-        default:
-            break;
-    }
+    pSheetViewBox->Update(rViewData);
 
     SfxToolBoxControl::StateChangedAtToolBoxControl(nSID, eState, pState);
 }
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 107adeac138d..2029d89f1734 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2116,7 +2116,7 @@ void ScTabView::SetTabNo( SCTAB nTab, bool bNew, bool 
bExtendSelection, bool bSa
     rBindings.Invalidate( SID_STYLE_FAMILY4 );      // Designer
     rBindings.Invalidate( SID_TABLES_COUNT );
 
-    rBindings.Invalidate(FID_CURRENT_SHEET_VIEW);
+    rBindings.Invalidate(FID_SELECT_SHEET_VIEW);
 
     if (pScMod->IsRefDialogOpen())
     {
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 472fe2021f50..483c3d878f07 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -1061,26 +1061,9 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
             ExitSheetView();
         break;
         case FID_SELECT_SHEET_VIEW:
-        {
-            ScViewData& rViewData = GetViewData();
-            auto pDialog = 
std::make_shared<sc::SelectSheetViewDialog>(GetFrameWeld(), rViewData);
-            weld::DialogController::runAsync(pDialog, [this, 
pDialog](sal_uInt32 nResult) {
-                if (RET_OK != nResult)
-                    return;
-
-                sc::SheetViewID nID = pDialog->getSelectedSheetViewID();
-                if (nID != sc::InvalidSheetViewID)
-                {
-                    SelectSheetView(nID);
-                }
-            });
-            rReq.Done();
-        }
-        break;
-        case FID_CURRENT_SHEET_VIEW:
         {
             const SfxPoolItem* pItem = nullptr;
-            if (pReqArgs != nullptr && 
pReqArgs->HasItem(FID_CURRENT_SHEET_VIEW, &pItem))
+            if (pReqArgs != nullptr && pReqArgs->HasItem(FN_PARAM_1, &pItem))
             {
                 const sal_Int32 nValue = static_cast<const 
SfxInt32Item*>(pItem)->GetValue();
                 sc::SheetViewID nID(nValue);
@@ -1089,6 +1072,21 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
                     SelectSheetView(nID);
                 }
             }
+            else
+            {
+                ScViewData& rViewData = GetViewData();
+                auto pDialog = 
std::make_shared<sc::SelectSheetViewDialog>(GetFrameWeld(), rViewData);
+                weld::DialogController::runAsync(pDialog, [this, 
pDialog](sal_uInt32 nResult) {
+                    if (RET_OK != nResult)
+                        return;
+
+                    sc::SheetViewID nID = pDialog->getSelectedSheetViewID();
+                    if (nID != sc::InvalidSheetViewID)
+                    {
+                        SelectSheetView(nID);
+                    }
+                });
+            }
             rReq.Done();
         }
         break;
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index edce540ba2da..4e616c9a8cb8 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -411,16 +411,6 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
                     }
                 }
                 break;
-            case FID_CURRENT_SHEET_VIEW:
-                {
-                    // TODO: This is a HACK - Set unique values so we force an 
update to the ToolBar every time
-                    // an invalidation occurs. This probably needs to be 
changed to a custom item or something,
-                    // or do it in another way.
-                    static sal_Int32 n = 0;
-                    rSet.ClearItem(FID_CURRENT_SHEET_VIEW);
-                    rSet.Put(SfxInt32Item(FID_CURRENT_SHEET_VIEW, n++));
-                }
-                break;
             case FID_NORMALVIEWMODE:
             case FID_PAGEBREAKMODE:
                 // always handle both slots - they exclude each other
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index da3a8cedd130..cd7a9a45f377 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -2082,7 +2082,7 @@ void ScViewFunc::SheetViewChanged()
             if (pTabViewShell && pTabViewShell->GetDocId() == nDocID)
             {
                 SfxBindings& rBindings = 
pTabViewShell->GetViewFrame().GetBindings();
-                rBindings.Invalidate(FID_CURRENT_SHEET_VIEW);
+                rBindings.Invalidate(FID_SELECT_SHEET_VIEW);
             }
             pViewShell = SfxViewShell::GetNext(*pViewShell);
         }
diff --git a/sc/uiconfig/scalc/ui/notebookbar_online.ui 
b/sc/uiconfig/scalc/ui/notebookbar_online.ui
index ccabe97190c4..f205e19673a2 100644
--- a/sc/uiconfig/scalc/ui/notebookbar_online.ui
+++ b/sc/uiconfig/scalc/ui/notebookbar_online.ui
@@ -97,7 +97,7 @@
           </packing>
         </child>
         <child>
-          <object class="sfxlo-NotebookbarToolBox" id="CurrentViewToolBox">
+          <object class="sfxlo-NotebookbarToolBox" id="SelectSheetViewToolBox">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="valign">center</property>
@@ -105,9 +105,9 @@
             <property name="toolbar_style">icons</property>
             <property name="show_arrow">False</property>
             <child>
-              <object class="GtkToolButton" id="Home-CurrentSheetView">
+              <object class="GtkToolButton" id="Home-SelectSheetView">
                 <property name="visible">True</property>
-                <property name="action_name">.uno:CurrentSheetView</property>
+                <property name="action_name">.uno:SelectSheetView</property>
               </object>
               <packing>
                 <property name="expand">True</property>

Reply via email to