aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2007-12-20 19:19:19 +0000
committerJeremias Maerki <jeremias@apache.org>2007-12-20 19:19:19 +0000
commited61f771c493e86046f3d13e3d6a553d825dd8f3 (patch)
tree045c5a0341773483443b312df7e0bd7e38670fbc /src/java/org/apache/fop
parent3311cbaf601724c5601e7ff7e6602016dbf862ac (diff)
downloadxmlgraphics-fop-ed61f771c493e86046f3d13e3d6a553d825dd8f3.tar.gz
xmlgraphics-fop-ed61f771c493e86046f3d13e3d6a553d825dd8f3.zip
Added support for scale-down-to-fit and scale-up-to-fit.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@606004 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop')
-rw-r--r--src/java/org/apache/fop/fo/Constants.java8
-rw-r--r--src/java/org/apache/fop/fo/FOPropertyMapping.java7
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java32
3 files changed, 41 insertions, 6 deletions
diff --git a/src/java/org/apache/fop/fo/Constants.java b/src/java/org/apache/fop/fo/Constants.java
index e0477c0a5..edfa68c1a 100644
--- a/src/java/org/apache/fop/fo/Constants.java
+++ b/src/java/org/apache/fop/fo/Constants.java
@@ -1087,6 +1087,12 @@ public interface Constants {
int EN_SMALL_CAPTION = 184;
/** Enumeration constant -- font shorthand */
int EN_STATUS_BAR = 185;
+ /** Enumeration constant -- for page-position, XSL 1.1 */
+ int EN_ONLY = 186;
+ /** Enumeration constant -- for instream-foreign-object and external-graphic, XSL 1.1 */
+ int EN_SCALE_DOWN_TO_FIT = 187;
+ /** Enumeration constant -- for instream-foreign-object and external-graphic, XSL 1.1 */
+ int EN_SCALE_UP_TO_FIT = 188;
/** Number of enumeration constants defined */
- int ENUM_COUNT = 185;
+ int ENUM_COUNT = 188;
}
diff --git a/src/java/org/apache/fop/fo/FOPropertyMapping.java b/src/java/org/apache/fop/fo/FOPropertyMapping.java
index 5d1a6f31a..1fe9a32c4 100644
--- a/src/java/org/apache/fop/fo/FOPropertyMapping.java
+++ b/src/java/org/apache/fop/fo/FOPropertyMapping.java
@@ -25,13 +25,13 @@ import java.util.Map;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.datatypes.LengthBase;
import org.apache.fop.fo.expr.PropertyException;
+import org.apache.fop.fo.flow.table.TableFObj.ColumnNumberPropertyMaker;
import org.apache.fop.fo.properties.BackgroundPositionShorthandParser;
import org.apache.fop.fo.properties.BorderSpacingShorthandParser;
import org.apache.fop.fo.properties.BorderWidthPropertyMaker;
import org.apache.fop.fo.properties.BoxPropShorthandParser;
import org.apache.fop.fo.properties.CharacterProperty;
import org.apache.fop.fo.properties.ColorProperty;
-import org.apache.fop.fo.flow.table.TableFObj.ColumnNumberPropertyMaker;
import org.apache.fop.fo.properties.CondLengthProperty;
import org.apache.fop.fo.properties.CorrespondingPropertyMaker;
import org.apache.fop.fo.properties.DimensionPropertyMaker;
@@ -1353,6 +1353,8 @@ public final class FOPropertyMapping implements Constants {
l.setInherited(false);
l.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
l.addEnum("scale-to-fit", getEnumProperty(EN_SCALE_TO_FIT, "SCALE_TO_FIT"));
+ l.addEnum("scale-down-to-fit", getEnumProperty(EN_SCALE_DOWN_TO_FIT, "SCALE_DOWN_TO_FIT"));
+ l.addEnum("scale-up-to-fit", getEnumProperty(EN_SCALE_UP_TO_FIT, "SCALE_UP_TO_FIT"));
l.setDefault("auto");
l.setPercentBase(LengthBase.IMAGE_INTRINSIC_HEIGHT);
addPropertyMaker("content-height", l);
@@ -1362,6 +1364,8 @@ public final class FOPropertyMapping implements Constants {
l.setInherited(false);
l.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
l.addEnum("scale-to-fit", getEnumProperty(EN_SCALE_TO_FIT, "SCALE_TO_FIT"));
+ l.addEnum("scale-down-to-fit", getEnumProperty(EN_SCALE_DOWN_TO_FIT, "SCALE_DOWN_TO_FIT"));
+ l.addEnum("scale-up-to-fit", getEnumProperty(EN_SCALE_UP_TO_FIT, "SCALE_UP_TO_FIT"));
l.setDefault("auto");
l.setPercentBase(LengthBase.IMAGE_INTRINSIC_WIDTH);
addPropertyMaker("content-width", l);
@@ -2223,6 +2227,7 @@ public final class FOPropertyMapping implements Constants {
m.addEnum("last", getEnumProperty(EN_LAST, "LAST"));
m.addEnum("rest", getEnumProperty(EN_REST, "REST"));
m.addEnum("any", getEnumProperty(EN_ANY, "ANY"));
+ m.addEnum("only", getEnumProperty(EN_ONLY, "ONLY")); //XSL 1.1
m.setDefault("any");
addPropertyMaker("page-position", m);
diff --git a/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
index ca82d3da7..75f852e06 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
@@ -104,21 +104,45 @@ public abstract class AbstractGraphicsLayoutManager extends LeafNodeLayoutManage
int cheight = -1;
len = fobj.getContentWidth();
if (len.getEnum() != EN_AUTO) {
- if (len.getEnum() == EN_SCALE_TO_FIT) {
+ switch (len.getEnum()) {
+ case EN_SCALE_TO_FIT:
if (ipd != -1) {
cwidth = ipd;
}
- } else {
+ break;
+ case EN_SCALE_DOWN_TO_FIT:
+ if (ipd != -1 && fobj.getIntrinsicWidth() > ipd) {
+ cwidth = ipd;
+ }
+ break;
+ case EN_SCALE_UP_TO_FIT:
+ if (ipd != -1 && fobj.getIntrinsicWidth() < ipd) {
+ cwidth = ipd;
+ }
+ break;
+ default:
cwidth = len.getValue(this);
}
}
len = fobj.getContentHeight();
if (len.getEnum() != EN_AUTO) {
- if (len.getEnum() == EN_SCALE_TO_FIT) {
+ switch (len.getEnum()) {
+ case EN_SCALE_TO_FIT:
if (bpd != -1) {
cheight = bpd;
}
- } else {
+ break;
+ case EN_SCALE_DOWN_TO_FIT:
+ if (bpd != -1 && fobj.getIntrinsicHeight() > bpd) {
+ cheight = bpd;
+ }
+ break;
+ case EN_SCALE_UP_TO_FIT:
+ if (bpd != -1 && fobj.getIntrinsicHeight() < bpd) {
+ cheight = bpd;
+ }
+ break;
+ default:
cheight = len.getValue(this);
}
}