gmazza 2003/11/10 20:40:12
Modified: src/java/org/apache/fop/layoutmgr BlockLayoutManager.java
BlockStackingLayoutManager.java
Log:
fo:block space-before property now activated only on the first Area.Block object used
in rendering the fo:block. (Previous implementation repeated space-before at the
top of every page.) Suggestion from Chris Bowditch.
(Space-after property still needs work: renders at the correct places but
results in subsequent text overrunning region borders.)
Revision Changes Path
1.8 +21 -4
xml-fop/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
Index: BlockLayoutManager.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- BlockLayoutManager.java 12 Sep 2003 18:57:34 -0000 1.7
+++ BlockLayoutManager.java 11 Nov 2003 04:40:12 -0000 1.8
@@ -76,6 +76,17 @@
private CommonBorderAndPadding borderProps;
private CommonBackground backgroundProps;
+ /* holds the (one-time use) fo:block space-before
+ and -after properties. Large fo:blocks are split
+ into multiple Area.Blocks to accomodate the subsequent
+ regions (pages) they are placed on. space-before
+ is applied at the beginning of the first
+ Block and space-after at the end of the last Block
+ used in rendering the fo:block.
+ */
+ private MinOptMax foBlockSpaceBefore = null;
+ private MinOptMax foBlockSpaceAfter = null; // not currently implemented
+
private int lead = 12000;
private int lineHeight = 14000;
private int follow = 2000;
@@ -169,6 +180,7 @@
layoutProps = pm.getLayoutProps();
borderProps = pm.getBorderAndPadding();
backgroundProps = pm.getBackgroundProps();
+ foBlockSpaceBefore = layoutProps.spaceBefore.getSpace();
}
public BreakPoss getNextBreakPoss(LayoutContext context) {
@@ -177,9 +189,13 @@
int ipd = context.getRefIPD();
MinOptMax stackSize = new MinOptMax();
- // if starting add space before
- stackSize.add(layoutProps.spaceBefore.getSpace());
+ if (foBlockSpaceBefore != null) {
+ // this function called before addAreas(), so
+ // setting foBlockSpaceBefore = null *in* addAreas()
+ stackSize.add(foBlockSpaceBefore);
+ }
+
BreakPoss lastPos = null;
while ((curLM = getChildLM()) != null) {
@@ -261,8 +277,9 @@
// if adjusted space before
double adjust = layoutContext.getSpaceAdjust();
- addBlockSpacing(adjust, layoutProps.spaceBefore.getSpace());
-
+ addBlockSpacing(adjust, foBlockSpaceBefore);
+ foBlockSpaceBefore = null;
+
addID();
addMarkers(true, true);
1.4 +3 -0
xml-fop/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
Index: BlockStackingLayoutManager.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BlockStackingLayoutManager.java 8 Sep 2003 17:00:54 -0000 1.3
+++ BlockStackingLayoutManager.java 11 Nov 2003 04:40:12 -0000 1.4
@@ -106,6 +106,9 @@
* @param minoptmax the min/opt/max value of the spacing
*/
public void addBlockSpacing(double adjust, MinOptMax minoptmax) {
+ if (minoptmax == null) {
+ return;
+ }
int sp = minoptmax.opt;
if (adjust > 0) {
sp = sp + (int)(adjust * (minoptmax.max - minoptmax.opt));
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]