include/sfx2/sidebar/SidebarController.hxx |   12 +--
 include/sfx2/sidebar/TabBar.hxx            |   23 +-----
 sfx2/source/sidebar/SidebarController.cxx  |   66 +------------------
 sfx2/source/sidebar/TabBar.cxx             |   96 ++++++++++++++++++++---------
 sfx2/source/sidebar/uiobject.cxx           |    2 
 5 files changed, 84 insertions(+), 115 deletions(-)

New commits:
commit 9895117d877cc5bd7ebb27a69e985a0770448427
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Jun 17 14:45:34 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Jun 19 09:24:29 2024 +0200

    tdf#159835 sfx2: Simplify TabBar::OnToolboxClicked
    
    Now that the logic from `SidebarController::PopulatePopupMenus`
    has been moved here in
        Change-Id: I8236f2467239e6a2f485d468656e961478eeb09c
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Mon Jun 17 13:35:12 2024 +0200
    
            tdf#159835 sfx2: Move logic to populate sidebar menus to TabBar
    
    as well, simplify `TabBar::OnToolboxClicked`:
    No longer use one loop to build a vector of entries
    and another to process these, but use a single loop
    for that instead.
    Drop the now unused `DeckMenuData` class.
    
    Change-Id: I884f3b70bb4d85b9a52421e9de6042cda80cfa0b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169006
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169076

