summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-08-10 16:25:35 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2018-09-19 10:18:18 +0200
commitebcf59eeba6a322dbf6d42e40149e0da135e4a93 (patch)
treee5ea375f207e942fcb5bab7790fe8e8afb25308a
parent4c8d1d2fa99aca14464c1d5f0283c1d0357cfa33 (diff)
sw: IsListeningTo can be const
Change-Id: Ib4ab6e9c68ec95b59d3bb68074ae39c9318076c8
-rw-r--r--sw/inc/calbck.hxx2
-rw-r--r--sw/source/core/attr/calbck.cxx2
-rw-r--r--sw/source/core/layout/pagedesc.cxx6
3 files changed, 5 insertions, 5 deletions
diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 8b029c75fe71..08f9e254829e 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -272,7 +272,7 @@ namespace sw
~WriterMultiListener();
void StartListening(SwModify* pDepend);
void EndListening(SwModify* pDepend);
- bool IsListeningTo(const SwModify* const pDepend);
+ bool IsListeningTo(const SwModify* const pDepend) const;
void EndListeningAll();
};
class ClientIteratorBase : public sw::Ring< ::sw::ClientIteratorBase >
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 1590123c58fa..d0ce0d84f1e2 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -338,7 +338,7 @@ void sw::WriterMultiListener::StartListening(SwModify* pDepend)
}
-bool sw::WriterMultiListener::IsListeningTo(const SwModify* const pBroadcaster)
+bool sw::WriterMultiListener::IsListeningTo(const SwModify* const pBroadcaster) const
{
return std::any_of(m_vDepends.begin(), m_vDepends.end(),
[&pBroadcaster](const ListenerEntry& aListener)
diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx
index 9098e8938fb1..aab5b2c90d78 100644
--- a/sw/source/core/layout/pagedesc.cxx
+++ b/sw/source/core/layout/pagedesc.cxx
@@ -80,7 +80,7 @@ SwPageDesc::SwPageDesc( const SwPageDesc &rCpy )
, m_IsFootnoteInfo( rCpy.GetFootnoteInfo() )
, m_pdList( nullptr )
{
- if(rCpy.m_pTextFormatColl && const_cast<sw::WriterMultiListener*>(&rCpy.m_aDepends)->IsListeningTo(rCpy.m_pTextFormatColl))
+ if (rCpy.m_pTextFormatColl && rCpy.m_aDepends.IsListeningTo(rCpy.m_pTextFormatColl))
{
m_pTextFormatColl = rCpy.m_pTextFormatColl;
m_aDepends.StartListening(const_cast<SwTextFormatColl*>(m_pTextFormatColl));
@@ -96,7 +96,7 @@ SwPageDesc & SwPageDesc::operator = (const SwPageDesc & rSrc)
m_FirstMaster = rSrc.m_FirstMaster;
m_FirstLeft = rSrc.m_FirstLeft;
m_aDepends.EndListeningAll();
- if(rSrc.m_pTextFormatColl && const_cast<sw::WriterMultiListener*>(&rSrc.m_aDepends)->IsListeningTo(rSrc.m_pTextFormatColl))
+ if (rSrc.m_pTextFormatColl && rSrc.m_aDepends.IsListeningTo(rSrc.m_pTextFormatColl))
{
m_pTextFormatColl = rSrc.m_pTextFormatColl;
m_aDepends.StartListening(const_cast<SwTextFormatColl*>(m_pTextFormatColl));
@@ -198,7 +198,7 @@ void SwPageDesc::SetRegisterFormatColl(const SwTextFormatColl* pFormat)
/// retrieve the style for the grid alignment
const SwTextFormatColl* SwPageDesc::GetRegisterFormatColl() const
{
- if(!const_cast<sw::WriterMultiListener*>(&m_aDepends)->IsListeningTo(m_pTextFormatColl))
+ if (!m_aDepends.IsListeningTo(m_pTextFormatColl))
m_pTextFormatColl = nullptr;
return m_pTextFormatColl;
}