From: Simon Steiner Date: Thu, 25 Feb 2021 13:12:16 +0000 (+0000) Subject: FOP-2999: Rollback after checking next page X-Git-Tag: fop-2_7~38 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=aa0f7734e3832439e505479ae60e6aff2173db31;p=xmlgraphics-fop.git FOP-2999: Rollback after checking next page git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1886916 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/fop-core/src/main/java/org/apache/fop/fo/pagination/PageSequence.java b/fop-core/src/main/java/org/apache/fop/fo/pagination/PageSequence.java index 3f82e6822..79955ff74 100644 --- a/fop-core/src/main/java/org/apache/fop/fo/pagination/PageSequence.java +++ b/fop-core/src/main/java/org/apache/fop/fo/pagination/PageSequence.java @@ -542,4 +542,10 @@ public class PageSequence extends AbstractPageSequence implements WritingModeTra public List getClonedChangeBarList() { return new LinkedList(changeBarList); } + + public void setOnlyTryInfinite(boolean b) { + if (pageSequenceMaster != null) { + pageSequenceMaster.onlyTryInfinite = b; + } + } } diff --git a/fop-core/src/main/java/org/apache/fop/fo/pagination/PageSequenceMaster.java b/fop-core/src/main/java/org/apache/fop/fo/pagination/PageSequenceMaster.java index f218e43b4..b9840e006 100644 --- a/fop-core/src/main/java/org/apache/fop/fo/pagination/PageSequenceMaster.java +++ b/fop-core/src/main/java/org/apache/fop/fo/pagination/PageSequenceMaster.java @@ -49,6 +49,7 @@ public class PageSequenceMaster extends FObj { private SubSequenceSpecifier currentSubSequence; private int currentSubSequenceNumber = -1; private BlockLevelEventProducer blockLevelEventProducer; + protected boolean onlyTryInfinite; // The terminology may be confusing. A 'page-sequence-master' consists // of a sequence of what the XSL spec refers to as @@ -199,6 +200,9 @@ public class PageSequenceMaster extends FObj { boolean isBlankPage, String mainFlowName) throws PageProductionException { + if (onlyTryInfinite && currentSubSequence != null && !currentSubSequence.isInfinite()) { + throw new PageProductionException("Limited to infinite"); + } if (currentSubSequence == null) { currentSubSequence = getNextSubSequence(); if (currentSubSequence == null) { diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/PageProvider.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/PageProvider.java index 3c3409ce7..266a7d9b9 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/PageProvider.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/PageProvider.java @@ -28,6 +28,7 @@ import org.apache.fop.area.AreaTreeHandler; import org.apache.fop.area.BodyRegion; import org.apache.fop.area.PageViewport; import org.apache.fop.fo.Constants; +import org.apache.fop.fo.pagination.PageProductionException; import org.apache.fop.fo.pagination.PageSequence; import org.apache.fop.fo.pagination.Region; import org.apache.fop.fo.pagination.RegionBody; @@ -192,7 +193,9 @@ public class PageProvider implements Constants { colIndex -= columnCount; pageIndex++; page = getPage(false, pageIndex, RELTO_CURRENT_ELEMENT_LIST); - columnCount = page.getPageViewport().getCurrentSpan().getColumnCount(); + if (page.getPageViewport().getPage() != null) { + columnCount = page.getPageViewport().getCurrentSpan().getColumnCount(); + } } while (colIndex >= columnCount); return new Column(page, pageIndex, colIndex, columnCount); } @@ -316,7 +319,8 @@ public class PageProvider implements Constants { log.debug("blank condition doesn't match. Replacing PageViewport."); replace = true; } - if (page.getPageViewport().getCurrentSpan().getColumnCount() == 1 + if (page.getPageViewport().getPage() != null + && page.getPageViewport().getCurrentSpan().getColumnCount() == 1 && !this.spanAllForCurrentElementList) { RegionBody rb = (RegionBody)page.getSimplePageMaster().getRegion(Region.FO_REGION_BODY); int colCount = rb.getColumnCount(); @@ -394,13 +398,27 @@ public class PageProvider implements Constants { } public int getCurrentIPD() { + if (startPageOfCurrentElementList == 0) { + return -1; + } Page page = getPageFromColumnIndex(startColumnOfCurrentElementList); return page.getPageViewport().getBodyRegion().getColumnIPD(); } public int getNextIPD() { - Page page = getPageFromColumnIndex(startColumnOfCurrentElementList + 1); - return page.getPageViewport().getBodyRegion().getColumnIPD(); + pageSeq.setOnlyTryInfinite(true); + try { + int oldSize = cachedPages.size(); + Page page = getPageFromColumnIndex(startColumnOfCurrentElementList + 1); + if (oldSize != cachedPages.size()) { + cachedPages.remove(cachedPages.size() - 1); + } + return page.getPageViewport().getBodyRegion().getColumnIPD(); + } catch (PageProductionException e) { + return getCurrentIPD(); + } finally { + pageSeq.setOnlyTryInfinite(false); + } } public int getCurrentColumnCount() { diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java index d079824ba..ffc4e7c88 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java @@ -492,6 +492,9 @@ public class ListItemLayoutManager extends SpacedBorderedPaddedBlockLayoutManage private boolean isChangingIPD(LayoutManager lm) { PageProvider pageProvider = lm.getPSLM().getPageProvider(); int currentIPD = pageProvider.getCurrentIPD(); + if (currentIPD == -1) { + return false; + } int nextIPD = pageProvider.getNextIPD(); return nextIPD != currentIPD; } diff --git a/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list3.xml b/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list3.xml new file mode 100644 index 000000000..4b2b408c6 --- /dev/null +++ b/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list3.xml @@ -0,0 +1,378 @@ + + + + + +

+ This test checks that blocks of texts are re-laid out after a change of the flow ipd. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + Small Group + health insurance + + + + For the business of: + + + + EC Logistics LLC + + + + + + Effective Date: 02/01/2021 + + + + + Prepared by: + wb underwriting + + 02/10/2021 + (800) 869-6989 + + + Success! + EC Logistics LLC is now enrolled. + + + + We’ve put together tips and information, as well as a roster of enrolled members (with member ID included) and final rates for your records. + + + + + + + + + + + + + + About group enrollment timing + + + + + + + + + + + + + + About member benefits + + + + + + + + + + + + + + + + + + • + + + This group will appear in Broker Connection after the group effective date. + + + + + + + • + + + This group will appear in Employer Connection Plus after the first month’s billing statement has been generated, which generally occurs by the 14th business day of the month. + + + + + + + + + + + + + + + + + + • + + + Members can use our Find a Doctor flier to learn how to search for doctors/specialists/facilities + + + + + + + • + + + Members can access care 24/7 via phone or video consultations with Teladoc + + + + + + + • + + + For access to Pharmacy Benefits, members must use the plan- specific alpha prefix with their member ID number. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + About member enrollment information and next steps + + + + + + + + + + + + + + See examples below: + + + + + + + + + + + + + + + + + + • + + + Identification cards should arrive in approximately 7 to10 business days at each subscriber’s home. + + + + + + + • + + + Access to ID card via our mobile app is available within 24 to 48 hours. + + + + + + + • + + + Temporary ID cards can be printed after members register online. + + + + + + + • + + + Members should appear in our Pharmacy Eligibility system within 24 to 48 hours. + + + + + + + • + + + Eligibility can be verified prior to receipt of ID cards by calling (888) 319-5999. + + + + + + + + + + + + + + + XEH - HMO members (example: XEH999999999) + XEA - PPO members (example: XEA999999999) + XNK - Tandem PPO members (example: XNK999999999) + Pharmacy services also requires the BIN # 600428 and PCN numbers: PCN # 01910000 - for Commercial HMO and PPO + PCN # 02960000 – for Commercial HAS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list4.xml b/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list4.xml new file mode 100644 index 000000000..ee04d1bc8 --- /dev/null +++ b/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list4.xml @@ -0,0 +1,71 @@ + + + + + +

+ This test checks that blocks of texts are re-laid out after a change of the flow ipd. +

+
+ + + + + + + + + + + + + + + + + + + + + + Mr les + + + + + + + + ● + + + + Cover summary (all your key policy information) + + + + + + + + + + + + +
diff --git a/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list5.xml b/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list5.xml new file mode 100644 index 000000000..7041ce4e5 --- /dev/null +++ b/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list5.xml @@ -0,0 +1,69 @@ + + + + + +

+ This test checks that blocks of texts are re-laid out after a change of the flow ipd. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + 1. + + + + Your name is the name on the attached declaration. + + + + + + + AGREEMENT + + + + + + + + +
diff --git a/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list6.xml b/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list6.xml new file mode 100644 index 000000000..bd420c3e2 --- /dev/null +++ b/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list6.xml @@ -0,0 +1,121 @@ + + + + + +

+ This test checks that blocks of texts are re-laid out after a change of the flow ipd. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + · + + + + London charges + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +