aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/fop/render')
-rw-r--r--src/java/org/apache/fop/render/rtf/PageAttributesConverter.java9
-rw-r--r--src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPage.java21
2 files changed, 20 insertions, 10 deletions
diff --git a/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java b/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java
index 3947f21d9..4d1cd0052 100644
--- a/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java
+++ b/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2004,2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -53,6 +53,13 @@ class PageAttributesConverter {
attrib.setTwips(RtfPage.PAGE_WIDTH, pagemaster.getPageWidth());
attrib.setTwips(RtfPage.PAGE_HEIGHT, pagemaster.getPageHeight());
+ Object widthRaw = attrib.getValue(RtfPage.PAGE_WIDTH);
+ Object heightRaw = attrib.getValue(RtfPage.PAGE_HEIGHT);
+ if ((widthRaw instanceof Integer) && (heightRaw instanceof Integer)
+ && ((Integer) widthRaw).intValue() > ((Integer) heightRaw).intValue()) {
+ attrib.set(RtfPage.LANDSCAPE);
+ }
+
Length pageTop = pagemaster.getCommonMarginBlock().marginTop;
Length pageBottom = pagemaster.getCommonMarginBlock().marginBottom;
Length pageLeft = pagemaster.getCommonMarginBlock().marginLeft;
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPage.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPage.java
index cd6fc0381..567e1ff86 100644
--- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPage.java
+++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPage.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2004,2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,6 +44,9 @@ extends RtfContainer {
/** constant for page height */
public static final String PAGE_HEIGHT = "paperh";
+ /** constant for landscape format */
+ public static final String LANDSCAPE = "landscape";
+
/** constant for top margin */
public static final String MARGIN_TOP = "margt";
/** constant for bottom margin */
@@ -60,7 +63,7 @@ extends RtfContainer {
/** String array of RtfPage attributes */
public static final String[] PAGE_ATTR = new String[]{
- PAGE_WIDTH, PAGE_HEIGHT, MARGIN_TOP, MARGIN_BOTTOM,
+ PAGE_WIDTH, PAGE_HEIGHT, LANDSCAPE, MARGIN_TOP, MARGIN_BOTTOM,
MARGIN_LEFT, MARGIN_RIGHT, HEADERY, FOOTERY
};
@@ -71,12 +74,12 @@ extends RtfContainer {
attrib = attrs;
}
- /**
- * RtfPage writes the attributes the attributes contained in the string
- * PAGE_ATTR, if not null
- * @throws IOException for I/O problems
- */
- protected void writeRtfContent() throws IOException {
+ /**
+ * RtfPage writes the attributes the attributes contained in the string
+ * PAGE_ATTR, if not null
+ * @throws IOException for I/O problems
+ */
+ protected void writeRtfContent() throws IOException {
writeAttributes(attrib, PAGE_ATTR);
if (attrib != null) {
@@ -85,7 +88,7 @@ extends RtfContainer {
if ((widthRaw instanceof Integer) && (heightRaw instanceof Integer)
&& ((Integer) widthRaw).intValue() > ((Integer) heightRaw).intValue()) {
- writeControlWord("landscape");
+ writeControlWord(LANDSCAPE);
}
}
}