From kde-commits Tue Jun 30 21:25:34 2015 From: C. Boemann Date: Tue, 30 Jun 2015 21:25:34 +0000 To: kde-commits Subject: [calligra/calligra/2.9] /: Fix crash with some cases of pagebreak, and make page break work correctl Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=143569954610832 Git commit 530bf6ca8e8d873c0c2feaf0d66db8536cf0068e by C. Boemann. Committed on 30/06/2015 at 19:55. Pushed by boemann into branch 'calligra/2.9'. Fix crash with some cases of pagebreak, and make page break work correctly = on multicolumn pages M +4 -1 libs/textlayout/KoTextDocumentLayout.cpp M +5 -2 words/part/KWRootAreaProvider.cpp http://commits.kde.org/calligra/530bf6ca8e8d873c0c2feaf0d66db8536cf0068e diff --git a/libs/textlayout/KoTextDocumentLayout.cpp b/libs/textlayout/KoT= extDocumentLayout.cpp index 73c4432..54e3b5e 100644 --- a/libs/textlayout/KoTextDocumentLayout.cpp +++ b/libs/textlayout/KoTextDocumentLayout.cpp @@ -734,7 +734,10 @@ RootAreaConstraint constraintsForPosition(QTextFrame::= iterator it, bool previous } constraints.newPageForced =3D table->frameFormat().intProperty(KoT= ableStyle::BreakBefore) =3D=3D KoText::PageBreak; } - = + + if (!constraints.masterPageName.isEmpty()) { + constraints.newPageForced =3D true; + } if (previousIsValid && !constraints.newPageForced) { it--; block =3D it.currentBlock(); diff --git a/words/part/KWRootAreaProvider.cpp b/words/part/KWRootAreaProvi= der.cpp index f4e0c13..cc899d5 100644 --- a/words/part/KWRootAreaProvider.cpp +++ b/words/part/KWRootAreaProvider.cpp @@ -155,12 +155,14 @@ KoTextLayoutRootArea* KWRootAreaProvider::provideNext= (KoTextDocumentLayout *docu = int pageNumber =3D 1; KWRootAreaPage *rootAreaPage =3D m_pages.isEmpty() ? 0 : m_pages.last(= ); - int requiredRootAreaCount =3D 1; if (rootAreaPage && frameSet()->textFrameSetType() =3D=3D Words::MainT= extFrameSet) { Q_ASSERT(rootAreaPage->page.isValid()); Q_ASSERT(rootAreaPage->page.pageStyle().isValid()); requiredRootAreaCount =3D rootAreaPage->page.pageStyle().columns()= .count; + if (constraints.newPageForced) { + requiredRootAreaCount =3D 1; + } } if (rootAreaPage && rootAreaPage->rootAreas.count() < requiredRootArea= Count) { pageNumber =3D m_pages.count(); // the root-area is still on the s= ame page @@ -294,7 +296,7 @@ KoTextLayoutRootArea *KWRootAreaProvider::provide(KoTex= tDocumentLayout* document = QString reallyNeededPageStyle =3D constraints.masterPageName; int visiblePageNumber =3D constraints.visiblePageNumber; - + bool newPageForced =3D constraints.newPageForced; if (m_rootAreaCache.size() > requestedPosition) { KoTextLayoutRootArea *rootArea =3D m_rootAreaCache[requestedPositi= on]; @@ -353,6 +355,7 @@ KoTextLayoutRootArea *KWRootAreaProvider::provide(KoTex= tDocumentLayout* document RootAreaConstraint realConstraints; realConstraints.masterPageName =3D reallyNeededPageStyle; realConstraints.visiblePageNumber =3D visiblePageNumber; + realConstraints.newPageForced =3D newPageForced; KoTextLayoutRootArea *area =3D 0; do { area =3D provideNext(documentLayout, realConstraints);