diff options
author | Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org> | 2020-02-16 12:54:36 +0100 |
---|---|---|
committer | Björn Michaelsen <bjoern.michaelsen@libreoffice.org> | 2020-02-16 18:12:01 +0100 |
commit | fbe8f2dc3b8a5734df0643c37a1f854f7eb84023 (patch) | |
tree | 16307956f7d662c67968486b0ef44049f70712da /sw | |
parent | ee51edf70e7f64d4d42aeb2ac0470da306bd875f (diff) |
no more SwIterator in GatherChapterFields
Change-Id: Iab5e210199948b2fbe9cca2f2ff6a36341a6c1c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88780
Tested-by: Jenkins
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/fldbas.hxx | 3 | ||||
-rw-r--r-- | sw/inc/fmtfld.hxx | 5 | ||||
-rw-r--r-- | sw/source/core/fields/fldbas.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/txtnode/atrfld.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 10 |
5 files changed, 18 insertions, 9 deletions
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx index 93012dc5458b..8601dea443b8 100644 --- a/sw/inc/fldbas.hxx +++ b/sw/inc/fldbas.hxx @@ -22,6 +22,8 @@ #include <i18nlangtag/lang.h> #include "swdllapi.h" #include "calbck.hxx" +#include "ndindex.hxx" + #include <cppuhelper/weakref.hxx> #include <editeng/svxenum.hxx> #include <vector> @@ -274,6 +276,7 @@ public: SwFormatField* FindFormatForPostItId(sal_uInt32 nPostItId) const; void CollectPostIts(std::vector<SwFormatField*>& rvFormatFields, IDocumentRedlineAccess const& rIDRA, bool HideRedlines); bool HasHiddenInformationNotes(); + void GatherNodeIndex(std::vector<sal_uLong>& rvNodeIndex); }; inline void SwFieldType::UpdateFields() const diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx index b2e6a6bf1508..e68a9be41582 100644 --- a/sw/inc/fmtfld.hxx +++ b/sw/inc/fmtfld.hxx @@ -26,6 +26,7 @@ #include "swdllapi.h" #include "calbck.hxx" +#include "ndindex.hxx" class SwField; class SwTextField; @@ -56,6 +57,10 @@ namespace sw { bool& m_rbHasHiddenInformationNotes; HasHiddenInformationNotesHint(bool& rbHasHiddenInformationNotes) : m_rbHasHiddenInformationNotes(rbHasHiddenInformationNotes) {}; }; + struct GatherNodeIndexHint final : SfxHint { + std::vector<sal_uLong>& m_rvNodeIndex; + GatherNodeIndexHint(std::vector<sal_uLong>& rvNodeIndex) : m_rvNodeIndex(rvNodeIndex) {}; + }; } diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx index b17d07fd4171..a56b2c81302b 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -180,6 +180,11 @@ bool SwFieldType::HasHiddenInformationNotes() return bHasHiddenInformationNotes; } +void SwFieldType::GatherNodeIndex(std::vector<sal_uLong>& rvNodeIndex) +{ + CallSwClientNotify(sw::GatherNodeIndexHint(rvNodeIndex)); +} + void SwFieldTypes::dumpAsXml(xmlTextWriterPtr pWriter) const { xmlTextWriterStartElement(pWriter, BAD_CAST("SwFieldTypes")); diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index 67ec2b0992f2..88b67c451b94 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -262,6 +262,10 @@ void SwFormatField::SwClientNotify( const SwModify& rModify, const SfxHint& rHin { if(!pHasHiddenInfoHint->m_rbHasHiddenInformationNotes && GetTextField() && IsFieldInDoc()) pHasHiddenInfoHint->m_rbHasHiddenInformationNotes = true; + } else if (const auto pGatherNodeIndexHint = dynamic_cast<const sw::GatherNodeIndexHint*>( &rHint )) + { + if(auto pTextField = GetTextField()) + pGatherNodeIndexHint->m_rvNodeIndex.push_back(pTextField->GetTextNode().GetIndex()); } } diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 96c7ebe0f50c..38181c2d69b8 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -355,15 +355,7 @@ void MSWordExportBase::GatherChapterFields() { //If the header/footer contains a chapter field SwFieldType* pType = m_pDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Chapter ); - SwIterator<SwFormatField,SwFieldType> aFormatFields( *pType ); - for ( SwFormatField* pField = aFormatFields.First(); pField; pField = aFormatFields.Next() ) - { - if (const SwTextField *pTextField = pField->GetTextField()) - { - const SwTextNode &rTextNode = pTextField->GetTextNode(); - m_aChapterFieldLocs.push_back(rTextNode.GetIndex()); - } - } + pType->GatherNodeIndex(m_aChapterFieldLocs); } bool MSWordExportBase::ContentContainsChapterField(const SwFormatContent &rContent) const |