summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2018-02-07 03:02:15 +0100
committerBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2018-02-07 03:02:15 +0100
commitec0fb10bc8cb01020bf407a342c4a4bf3d1ac2ec (patch)
tree745524da34b87b7b7c488863d8ea569fd854fdf4
parent72dc2ba421322aeabb272c1303334270d24f4dfb (diff)
SwEndNote
Change-Id: Id9137ef44a0f24e4614267a5b811b8b25192ff8a
-rw-r--r--sw/inc/ftninfo.hxx3
-rw-r--r--sw/source/core/attr/calbck.cxx3
-rw-r--r--sw/source/core/doc/docftn.cxx16
3 files changed, 16 insertions, 6 deletions
diff --git a/sw/inc/ftninfo.hxx b/sw/inc/ftninfo.hxx
index d798a4517770..adbc7a7e9499 100644
--- a/sw/inc/ftninfo.hxx
+++ b/sw/inc/ftninfo.hxx
@@ -33,6 +33,7 @@ class SwDoc;
class SW_DLLPUBLIC SwEndNoteInfo : public SwClient
{
mutable SwMultiDepend aDepends;
+ mutable SwTextFormatColl* pTextFormatColl;
mutable SwPageDesc* pPageDesc;
mutable SwCharFormat* pCharFormat;
mutable SwCharFormat* pAnchorFormat;
@@ -52,7 +53,7 @@ public:
bool DependsOn(const SwPageDesc*) const;
void SetFootnoteTextColl(SwTextFormatColl& rColl);
- SwTextFormatColl* GetFootnoteTextColl() const { return const_cast<SwTextFormatColl*>(static_cast<const SwTextFormatColl*>(GetRegisteredIn())); } // can be 0.
+ SwTextFormatColl* GetFootnoteTextColl() const { return pTextFormatColl; } // can be 0.
SwCharFormat* GetCharFormat(SwDoc &rDoc) const;
void SetCharFormat( SwCharFormat* );
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 53baf82662df..908a480f9fcd 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -45,9 +45,10 @@ std::unique_ptr<sw::ModifyChangedHint> SwClient::CheckRegistration( const SfxPoo
return nullptr;
const SwPtrMsgPoolItem* pDead = static_cast<const SwPtrMsgPoolItem*>(pOld);
+ assert(pDead);
if(!pDead || pDead->pObject != m_pRegisteredIn)
{
- assert(false); // we should only received death notes from objects we are following
+ // we should only care received death notes from objects we are following
return nullptr;
}
// I've got a notification from the object I know
diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx
index fcd383c3bc8e..d39d399f4274 100644
--- a/sw/source/core/doc/docftn.cxx
+++ b/sw/source/core/doc/docftn.cxx
@@ -39,11 +39,12 @@
SwEndNoteInfo& SwEndNoteInfo::operator=(const SwEndNoteInfo& rInfo)
{
- StartListeningToSameModifyAs(rInfo);
+ pTextFormatColl = rInfo.pTextFormatColl;
pPageDesc = rInfo.pPageDesc;
pCharFormat = rInfo.pCharFormat;
pAnchorFormat = rInfo.pAnchorFormat;
aDepends.EndListeningAll();
+ aDepends.StartListening(pTextFormatColl);
aDepends.StartListening(pPageDesc);
aDepends.StartListening(pCharFormat);
aDepends.StartListening(pAnchorFormat);
@@ -59,10 +60,10 @@ SwEndNoteInfo& SwEndNoteInfo::operator=(const SwEndNoteInfo& rInfo)
bool SwEndNoteInfo::operator==( const SwEndNoteInfo& rInfo ) const
{
return
+ pTextFormatColl == rInfo.pTextFormatColl &&
pPageDesc == rInfo.pPageDesc &&
pCharFormat == rInfo.pCharFormat &&
pAnchorFormat == rInfo.pAnchorFormat &&
- GetFootnoteTextColl() == rInfo.GetFootnoteTextColl() &&
aFormat.GetNumberingType() == rInfo.aFormat.GetNumberingType() &&
nFootnoteOffset == rInfo.nFootnoteOffset &&
m_bEndNote == rInfo.m_bEndNote &&
@@ -71,8 +72,9 @@ bool SwEndNoteInfo::operator==( const SwEndNoteInfo& rInfo ) const
}
SwEndNoteInfo::SwEndNoteInfo(const SwEndNoteInfo& rInfo) :
- SwClient( rInfo.GetFootnoteTextColl() ),
+ SwClient(nullptr),
aDepends(*this),
+ pTextFormatColl(rInfo.pTextFormatColl),
pPageDesc(rInfo.pPageDesc),
pCharFormat(rInfo.pCharFormat),
pAnchorFormat(rInfo.pAnchorFormat),
@@ -82,6 +84,7 @@ SwEndNoteInfo::SwEndNoteInfo(const SwEndNoteInfo& rInfo) :
aFormat( rInfo.aFormat ),
nFootnoteOffset( rInfo.nFootnoteOffset )
{
+ aDepends.StartListening(pTextFormatColl);
aDepends.StartListening(pPageDesc);
aDepends.StartListening(pCharFormat);
aDepends.StartListening(pAnchorFormat);
@@ -90,6 +93,7 @@ SwEndNoteInfo::SwEndNoteInfo(const SwEndNoteInfo& rInfo) :
SwEndNoteInfo::SwEndNoteInfo() :
SwClient(nullptr),
aDepends(*this),
+ pTextFormatColl(nullptr),
pPageDesc(nullptr),
pCharFormat(nullptr),
pAnchorFormat(nullptr),
@@ -129,7 +133,9 @@ void SwEndNoteInfo::ChgPageDesc(SwPageDesc* pDesc)
void SwEndNoteInfo::SetFootnoteTextColl(SwTextFormatColl& rFormat)
{
- rFormat.Add(this);
+ aDepends.EndListening(pTextFormatColl);
+ pTextFormatColl = &rFormat;
+ aDepends.StartListening(pTextFormatColl);
}
SwCharFormat* SwEndNoteInfo::GetCharFormat(SwDoc &rDoc) const
@@ -205,6 +211,8 @@ void SwEndNoteInfo::SwClientNotify( const SwModify& rModify, const SfxHint& rHin
pAnchorFormat = const_cast<SwCharFormat*>(static_cast<const SwCharFormat*>(pModifyChangedHint->m_pNew));
else if(pPageDesc == &rModify)
pPageDesc = const_cast<SwPageDesc*>(static_cast<const SwPageDesc*>(pModifyChangedHint->m_pNew));
+ else if(pTextFormatColl == &rModify)
+ pTextFormatColl = const_cast<SwTextFormatColl*>(static_cast<const SwTextFormatColl*>(pModifyChangedHint->m_pNew));
}
}