From 4839756fcb381e37f7c4cc65e392d772b325c8b4 Mon Sep 17 00:00:00 2001
From: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
Date: Mon, 2 Nov 2020 12:18:46 +0100
Subject: SwFieldType: ModifyNotification no more ...

Change-Id: Idb6c0a6cca5df729037067f6def5594eed2cca19
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105178
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
---
 sw/inc/fldbas.hxx                |  8 ++------
 sw/source/core/fields/fldbas.cxx | 12 ++++++++++++
 sw/source/core/view/viewsh.cxx   | 11 +++--------
 3 files changed, 17 insertions(+), 14 deletions(-)

(limited to 'sw')

diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 68cd955f97c0..82461033fe1b 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -271,7 +271,8 @@ public:
 
     SwFieldIds              Which() const { return m_nWhich; }
 
-    inline  void            UpdateFields() const;
+    void UpdateFields() const;
+    void PrintHiddenPara();
     virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
     SwFormatField* FindFormatForField(const SwField*) const;
     SwFormatField* FindFormatForPostItId(sal_uInt32 nPostItId) const;
@@ -282,11 +283,6 @@ public:
     void GatherFields(std::vector<SwFormatField*>& rvFormatFields, bool bCollectOnlyInDocNodes=true) const;
 };
 
-inline void SwFieldType::UpdateFields() const
-{
-    const_cast<SwFieldType*>(this)->ModifyNotification( nullptr, nullptr );
-}
-
 /** Base class of all fields.
  Type of field is queried via Which.
  Expanded content of field is queried via ExpandField(). */
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index ce63d378f3fd..2a8da69042cb 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -40,6 +40,7 @@
 #include <authfld.hxx>
 #include <calbck.hxx>
 #include <viewsh.hxx>
+#include <hints.hxx>
 
 using namespace ::com::sun::star;
 using namespace nsSwDocInfoSubType;
@@ -144,6 +145,17 @@ void SwFieldType::PutValue( const uno::Any& , sal_uInt16 )
 {
 }
 
+void SwFieldType::UpdateFields() const
+{
+    const_cast<SwFieldType*>(this)->SwClientNotify(*this, sw::LegacyModifyHint(nullptr, nullptr));
+}
+
+void SwFieldType::PrintHiddenPara()
+{
+    const SwMsgPoolItem aHint(RES_HIDDENPARA_PRINT);
+    SwClientNotify(*this, sw::LegacyModifyHint(&aHint, nullptr));
+}
+
 void SwFieldType::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
     std::vector<SwFormatField*> vFields;
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index cac98fffaace..95129e6b90dc 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -940,10 +940,8 @@ void SwViewShell::SetEmptyDbFieldHidesPara(bool bEmptyDbFieldHidesPara)
     GetDoc()->getIDocumentState().SetModified();
     for (auto const & pFieldType : *GetDoc()->getIDocumentFieldsAccess().GetFieldTypes())
     {
-        if (pFieldType->Which() == SwFieldIds::Database)
-        {
-            pFieldType->ModifyNotification(nullptr, nullptr);
-        }
+        if(pFieldType->Which() == SwFieldIds::Database)
+            pFieldType->UpdateFields();
     }
     EndAction();
 }
@@ -2172,10 +2170,7 @@ void SwViewShell::ImplApplyViewOptions( const SwViewOption &rOpt )
         SwHiddenParaFieldType* pFieldType = static_cast<SwHiddenParaFieldType*>(GetDoc()->
                                           getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::HiddenPara));
         if( pFieldType && pFieldType->HasWriterListeners() )
-        {
-            SwMsgPoolItem aHint( RES_HIDDENPARA_PRINT );
-            pFieldType->ModifyNotification( &aHint, nullptr);
-        }
+            pFieldType->PrintHiddenPara();
         bReformat = true;
     }
     if ( !bReformat && mpOpt->IsShowHiddenChar() != rOpt.IsShowHiddenChar() )
-- 
cgit