diff --git a/include/sfx2/sidebar/TabBar.hxx b/include/sfx2/sidebar/TabBar.hxx
index 54d018aae018..bc2b2a4e4d04 100644
--- a/include/sfx2/sidebar/TabBar.hxx
+++ b/include/sfx2/sidebar/TabBar.hxx
@@ -41,18 +41,6 @@ class TabBar final : public InterimItemWindow
 {
     friend class TabBarUIObject;
 public:
-    /** DeckMenuData has entries for display name, and a flag:
-         - isCurrentDeck for the deck selection data
-         - isEnabled     for the show/hide menu
-    */
-    class DeckMenuData
-    {
-    public:
-        OUString msDisplayName;
-        bool mbIsCurrentDeck;
-        bool mbIsActive;
-        bool mbIsEnabled;
-    };
     typedef ::std::function<void (
             weld::Menu& rMainMenu, weld::Menu& rSubMenu)> 
PopupMenuSignalConnectFunction;
     TabBar (
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index bb5ec5471f9b..d9608e36d49f 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -334,23 +334,6 @@ IMPL_LINK_NOARG(TabBar, OnToolboxClicked, 
weld::Toggleable&, void)
     if (!mxMenuButton->get_active())
         return;
 
-    std::vector<DeckMenuData> aMenuData;
-
-    for (auto const& item : maItems)
-    {
-        std::shared_ptr<DeckDescriptor> xDeckDescriptor = 
mrParentSidebarController.GetResourceManager()->GetDeckDescriptor(item->msDeckId);
-
-        if (!xDeckDescriptor)
-            continue;
-
-        DeckMenuData aData;
-        aData.msDisplayName = xDeckDescriptor->msTitle;
-        aData.mbIsCurrentDeck = 
item->mxButton->get_item_active(u"toggle"_ustr);
-        aData.mbIsActive = !item->mbIsHidden;
-        aData.mbIsEnabled = item->mxButton->get_sensitive();
-        aMenuData.push_back(aData);
-    }
-
     for (int i = mxMainMenu->n_children() - 1; i >= 0; --i)
     {
         OUString sIdent = mxMainMenu->get_id(i);
@@ -367,30 +350,39 @@ IMPL_LINK_NOARG(TabBar, OnToolboxClicked, 
weld::Toggleable&, void)
     // Add one entry for every tool panel element to individually make
     // them visible or hide them.
     sal_Int32 nIndex (0);
-    for (const auto& rItem : aMenuData)
+    for (auto const& rItem : maItems)
     {
+        std::shared_ptr<DeckDescriptor> xDeckDescriptor
+            = 
mrParentSidebarController.GetResourceManager()->GetDeckDescriptor(rItem->msDeckId);
+
+        if (!xDeckDescriptor)
+            continue;
+
+        const OUString sDisplayName = xDeckDescriptor->msTitle;
         OUString sIdent("select" + OUString::number(nIndex));
-        mxMainMenu->insert(nIndex, sIdent, rItem.msDisplayName,
-                     nullptr, nullptr, nullptr, TRISTATE_FALSE);
-        mxMainMenu->set_active(sIdent, rItem.mbIsCurrentDeck);
-        mxMainMenu->set_sensitive(sIdent, rItem.mbIsEnabled && 
rItem.mbIsActive);
+        const bool bCurrentDeck = 
rItem->mxButton->get_item_active(u"toggle"_ustr);
+        const bool bActive = !rItem->mbIsHidden;
+        const bool bEnabled = rItem->mxButton->get_sensitive();
+        mxMainMenu->insert(nIndex, sIdent, sDisplayName, nullptr, nullptr, 
nullptr, TRISTATE_FALSE);
+        mxMainMenu->set_active(sIdent, bCurrentDeck);
+        mxMainMenu->set_sensitive(sIdent, bEnabled && bActive);
 
         if (!comphelper::LibreOfficeKit::isActive())
         {
-            if (rItem.mbIsCurrentDeck)
+            if (bCurrentDeck)
             {
                 // Don't allow the currently visible deck to be disabled.
                 OUString sSubIdent("nocustomize" + OUString::number(nIndex));
-                mxSubMenu->insert(nIndex, sSubIdent, rItem.msDisplayName,
-                                          nullptr, nullptr, nullptr, 
TRISTATE_FALSE);
+                mxSubMenu->insert(nIndex, sSubIdent, sDisplayName, nullptr, 
nullptr, nullptr,
+                                  TRISTATE_FALSE);
                 mxSubMenu->set_active(sSubIdent, true);
             }
             else
             {
                 OUString sSubIdent("customize" + OUString::number(nIndex));
-                mxSubMenu->insert(nIndex, sSubIdent, rItem.msDisplayName,
-                                          nullptr, nullptr, nullptr, 
TRISTATE_TRUE);
-                mxSubMenu->set_active(sSubIdent, rItem.mbIsEnabled && 
rItem.mbIsActive);
+                mxSubMenu->insert(nIndex, sSubIdent, sDisplayName, nullptr, 
nullptr, nullptr,
+                                  TRISTATE_TRUE);
+                mxSubMenu->set_active(sSubIdent, bEnabled && bActive);
             }
         }
 
commit 2e1bfcab2ac61f773ef3fac29ea08396fe3db71d
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Jun 17 13:35:12 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Jun 19 09:24:24 2024 +0200

    tdf#159835 sfx2: Move logic to populate sidebar menus to TabBar
    
    Move the logic to populate the menus from
    `SidebarController::PopulatePopupMenus` (called
    by `SidebarController::ShowPopupMenu`) to
    `TabBar::OnToolboxClicked`. The latter called
    `SidebarController::ShowPopupMenu`.
    (In a first step, take over the existing implementation
    but leave further changes for following commits.)
    
    `TabBar::OnToolboxClicked` already collects all the deck
    data relevant for the menus and the menus are members of that
    class, so it seems more straighforward to populate
    the menus there right away.
    The only information needed from `SidebarController`
    is whether the sidebar is docked or not, so add a
    new method `SidebarController::IsDocked` to retrieve that
    information.
    
    Rename `SidebarController::ShowPopupMenu` to
    `SidebarController::ConnectMenuActivateHandlers` as
    it only connects the signals now, and rename
    `PopupMenuProvider` to `PopupMenuSignalConnectFunction`
    accordingly.
    
    This commit does some refactoring in preparation of
    fixing tdf#159835, no change in behavior intended (yet).
    
    Change-Id: I8236f2467239e6a2f485d468656e961478eeb09c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169005
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169075

diff --git a/include/sfx2/sidebar/SidebarController.hxx 
b/include/sfx2/sidebar/SidebarController.hxx
index 06e092bceec8..63fc4435848f 100644
--- a/include/sfx2/sidebar/SidebarController.hxx
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -113,6 +113,8 @@ public:
     const static sal_Int32 SwitchFlag_ForceNewDeck = 0x02;
     const static sal_Int32 SwitchFlag_ForceNewPanels = 0x02;
 
+    bool IsDocked() const;
+
     void OpenThenSwitchToDeck(std::u16string_view rsDeckId);
     void OpenThenToggleDeck(const OUString& rsDeckId);
 
@@ -251,14 +253,8 @@ private:
         const DeckDescriptor& rDeckDescriptor,
         const Context& rContext);
 
-    void ShowPopupMenu (
-        weld::Menu& rMainMenu,
-        weld::Menu& rSubMenu,
-        const ::std::vector<TabBar::DeckMenuData>& rMenuData) const;
-    void PopulatePopupMenus(
-        weld::Menu& rMainButton,
-        weld::Menu& rSubMenu,
-        const ::std::vector<TabBar::DeckMenuData>& rMenuData) const;
+    void ConnectMenuActivateHandlers(weld::Menu& rMainMenu, weld::Menu& 
rSubMenu) const;
+
     DECL_DLLPRIVATE_LINK(OnMenuItemSelected, const OUString&, void);
     DECL_DLLPRIVATE_LINK(OnSubMenuItemSelected, const OUString&, void);
     void BroadcastPropertyChange();
diff --git a/include/sfx2/sidebar/TabBar.hxx b/include/sfx2/sidebar/TabBar.hxx
index f83ac163604e..54d018aae018 100644
--- a/include/sfx2/sidebar/TabBar.hxx
+++ b/include/sfx2/sidebar/TabBar.hxx
@@ -54,13 +54,12 @@ public:
         bool mbIsEnabled;
     };
     typedef ::std::function<void (
-            weld::Menu& rMainMenu, weld::Menu& rSubMenu,
-            const ::std::vector<DeckMenuData>& rMenuData)> PopupMenuProvider;
+            weld::Menu& rMainMenu, weld::Menu& rSubMenu)> 
PopupMenuSignalConnectFunction;
     TabBar (
         vcl::Window* pParentWindow,
         const css::uno::Reference<css::frame::XFrame>& rxFrame,
         ::std::function<void (const OUString& rsDeckId)> 
aDeckActivationFunctor,
-        PopupMenuProvider aPopupMenuProvider,
+        PopupMenuSignalConnectFunction aPopupMenuSignalConnectFunction,
         SidebarController& rParentSidebarController);
 
     weld::Container* GetContainer() { return m_xContainer.get(); }
@@ -119,7 +118,7 @@ private:
     typedef ::std::vector<std::unique_ptr<Item>> ItemContainer;
     ItemContainer maItems;
     const ::std::function<void (const OUString& rsDeckId)> 
maDeckActivationFunctor;
-    PopupMenuProvider maPopupMenuProvider;
+    PopupMenuSignalConnectFunction maPopupMenuSignalConnectFunction;
 
     void CreateTabItem(weld::Toolbar& rButton, const DeckDescriptor& 
rDeckDescriptor);
     css::uno::Reference<css::graphic::XGraphic> GetItemImage(const 
DeckDescriptor& rDeskDescriptor) const;
diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index 6f65a302a06b..2ebfebe6ab81 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -120,8 +120,7 @@ SidebarController::SidebarController (
               mpParentWindow,
               mxFrame,
               [this](const OUString& rsDeckId) { return 
this->OpenThenToggleDeck(rsDeckId); },
-              [this](weld::Menu& rMainMenu, weld::Menu& rSubMenu,
-                     const ::std::vector<TabBar::DeckMenuData>& rMenuData) { 
return this->ShowPopupMenu(rMainMenu, rSubMenu, rMenuData); },
+              [this](weld::Menu& rMainMenu, weld::Menu& rSubMenu) { return 
this->ConnectMenuActivateHandlers(rMainMenu, rSubMenu); },
               *this)),
       maCurrentContext(OUString(), OUString()),
       maRequestedContext(OUString(), OUString()),
