bckfnn 2004/01/29 11:36:04 Modified: src/java/org/apache/fop/layoutmgr TraitSetter.java Log: Added addMargins() to set the SPACE_* traits. PR: 25802. Revision Changes Path 1.5 +26 -0 xml-fop/src/java/org/apache/fop/layoutmgr/TraitSetter.java Index: TraitSetter.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/TraitSetter.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- TraitSetter.java 24 Nov 2003 19:07:35 -0000 1.4 +++ TraitSetter.java 29 Jan 2004 19:36:04 -0000 1.5 @@ -55,6 +55,7 @@ import org.apache.fop.area.Area; import org.apache.fop.area.Trait; import org.apache.fop.fo.properties.CommonBackground; +import org.apache.fop.fo.properties.CommonMarginBlock; /** * This is a helper class used for setting common traits on areas. @@ -202,6 +203,31 @@ if (back.getColor() != null || back.getURL() != null) { curBlock.addTrait(Trait.BACKGROUND, back); + } + } + + /** + * Add space to a block area. + * Layout managers that create block areas can use this to add space + * outside of the border rectangle to the area. + * @param curBlock the current block. + * @param marginProps the margin properties. + */ + public static void addMargins(Area curBlock, + CommonBorderAndPadding bpProps, + CommonMarginBlock marginProps) { + int spaceStart = marginProps.startIndent - + bpProps.getBorderStartWidth(false) - + bpProps.getPaddingStart(false); + if (spaceStart != 0) { + curBlock.addTrait(Trait.SPACE_START, new Integer(spaceStart)); + } + + int spaceEnd = marginProps.endIndent - + bpProps.getBorderEndWidth(false) - + bpProps.getPaddingEnd(false); + if (spaceEnd != 0) { + curBlock.addTrait(Trait.SPACE_END, new Integer(spaceEnd)); } } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]