officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu |    5 
 sc/Library_sc.mk                                                  |    2 
 sc/UIConfig_scalc.mk                                              |    1 
 sc/inc/SheetViewControl.hxx                                       |   32 +++
 sc/inc/sc.hrc                                                     |    2 
 sc/sdi/scalc.sdi                                                  |   21 +
 sc/sdi/tabvwsh.sdi                                                |    1 
 sc/source/ui/app/scdll.cxx                                        |    2 
 sc/source/ui/cctrl/SheetViewBox.cxx                               |  106 
++++++++++
 sc/source/ui/cctrl/SheetViewControl.cxx                           |   63 +++++
 sc/source/ui/inc/SheetViewBox.hxx                                 |   36 +++
 sc/source/ui/inc/viewdata.hxx                                     |    4 
 sc/source/ui/view/tabview3.cxx                                    |    2 
 sc/source/ui/view/tabvwsh3.cxx                                    |   15 +
 sc/source/ui/view/tabvwsha.cxx                                    |    6 
 sc/source/ui/view/viewdata.cxx                                    |    4 
 sc/source/ui/view/viewfun3.cxx                                    |   10 
 sc/uiconfig/scalc/ui/notebookbar_online.ui                        |   27 ++
 sc/uiconfig/scalc/ui/sheetviewbox.ui                              |   28 ++
 vcl/jsdialog/enabled.cxx                                          |    1 
 20 files changed, 361 insertions(+), 7 deletions(-)

New commits:
commit 8ce68da7503eab59a50c89713824f9d0a2a95ee0
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Wed Oct 22 16:06:00 2025 +0900
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Sun Oct 26 05:08:31 2025 +0100

    sc: Toolbar / NotebookBar combobox for selecting sheet views
    
    Introduced CurrentSheetView command that handles reading and
    setting the sheet view for the current sheet. In addition under
    the same command, the toolbar / (online) notebookbar combobox to
    show and set the combobox is available, so it can be added to the
    toolbar.
    
    Change-Id: I7910ac0590ca2b2349496e91fdf61e70c297d651
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192797
    Reviewed-by: Szymon Kłos <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192966
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <[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 3dcb94e9369e..7d3e943b92a3 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -35,6 +35,11 @@
           <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/Library_sc.mk b/sc/Library_sc.mk
index 7a4c6a34cc14..eb705ac493db 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -404,6 +404,8 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
     sc/source/ui/cctrl/checklistmenu \
     sc/source/ui/cctrl/dpcontrol \
     sc/source/ui/cctrl/tbzoomsliderctrl \
+    sc/source/ui/cctrl/SheetViewBox \
+    sc/source/ui/cctrl/SheetViewControl \
     sc/source/ui/condformat/condformatdlg \
     sc/source/ui/condformat/condformatdlgentry \
     sc/source/ui/condformat/condformatdlgdata \
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 6b4026af9734..e1e03bb2f099 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -239,6 +239,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
        sc/uiconfig/scalc/ui/sharedfooterdialog \
        sc/uiconfig/scalc/ui/sharedheaderdialog \
        sc/uiconfig/scalc/ui/sharedwarningdialog \
+       sc/uiconfig/scalc/ui/sheetviewbox \
        sc/uiconfig/scalc/ui/showchangesdialog \
        sc/uiconfig/scalc/ui/showdetaildialog \
        sc/uiconfig/scalc/ui/showsheetdialog \
diff --git a/sc/inc/SheetViewControl.hxx b/sc/inc/SheetViewControl.hxx
new file mode 100644
index 000000000000..878c10680685
--- /dev/null
+++ b/sc/inc/SheetViewControl.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sfx2/tbxctrl.hxx>
+
+namespace sc
+{
+/** Toolbox control for showing the SheetViewBox in the toolbar / notebookbar 
*/
+class SheetViewControl final : public SfxToolBoxControl
+{
+public:
+    SFX_DECL_TOOLBOX_CONTROL();
+
+    SheetViewControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rToolBox);
+    virtual ~SheetViewControl() override;
+
+    virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState 
eState,
+                                              const SfxPoolItem* pState) 
override;
+    virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) 
override;
+};
+
+} // end of namespace sc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 51e78553ae2b..629289aef0bf 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -291,6 +291,8 @@ class SvxZoomSliderItem;
 #define FID_SWITCH_TO_PREVIOUS_SHEET_VIEW (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)