@@ -634,6 +633,8 @@ void collectUIInformation(const OUString& rDeckId)
 
 }
 
+bool SidebarController::IsDocked() const { return 
!mpParentWindow->IsFloatingMode(); }
+
 void SidebarController::OpenThenToggleDeck (
     const OUString& rsDeckId)
 {
@@ -1109,69 +1110,12 @@ IMPL_LINK(SidebarController, WindowEventHandler, 
VclWindowEvent&, rEvent, void)
     }
 }
 
-void SidebarController::ShowPopupMenu(
-    weld::Menu& rMainMenu, weld::Menu& rSubMenu,
-    const ::std::vector<TabBar::DeckMenuData>& rMenuData) const
+void SidebarController::ConnectMenuActivateHandlers(weld::Menu& rMainMenu, 
weld::Menu& rSubMenu) const
 {
-    PopulatePopupMenus(rMainMenu, rSubMenu, rMenuData);
     rMainMenu.connect_activate(LINK(const_cast<SidebarController*>(this), 
SidebarController, OnMenuItemSelected));
     rSubMenu.connect_activate(LINK(const_cast<SidebarController*>(this), 
SidebarController, OnSubMenuItemSelected));
 }
 
-void SidebarController::PopulatePopupMenus(weld::Menu& rMenu, weld::Menu& 
rCustomizationMenu,
-                                           const 
std::vector<TabBar::DeckMenuData>& rMenuData) const
-{
-    // Add one entry for every tool panel element to individually make
-    // them visible or hide them.
-    sal_Int32 nIndex (0);
-    for (const auto& rItem : rMenuData)
-    {
-        OUString sIdent("select" + OUString::number(nIndex));
-        rMenu.insert(nIndex, sIdent, rItem.msDisplayName,
-                     nullptr, nullptr, nullptr, TRISTATE_FALSE);
-        rMenu.set_active(sIdent, rItem.mbIsCurrentDeck);
-        rMenu.set_sensitive(sIdent, rItem.mbIsEnabled && rItem.mbIsActive);
-
-        if (!comphelper::LibreOfficeKit::isActive())
-        {
-            if (rItem.mbIsCurrentDeck)
-            {
-                // Don't allow the currently visible deck to be disabled.
-                OUString sSubIdent("nocustomize" + OUString::number(nIndex));
-                rCustomizationMenu.insert(nIndex, sSubIdent, 
rItem.msDisplayName,
-                                          nullptr, nullptr, nullptr, 
TRISTATE_FALSE);
-                rCustomizationMenu.set_active(sSubIdent, true);
-            }
-            else
-            {
-                OUString sSubIdent("customize" + OUString::number(nIndex));
-                rCustomizationMenu.insert(nIndex, sSubIdent, 
rItem.msDisplayName,
-                                          nullptr, nullptr, nullptr, 
TRISTATE_TRUE);
-                rCustomizationMenu.set_active(sSubIdent, rItem.mbIsEnabled && 
rItem.mbIsActive);
-            }
-        }
-
-        ++nIndex;
-    }
-
-    bool bHideLock = true;
-    bool bHideUnLock = true;
-    // LOK doesn't support docked/undocked; Sidebar is floating but rendered 
docked in browser.
-    if (!comphelper::LibreOfficeKit::isActive())
-    {
-        // Add entry for docking or un-docking the tool panel.
-        if (mpParentWindow->IsFloatingMode())
-            bHideLock = false;
-        else
-            bHideUnLock = false;
-    }
-    rMenu.set_visible(u"locktaskpanel"_ustr, !bHideLock);
-    rMenu.set_visible(u"unlocktaskpanel"_ustr, !bHideUnLock);
-
-    // No Restore or Customize options for LoKit.
-    rMenu.set_visible(u"customization"_ustr, 
!comphelper::LibreOfficeKit::isActive());
-}
-
 IMPL_LINK(SidebarController, OnMenuItemSelected, const OUString&, rCurItemId, 
void)
 {
     if (rCurItemId == "unlocktaskpanel")
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index 8d4dfe6f438f..bb5ec5471f9b 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -47,7 +47,7 @@ namespace sfx2::sidebar {
 TabBar::TabBar(vcl::Window* pParentWindow,
                const Reference<frame::XFrame>& rxFrame,
                std::function<void (const OUString&)> aDeckActivationFunctor,
-               PopupMenuProvider  aPopupMenuProvider,
+               PopupMenuSignalConnectFunction aPopupMenuSignalConnectFunction,
                SidebarController& rParentSidebarController
               )
     : InterimItemWindow(pParentWindow, u"sfx/ui/tabbar.ui"_ustr, 
u"TabBar"_ustr)
@@ -57,7 +57,7 @@ TabBar::TabBar(vcl::Window* pParentWindow,
     , mxContents(mxAuxBuilder->weld_widget(u"TabBarContents"_ustr))
     , mxMeasureBox(mxAuxBuilder->weld_widget(u"measure"_ustr))
     , maDeckActivationFunctor(std::move(aDeckActivationFunctor))
-    , maPopupMenuProvider(std::move(aPopupMenuProvider))
+    , 
maPopupMenuSignalConnectFunction(std::move(aPopupMenuSignalConnectFunction))
     , mrParentSidebarController(rParentSidebarController)
 {
     set_id(u"TabBar"_ustr); // for uitest
@@ -364,7 +364,57 @@ IMPL_LINK_NOARG(TabBar, OnToolboxClicked, 
weld::Toggleable&, void)
             mxSubMenu->remove(sIdent);
     }
 
-    maPopupMenuProvider(*mxMainMenu, *mxSubMenu, aMenuData);
+    // Add one entry for every tool panel element to individually make
+    // them visible or hide them.
+    sal_Int32 nIndex (0);
+    for (const auto& rItem : aMenuData)
+    {
+        OUString sIdent("select" + OUString::number(nIndex));
+        mxMainMenu->insert(nIndex, sIdent, rItem.msDisplayName,
+                     nullptr, nullptr, nullptr, TRISTATE_FALSE);
+        mxMainMenu->set_active(sIdent, rItem.mbIsCurrentDeck);
+        mxMainMenu->set_sensitive(sIdent, rItem.mbIsEnabled && 
rItem.mbIsActive);
+
+        if (!comphelper::LibreOfficeKit::isActive())
+        {
+            if (rItem.mbIsCurrentDeck)
+            {
+                // Don't allow the currently visible deck to be disabled.
+                OUString sSubIdent("nocustomize" + OUString::number(nIndex));
+                mxSubMenu->insert(nIndex, sSubIdent, rItem.msDisplayName,
+                                          nullptr, nullptr, nullptr, 
TRISTATE_FALSE);
+                mxSubMenu->set_active(sSubIdent, true);
+            }
+            else
+            {
+                OUString sSubIdent("customize" + OUString::number(nIndex));
+                mxSubMenu->insert(nIndex, sSubIdent, rItem.msDisplayName,
+                                          nullptr, nullptr, nullptr, 
TRISTATE_TRUE);
+                mxSubMenu->set_active(sSubIdent, rItem.mbIsEnabled && 
rItem.mbIsActive);
+            }
+        }
+
+        ++nIndex;
+    }
+
+    bool bHideLock = true;
+    bool bHideUnLock = true;
+    // LOK doesn't support docked/undocked; Sidebar is floating but rendered 
docked in browser.
+    if (!comphelper::LibreOfficeKit::isActive())
+    {
+        // Add entry for docking or un-docking the tool panel.
+        if (!mrParentSidebarController.IsDocked())
+            bHideLock = false;
+        else
+            bHideUnLock = false;
+    }
+    mxMainMenu->set_visible(u"locktaskpanel"_ustr, !bHideLock);
+    mxMainMenu->set_visible(u"unlocktaskpanel"_ustr, !bHideUnLock);
+
+    // No Restore or Customize options for LoKit.
+    mxMainMenu->set_visible(u"customization"_ustr, 
!comphelper::LibreOfficeKit::isActive());
+
+    maPopupMenuSignalConnectFunction(*mxMainMenu, *mxSubMenu);
 }
 
 void TabBar::EnableMenuButton(const bool bEnable)
commit b701d04976059f26bc0b8bd9f4f01bb1c5e11376
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Jun 17 13:26:18 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Jun 19 09:24:16 2024 +0200

    tdf#159835 sfx2: Use reference instead of pointer
    
    This e.g. makes it clear that this is never null.
    Also use an `m` prefix for the class member.
    
    Change-Id: Ia66245f17e7f0ca9e57750e8606c8ccc1387eb97
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169004
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169074

diff --git a/include/sfx2/sidebar/TabBar.hxx b/include/sfx2/sidebar/TabBar.hxx
index bdaa442c58ef..f83ac163604e 100644
--- a/include/sfx2/sidebar/TabBar.hxx
+++ b/include/sfx2/sidebar/TabBar.hxx
@@ -61,7 +61,7 @@ public:
         const css::uno::Reference<css::frame::XFrame>& rxFrame,
         ::std::function<void (const OUString& rsDeckId)> 
aDeckActivationFunctor,
         PopupMenuProvider aPopupMenuProvider,
-        SidebarController* rParentSidebarController);
+        SidebarController& rParentSidebarController);
 
     weld::Container* GetContainer() { return m_xContainer.get(); }
 
