aboutsummaryrefslogtreecommitdiffstats
path: root/src/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/org')
-rw-r--r--src/org/apache/fop/fo/flow/ExternalGraphic.java70
-rw-r--r--src/org/apache/fop/image/ImageArea.java43
2 files changed, 102 insertions, 11 deletions
diff --git a/src/org/apache/fop/fo/flow/ExternalGraphic.java b/src/org/apache/fop/fo/flow/ExternalGraphic.java
index 46c6be514..d828a5d06 100644
--- a/src/org/apache/fop/fo/flow/ExternalGraphic.java
+++ b/src/org/apache/fop/fo/flow/ExternalGraphic.java
@@ -44,9 +44,7 @@ package org.apache.fop.fo.flow;
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 @@ import java.net.MalformedURLException;
public class ExternalGraphic extends FObj {
+ int breakAfter;
+ int breakBefore;
int align;
int startIndent;
int endIndent;
@@ -103,7 +103,7 @@ public class ExternalGraphic extends FObj {
this.id = this.properties.get("id").getString();
area.getIDReferences().createID(id);
-
+/*
if (area instanceof BlockArea) {
area.end();
}
@@ -114,6 +114,7 @@ public class ExternalGraphic extends FObj {
forcedStartOffset;
}
+*/
this.marker = 0;
}
@@ -172,12 +173,63 @@ public class ExternalGraphic extends FObj {
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) {
@@ -191,9 +243,9 @@ public class ExternalGraphic extends FObj {
imgex.getMessage());
}
- if (area instanceof BlockArea) {
- area.start();
- }
+ //if (area instanceof BlockArea) {
+ // area.start();
+ //}
return new Status(Status.OK);
}
diff --git a/src/org/apache/fop/image/ImageArea.java b/src/org/apache/fop/image/ImageArea.java
index 65c512861..e09afced7 100644
--- a/src/org/apache/fop/image/ImageArea.java
+++ b/src/org/apache/fop/image/ImageArea.java
@@ -54,24 +54,32 @@ package org.apache.fop.image;
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;
@@ -90,6 +98,7 @@ public class ImageArea extends Area {
xOffset = startIndent + ((endIndent - startIndent) - width)/2;
break;
}
+ */
}
public int getXOffset() {
@@ -107,4 +116,34 @@ public class ImageArea extends Area {
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;
+ }
+
+
+
}
+
+