From f9404c6f4a07e15a45f00db456f55259844a960c Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Fri, 19 Jul 2024 13:45:33 +0100 Subject: [PATCH] FOP-3192: Redo layout for multipage columns for change in column count --- .../org/apache/fop/layoutmgr/PageBreaker.java | 14 ++-- .../page-position_only_8.xml | 68 ++++++++++++++++++ .../page-position_only_8_legacy.xml | 71 +++++++++++++++++++ 3 files changed, 149 insertions(+), 4 deletions(-) create mode 100644 fop/test/layoutengine/standard-testcases/page-position_only_8.xml create mode 100644 fop/test/layoutengine/standard-testcases/page-position_only_8_legacy.xml diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java index d95bd3c48..3f90d033a 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java @@ -621,6 +621,7 @@ public class PageBreaker extends AbstractBreaker { && pv.getCurrentSpan().getColumnCount() == 1); if (forceNewPageWithSpan) { + checkPagePositionOnly(); log.trace("Forcing new page with span"); curPage = pslm.makeNewPage(false); curPage.getPageViewport().createSpan(true); @@ -632,10 +633,7 @@ public class PageBreaker extends AbstractBreaker { log.trace("Moving to next flow"); pv.getCurrentSpan().moveToNextFlow(); } else { - if (pslm.getCurrentPage().isPagePositionOnly - && !pslm.fobj.getUserAgent().isLegacySkipPagePositionOnly()) { - throw new PagePositionOnlyException(); - } + checkPagePositionOnly(); log.trace("Making new page"); pslm.makeNewPage(false, emptyContent); } @@ -647,14 +645,22 @@ public class PageBreaker extends AbstractBreaker { } } + private void checkPagePositionOnly() { + if (pslm.getCurrentPage().isPagePositionOnly && !pslm.fobj.getUserAgent().isLegacySkipPagePositionOnly()) { + throw new PagePositionOnlyException(); + } + } + private void handleBreakBeforeFollowingPage(int breakVal) { log.debug("handling break-before after page " + pslm.getCurrentPageNum() + " breakVal=" + getBreakClassName(breakVal)); if (needBlankPageBeforeNew(breakVal)) { + checkPagePositionOnly(); log.trace("Inserting blank page"); /* curPage = */pslm.makeNewPage(true); } if (needNewPage(breakVal)) { + checkPagePositionOnly(); log.trace("Making new page"); /* curPage = */pslm.makeNewPage(false); } diff --git a/fop/test/layoutengine/standard-testcases/page-position_only_8.xml b/fop/test/layoutengine/standard-testcases/page-position_only_8.xml new file mode 100644 index 000000000..1764f0ac5 --- /dev/null +++ b/fop/test/layoutengine/standard-testcases/page-position_only_8.xml @@ -0,0 +1,68 @@ + + + + + +

+ This test checks the page-position only is not used as there is more than 1 page +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + test + + + + test + + test + + + + + + + + + +
diff --git a/fop/test/layoutengine/standard-testcases/page-position_only_8_legacy.xml b/fop/test/layoutengine/standard-testcases/page-position_only_8_legacy.xml new file mode 100644 index 000000000..1b725e1f5 --- /dev/null +++ b/fop/test/layoutengine/standard-testcases/page-position_only_8_legacy.xml @@ -0,0 +1,71 @@ + + + + + +

+ This test checks the page-position only is not used as there is more than 1 page +

+
+ + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + test + + + + test + + test + + + + + + + + + +
-- 2.39.5