@@ -127,7 +127,7 @@ private:
 
     DECL_LINK(OnToolboxClicked, weld::Toggleable&, void);
 
-    SidebarController* pParentSidebarController;
+    SidebarController& mrParentSidebarController;
 };
 
 
diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index 9d5165abd299..6f65a302a06b 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -122,7 +122,7 @@ SidebarController::SidebarController (
               [this](const OUString& rsDeckId) { return 
this->OpenThenToggleDeck(rsDeckId); },
               [this](weld::Menu& rMainMenu, weld::Menu& rSubMenu,
                      const ::std::vector<TabBar::DeckMenuData>& rMenuData) { 
return this->ShowPopupMenu(rMainMenu, rSubMenu, rMenuData); },
-              this)),
+              *this)),
       maCurrentContext(OUString(), OUString()),
       maRequestedContext(OUString(), OUString()),
       mnRequestedForceFlags(SwitchFlag_NoForce),
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index 44972ad63743..8d4dfe6f438f 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -48,7 +48,7 @@ TabBar::TabBar(vcl::Window* pParentWindow,
                const Reference<frame::XFrame>& rxFrame,
                std::function<void (const OUString&)> aDeckActivationFunctor,
                PopupMenuProvider  aPopupMenuProvider,
-               SidebarController* rParentSidebarController
+               SidebarController& rParentSidebarController
               )
     : InterimItemWindow(pParentWindow, u"sfx/ui/tabbar.ui"_ustr, 
u"TabBar"_ustr)
     , mxFrame(rxFrame)