+
 
 #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 ebab09fef7fc..2ccbae38b739 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -6049,6 +6049,23 @@ 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 */
@@ -6134,8 +6151,8 @@ SfxBoolItem SelectSheetView FID_SELECT_SHEET_VIEW
 
     /* config */
     AccelConfig = TRUE,
-    MenuConfig = FALSE,
-    ToolBoxConfig = FALSE,
+    MenuConfig = TRUE,
+    ToolBoxConfig = TRUE,
     GroupId = SfxGroupId::View
 ]
 
diff --git a/sc/sdi/tabvwsh.sdi b/sc/sdi/tabvwsh.sdi
index 753e606b8bec..cae6da0dfb4f 100644
--- a/sc/sdi/tabvwsh.sdi
+++ b/sc/sdi/tabvwsh.sdi
@@ -213,6 +213,7 @@ interface TableEditView
     FID_SWITCH_TO_PREVIOUS_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 f581ad886bfd..24980df11a36 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -72,6 +72,7 @@
 #include <svx/formatpaintbrushctrl.hxx>
 #include <tbzoomsliderctrl.hxx>
 #include <svx/zoomsliderctrl.hxx>
+#include <SheetViewControl.hxx>
 
 #include <svx/xmlsecctrl.hxx>
 // Child windows
@@ -148,6 +149,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);
 
     SvxGrafModeToolBoxControl       ::RegisterControl(SID_ATTR_GRAF_MODE,      
 pMod);
     SvxGrafRedToolBoxControl        ::RegisterControl(SID_ATTR_GRAF_RED,       
 pMod);
