diff options
author | Noel Grandin <noel@peralex.com> | 2015-09-17 13:53:42 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-09-17 14:41:58 +0200 |
commit | dbd4c01975adf306932766adcba0ecbb9d6a6e1b (patch) | |
tree | f0df61308ca58df74f51b1d53c9a40a5d48581e8 /sd | |
parent | 118dd2fba2038891d06381e9cda0396e661e60ac (diff) |
convert Link<> to typed
Change-Id: If1544b0e38500d11e18ca99725f9533a29b2beb7
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/sidebar/MasterPageContainer.cxx | 24 | ||||
-rw-r--r-- | sd/source/ui/sidebar/MasterPageContainer.hxx | 5 | ||||
-rw-r--r-- | sd/source/ui/sidebar/MasterPagesSelector.cxx | 10 | ||||
-rw-r--r-- | sd/source/ui/sidebar/MasterPagesSelector.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx | 36 | ||||
-rw-r--r-- | sd/source/ui/sidebar/RecentlyUsedMasterPages.hxx | 2 |
6 files changed, 38 insertions, 41 deletions
diff --git a/sd/source/ui/sidebar/MasterPageContainer.cxx b/sd/source/ui/sidebar/MasterPageContainer.cxx index 82ad5b50c774..2b55982f3e04 100644 --- a/sd/source/ui/sidebar/MasterPageContainer.cxx +++ b/sd/source/ui/sidebar/MasterPageContainer.cxx @@ -84,8 +84,8 @@ public: static ::boost::shared_ptr<Implementation> Instance(); void LateInit(); - void AddChangeListener (const Link<>& rLink); - void RemoveChangeListener (const Link<>& rLink); + void AddChangeListener (const Link<MasterPageContainerChangeEvent&,void>& rLink); + void RemoveChangeListener (const Link<MasterPageContainerChangeEvent&,void>& rLink); void UpdatePreviewSizePixel(); Size GetPreviewSizePixel (PreviewSize eSize) const; @@ -158,7 +158,7 @@ private: Image maLargePreviewNotAvailable; Image maSmallPreviewNotAvailable; - ::std::vector<Link<>> maChangeListeners; + ::std::vector<Link<MasterPageContainerChangeEvent&,void>> maChangeListeners; // We have to remember the tasks for initialization and filling in case // a MasterPageContainer object is destroyed before these tasks have @@ -228,12 +228,12 @@ MasterPageContainer::~MasterPageContainer() { } -void MasterPageContainer::AddChangeListener (const Link<>& rLink) +void MasterPageContainer::AddChangeListener (const Link<MasterPageContainerChangeEvent&,void>& rLink) { mpImpl->AddChangeListener(rLink); } -void MasterPageContainer::RemoveChangeListener (const Link<>& rLink) +void MasterPageContainer::RemoveChangeListener (const Link<MasterPageContainerChangeEvent&,void>& rLink) { mpImpl->RemoveChangeListener(rLink); } @@ -548,22 +548,22 @@ void MasterPageContainer::Implementation::LateInit() } } -void MasterPageContainer::Implementation::AddChangeListener (const Link<>& rLink) +void MasterPageContainer::Implementation::AddChangeListener (const Link<MasterPageContainerChangeEvent&,void>& rLink) { const ::osl::MutexGuard aGuard (maMutex); - ::std::vector<Link<>>::iterator iListener ( + ::std::vector<Link<MasterPageContainerChangeEvent&,void>>::iterator iListener ( ::std::find(maChangeListeners.begin(),maChangeListeners.end(),rLink)); if (iListener == maChangeListeners.end()) maChangeListeners.push_back(rLink); } -void MasterPageContainer::Implementation::RemoveChangeListener (const Link<>& rLink) +void MasterPageContainer::Implementation::RemoveChangeListener (const Link<MasterPageContainerChangeEvent&,void>& rLink) { const ::osl::MutexGuard aGuard (maMutex); - ::std::vector<Link<>>::iterator iListener ( + ::std::vector<Link<MasterPageContainerChangeEvent&,void>>::iterator iListener ( ::std::find(maChangeListeners.begin(),maChangeListeners.end(),rLink)); if (iListener != maChangeListeners.end()) maChangeListeners.erase(iListener); @@ -957,13 +957,13 @@ void MasterPageContainer::Implementation::FireContainerChange ( } else { - ::std::vector<Link<>> aCopy(maChangeListeners.begin(),maChangeListeners.end()); - ::std::vector<Link<>>::iterator iListener; + ::std::vector<Link<MasterPageContainerChangeEvent&,void>> aCopy(maChangeListeners.begin(),maChangeListeners.end()); + ::std::vector<Link<MasterPageContainerChangeEvent&,void>>::iterator iListener; MasterPageContainerChangeEvent aEvent; aEvent.meEventType = eType; aEvent.maChildToken = aToken; for (iListener=aCopy.begin(); iListener!=aCopy.end(); ++iListener) - iListener->Call(&aEvent); + iListener->Call(aEvent); } } diff --git a/sd/source/ui/sidebar/MasterPageContainer.hxx b/sd/source/ui/sidebar/MasterPageContainer.hxx index 9b28bef0e152..d1f27b9a1b21 100644 --- a/sd/source/ui/sidebar/MasterPageContainer.hxx +++ b/sd/source/ui/sidebar/MasterPageContainer.hxx @@ -36,6 +36,7 @@ class SdPage; namespace sd { namespace sidebar { class MasterPageDescriptor; +class MasterPageContainerChangeEvent; /** This container manages the master pages used by the MasterPagesSelector controls. It uses internally a singleton implementation object. @@ -61,8 +62,8 @@ public: MasterPageContainer(); virtual ~MasterPageContainer(); - void AddChangeListener (const Link<>& rLink); - void RemoveChangeListener (const Link<>& rLink); + void AddChangeListener (const Link<MasterPageContainerChangeEvent&,void>& rLink); + void RemoveChangeListener (const Link<MasterPageContainerChangeEvent&,void>& rLink); enum PreviewSize { SMALL, LARGE }; /** There are two different preview sizes, a small one and a large one. diff --git a/sd/source/ui/sidebar/MasterPagesSelector.cxx b/sd/source/ui/sidebar/MasterPagesSelector.cxx index 716fc9ef4495..34af3591ced7 100644 --- a/sd/source/ui/sidebar/MasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/MasterPagesSelector.cxx @@ -98,7 +98,7 @@ MasterPagesSelector::MasterPagesSelector ( SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground)); SetColor(sfx2::sidebar::Theme::GetColor(sfx2::sidebar::Theme::Paint_PanelBackground)); - Link<> aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener)); + Link<MasterPageContainerChangeEvent&,void> aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener)); mpContainer->AddChangeListener(aChangeListener); } @@ -112,7 +112,7 @@ void MasterPagesSelector::dispose() Clear(); UpdateLocks(ItemList()); - Link<> aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener)); + Link<MasterPageContainerChangeEvent&,void> aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener)); mpContainer->RemoveChangeListener(aChangeListener); PreviewValueSet::dispose(); } @@ -330,11 +330,9 @@ void MasterPagesSelector::ExecuteCommand (const sal_Int32 nCommandId) } } -IMPL_LINK(MasterPagesSelector, ContainerChangeListener, MasterPageContainerChangeEvent*, pEvent) +IMPL_LINK_TYPED(MasterPagesSelector, ContainerChangeListener, MasterPageContainerChangeEvent&, rEvent, void) { - if (pEvent) - NotifyContainerChangeEvent(*pEvent); - return 0; + NotifyContainerChangeEvent(rEvent); } SdPage* MasterPagesSelector::GetSelectedMasterPage() diff --git a/sd/source/ui/sidebar/MasterPagesSelector.hxx b/sd/source/ui/sidebar/MasterPagesSelector.hxx index df32909486d6..8cd93cbe55d0 100644 --- a/sd/source/ui/sidebar/MasterPagesSelector.hxx +++ b/sd/source/ui/sidebar/MasterPagesSelector.hxx @@ -194,7 +194,7 @@ private: DECL_LINK_TYPED(ClickHandler, ValueSet*, void); DECL_LINK(RightClickHandler, MouseEvent*); DECL_LINK(ContextMenuCallback, CommandEvent*); - DECL_LINK(ContainerChangeListener, MasterPageContainerChangeEvent*); + DECL_LINK_TYPED(ContainerChangeListener, MasterPageContainerChangeEvent&, void); DECL_LINK_TYPED(OnMenuItemSelected, Menu*, bool); void SetItem ( diff --git a/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx b/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx index 89900189fed6..53d9fe7f41f9 100644 --- a/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx +++ b/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx @@ -96,7 +96,7 @@ RecentlyUsedMasterPages::RecentlyUsedMasterPages() RecentlyUsedMasterPages::~RecentlyUsedMasterPages() { - Link<> aLink (LINK(this,RecentlyUsedMasterPages,MasterPageContainerChangeListener)); + Link<MasterPageContainerChangeEvent&,void> aLink (LINK(this,RecentlyUsedMasterPages,MasterPageContainerChangeListener)); mpContainer->RemoveChangeListener(aLink); MasterPageObserver::Instance().RemoveEventListener( @@ -105,7 +105,7 @@ RecentlyUsedMasterPages::~RecentlyUsedMasterPages() void RecentlyUsedMasterPages::LateInit() { - Link<> aLink (LINK(this,RecentlyUsedMasterPages,MasterPageContainerChangeListener)); + Link<MasterPageContainerChangeEvent&,void> aLink (LINK(this,RecentlyUsedMasterPages,MasterPageContainerChangeListener)); mpContainer->AddChangeListener(aLink); LoadPersistentValues (); @@ -302,24 +302,22 @@ IMPL_LINK(RecentlyUsedMasterPages, MasterPageChangeListener, return 0; } -IMPL_LINK(RecentlyUsedMasterPages, MasterPageContainerChangeListener, - MasterPageContainerChangeEvent*, pEvent) +IMPL_LINK_TYPED(RecentlyUsedMasterPages, MasterPageContainerChangeListener, + MasterPageContainerChangeEvent&, rEvent, void) { - if (pEvent != NULL) - switch (pEvent->meEventType) - { - case MasterPageContainerChangeEvent::CHILD_ADDED: - case MasterPageContainerChangeEvent::CHILD_REMOVED: - case MasterPageContainerChangeEvent::INDEX_CHANGED: - case MasterPageContainerChangeEvent::INDEXES_CHANGED: - ResolveList(); - break; - - default: - // Ignored. - break; - } - return 0; + switch (rEvent.meEventType) + { + case MasterPageContainerChangeEvent::CHILD_ADDED: + case MasterPageContainerChangeEvent::CHILD_REMOVED: + case MasterPageContainerChangeEvent::INDEX_CHANGED: + case MasterPageContainerChangeEvent::INDEXES_CHANGED: + ResolveList(); + break; + + default: + // Ignored. + break; + } } void RecentlyUsedMasterPages::AddMasterPage ( diff --git a/sd/source/ui/sidebar/RecentlyUsedMasterPages.hxx b/sd/source/ui/sidebar/RecentlyUsedMasterPages.hxx index c4da8a3986e3..47bdf836a8e9 100644 --- a/sd/source/ui/sidebar/RecentlyUsedMasterPages.hxx +++ b/sd/source/ui/sidebar/RecentlyUsedMasterPages.hxx @@ -104,7 +104,7 @@ private: void SendEvent(); DECL_LINK(MasterPageChangeListener, MasterPageObserverEvent*); - DECL_LINK(MasterPageContainerChangeListener, MasterPageContainerChangeEvent*); + DECL_LINK_TYPED(MasterPageContainerChangeListener, MasterPageContainerChangeEvent&, void); /** Add a descriptor for the specified master page to the end of the list of most recently used master pages. When the page is already a |