cvs commit: xml-fop/src/org/apache/fop/fo/flow ExternalGraphic.java
keiron 2002/11/06 07:38:12 Modified:src/org/apache/fop/fo/flow ExternalGraphic.java Log: improved error message and id, background, borders fixed styling Revision ChangesPath 1.29 +92 -55xml-fop/src/org/apache/fop/fo/flow/ExternalGraphic.java Index: ExternalGraphic.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/ExternalGraphic.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- ExternalGraphic.java 20 Aug 2002 07:03:19 - 1.28 +++ ExternalGraphic.java 6 Nov 2002 15:38:12 - 1.29 @@ -1,6 +1,6 @@ /* * $Id$ - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. + * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. */ @@ -8,45 +8,70 @@ package org.apache.fop.fo.flow; // FOP -import org.apache.fop.fo.*; -import org.apache.fop.fo.properties.*; -import org.apache.fop.layout.*; -import org.apache.fop.apps.FOPException; -import org.apache.fop.image.*; +import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FObj; +import org.apache.fop.layout.AuralProps; +import org.apache.fop.layout.AccessibilityProps; +import org.apache.fop.layout.BorderAndPadding; +import org.apache.fop.layout.BackgroundProps; +import org.apache.fop.layout.MarginInlineProps; +import org.apache.fop.layout.RelativePositionProps; +import org.apache.fop.fo.properties.TextAlign; +import org.apache.fop.fo.properties.Overflow; +import org.apache.fop.fo.properties.DisplayAlign; +import org.apache.fop.fo.properties.Scaling; +import org.apache.fop.image.ImageFactory; +import org.apache.fop.image.FopImage; import org.apache.fop.area.inline.InlineArea; -import org.apache.fop.layoutmgr.LayoutManager; +import org.apache.fop.layoutmgr.AbstractLayoutManager; import org.apache.fop.layoutmgr.LeafNodeLayoutManager; import org.apache.fop.area.inline.Image; import org.apache.fop.area.inline.Viewport; -import org.apache.fop.datatypes.*; +import org.apache.fop.datatypes.Length; // Java -import java.net.URL; -import java.net.MalformedURLException; import java.util.List; import java.awt.geom.Rectangle2D; +/** + * External graphic formatting object. + * This FO node handles the external graphic. It creates an image + * inline area that can be added to the area tree. + */ public class ExternalGraphic extends FObj { -String url; -int breakAfter; -int breakBefore; -int align; -int startIndent; -int endIndent; -int spaceBefore; -int spaceAfter; -int viewWidth = -1; -int viewHeight = -1; -boolean clip = false; -Rectangle2D placement = null; - +private String url; +private int breakAfter; +private int breakBefore; +private int align; +private int startIndent; +private int endIndent; +private int spaceBefore; +private int spaceAfter; +private int viewWidth = -1; +private int viewHeight = -1; +private boolean clip = false; +private Rectangle2D placement = null; + +/** + * Create a new External graphic node. + * + * @param parent the parent of this node + */ public ExternalGraphic(FONode parent) { super(parent); } +/** + * Add the layout manager for this to the list. + * This adds a leafnode layout manager that deals with the + * created viewport/image area. + * + * @param list the list to add the layout manager to + */ public void addLayoutManager(List list) { InlineArea area = getInlineArea(); -if(area != null) { +if (area != null) { +setupID(); LeafNodeLayoutManager lm = new LeafNodeLayoutManager(this); lm.setCurrentArea(area); lm.setAlignment(properties.get("vertical-align").getEnum()); @@ -55,9 +80,15 @@ } } +/** + * Get the inline area for this external grpahic. + * This creates the image area and puts it inside a viewport. + * + * @return the viewport containing the image area + */ protected InlineArea getInlineArea() { setup(); -if(url == null) { +if (url == null) { return null; } Image imArea = new Image(url); @@ -68,32 +99,42 @@ vp.setContentPosition(placement); vp.setOffset(0); +// Common Border, Padding, and Background Properties +BorderAndPadding bap = propMgr.getBorderAndPadding(); +BackgroundProps bProps = propMgr.getBackgroundProps(); +AbstractLayoutMana
cvs commit: xml-fop/src/org/apache/fop/fo/flow ExternalGraphic.java
keiron 01/09/12 02:19:34 Modified:src/org/apache/fop/fo/flow ExternalGraphic.java Log: gets the available space better, should prevent some infinite loops until the layout is done properly PR: bug id 3475 Submitted by: Paul Austin <[EMAIL PROTECTED]> Revision ChangesPath 1.13 +3 -2 xml-fop/src/org/apache/fop/fo/flow/ExternalGraphic.java Index: ExternalGraphic.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/ExternalGraphic.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- ExternalGraphic.java 2001/08/20 11:19:23 1.12 +++ ExternalGraphic.java 2001/09/12 09:19:34 1.13 @@ -1,5 +1,5 @@ /* - * $Id: ExternalGraphic.java,v 1.12 2001/08/20 11:19:23 keiron Exp $ + * $Id: ExternalGraphic.java,v 1.13 2001/09/12 09:19:34 keiron Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -143,7 +143,8 @@ double ratio = ((double)width) / ((double)height); int areaWidth = area.getAllocationWidth() - startIndent - endIndent; -int pageHeight = area.getPage().getHeight(); +int pageHeight = area.getPage().getBody().getMaxHeight() + - spaceBefore; if (height > pageHeight) { height = pageHeight; width = (int)(ratio * ((double)height)); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/fo/flow ExternalGraphic.java
arved 01/06/10 10:02:24 Modified:src/org/apache/fop/fo/flow ExternalGraphic.java Log: SGK/AHS: inling of images Revision ChangesPath 1.9 +61 -9 xml-fop/src/org/apache/fop/fo/flow/ExternalGraphic.java Index: ExternalGraphic.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/ExternalGraphic.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- ExternalGraphic.java 2001/03/04 21:34:51 1.8 +++ ExternalGraphic.java 2001/06/10 17:02:24 1.9 @@ -44,9 +44,7 @@ import org.apache.fop.fo.*; import org.apache.fop.messaging.MessageHandler; import org.apache.fop.fo.properties.*; -import org.apache.fop.layout.Area; -import org.apache.fop.layout.BlockArea; -import org.apache.fop.layout.FontState; +import org.apache.fop.layout.*; import org.apache.fop.apps.FOPException; import org.apache.fop.image.*; @@ -58,6 +56,8 @@ public class ExternalGraphic extends FObj { + int breakAfter; + int breakBefore; int align; int startIndent; int endIndent; @@ -103,7 +103,7 @@ this.id = this.properties.get("id").getString(); area.getIDReferences().createID(id); - +/* if (area instanceof BlockArea) { area.end(); } @@ -114,6 +114,7 @@ forcedStartOffset; } +*/ this.marker = 0; } @@ -172,13 +173,64 @@ imageArea.start(); imageArea.end(); - area.addChild(imageArea); - area.increaseHeight(imageArea.getHeight()); + //area.addChild(imageArea); + //area.increaseHeight(imageArea.getHeight()); if (spaceAfter != 0) { area.addDisplaySpace(spaceAfter); } + if (breakBefore == BreakBefore.PAGE || ((spaceBefore + imageArea.getHeight()) > area.spaceLeft())){ + return new Status(Status.FORCE_PAGE_BREAK); + } + + if (breakBefore == BreakBefore.ODD_PAGE) { + return new Status(Status.FORCE_PAGE_BREAK_ODD); + } + + if (breakBefore == BreakBefore.EVEN_PAGE) { + return new Status(Status.FORCE_PAGE_BREAK_EVEN); + } + + + if (area instanceof BlockArea) { + BlockArea ba = (BlockArea)area; + LineArea la = ba.getCurrentLineArea(); + if(la == null) { + return new Status(Status.AREA_FULL_NONE); + } + la.addPending(); + if(imageArea.getContentWidth() > la.getRemainingWidth()) { + la = ba.createNextLineArea(); + if(la == null) { + return new Status(Status.AREA_FULL_NONE); + } + } + la.addInlineArea(imageArea); + } else { + area.addChild(imageArea); + area.increaseHeight(imageArea.getContentHeight()); + } + imageArea.setPage(area.getPage()); + + if (breakAfter == BreakAfter.PAGE) { + this.marker = BREAK_AFTER; + return new Status(Status.FORCE_PAGE_BREAK); + } + + if (breakAfter == BreakAfter.ODD_PAGE) { + this.marker = BREAK_AFTER; + return new Status(Status.FORCE_PAGE_BREAK_ODD); + } + + if (breakAfter == BreakAfter.EVEN_PAGE) { + this.marker = BREAK_AFTER; + return new Status(Status.FORCE_PAGE_BREAK_EVEN); + } + + + + } catch (MalformedURLException urlex) { // bad URL @@ -191,9 +243,9 @@ imgex.getMessage()); } - if (area instanceof BlockArea) { - area.start(); - } + //if (area instanceof BlockArea) { + // area.start(); + //} return new Status(Status.OK);