@@ -58,7 +58,7 @@ TabBar::TabBar(vcl::Window* pParentWindow,
     , mxMeasureBox(mxAuxBuilder->weld_widget(u"measure"_ustr))
     , maDeckActivationFunctor(std::move(aDeckActivationFunctor))
     , maPopupMenuProvider(std::move(aPopupMenuProvider))
-    , pParentSidebarController(rParentSidebarController)
+    , mrParentSidebarController(rParentSidebarController)
 {
     set_id(u"TabBar"_ustr); // for uitest
 
@@ -127,7 +127,7 @@ void TabBar::SetDecks(const 
ResourceManager::DeckContextDescriptorContainer& rDe
     maItems.clear();
     for (auto const& deck : rDecks)
     {
-        std::shared_ptr<DeckDescriptor> xDescriptor = 
pParentSidebarController->GetResourceManager()->GetDeckDescriptor(deck.msId);
+        std::shared_ptr<DeckDescriptor> xDescriptor = 
mrParentSidebarController.GetResourceManager()->GetDeckDescriptor(deck.msId);
         if (xDescriptor == nullptr)
         {
             OSL_ASSERT(xDescriptor!=nullptr);
@@ -153,7 +153,7 @@ void TabBar::UpdateButtonIcons()
 {
     for (auto const& item : maItems)
     {
-        std::shared_ptr<DeckDescriptor> xDeckDescriptor = 
pParentSidebarController->GetResourceManager()->GetDeckDescriptor(item->msDeckId);
+        std::shared_ptr<DeckDescriptor> xDeckDescriptor = 
mrParentSidebarController.GetResourceManager()->GetDeckDescriptor(item->msDeckId);
         if (!xDeckDescriptor)
             continue;
         item->mxButton->set_item_image(u"toggle"_ustr, 
GetItemImage(*xDeckDescriptor));
@@ -287,13 +287,13 @@ void TabBar::ToggleHideFlag (const sal_Int32 nIndex)
 
     maItems[nIndex]->mbIsHidden = ! maItems[nIndex]->mbIsHidden;
 
-    std::shared_ptr<DeckDescriptor> xDeckDescriptor = 
pParentSidebarController->GetResourceManager()->GetDeckDescriptor(maItems[nIndex]->msDeckId);
+    std::shared_ptr<DeckDescriptor> xDeckDescriptor = 
mrParentSidebarController.GetResourceManager()->GetDeckDescriptor(maItems[nIndex]->msDeckId);
     if (xDeckDescriptor)
     {
         xDeckDescriptor->mbIsEnabled = ! maItems[nIndex]->mbIsHidden;
 
         Context aContext;
-        aContext.msApplication = 
pParentSidebarController->GetCurrentContext().msApplication;
+        aContext.msApplication = 
mrParentSidebarController.GetCurrentContext().msApplication;
         // leave aContext.msContext on default 'any' ... this func is used 
only for decks
         // and we don't have context-sensitive decks anyway
 
@@ -309,7 +309,7 @@ void TabBar::RestoreHideFlags()
         if (item->mbIsHidden != item->mbIsHiddenByDefault)
         {
             item->mbIsHidden = item->mbIsHiddenByDefault;
-            std::shared_ptr<DeckDescriptor> xDeckDescriptor = 
pParentSidebarController->GetResourceManager()->GetDeckDescriptor(item->msDeckId);
+            std::shared_ptr<DeckDescriptor> xDeckDescriptor = 
mrParentSidebarController.GetResourceManager()->GetDeckDescriptor(item->msDeckId);
             if (xDeckDescriptor)
                 xDeckDescriptor->mbIsEnabled = !item->mbIsHidden;
 
@@ -338,7 +338,7 @@ IMPL_LINK_NOARG(TabBar, OnToolboxClicked, 
weld::Toggleable&, void)
 
     for (auto const& item : maItems)
     {
-        std::shared_ptr<DeckDescriptor> xDeckDescriptor = 
pParentSidebarController->GetResourceManager()->GetDeckDescriptor(item->msDeckId);
+        std::shared_ptr<DeckDescriptor> xDeckDescriptor = 
mrParentSidebarController.GetResourceManager()->GetDeckDescriptor(item->msDeckId);
 
         if (!xDeckDescriptor)
             continue;
diff --git a/sfx2/source/sidebar/uiobject.cxx b/sfx2/source/sidebar/uiobject.cxx
index 6c0077849f3d..ae3592fa4bce 100644
--- a/sfx2/source/sidebar/uiobject.cxx
+++ b/sfx2/source/sidebar/uiobject.cxx
@@ -40,7 +40,7 @@ void TabBarUIObject::execute(const OUString& rAction, const 
StringMap& rParamete
     if (rAction == "CLICK")
     {
         if (rParameters.find(u"POS"_ustr) != rParameters.end())
-            mxTabBar->pParentSidebarController->OpenThenToggleDeck(
+            mxTabBar->mrParentSidebarController.OpenThenToggleDeck(
                 
mxTabBar->GetDeckIdForIndex(rParameters.find(u"POS"_ustr)->second.toInt32()));
     }
     else

Reply via email to