sw/source/core/doc/DocumentFieldsManager.cxx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
New commits: commit 928215201d1842b930ac7254749c9949ca4cb45c Author: Serge Krot <serge.k...@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.behr...@cib.de> Tested-by: Thorsten Behrens <thorsten.behr...@cib.de> (cherry picked from commit 27c9370b5fd00b851582e4163907656286e8c581) Reviewed-on: https://gerrit.libreoffice.org/54485 diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index f99ad757320b..3231597a9c98 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -900,11 +900,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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits