include/sfx2/viewsh.hxx | 3 - sd/source/ui/framework/configuration/Configuration.cxx | 17 +++------- sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx | 11 ++---- sd/source/ui/framework/tools/FrameworkHelper.cxx | 13 +++---- sd/source/ui/inc/framework/FrameworkHelper.hxx | 6 +-- sfx2/source/view/viewsh.cxx | 2 - 6 files changed, 22 insertions(+), 30 deletions(-)
New commits: commit 400e5755eac7529622f3b09bdd9336b3145366b2 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Thu Sep 13 22:12:00 2018 -0400 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Sep 3 13:36:59 2019 +0200 sd: modernize some loops (cherry picked from commit beb738eb8688ddaf133a0832328073e3e2b78757) (cherry picked from commit 808359e4def4f9dd1318c7d0330a14eacda7d02c) Change-Id: Ic86960ce2f690bebc51c9120053bdd50232f0358 Reviewed-on: https://gerrit.libreoffice.org/78433 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> diff --git a/sd/source/ui/framework/configuration/Configuration.cxx b/sd/source/ui/framework/configuration/Configuration.cxx index 1d9639c611b1..7200e26d1cc6 100644 --- a/sd/source/ui/framework/configuration/Configuration.cxx +++ b/sd/source/ui/framework/configuration/Configuration.cxx @@ -133,16 +133,13 @@ Sequence<Reference<XResourceId> > SAL_CALL Configuration::getResources ( ::osl::MutexGuard aGuard (maMutex); ThrowIfDisposed(); - bool bFilterResources (!rsResourceURLPrefix.isEmpty()); + const bool bFilterResources (!rsResourceURLPrefix.isEmpty()); // Collect the matching resources in a vector. ::std::vector<Reference<XResourceId> > aResources; - ResourceContainer::const_iterator iResource; - for (iResource=mpResourceContainer->begin(); - iResource!=mpResourceContainer->end(); - ++iResource) + for (const auto& resource : *mpResourceContainer) { - if ( ! (*iResource)->isBoundTo(rxAnchorId,eMode)) + if (!resource->isBoundTo(rxAnchorId, eMode)) continue; if (bFilterResources) @@ -151,19 +148,17 @@ Sequence<Reference<XResourceId> > SAL_CALL Configuration::getResources ( // Make sure that the resource is bound directly to the anchor. if (eMode != AnchorBindingMode_DIRECT - && ! (*iResource)->isBoundTo(rxAnchorId, AnchorBindingMode_DIRECT)) + && !resource->isBoundTo(rxAnchorId, AnchorBindingMode_DIRECT)) { continue; } // Make sure that the resource URL matches the given prefix. - if ( ! (*iResource)->getResourceURL().match(rsResourceURLPrefix)) - { + if (!resource->getResourceURL().match(rsResourceURLPrefix)) continue; - } } - aResources.push_back(*iResource); + aResources.emplace_back(resource); } return comphelper::containerToSequence(aResources); diff --git a/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx b/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx index 32e67427ee58..6bf7bfdec769 100644 --- a/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx @@ -84,20 +84,19 @@ void ConfigurationControllerBroadcaster::NotifyListeners ( // for every listener. ConfigurationChangeEvent aEvent (rEvent); - ListenerList::const_iterator iListener; - for (iListener=rList.begin(); iListener!=rList.end(); ++iListener) + for (const ListenerDescriptor& listener : rList) { try { - aEvent.UserData = iListener->maUserData; - iListener->mxListener->notifyConfigurationChange(aEvent); + aEvent.UserData = listener.maUserData; + listener.mxListener->notifyConfigurationChange(aEvent); } catch (const lang::DisposedException& rException) { // When the exception comes from the listener itself then // unregister it. - if (rException.Context == iListener->mxListener) - RemoveListener(iListener->mxListener); + if (rException.Context == listener.mxListener) + RemoveListener(listener.mxListener); } catch (const RuntimeException&) { diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx index b5bcee227e43..48cb57bbb7d0 100644 --- a/sd/source/ui/framework/tools/FrameworkHelper.cxx +++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx @@ -756,11 +756,10 @@ OUString FrameworkHelper::ResourceIdToString (const Reference<XResourceId>& rxRe sString.append(rxResourceId->getResourceURL()); if (rxResourceId->hasAnchor()) { - Sequence<OUString> aAnchorURLs (rxResourceId->getAnchorURLs()); - for (sal_Int32 nIndex=0; nIndex < aAnchorURLs.getLength(); ++nIndex) + for (const OUString& s : rxResourceId->getAnchorURLs()) { sString.append(" | "); - sString.append(aAnchorURLs[nIndex]); + sString.append(s); } } } commit e204fcf3e2e675de4c429b8453cb4a9abcb46dd9 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Sat Aug 4 23:38:44 2018 -0400 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Sep 3 13:36:37 2019 +0200 ViewShellBase const correctness Change-Id: I00bffe23f2f850f5e0cbf63a60aa1600f848edac (cherry picked from commit 4e6e33870a60a796c17c1e2d67ac6482b853ad28) (cherry picked from commit e1143d75eea07bdcd1e13d99a6015c1fc32bfb60) Reviewed-on: https://gerrit.libreoffice.org/78432 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index cb185bb7b058..0f6915d8a9c0 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -281,8 +281,7 @@ public: void SetNewWindowAllowed( bool bSet ) { bNoNewWindow = !bSet; } void SetController( SfxBaseController* pController ); - css::uno::Reference< css::frame::XController > - GetController(); + css::uno::Reference<css::frame::XController> GetController() const; bool TryContextMenuInterception( Menu& rIn, const OUString& rMenuIdentifier, VclPtr<Menu>& rpOut, css::ui::ContextMenuExecuteEvent aEvent ); bool TryContextMenuInterception( Menu& rMenu, const OUString& rMenuIdentifier, css::ui::ContextMenuExecuteEvent aEvent ); diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx index fb1c2acf35f0..b5bcee227e43 100644 --- a/sd/source/ui/framework/tools/FrameworkHelper.cxx +++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx @@ -88,7 +88,7 @@ public: callback is destroyed. */ CallbackCaller ( - ::sd::ViewShellBase& rBase, + const ::sd::ViewShellBase& rBase, const OUString& rsEventType, const ::sd::framework::FrameworkHelper::ConfigurationChangeEventFilter& rFilter, const ::sd::framework::FrameworkHelper::Callback& rCallback); @@ -347,7 +347,7 @@ FrameworkHelper::InstanceMap FrameworkHelper::maInstanceMap; return pHelper; } -void FrameworkHelper::DisposeInstance (ViewShellBase& rBase) +void FrameworkHelper::DisposeInstance (const ViewShellBase& rBase) { InstanceMap::iterator iHelper (maInstanceMap.find(&rBase)); if (iHelper != maInstanceMap.end()) @@ -356,7 +356,7 @@ void FrameworkHelper::DisposeInstance (ViewShellBase& rBase) } } -void FrameworkHelper::ReleaseInstance (ViewShellBase& rBase) +void FrameworkHelper::ReleaseInstance (const ViewShellBase& rBase) { InstanceMap::iterator iHelper (maInstanceMap.find(&rBase)); if (iHelper != maInstanceMap.end()) @@ -834,7 +834,7 @@ namespace { //===== CallbackCaller ======================================================== CallbackCaller::CallbackCaller ( - ::sd::ViewShellBase& rBase, + const ::sd::ViewShellBase& rBase, const OUString& rsEventType, const ::sd::framework::FrameworkHelper::ConfigurationChangeEventFilter& rFilter, const ::sd::framework::FrameworkHelper::Callback& rCallback) diff --git a/sd/source/ui/inc/framework/FrameworkHelper.hxx b/sd/source/ui/inc/framework/FrameworkHelper.hxx index f4e44fab22db..20d7d0c9149a 100644 --- a/sd/source/ui/inc/framework/FrameworkHelper.hxx +++ b/sd/source/ui/inc/framework/FrameworkHelper.hxx @@ -114,14 +114,14 @@ public: Do not call this method. It is an internally used method that can not be made private. */ - static void DisposeInstance (ViewShellBase& rBase); + static void DisposeInstance (const ViewShellBase& rBase); /** Destroy the FrameworkHelper object for the given ViewShellBase. Do not call this method. It is an internally used method that can not be made private. */ - static void ReleaseInstance (ViewShellBase& rBase); + static void ReleaseInstance (const ViewShellBase& rBase); /** Return an identifier for the given view URL. This identifier can be used in a switch statement. See GetViewURL() for a mapping in the @@ -299,7 +299,7 @@ public: private: typedef ::std::map< - ViewShellBase*, + const ViewShellBase*, ::std::shared_ptr<FrameworkHelper> > InstanceMap; /** The instance map holds (at least) one FrameworkHelper instance for every ViewShellBase object. diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index d3826d29d7ad..e7e61f40ec83 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1762,7 +1762,7 @@ void SfxViewShell::SetController( SfxBaseController* pController ) pImpl->xClipboardListener = new SfxClipboardChangeListener( this, GetClipboardNotifier() ); } -Reference < XController > SfxViewShell::GetController() +Reference < XController > SfxViewShell::GetController() const { return pImpl->m_pController.get(); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits