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

Bjoern Michaelsen (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 10 23:00:03 UTC 2020


 sw/source/core/doc/DocumentStatisticsManager.cxx |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

New commits:
commit ab9f13a659e73e3bb15f995f8d78fb439b73ae59
Author:     Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
AuthorDate: Tue Mar 10 22:59:38 2020 +0100
Commit:     Björn Michaelsen <bjoern.michaelsen at libreoffice.org>
CommitDate: Tue Mar 10 23:59:31 2020 +0100

    DocumentStatisticsManager: SwIterator no more ...
    
    Change-Id: I179db8fe1762a4931a4752c9c865f8c1e1b4fc4d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90309
    Tested-by: Jenkins
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at libreoffice.org>

diff --git a/sw/source/core/doc/DocumentStatisticsManager.cxx b/sw/source/core/doc/DocumentStatisticsManager.cxx
index e8bef7ca9d25..75e605a4f83d 100644
--- a/sw/source/core/doc/DocumentStatisticsManager.cxx
+++ b/sw/source/core/doc/DocumentStatisticsManager.cxx
@@ -134,15 +134,12 @@ bool DocumentStatisticsManager::IncrementalDocStatCalculate(long nChars, bool bF
     // #i93174#: notes contain paragraphs that are not nodes
     {
         SwFieldType * const pPostits( m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Postit) );
-        SwIterator<SwFormatField,SwFieldType> aIter( *pPostits );
-        for( SwFormatField* pFormatField = aIter.First(); pFormatField;  pFormatField = aIter.Next() )
+        std::vector<SwFormatField*> vFields;
+        pPostits->GatherFields(vFields);
+        for(auto pFormatField : vFields)
         {
-            if (pFormatField->IsFieldInDoc())
-            {
-                SwPostItField const * const pField(
-                    static_cast<SwPostItField const*>(pFormatField->GetField()));
-                mpDocStat->nAllPara += pField->GetNumberOfParagraphs();
-            }
+            const auto pField = static_cast<SwPostItField const*>(pFormatField->GetField());
+            mpDocStat->nAllPara += pField->GetNumberOfParagraphs();
         }
     }
 


More information about the Libreoffice-commits mailing list