diff --git a/sc/source/ui/cctrl/SheetViewBox.cxx 
b/sc/source/ui/cctrl/SheetViewBox.cxx
new file mode 100644
index 000000000000..222d03681be1
--- /dev/null
+++ b/sc/source/ui/cctrl/SheetViewBox.cxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <SheetViewBox.hxx>
+
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/viewsh.hxx>
+#include <svl/intitem.hxx>
+#include <svl/itemset.hxx>
+
+#include <globstr.hrc>
+#include <scresid.hxx>
+#include <sc.hrc>
+#include <docsh.hxx>
+#include <viewdata.hxx>
+
+#include <SheetViewManager.hxx>
+#include <SheetView.hxx>
+#include <SheetViewTypes.hxx>
+
+SheetViewBox::SheetViewBox(vcl::Window* pParent)
+    : InterimItemWindow(pParent, u"modules/scalc/ui/sheetviewbox.ui"_ustr, 
u"SheetViewBox"_ustr,
+                        true, 
reinterpret_cast<sal_uInt64>(SfxViewShell::Current()))
+    , m_xWidget(m_xBuilder->weld_combo_box(u"sheetview_combobox"_ustr))
+{
+    m_xWidget->connect_changed(LINK(this, SheetViewBox, SelectHdl));
+    m_xWidget->connect_key_press(LINK(this, SheetViewBox, KeyInputHdl));
+    SetSizePixel(m_xWidget->get_preferred_size());
+}
+
+void SheetViewBox::dispose()
+{
+    m_xWidget.reset();
+    InterimItemWindow::dispose();
+}
+
+SheetViewBox::~SheetViewBox() { disposeOnce(); }
+
+void SheetViewBox::GetFocus()
+{
+    if (m_xWidget)
+        m_xWidget->grab_focus();
+    InterimItemWindow::GetFocus();
+}
+
+void SheetViewBox::Update(sc::SheetViewID nSelectedID)
+{
+    ScViewData* pViewData = ScDocShell::GetViewData();
+    if (!pViewData)
+        return;
+
+    m_xWidget->clear();
+    m_xWidget->freeze();
+
+    OUString sActiveID = OUString::number(sc::DefaultSheetViewID);
+    m_xWidget->append(sActiveID, sc::SheetViewManager::defaultViewName());
+
+    auto pSheetManager = pViewData->GetCurrentSheetViewManager();
+
+    if (pSheetManager)
+    {
+        sc::SheetViewID nSheetViewID = 0;
+        for (auto const& pSheetView : pSheetManager->getSheetViews())
+        {
+            if (pSheetView)
+            {
+                OUString sID = OUString::number(nSheetViewID);
+                if (nSheetViewID == nSelectedID)
+                    sActiveID = sID;
+                m_xWidget->append(sID, pSheetView->GetName());
+            }
+            nSheetViewID++;
+        }
+    }
+    m_xWidget->thaw();
+
+    m_xWidget->set_active_id(sActiveID);
+}
+
+IMPL_STATIC_LINK(SheetViewBox, SelectHdl, weld::ComboBox&, rComboBox, void)
+{
+    auto* pViewFrame = SfxViewFrame::Current();
+    if (!pViewFrame)
+        return;
+
+    SfxDispatcher* pDispatcher = pViewFrame->GetBindings().GetDispatcher();
+    if (!pDispatcher)
+        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 });
+
+    pViewFrame->GetWindow().GrabFocus();
+}
+
+IMPL_LINK(SheetViewBox, KeyInputHdl, const KeyEvent&, rKEvt, bool) { return 
ChildKeyInput(rKEvt); }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/cctrl/SheetViewControl.cxx 
b/sc/source/ui/cctrl/SheetViewControl.cxx
new file mode 100644
index 000000000000..cd0a8e5e92a8
--- /dev/null
+++ b/sc/source/ui/cctrl/SheetViewControl.cxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <SheetViewControl.hxx>
+#include <SheetViewBox.hxx>
+#include <svl/intitem.hxx>
+#include <vcl/toolbox.hxx>
+
+using namespace sc;
+
+SFX_IMPL_TOOLBOX_CONTROL(SheetViewControl, SfxInt32Item);
+
+SheetViewControl::SheetViewControl(sal_uInt16 nSlotId, ToolBoxItemId nId, 
ToolBox& rTbx)
+    : SfxToolBoxControl(nSlotId, nId, rTbx)
+{
+}
+
+SheetViewControl::~SheetViewControl() {}
+
+void SheetViewControl::StateChangedAtToolBoxControl(sal_uInt16, SfxItemState 
eState,
+                                                    const SfxPoolItem* pState)
+{
+    ToolBoxItemId nId = GetId();
+    ToolBox& rToolBox = GetToolBox();
+    SheetViewBox* pSheetViewBox = 
static_cast<SheetViewBox*>(rToolBox.GetItemWindow(nId));
+
+    if (SfxItemState::DISABLED == eState)
+        pSheetViewBox->Disable();
+    else
+        pSheetViewBox->Enable();
+
+    rToolBox.EnableItem(nId, SfxItemState::DISABLED != eState);
+
+    switch (eState)
+    {
+        case SfxItemState::DEFAULT:
+        {
+            const auto* pItem = static_cast<const SfxInt32Item*>(pState);
+            sc::SheetViewID nValue = pItem->GetValue();
+            pSheetViewBox->Update(nValue);
+            break;
+        }
+
+        default:
+            break;
+    }
+}
+
+VclPtr<InterimItemWindow> SheetViewControl::CreateItemWindow(vcl::Window* 
pParent)
+{
+    VclPtr<SheetViewBox> pControl = VclPtr<SheetViewBox>::Create(pParent);
+    pControl->Show();
+
+    return pControl;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/SheetViewBox.hxx 
b/sc/source/ui/inc/SheetViewBox.hxx
new file mode 100644
index 000000000000..95a39c7571dc
--- /dev/null
+++ b/sc/source/ui/inc/SheetViewBox.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <vcl/InterimItemWindow.hxx>
+#include <SheetViewTypes.hxx>
+
+/** Box / container for the combobox for showing / selecting the sheet view */
+class SheetViewBox final : public InterimItemWindow
+{
+public:
+    explicit SheetViewBox(vcl::Window* pParent);
+    virtual void dispose() override;
+    virtual ~SheetViewBox() override;
+
+    virtual void GetFocus() override;
+
+    void Update(sc::SheetViewID nID);
+
+    weld::ComboBox* getWidget() { return m_xWidget.get(); }
+
+private:
+    std::unique_ptr<weld::ComboBox> m_xWidget;
+
+    DECL_STATIC_LINK(SheetViewBox, SelectHdl, weld::ComboBox&, void);
+    DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 1eaa197682ef..0aa378dc73cd 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -28,6 +28,8 @@
 #include <memory>
 #include <o3tl/typed_flags_set.hxx>
 
+namespace sc { class SheetViewManager; }
+
 constexpr auto SC_SIZE_NONE = std::numeric_limits<tools::Long>::max();
 
 enum class ScFillMode
@@ -420,6 +422,8 @@ public:
 
     sc::SheetViewID GetSheetViewIDForSheet(SCTAB nTab) const;
 
+    std::shared_ptr<sc::SheetViewManager> GetCurrentSheetViewManager() const;
+
     SCCOL           MaxCol() const                          { return 
mrDoc.MaxCol(); }
     SCROW           MaxRow() const                          { return 
mrDoc.MaxRow(); }
     ScSplitPos      GetActivePart() const                   { return 
pThisTab->eWhichActive; }
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 765acf0b715e..8fd45f493c68 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2126,6 +2126,8 @@ 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);
+
     if (pScMod->IsRefDialogOpen())
     {
         sal_uInt16 nCurRefDlgId=pScMod->GetCurRefDlgId();
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 7c3b3fc6a536..8c0b51b0c8e6 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -1080,6 +1080,21 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
             rReq.Done();
         }
         break;
+        case FID_CURRENT_SHEET_VIEW:
+        {
+            const SfxPoolItem* pItem = nullptr;
+            if (pReqArgs != nullptr && 
pReqArgs->HasItem(FID_CURRENT_SHEET_VIEW, &pItem))
+            {
+                const sal_Int32 nValue = static_cast<const 
SfxInt32Item*>(pItem)->GetValue();
+                sc::SheetViewID nID(nValue);
+                if (nID != sc::InvalidSheetViewID)
+                {
+                    SelectSheetView(nID);
+                }
+            }
+            rReq.Done();
+        }
+        break;
 
         case SID_ATTR_ZOOM: // status row
         case FID_SCALE:
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 3463000eb212..8f22f8c8acf1 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -412,7 +412,11 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
                     }
                 }
                 break;
