diff options
author | Jeremias Maerki <jeremias@apache.org> | 2006-01-20 12:52:50 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2006-01-20 12:52:50 +0000 |
commit | 5a9b73f0742d64a486e69d9713c3304232ea4492 (patch) | |
tree | b628e2d2d98b6ddd18d5779c853d26efed48e314 /src/java/org/apache/fop/render | |
parent | 4a34763794b0293bbcf74a08f34d0035aeff61fe (diff) | |
download | xmlgraphics-fop-5a9b73f0742d64a486e69d9713c3304232ea4492.tar.gz xmlgraphics-fop-5a9b73f0742d64a486e69d9713c3304232ea4492.zip |
RTF output did not generate the "\landscape" tag when necessary.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@370798 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render')
-rw-r--r-- | src/java/org/apache/fop/render/rtf/PageAttributesConverter.java | 9 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPage.java | 21 |
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); } } } |