arved 01/07/12 19:29:50
Modified: src/org/apache/fop/fo PropertyManager.java
Log:
AHS: addressing break boundary conditions
Revision Changes Path
1.3 +47 -4 xml-fop/src/org/apache/fop/fo/PropertyManager.java
Index: PropertyManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/PropertyManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PropertyManager.java 2001/04/11 21:41:34 1.2
+++ PropertyManager.java 2001/07/13 02:29:47 1.3
@@ -1,4 +1,4 @@
-/*-- $Id: PropertyManager.java,v 1.2 2001/04/11 21:41:34 klease Exp $ -- */
+/*-- $Id: PropertyManager.java,v 1.3 2001/07/13 02:29:47 arved Exp $ -- */
/*
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
@@ -9,12 +9,15 @@
import org.apache.fop.layout.FontState;
import org.apache.fop.layout.FontInfo;
import org.apache.fop.layout.BorderAndPadding;
+import org.apache.fop.fo.properties.BreakAfter;
import org.apache.fop.fo.properties.BreakBefore;
import org.apache.fop.fo.properties.Constants;
import org.apache.fop.layout.HyphenationProps;
import org.apache.fop.apps.FOPException;
import java.text.MessageFormat;
import java.text.FieldPosition;
+import org.apache.fop.layout.Area;
+import org.apache.fop.layout.ColumnArea;
public class PropertyManager {
@@ -103,15 +106,55 @@
return hyphProps;
}
- public int checkBreakBefore() {
+ public int checkBreakBefore(Area area) {
+ if (!(area instanceof ColumnArea))
+ return Status.OK;
+ ColumnArea colArea = (ColumnArea)area;
switch(properties.get("break-before").getEnum()) {
case BreakBefore.PAGE:
- return Status.FORCE_PAGE_BREAK;
+ // if first ColumnArea, and empty, return OK
+ if (!colArea.hasChildren() && (colArea.getColumnIndex() == 1))
+ return Status.OK;
+ else
+ return Status.FORCE_PAGE_BREAK;
case BreakBefore.ODD_PAGE:
- return Status.FORCE_PAGE_BREAK_ODD;
+ // if first ColumnArea, empty, _and_ in odd page,
+ // return OK
+ if (!colArea.hasChildren() && (colArea.getColumnIndex() == 1) &&
+ (colArea.getPage().getNumber() % 2 != 0))
+ return Status.OK;
+ else
+ return Status.FORCE_PAGE_BREAK_ODD;
case BreakBefore.EVEN_PAGE:
+ // if first ColumnArea, empty, _and_ in even page,
+ // return OK
+ if (!colArea.hasChildren() && (colArea.getColumnIndex() == 1) &&
+ (colArea.getPage().getNumber() % 2 == 0))
+ return Status.OK;
+ else
return Status.FORCE_PAGE_BREAK_EVEN;
case BreakBefore.COLUMN:
+ // if ColumnArea is empty return OK
+ if (!area.hasChildren())
+ return Status.OK;
+ else
+ return Status.FORCE_COLUMN_BREAK;
+ default:
+ return Status.OK;
+ }
+ }
+
+ public int checkBreakAfter(Area area) {
+ if (!(area instanceof org.apache.fop.layout.ColumnArea))
+ return Status.OK;
+ switch(properties.get("break-after").getEnum()) {
+ case BreakAfter.PAGE:
+ return Status.FORCE_PAGE_BREAK;
+ case BreakAfter.ODD_PAGE:
+ return Status.FORCE_PAGE_BREAK_ODD;
+ case BreakAfter.EVEN_PAGE:
+ return Status.FORCE_PAGE_BREAK_EVEN;
+ case BreakAfter.COLUMN:
return Status.FORCE_COLUMN_BREAK;
default:
return Status.OK;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]