//Get page break from which we restart
PageBreakPosition pbp = (PageBreakPosition)
alg.getPageBreaks().get(restartPoint - 1);
- newStartPos = pbp.getLeafPos();
+ //Set starting position to the first element *after* the page-break
+ newStartPos = pbp.getLeafPos() + 1;
//Handle page break right here to avoid any side-effects
if (newStartPos > 0) {
handleBreakTrait(Constants.EN_PAGE);
1, true, BreakingAlgorithm.ALL_BREAKS);
AbstractBreaker.log.debug("restart: iOptPageCount= " + iOptPageCount
+ " pageBreaks.size()= " + algRestart.getPageBreaks().size());
+ //Make sure we only add the areas we haven't added already
+ effectiveList.ignoreAtStart = newStartPos;
boolean replaceLastPage
= iOptPageCount <= pslm.getCurrentPV().getBodyRegion().getColumnCount();
if (replaceLastPage) {
//Replace last page
pslm.setCurrentPage(pageProvider.getPage(false, currentPageNum));
- //Make sure we only add the areas we haven't added already
- effectiveList.ignoreAtStart = newStartPos;
addAreas(algRestart, iOptPageCount, originalList, effectiveList);
} else {
- effectiveList.ignoreAtStart = newStartPos;
addAreas(alg, restartPoint, partCount - restartPoint, originalList, effectiveList);
//Add blank last page
pageProvider.setLastPageIndex(currentPageNum + 1);
childLC);
}
// set the offset from the top margin
- Footnote parentArea = (Footnote) pslm.getCurrentPV().getBodyRegion().getFootnote();
- int topOffset = (int) pslm.getCurrentPV().getBodyRegion().getBPD() - parentArea.getBPD();
+ Footnote parentArea = pslm.getCurrentPV().getBodyRegion().getFootnote();
+ int topOffset = pslm.getCurrentPV().getBodyRegion().getBPD() - parentArea.getBPD();
if (separatorArea != null) {
topOffset -= separatorArea.getBPD();
}
/** {@inheritDoc} */
protected void observeElementList(List elementList) {
ElementListObserver.observe(elementList, "breaker",
- ((PageSequence)pslm.getFObj()).getId());
+ pslm.getFObj().getId());
}
/**
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!--\r
+ Licensed to the Apache Software Foundation (ASF) under one or more\r
+ contributor license agreements. See the NOTICE file distributed with\r
+ this work for additional information regarding copyright ownership.\r
+ The ASF licenses this file to You under the Apache License, Version 2.0\r
+ (the "License"); you may not use this file except in compliance with\r
+ the License. You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+-->\r
+<!-- $Id$ -->\r
+<testcase>\r
+ <info>\r
+ <p>\r
+ This test checks page-masters (reference orientation).\r
+ </p>\r
+ </info>\r
+ <fo>\r
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">\r
+ <fo:layout-master-set>\r
+ <fo:simple-page-master master-name="OTCTermsheetPageMasterFrontPage" page-width="210mm" page-height="297mm" margin-bottom="12.7mm" margin-right="12.7mm" margin-top="12.7mm" margin-left="12.7mm">\r
+ <fo:region-body margin-bottom="30mm" margin-top="42.3mm" region-name="PageBody"/>\r
+ <fo:region-before region-name="PageHeaderFrontPage" extent="42.3mm"/>\r
+ <fo:region-after precedence="true" region-name="PageFooter" extent="30mm"/>\r
+ </fo:simple-page-master>\r
+ <fo:simple-page-master master-name="OTCTermsheetPageMasterFollowing" page-width="210mm" page-height="297mm" margin-bottom="12.7mm" margin-right="12.7mm" margin-top="12.7mm" margin-left="12.7mm">\r
+ <fo:region-body margin-bottom="30mm" margin-top="20mm" region-name="PageBody"/>\r
+ <fo:region-before region-name="PageHeaderFollowing" extent="20mm"/>\r
+ <fo:region-after precedence="true" region-name="PageFooter" extent="30mm"/>\r
+ </fo:simple-page-master>\r
+ <fo:page-sequence-master master-name="OTCTermsheetPageSeq">\r
+ <fo:repeatable-page-master-alternatives>\r
+ <fo:conditional-page-master-reference page-position="first" master-reference="OTCTermsheetPageMasterFrontPage"/>\r
+ <fo:conditional-page-master-reference page-position="rest" master-reference="OTCTermsheetPageMasterFollowing"/>\r
+ <fo:conditional-page-master-reference page-position="last" master-reference="OTCTermsheetPageMasterFollowing"/> \r
+ </fo:repeatable-page-master-alternatives>\r
+ </fo:page-sequence-master>\r
+ </fo:layout-master-set>\r
+ <fo:page-sequence initial-page-number="1" force-page-count="no-force" master-reference="OTCTermsheetPageSeq">\r
+ <fo:flow flow-name="PageBody" font-family="Times New Roman" font-size="10pt" line-height="12pt">\r
+ <fo:block>\r
+ <fo:table table-layout="fixed" width="100%">\r
+ <fo:table-column column-width="proportional-column-width(32.36)" column-number="1"/>\r
+ <fo:table-column column-width="proportional-column-width(67.64)" column-number="2"/>\r
+ <fo:table-body>\r
+ <fo:table-row>\r
+ <fo:table-cell padding="4pt">\r
+ <fo:block>\r
+ <fo:block>\r
+ <fo:inline color="#6D6E71">Some text</fo:inline>\r
+ </fo:block>\r
+ </fo:block>\r
+ </fo:table-cell>\r
+ <fo:table-cell padding="4pt">\r
+ <fo:block>\r
+ <fo:block text-align="justify">More text before break. More text before break. More text before break.</fo:block>\r
+ <fo:block>\r
+ <fo:leader/>\r
+ </fo:block>\r
+ </fo:block>\r
+ </fo:table-cell>\r
+ </fo:table-row>\r
+ </fo:table-body>\r
+ </fo:table>\r
+ <fo:table table-layout="fixed" width="100%">\r
+ <fo:table-column column-width="proportional-column-width(100)" column-number="1"/>\r
+ <fo:table-body>\r
+ <fo:table-row>\r
+ <fo:table-cell padding="4pt">\r
+ <fo:block>\r
+ <fo:block id="the-block" line-height="14pt" color="#6D6E71" font-size="11pt" font-family="Arial" text-align="left" page-break-before="always">TEXT AFTER BREAK</fo:block>\r
+ <fo:block>\r
+ <fo:leader/>\r
+ </fo:block>\r
+ </fo:block>\r
+ </fo:table-cell>\r
+ </fo:table-row>\r
+ </fo:table-body>\r
+ </fo:table>\r
+ <fo:table table-layout="fixed" width="100%">\r
+ <fo:table-column column-width="proportional-column-width(100)" column-number="1"/>\r
+ <fo:table-body>\r
+ <fo:table-row>\r
+ <fo:table-cell padding="4pt">\r
+ <fo:block>\r
+ <fo:block>\r
+ <fo:leader/>\r
+ </fo:block>\r
+ <fo:block>\r
+ <fo:leader/>\r
+ </fo:block>\r
+ <fo:block text-align="justify">blah blah blah</fo:block>\r
+ <fo:block>\r
+ <fo:leader/>\r
+ </fo:block>\r
+ <fo:block text-align="justify">blah blah blah</fo:block>\r
+ </fo:block>\r
+ </fo:table-cell>\r
+ </fo:table-row>\r
+ </fo:table-body>\r
+ </fo:table>\r
+ </fo:block>\r
+ </fo:flow>\r
+ </fo:page-sequence>\r
+ </fo:root>\r
+ </fo>\r
+ <checks>\r
+ <true xpath="count(//page) = 2" />\r
+ </checks>\r
+</testcase>\r