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

Bjoern Michaelsen (via logerrit) logerrit at kemper.freedesktop.org
Sun Feb 9 19:06:35 UTC 2020


 sw/source/core/fields/tblcalc.cxx |   10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

New commits:
commit dc7c73988a6b73298314922d7a4c74ad6c1e518f
Author:     Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
AuthorDate: Sat Feb 8 18:07:00 2020 +0100
Commit:     Björn Michaelsen <bjoern.michaelsen at libreoffice.org>
CommitDate: Sun Feb 9 20:06:02 2020 +0100

    Simplify SwTableField::GetNodeOfFormula()
    
    ... by using the new SwFormatType::FindFormatForField()
    
    Change-Id: If0492ca04ed836d89bcfcc56572859ba04e084b2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88273
    Tested-by: Jenkins
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at libreoffice.org>

diff --git a/sw/source/core/fields/tblcalc.cxx b/sw/source/core/fields/tblcalc.cxx
index a289c3a84430..c93d04a5c4bd 100644
--- a/sw/source/core/fields/tblcalc.cxx
+++ b/sw/source/core/fields/tblcalc.cxx
@@ -80,14 +80,8 @@ OUString SwTableField::GetFieldName() const
 /// search TextNode containing this field
 const SwNode* SwTableField::GetNodeOfFormula() const
 {
-    if( !GetTyp()->HasWriterListeners() )
-        return nullptr;
-
-    SwIterator<SwFormatField,SwFieldType> aIter( *GetTyp() );
-    for( SwFormatField* pFormatField = aIter.First(); pFormatField; pFormatField = aIter.Next() )
-            if( this == pFormatField->GetField() )
-                return &pFormatField->GetTextField()->GetTextNode();
-    return nullptr;
+    auto pFormat = GetTyp()->FindFormatForField(this);
+    return pFormat ? &pFormat->GetTextField()->GetTextNode() : nullptr;
 }
 
 OUString SwTableField::GetCommand()


More information about the Libreoffice-commits mailing list