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.*;
public class ExternalGraphic extends FObj {
+ int breakAfter;
+ int breakBefore;
int align;
int startIndent;
int endIndent;
this.id = this.properties.get("id").getString();
area.getIDReferences().createID(id);
-
+/*
if (area instanceof BlockArea) {
area.end();
}
forcedStartOffset;
}
+*/
this.marker = 0;
}
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
imgex.getMessage());
}
- if (area instanceof BlockArea) {
- area.start();
- }
+ //if (area instanceof BlockArea) {
+ // area.start();
+ //}
return new Status(Status.OK);
}
import org.apache.fop.fo.properties.TextAlign;
import org.apache.fop.layout.*;
+import org.apache.fop.layout.inline.*;
+
import org.apache.fop.render.Renderer;
import java.util.Vector;
import java.util.Enumeration;
-public class ImageArea extends Area {
+public class ImageArea extends InlineArea {
protected int xOffset = 0;
+ protected int align;
+ protected int valign;
protected FopImage image;
+
public ImageArea(FontState fontState, FopImage img,
int AllocationWidth, int width, int height,
int startIndent, int endIndent, int align) {
- super(fontState,width,height);
+ super(fontState,width,0,0,0);
this.currentHeight = height;
this.contentRectangleWidth = width;
+ this.height = height;
this.image = img;
+ this.align = align;
+/*
switch (align) {
case TextAlign.START:
xOffset = startIndent;
xOffset = startIndent + ((endIndent - startIndent) - width)/2;
break;
}
+ */
}
public int getXOffset() {
public int getImageHeight() {
return currentHeight;
}
+
+ public void setAlign(int align)
+ {
+ this.align = align;
+ }
+
+ public int getAlign()
+ {
+ return this.align;
+ }
+
+ public void setVerticalAlign(int align)
+ {
+ this.valign = align;
+ }
+
+ public int getVerticalAlign()
+ {
+ return this.valign;
+ }
+
+ public void setStartIndent(int startIndent)
+ {
+ xOffset = startIndent;
+ }
+
+
+
}
+
+