summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorSerge Krot <Serge.Krot@cib.de>2018-05-16 13:58:59 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-05-17 14:26:59 +0200
commit928215201d1842b930ac7254749c9949ca4cb45c (patch)
tree8c2cd520fbf90c5f47675c8d011cd7d2fc1ec3ef /sw
parent3ae74cd221898622821e813e3bb86b9335e38055 (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> (cherry picked from commit 27c9370b5fd00b851582e4163907656286e8c581) Reviewed-on: https://gerrit.libreoffice.org/54485
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/DocumentFieldsManager.cxx14
1 files changed, 10 insertions, 4 deletions
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;