[Libreoffice-commits] core.git: sw/inc sw/source
Bjoern Michaelsen (via logerrit)
logerrit at kemper.freedesktop.org
Sun Feb 16 13:11:40 UTC 2020
sw/inc/fldbas.hxx | 1 +
sw/inc/fmtfld.hxx | 4 ++++
sw/source/core/fields/fldbas.cxx | 7 +++++++
sw/source/core/txtnode/atrfld.cxx | 4 ++++
sw/source/uibase/app/docsh.cxx | 17 ++---------------
5 files changed, 18 insertions(+), 15 deletions(-)
New commits:
commit 79d0f67f01f75bf80e80a814ff3397fcf7dd1599
Author: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
AuthorDate: Mon Feb 10 07:51:17 2020 +0100
Commit: Björn Michaelsen <bjoern.michaelsen at libreoffice.org>
CommitDate: Sun Feb 16 14:10:56 2020 +0100
no more SwIterator in HasHiddenInformationNotes
Change-Id: Ic2a4340972ad29305dadc56a33081a211cc0205b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88758
Reviewed-by: Björn Michaelsen <bjoern.michaelsen at libreoffice.org>
Tested-by: Björn Michaelsen <bjoern.michaelsen at libreoffice.org>
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 0b7367a24509..93012dc5458b 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -273,6 +273,7 @@ public:
SwFormatField* FindFormatForField(const SwField*) const;
SwFormatField* FindFormatForPostItId(sal_uInt32 nPostItId) const;
void CollectPostIts(std::vector<SwFormatField*>& rvFormatFields, IDocumentRedlineAccess const& rIDRA, bool HideRedlines);
+ bool HasHiddenInformationNotes();
};
inline void SwFieldType::UpdateFields() const
diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx
index 812bc7403209..b2e6a6bf1508 100644
--- a/sw/inc/fmtfld.hxx
+++ b/sw/inc/fmtfld.hxx
@@ -52,6 +52,10 @@ namespace sw {
const bool m_bHideRedlines;
CollectPostItsHint(std::vector<SwFormatField*>& rvFormatFields, IDocumentRedlineAccess const& rIDRA, bool bHideRedlines) : m_rvFormatFields(rvFormatFields), m_rIDRA(rIDRA), m_bHideRedlines(bHideRedlines) {};
};
+ struct HasHiddenInformationNotesHint final : SfxHint {
+ bool& m_rbHasHiddenInformationNotes;
+ HasHiddenInformationNotesHint(bool& rbHasHiddenInformationNotes) : m_rbHasHiddenInformationNotes(rbHasHiddenInformationNotes) {};
+ };
}
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index b2345906496d..b17d07fd4171 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -173,6 +173,13 @@ void SwFieldType::CollectPostIts(std::vector<SwFormatField*>& rvFormatFields, ID
CallSwClientNotify(sw::CollectPostItsHint(rvFormatFields, rIDRA, bHideRedlines));
}
+bool SwFieldType::HasHiddenInformationNotes()
+{
+ bool bHasHiddenInformationNotes = false;
+ CallSwClientNotify(sw::HasHiddenInformationNotesHint(bHasHiddenInformationNotes));
+ return bHasHiddenInformationNotes;
+}
+
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 6042ad99b931..67ec2b0992f2 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -258,6 +258,10 @@ void SwFormatField::SwClientNotify( const SwModify& rModify, const SfxHint& rHin
{
if(GetTextField() && IsFieldInDoc() && (!pCollectPostItsHint->m_bHideRedlines || !sw::IsFieldDeletedInModel(pCollectPostItsHint->m_rIDRA, *GetTextField())))
pCollectPostItsHint->m_rvFormatFields.push_back(this);
+ } else if (const auto pHasHiddenInfoHint = dynamic_cast<const sw::HasHiddenInformationNotesHint*>( &rHint ))
+ {
+ if(!pHasHiddenInfoHint->m_rbHasHiddenInformationNotes && GetTextField() && IsFieldInDoc())
+ pHasHiddenInfoHint->m_rbHasHiddenInformationNotes = true;
}
}
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index 758419a2b899..a8e80a688e58 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -953,21 +953,8 @@ HiddenInformation SwDocShell::GetHiddenInformationState( HiddenInformation nStat
if ( nStates & HiddenInformation::NOTES )
{
OSL_ENSURE( GetWrtShell(), "No SwWrtShell, no information" );
- if ( GetWrtShell() )
- {
- SwFieldType* pType = GetWrtShell()->GetFieldType(SwFieldIds::Postit, OUString());
- SwIterator<SwFormatField,SwFieldType> aIter( *pType );
- SwFormatField* pFirst = aIter.First();
- while( pFirst )
- {
- if( pFirst->GetTextField() && pFirst->IsFieldInDoc() )
- {
- nState |= HiddenInformation::NOTES;
- break;
- }
- pFirst = aIter.Next();
- }
- }
+ if(GetWrtShell() && GetWrtShell()->GetFieldType(SwFieldIds::Postit, OUString())->HasHiddenInformationNotes())
+ nState |= HiddenInformation::NOTES;
}
return nState;
More information about the Libreoffice-commits
mailing list