From: Jeremias Maerki Date: Fri, 20 Jan 2006 12:52:50 +0000 (+0000) Subject: RTF output did not generate the "\landscape" tag when necessary. X-Git-Tag: fop-0_92-beta~194 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5a9b73f0742d64a486e69d9713c3304232ea4492;p=xmlgraphics-fop.git 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 --- 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); } } } diff --git a/status.xml b/status.xml index 612d116f6..1991f3bf8 100644 --- a/status.xml +++ b/status.xml @@ -27,6 +27,10 @@ + + The RTF output now properly generates the "\landscape" flag for documents in + landscape orientation. + Following a clarification by the XSL FO SG, space traits are only set on the first and last area generated by an FO, and not on every area anymore.