-
+            case FID_CURRENT_SHEET_VIEW:
+                {
+                    rSet.Put(SfxInt32Item(FID_CURRENT_SHEET_VIEW, 
GetViewData().GetSheetViewID()));
+                }
+                break;
             case FID_NORMALVIEWMODE:
             case FID_PAGEBREAKMODE:
                 // always handle both slots - they exclude each other
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 909df42d53c2..cc625749ad04 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -4465,5 +4465,9 @@ sc::SheetViewID ScViewData::GetSheetViewIDForSheet(SCTAB 
nTab) const
     return maTabData[nTab]->mnSheetViewID;
 }
 
+std::shared_ptr<sc::SheetViewManager> ScViewData::GetCurrentSheetViewManager() 
const
+{
+    return GetDocument().GetSheetViewManager(GetTabNumber());
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index e15906bba1d9..af92ca4c2b68 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -67,7 +67,8 @@
 #include <uiitems.hxx>
 #include <com/sun/star/util/XCloneable.hpp>
 #include <sfx2/lokhelper.hxx>
-
+#include <sc.hrc>
+#include <sfx2/bindings.hxx>
 
 using namespace com::sun::star;
 
@@ -2065,8 +2066,9 @@ void ScViewFunc::DataFormPutData( SCROW nCurrentRow ,
 
 void ScViewFunc::SheetViewChanged()
 {
-    ScDocShell& rDocSh = GetViewData().GetDocShell();
-    ScDocument& rDocument = GetViewData().GetDocument();
+    ScViewData& rViewData = GetViewData();
+    ScDocShell& rDocSh = rViewData.GetDocShell();
+    ScDocument& rDocument = rViewData.GetDocument();
     rDocSh.PostPaint(0, 0, 0, rDocument.MaxCol(), rDocument.MaxRow(), MAXTAB, 
PaintPartFlags::All);
 
     if (ScTabViewShell* pViewShell = GetViewData().GetViewShell())
@@ -2074,6 +2076,8 @@ void ScViewFunc::SheetViewChanged()
         ScModelObj* pModel = 
comphelper::getFromUnoTunnel<ScModelObj>(pViewShell->GetCurrentDocument());
         SfxLokHelper::notifyViewRenderState(pViewShell, pModel);
     }
+    SfxBindings& rBindings = rViewData.GetBindings();
+    rBindings.Invalidate(FID_CURRENT_SHEET_VIEW);
 }
 
 void ScViewFunc::MakeNewSheetView()
diff --git a/sc/uiconfig/scalc/ui/notebookbar_online.ui 
b/sc/uiconfig/scalc/ui/notebookbar_online.ui
index 34c72a531b22..3b4ce81df5dd 100644
--- a/sc/uiconfig/scalc/ui/notebookbar_online.ui
+++ b/sc/uiconfig/scalc/ui/notebookbar_online.ui
@@ -94,7 +94,32 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="position">0</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="CurrentViewToolBox">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="valign">center</property>
+            <property name="hexpand">True</property>
+            <property name="toolbar_style">icons</property>
+            <property name="show_arrow">False</property>
+            <child>
+              <object class="GtkToolButton" id="Home-CurrentSheetView">
+                <property name="visible">True</property>
+                <property name="action_name">.uno:CurrentSheetView</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">3</property>
           </packing>
         </child>
       </object>
diff --git a/sc/uiconfig/scalc/ui/sheetviewbox.ui 
b/sc/uiconfig/scalc/ui/sheetviewbox.ui
new file mode 100644
index 000000000000..2197a9004009
--- /dev/null
+++ b/sc/uiconfig/scalc/ui/sheetviewbox.ui
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.40.0 -->
+<interface domain="sc">
+  <requires lib="gtk+" version="3.20"/>
+  <object class="GtkBox" id="SheetViewBox">
+    <property name="visible">True</property>
+    <property name="can-focus">False</property>
+    <property name="hexpand">True</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkComboBoxText" id="sheetview_combobox">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="hexpand">True</property>
+        <child internal-child="accessible">
+          <object class="AtkObject" id="sheetview_combobox-atkobject">
+            <property name="AtkObject::accessible-name" translatable="yes" 
context="sheetviewbox|sheetview_combobox|accessible_name">Sheet View</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index ab391b38f073..6cbc3e21cc8e 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -472,6 +472,7 @@ constexpr auto NavigatorList
 constexpr auto NotebookbarList
     = frozen::make_unordered_set<std::u16string_view>({
         { u"modules/scalc/ui/numberbox.ui" },
+        { u"modules/scalc/ui/sheetviewbox.ui" },
         { u"svx/ui/fontnamebox.ui" },
         { u"svx/ui/fontsizebox.ui" },
         { u"svx/ui/stylespreview.ui" },

Reply via email to