diff options
author | Michael Stahl <mstahl@redhat.com> | 2018-03-19 16:54:33 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-03-19 21:28:54 +0100 |
commit | 8f0f5353b079073b450c099bea659bcd4848f830 (patch) | |
tree | cd94b351402f26180e61c801ca742c22b6572a32 | |
parent | bb1376afbe6978f3d9bd153e2cf34919000bc174 (diff) |
sw: more tweaks to sanity check in SwFrame::GetNextSctLeaf()
* ooo50432-1.sxw has a move from a page with columns to a page without
columns
* kde327565-1.odt has a move from a page without columns to a page with
columns
* novell348228-1.odt has a section inside a fly frame that has no
mpUpper
Change-Id: I65afbbad7bb1b7aa3bf7cac8ff78e864adf66c3c
Reviewed-on: https://gerrit.libreoffice.org/51572
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r-- | sw/source/core/layout/sectfrm.cxx | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index e175ee709221..62b3e7f310d3 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -1594,7 +1594,7 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage ) #ifndef NDEBUG std::vector<SwFrame *> parents; - for (SwFrame * pTmp = GetUpper(); !pTmp->IsPageFrame(); pTmp = pTmp->GetUpper()) + for (SwFrame * pTmp = GetUpper(); pTmp && !pTmp->IsPageFrame(); pTmp = pTmp->GetUpper()) { parents.push_back(pTmp); } @@ -1761,7 +1761,15 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage ) for ( ; iter != parents.end(); ++iter) { - assert(!pTmp->IsPageFrame()); + if (pTmp->IsPageFrame()) + { + if ((*iter)->IsColumnFrame() && + (iter + 1) != parents.end() && (*(iter + 1))->IsBodyFrame()) + { // page style has columns - evidently these are + break; // added later? + } + assert(!pTmp->IsPageFrame()); + } assert(pTmp->GetType() == (*iter)->GetType()); // for cell frames and table frames: // 1) there may be multiple follow frames of the old one @@ -1802,7 +1810,11 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage ) } pTmp = pTmp->GetUpper(); } - assert(pTmp->IsPageFrame()); + assert(pTmp == nullptr /* SwFlyAtContentFrame case */ + || pTmp->IsPageFrame() // usual case + // the new page has columns, but the old page did not + || (pTmp->IsColumnFrame() && pTmp->GetUpper()->IsBodyFrame() + && pTmp->GetUpper()->GetUpper()->IsPageFrame())); } #endif |