[Libreoffice-commits] core.git: sw/source

Bjoern Michaelsen (via logerrit) logerrit at kemper.freedesktop.org
Sat Nov 21 15:24:00 UTC 2020


 sw/source/core/edit/edfld.cxx     |   10 ++--------
 sw/source/core/fields/ddetbl.cxx  |    6 +++++-
 sw/source/core/txtnode/atrfld.cxx |    6 ++++--
 3 files changed, 11 insertions(+), 11 deletions(-)

New commits:
commit 30b69db070131190454342ce57c25383edf36f04
Author:     Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
AuthorDate: Fri Nov 20 01:30:23 2020 +0100
Commit:     Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
CommitDate: Sat Nov 21 16:23:13 2020 +0100

    SwEditShell: remove SwIterator hack
    
    Change-Id: I27facf6490241e6978c848f80acb8e07d7b91144
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106210
    Tested-by: Jenkins
    Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>

diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index a897232adcd7..c83f442b7160 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -130,14 +130,8 @@ void SwEditShell::FieldToText( SwFieldType const * pType )
     StartUndo( SwUndoId::DELETE );
     Push();
     SwPaM* pPaM = GetCursor();
-    // TODO: this is really hackish
-    SwFieldHint aHint(pPaM, GetLayout());
-    SwIterator<SwClient,SwFieldType> aIter(*pType);
-    for( SwClient* pClient = aIter.First(); pClient; pClient = aIter.Next() )
-    {
-        pPaM->DeleteMark();
-        pClient->SwClientNotifyCall( *pType, aHint );
-    }
+    const SwFieldHint aHint(pPaM, GetLayout());
+    CallSwClientNotify(aHint);
 
     Pop(PopMode::DeleteCurrent);
     EndAllAction();
diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx
index 5e7f3f7e5023..53f6c2c3f7e7 100644
--- a/sw/source/core/fields/ddetbl.cxx
+++ b/sw/source/core/fields/ddetbl.cxx
@@ -31,6 +31,7 @@
 #include <swtblfmt.hxx>
 #include <fieldhint.hxx>
 #include <osl/diagnose.h>
+#include <pam.hxx>
 
 /// Ctor moves all lines/boxes from a SwTable into itself.
 /// Afterwards the SwTable is empty and must be deleted.
@@ -92,9 +93,12 @@ void SwDDETable::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
 void SwDDETable::SwClientNotify( const SwModify& rModify, const SfxHint& rHint )
 {
     SwClient::SwClientNotify(rModify, rHint);
-    if(dynamic_cast<const SwFieldHint*>(&rHint))
+    if(auto pFieldHint = dynamic_cast<const SwFieldHint*>(&rHint))
+    {
+        pFieldHint->m_pPaM->DeleteMark(); // TODO: this is really hackish
         // replace DDETable by real table
         NoDDETable();
+    }
     else if(const auto pLinkAnchorHint = dynamic_cast<const sw::LinkAnchorSearchHint*>(&rHint))
     {
         if(pLinkAnchorHint->m_rpFoundNode)
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index 23363c6f3e3b..aa4dab94b8e5 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -224,11 +224,13 @@ void SwFormatField::SwClientNotify( const SwModify& rModify, const SfxHint& rHin
     SwClient::SwClientNotify(rModify, rHint);
     if (const auto pFieldHint = dynamic_cast<const SwFieldHint*>( &rHint ))
     {
+        // replace field content by text
+        SwPaM* pPaM = pFieldHint->m_pPaM;
+        pPaM->DeleteMark(); // TODO: this is really hackish
+
         if( !mpTextField )
             return;
 
-        // replace field content by text
-        SwPaM* pPaM = pFieldHint->m_pPaM;
         SwDoc& rDoc = pPaM->GetDoc();
         const SwTextNode& rTextNode = mpTextField->GetTextNode();
         pPaM->GetPoint()->nNode = rTextNode;


More information about the Libreoffice-commits mailing list