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

Serge Krot Serge.Krot at cib.de
Thu May 17 12:26:35 UTC 2018


 sw/source/core/doc/DocumentFieldsManager.cxx |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 27c9370b5fd00b851582e4163907656286e8c581
Author: Serge Krot <Serge.Krot at cib.de>
Date:   Wed May 16 13:58:59 2018 +0200

    tdf#117668 Fix wrong number of sections in document
    
    Change-Id: Ia2b8a1376f4f2b4e790598255ae69fb6ee92d23d
    Reviewed-on: https://gerrit.libreoffice.org/54423
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx
index 1ca77504320d..f6bd75d036a4 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -908,11 +908,17 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp
 
     // Make sure we don't hide all sections, which would lead to a crash. First, count how many of them do we have.
     int nShownSections = 0;
-    for( SetGetExpFields::const_iterator it = mpUpdateFields->GetSortLst()->begin(); it != mpUpdateFields->GetSortLst()->end(); ++it )
     {
-        SwSection* pSect = const_cast<SwSection*>((*it)->GetSection());
-        if ( pSect && !pSect->IsCondHidden())
-            nShownSections++;
+        SwSectionFormats& rSectFormats = m_rDoc.GetSections();
+        for( SwSectionFormats::size_type n = 0; n<rSectFormats.size(); ++n )
+        {
+            SwSectionFormat* pSectFormat = rSectFormats[ n ];
+            SwSection* pSect = pSectFormat->GetSection();
+
+            // count only visible sections
+            if ( pSect && !pSect->CalcHiddenFlag())
+                nShownSections++;
+        }
     }
 
     OUString aNew;


More information about the Libreoffice-commits mailing list