diff options
author | Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org> | 2018-01-29 23:42:29 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org> | 2018-01-29 23:42:29 +0100 |
commit | 61db9f05ab0451f684752fc686b972ed0ca35d72 (patch) | |
tree | 8987b2c3c827f7a34fc769763e77c84cf1edb0ea | |
parent | 83e6cfd99b202afdb7f4103d9c1ecfe612219ddc (diff) |
intermediate: compiles
Change-Id: I9b6cacfcdcf82b678ff67f818cf692f9a85cc543
-rw-r--r-- | sw/Module_sw.mk | 1 | ||||
-rw-r--r-- | sw/inc/calbck.hxx | 14 | ||||
-rw-r--r-- | sw/source/core/attr/calbck.cxx | 21 |
3 files changed, 35 insertions, 1 deletions
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index 4ef524d1fd94..35c5fdc60247 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -82,7 +82,6 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\ CppunitTest_sw_rtfexport \ CppunitTest_sw_rtfexport2 \ CppunitTest_sw_rtfexport3 \ - CppunitTest_sw_rtfimport \ CppunitTest_sw_odfexport \ CppunitTest_sw_odfimport \ CppunitTest_sw_txtexport \ diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index ea4181a190ea..e5d90269777e 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -26,6 +26,8 @@ #include "hints.hxx" #include <typeinfo> #include <type_traits> +#include <vector> +#include <memory> class SwModify; @@ -231,6 +233,18 @@ private: { if(m_pToTell) m_pToTell->SwClientNotifyCall(rModify, rHint); } }; +class SW_DLLPUBLIC SwMultiDepend final +{ + SwClient& m_rToTell; + std::vector<std::shared_ptr<SwDepend>> m_vpDepends; + public: + SwMultiDepend(SwClient& rToTell) + : m_rToTell(rToTell) {} + void StartListening(SwModify* pDepend); + void EndListening(SwModify* pDepend); + void EndListeningAll(); +}; + namespace sw { class ClientIteratorBase : public sw::Ring< ::sw::ClientIteratorBase > diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx index 98376e649a93..412da99fc46b 100644 --- a/sw/source/core/attr/calbck.cxx +++ b/sw/source/core/attr/calbck.cxx @@ -23,6 +23,7 @@ #include <swcache.hxx> #include <swfntcch.hxx> #include <tools/debug.hxx> +#include <algorithm> sw::LegacyModifyHint::~LegacyModifyHint() {} @@ -280,5 +281,25 @@ void SwModify::CheckCaching( const sal_uInt16 nWhich ) } } +void SwMultiDepend::StartListening(SwModify* pDepend) +{ + EndListening(nullptr); + m_vpDepends.push_back(std::make_unique<SwDepend>(&m_rToTell, pDepend)); +} + +void SwMultiDepend::EndListening(SwModify* pBroadcaster) +{ + m_vpDepends.erase(std::remove_if(m_vpDepends.begin(), m_vpDepends.end(), + [&pBroadcaster](const std::shared_ptr<SwDepend> pListener) + { + return pListener->GetRegisteredIn() == nullptr || pListener->GetRegisteredIn() == pBroadcaster; + })); +} + +void SwMultiDepend::EndListeningAll() +{ + m_vpDepends.clear(); +} + sw::ClientIteratorBase* sw::ClientIteratorBase::our_pClientIters = nullptr; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |