diff options
author | Serge Krot <Serge.Krot@cib.de> | 2018-05-16 13:58:59 +0200 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-05-17 14:26:12 +0200 |
commit | 27c9370b5fd00b851582e4163907656286e8c581 (patch) | |
tree | da31848fc5db36a8668b7e004ea5477039201475 | |
parent | 8fde560d58a8ddc9c023251e55e6542f8ec6c1e9 (diff) |
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@CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r-- | sw/source/core/doc/DocumentFieldsManager.cxx | 14 |
1 files changed, 10 insertions, 4 deletions
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; |