diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-06-17 13:26:18 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-06-18 05:26:26 +0200 |
commit | 8a10012039204b208aea3bc2f9da9fe1162c4a2a (patch) | |
tree | 04bf69b8d75008c65546486e81411886447382d7 /sfx2/source/sidebar | |
parent | c39e4f6b8a942680bc7250177c34fd034a0605e0 (diff) |
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.weghorn@posteo.de>
Diffstat (limited to 'sfx2/source/sidebar')
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/sidebar/TabBar.cxx | 16 | ||||
-rw-r--r-- | sfx2/source/sidebar/uiobject.cxx | 2 |
3 files changed, 10 insertions, 10 deletions
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 |