From: Jeremias Maerki Date: Wed, 3 Aug 2005 19:30:55 +0000 (+0000) Subject: Removing dependencies of RTF library on the rest of FOP so it can be used stand-alone. X-Git-Tag: fop-0_90-alpha1~434 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=65cf9c8ad2c4ede890e150525f4a6d764c52a9ab;p=xmlgraphics-fop.git Removing dependencies of RTF library on the rest of FOP so it can be used stand-alone. Submitted by: Guillaume Déflache git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@227252 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/render/rtf/BorderAttributesConverter.java b/src/java/org/apache/fop/render/rtf/BorderAttributesConverter.java new file mode 100644 index 000000000..2f9e5e4b9 --- /dev/null +++ b/src/java/org/apache/fop/render/rtf/BorderAttributesConverter.java @@ -0,0 +1,106 @@ +/* + * Copyright 1999-2005 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id$ */ + + +/* + * This file is part of the RTF library of the FOP project, which was originally + * created by Bertrand Delacretaz and by other + * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to + * the FOP project. + */ + +package org.apache.fop.render.rtf; + +import org.apache.fop.fo.Constants; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.render.rtf.rtflib.rtfdoc.IBorderAttributes; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes; + +/** Constants for RTF border attribute names, and a static method for converting + * fo attribute strings. */ + +public class BorderAttributesConverter { + + /** + * Create a border control word in attributes, with border properties + * as specified in color, style and width. + * @param border The CommonBorderPaddingBackground object. + * @param side The START, END, BEFORE, AFTER enum from CommonBorderPaddingBackground. + * @param attributes The attributes list to set the border control word. + * @param controlWord The border control word. + */ + public static void makeBorder(CommonBorderPaddingBackground border, int side, + RtfAttributes attributes, String controlWord) { + int styleEnum = border.getBorderStyle(side); + if (styleEnum != Constants.EN_NONE) { + FOPRtfAttributes attrs = new FOPRtfAttributes(); + attrs.set(IBorderAttributes.BORDER_COLOR, border.getBorderColor(side)); + attrs.set(convertAttributetoRtf(styleEnum)); + attrs.set(IBorderAttributes.BORDER_WIDTH, border.getBorderWidth(side, false)); + attributes.set(controlWord, attrs); + } + } + + /** + * + * @param iBorderStyle the border style to be converted + * @return String with the converted border style + */ + public static String convertAttributetoRtf(int iBorderStyle) { + // Added by Normand Masse + // "solid" is interpreted like "thin" + if (iBorderStyle == Constants.EN_NONE) { + return IBorderAttributes.BORDER_NIL; + } else if (iBorderStyle == Constants.EN_SOLID) { + return IBorderAttributes.BORDER_SINGLE_THICKNESS; +/* } else if (iBorderStyle==Constants.EN_THIN) { + return IBorderAttributes.BORDER_SINGLE_THICKNESS; + } else if (iBorderStyle==Constants.EN_THICK) { + return IBorderAttributes.BORDER_DOUBLE_THICKNESS; + } else if (iBorderStyle==Constants.EN_ value.equals("shadowed")) { + return IBorderAttributes.BORDER_SHADOWED;*/ + } else if (iBorderStyle == Constants.EN_DOUBLE) { + return IBorderAttributes.BORDER_DOUBLE; + } else if (iBorderStyle == Constants.EN_DOTTED) { + return IBorderAttributes.BORDER_DOTTED; + } else if (iBorderStyle == Constants.EN_DASHED) { + return IBorderAttributes.BORDER_DASH; +/* } else if (iBorderStyle==Constants value.equals("hairline")) { + return IBorderAttributes.BORDER_HAIRLINE;*/ +/* } else if (iBorderStyle==Constant value.equals("dot-dash")) { + return IBorderAttributes.BORDER_DOT_DASH; + } else if (iBorderStyle==Constant value.equals("dot-dot-dash")) { + return IBorderAttributes.BORDER_DOT_DOT_DASH; + } else if (iBorderStyle==Constant value.equals("triple")) { + return IBorderAttributes.BORDER_TRIPLE; + } else if (iBorderStyle==Constant value.equals("wavy")) { + return IBorderAttributes.BORDER_WAVY; + } else if (iBorderStyle==Constant value.equals("wavy-double")) { + return IBorderAttributes.BORDER_WAVY_DOUBLE; + } else if (iBorderStyle==Constant value.equals("striped")) { + return IBorderAttributes.BORDER_STRIPED; + } else if (iBorderStyle==Constant value.equals("emboss")) { + return IBorderAttributes.BORDER_EMBOSS; + } else if (iBorderStyle==Constant value.equals("engrave")) { + return IBorderAttributes.BORDER_ENGRAVE;*/ + } else { + return null; + } + + } +} \ No newline at end of file diff --git a/src/java/org/apache/fop/render/rtf/BuilderContext.java b/src/java/org/apache/fop/render/rtf/BuilderContext.java index 768532d00..d9b73f022 100644 --- a/src/java/org/apache/fop/render/rtf/BuilderContext.java +++ b/src/java/org/apache/fop/render/rtf/BuilderContext.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2005 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. @@ -33,7 +33,7 @@ import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfContainer; * for the JFOR project and is now integrated into FOP. */ -class BuilderContext { +public class BuilderContext { /** stack of RtfContainers */ private final Stack containers = new Stack(); @@ -46,7 +46,7 @@ class BuilderContext { /** Rtf options */ private IRtfOptions options; - BuilderContext(IRtfOptions rtfOptions) { + public BuilderContext(IRtfOptions rtfOptions) { options = rtfOptions; } @@ -67,7 +67,7 @@ class BuilderContext { } /* find the "nearest" IBuilder of given class / - Object getBuilder(Class builderClass,boolean required) + public Object getBuilder(Class builderClass,boolean required) throws Exception { final IBuilder result = (IBuilder)getObjectFromStack(builders,builderClass); @@ -83,7 +83,7 @@ class BuilderContext { * @param required if true, ConverterException is thrown if no container found * @param forWhichBuilder used in error message if container not found */ - RtfContainer getContainer(Class containerClass, boolean required, + public RtfContainer getContainer(Class containerClass, boolean required, Object /*IBuilder*/ forWhichBuilder) throws Exception { // TODO what to do if the desired container is not at the top of the stack? // close top-of-stack container? @@ -101,7 +101,7 @@ class BuilderContext { } /** push an RtfContainer on our stack */ - void pushContainer(RtfContainer c) { + public void pushContainer(RtfContainer c) { containers.push(c); } @@ -113,7 +113,7 @@ class BuilderContext { * TODO: what happens to elements that are "more on top" than oldC on the * stack? shouldn't they be closed or something? */ - void replaceContainer(RtfContainer oldC, RtfContainer newC) + public void replaceContainer(RtfContainer oldC, RtfContainer newC) throws Exception { // treating the Stack as a Vector allows such manipulations (yes, I hear you screaming ;-) final int index = containers.indexOf(oldC); @@ -124,12 +124,12 @@ class BuilderContext { } /** pop the topmost RtfContainer from our stack */ - void popContainer() { + public void popContainer() { containers.pop(); } /* push an IBuilder to our stack / - void pushBuilder(IBuilder b) + public void pushBuilder(IBuilder b) { builders.push(b); }*/ @@ -137,7 +137,7 @@ class BuilderContext { /** pop the topmost IBuilder from our stack and return previous builder on stack * @return null if builders stack is empty - IBuilder popBuilderAndGetPreviousOne() + public IBuilder popBuilderAndGetPreviousOne() { IBuilder result = null; builders.pop(); @@ -148,18 +148,18 @@ class BuilderContext { } */ /** return the current TableContext */ - TableContext getTableContext() { + public TableContext getTableContext() { return (TableContext)tableContexts.peek(); } /** push a TableContext to our stack */ - void pushTableContext(TableContext tc) { + public void pushTableContext(TableContext tc) { tableContexts.push(tc); } /** pop a TableContext from our stack */ - void popTableContext() { + public void popTableContext() { tableContexts.pop(); } -} \ No newline at end of file +} diff --git a/src/java/org/apache/fop/render/rtf/RTFHandler.java b/src/java/org/apache/fop/render/rtf/RTFHandler.java index 151bb373d..06e02f9ff 100644 --- a/src/java/org/apache/fop/render/rtf/RTFHandler.java +++ b/src/java/org/apache/fop/render/rtf/RTFHandler.java @@ -505,7 +505,9 @@ public class RTFHandler extends FOEventHandler { try { Integer iWidth = new Integer(tc.getColumnWidth().getValue() / 1000); - builderContext.getTableContext().setNextColumnWidth(iWidth.toString() + "pt"); + String strWidth = iWidth.toString() + "pt"; + Float width = new Float(FoUnitsConverter.getInstance().convertToTwips(strWidth)); + builderContext.getTableContext().setNextColumnWidth(width); builderContext.getTableContext().setNextColumnRowSpanning(new Integer(0), null); } catch (Exception e) { log.error("startColumn: " + e.getMessage()); diff --git a/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java b/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java index d16f17119..0f1a92a17 100644 --- a/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java +++ b/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2005 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. @@ -29,7 +29,7 @@ import org.apache.fop.fo.flow.TableCell; import org.apache.fop.fo.flow.TableRow; import org.apache.fop.fo.properties.CommonBorderPaddingBackground; import org.apache.fop.fo.properties.Property; -import org.apache.fop.render.rtf.rtflib.rtfdoc.BorderAttributesConverter; +import org.apache.fop.render.rtf.BorderAttributesConverter; import org.apache.fop.render.rtf.rtflib.rtfdoc.ITableAttributes; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfColorTable; @@ -320,50 +320,4 @@ public class TableAttributesConverter { return attrib; } - - /** - * - * @param iBorderStyle the border style to be converted - * @return String with the converted border style - */ - public static String convertAttributetoRtf(int iBorderStyle) { - // Added by Normand Masse - // "solid" is interpreted like "thin" - if (iBorderStyle == Constants.EN_SOLID) { - return BorderAttributesConverter.BORDER_SINGLE_THICKNESS; -/* } else if (iBorderStyle==Constants.EN_THIN) { - return BorderAttributesConverter.BORDER_SINGLE_THICKNESS; - } else if (iBorderStyle==Constants.EN_THICK) { - return BorderAttributesConverter.BORDER_DOUBLE_THICKNESS; - } else if (iBorderStyle==Constants.EN_ value.equals("shadowed")) { - return BorderAttributesConverter.BORDER_SHADOWED;*/ - } else if (iBorderStyle == Constants.EN_DOUBLE) { - return BorderAttributesConverter.BORDER_DOUBLE; - } else if (iBorderStyle == Constants.EN_DOTTED) { - return BorderAttributesConverter.BORDER_DOTTED; - } else if (iBorderStyle == Constants.EN_DASHED) { - return BorderAttributesConverter.BORDER_DASH; -/* } else if (iBorderStyle==Constants value.equals("hairline")) { - return BorderAttributesConverter.BORDER_HAIRLINE;*/ -/* } else if (iBorderStyle==Constant value.equals("dot-dash")) { - return BorderAttributesConverter.BORDER_DOT_DASH; - } else if (iBorderStyle==Constant value.equals("dot-dot-dash")) { - return BorderAttributesConverter.BORDER_DOT_DOT_DASH; - } else if (iBorderStyle==Constant value.equals("triple")) { - return BorderAttributesConverter.BORDER_TRIPLE; - } else if (iBorderStyle==Constant value.equals("wavy")) { - return BorderAttributesConverter.BORDER_WAVY; - } else if (iBorderStyle==Constant value.equals("wavy-double")) { - return BorderAttributesConverter.BORDER_WAVY_DOUBLE; - } else if (iBorderStyle==Constant value.equals("striped")) { - return BorderAttributesConverter.BORDER_STRIPED; - } else if (iBorderStyle==Constant value.equals("emboss")) { - return BorderAttributesConverter.BORDER_EMBOSS; - } else if (iBorderStyle==Constant value.equals("engrave")) { - return BorderAttributesConverter.BORDER_ENGRAVE;*/ - } else { - return null; - } - } - } diff --git a/src/java/org/apache/fop/render/rtf/TableContext.java b/src/java/org/apache/fop/render/rtf/TableContext.java index fa847f09e..8ae98a922 100644 --- a/src/java/org/apache/fop/render/rtf/TableContext.java +++ b/src/java/org/apache/fop/render/rtf/TableContext.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2005 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. @@ -38,7 +38,7 @@ import org.apache.fop.render.rtf.rtflib.interfaces.ITableColumnsInfo; * is now integrated into FOP. */ -class TableContext implements ITableColumnsInfo { +public class TableContext implements ITableColumnsInfo { private final Log log = new SimpleLog("FOP/RTF"); private final BuilderContext context; private final List colWidths = new java.util.ArrayList(); @@ -72,27 +72,27 @@ class TableContext implements ITableColumnsInfo { return bNextRowBelongsToHeader; } - TableContext(BuilderContext ctx) { + public TableContext(BuilderContext ctx) { context = ctx; } - void setNextColumnWidth(String strWidth) + public void setNextColumnWidth(Float width) throws Exception { - colWidths.add(new Float(FoUnitsConverter.getInstance().convertToTwips(strWidth))); + colWidths.add(width); } //Added by Peter Herweg on 2002-06-29 - RtfAttributes getColumnRowSpanningAttrs() { + public RtfAttributes getColumnRowSpanningAttrs() { return (RtfAttributes)colRowSpanningAttrs.get(colIndex); } //Added by Peter Herweg on 2002-06-29 - Integer getColumnRowSpanningNumber() { + public Integer getColumnRowSpanningNumber() { return (Integer)colRowSpanningNumber.get(colIndex); } //Added by Peter Herweg on 2002-06-29 - void setCurrentColumnRowSpanning(Integer iRowSpanning, RtfAttributes attrs) + public void setCurrentColumnRowSpanning(Integer iRowSpanning, RtfAttributes attrs) throws Exception { if (colIndex < colRowSpanningNumber.size()) { diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/BorderAttributesConverter.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/BorderAttributesConverter.java deleted file mode 100644 index 4eca61954..000000000 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/BorderAttributesConverter.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright 1999-2004 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Id$ */ - - -/* - * This file is part of the RTF library of the FOP project, which was originally - * created by Bertrand Delacretaz and by other - * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to - * the FOP project. - */ - -package org.apache.fop.render.rtf.rtflib.rtfdoc; - -import org.apache.fop.fo.Constants; -import org.apache.fop.fo.properties.CommonBorderPaddingBackground; -import org.apache.fop.render.rtf.FOPRtfAttributes; - -/** Constants for RTF border attribute names, and a static method for converting - * fo attribute strings. */ - -public class BorderAttributesConverter { - - /** Constant for a single-thick border */ - public static final String BORDER_SINGLE_THICKNESS = "brdrs"; - /** Constant for a double-thick border */ - public static final String BORDER_DOUBLE_THICKNESS = "brdrth"; - /** Constant for a shadowed border */ - public static final String BORDER_SHADOWED = "brdrsh"; - /** Constant for a double border */ - public static final String BORDER_DOUBLE = "brdrdb"; - /** Constant for a dotted border */ - public static final String BORDER_DOTTED = "brdrdot"; - /** Constant for a dashed border */ - public static final String BORDER_DASH = "brdrdash"; - /** Constant for a hairline border */ - public static final String BORDER_HAIRLINE = "brdrhair"; - /** Constant for a small-dashed border */ - public static final String BORDER_DASH_SMALL = "brdrdashsm"; - /** Constant for a dot-dashed border */ - public static final String BORDER_DOT_DASH = "brdrdashd"; - /** Constant for a dot-dot-dashed border */ - public static final String BORDER_DOT_DOT_DASH = "brdrdashdd"; - /** Constant for a triple border */ - public static final String BORDER_TRIPLE = "brdrtriple"; - /** Constant for a think-thin-small border */ - public static final String BORDER_THINK_THIN_SMALL = "brdrtnthsg"; - /** Constant for a thin-thick-small border */ - public static final String BORDER_THIN_THICK_SMALL = "brdrthtnsg"; - /** Constant for a thin-thick-thin-small border */ - public static final String BORDER_THIN_THICK_THIN_SMALL = "brdrthtnthsg"; - /** Constant for a think-thin-medium border */ - public static final String BORDER_THINK_THIN_MEDIUM = "brdrtnthmg"; - /** Constant for a thin-thick-medium border */ - public static final String BORDER_THIN_THICK_MEDIUM = "brdrthtnmg"; - /** Constant for a thin-thick-thin-medium border */ - public static final String BORDER_THIN_THICK_THIN_MEDIUM = "brdrthtnthmg"; - /** Constant for a think-thin-large border */ - public static final String BORDER_THINK_THIN_LARGE = "brdrtnthlg"; - /** Constant for a thin-thick-large border */ - public static final String BORDER_THIN_THICK_LARGE = "brdrthtnlg"; - /** Constant for a thin-thick-thin-large border */ - public static final String BORDER_THIN_THICK_THIN_LARGE = "brdrthtnthlg"; - /** Constant for a wavy border */ - public static final String BORDER_WAVY = "brdrwavy"; - /** Constant for a double wavy border */ - public static final String BORDER_WAVY_DOUBLE = "brdrwavydb"; - /** Constant for a striped border */ - public static final String BORDER_STRIPED = "brdrdashdotstr"; - /** Constant for an embossed border */ - public static final String BORDER_EMBOSS = "brdremboss"; - /** Constant for an engraved border */ - public static final String BORDER_ENGRAVE = "brdrengrave"; - /** Constant for an nil border */ - public static final String BORDER_NIL = "brdrnil"; - /** Constant for border color */ - public static final String BORDER_COLOR = "brdrcf"; - /** Constant for border space */ - public static final String BORDER_SPACE = "brsp"; - /** Constant for border width */ - public static final String BORDER_WIDTH = "brdrw"; - - /** String array of border attributes */ - public static final String [] BORDERS = new String[] { - BORDER_SINGLE_THICKNESS, BORDER_DOUBLE_THICKNESS, BORDER_SHADOWED, - BORDER_DOUBLE, BORDER_DOTTED, BORDER_DASH, - BORDER_HAIRLINE, BORDER_DASH_SMALL, BORDER_DOT_DASH, - BORDER_DOT_DOT_DASH, BORDER_TRIPLE, BORDER_THINK_THIN_SMALL, - BORDER_THIN_THICK_SMALL, BORDER_THIN_THICK_THIN_SMALL, BORDER_THINK_THIN_MEDIUM, - BORDER_THIN_THICK_MEDIUM, BORDER_THIN_THICK_THIN_MEDIUM, BORDER_THINK_THIN_LARGE, - BORDER_THIN_THICK_LARGE, BORDER_THIN_THICK_THIN_LARGE, BORDER_WAVY, - BORDER_WAVY_DOUBLE, BORDER_STRIPED, BORDER_EMBOSS, - BORDER_ENGRAVE, BORDER_COLOR, BORDER_SPACE, - BORDER_WIDTH - }; - - /** - * Create a border control word in attributes, with border properties - * as specified in color, style and width. - * @param border The CommonBorderPaddingBackground object. - * @param side The START, END, BEFORE, AFTER enum from CommonBorderPaddingBackground. - * @param attributes The attributes list to set the border control word. - * @param controlWord The border control word. - */ - public static void makeBorder(CommonBorderPaddingBackground border, int side, - RtfAttributes attributes, String controlWord) { - int styleEnum = border.getBorderStyle(side); - if (styleEnum != Constants.EN_NONE) { - FOPRtfAttributes attrs = new FOPRtfAttributes(); - attrs.set(BORDER_COLOR, border.getBorderColor(side)); - attrs.set(convertAttributetoRtf(styleEnum)); - attrs.set(BORDER_WIDTH, border.getBorderWidth(side, false)); - attributes.set(controlWord, attrs); - } - } - - /** - * - * @param iBorderStyle the border style to be converted - * @return String with the converted border style - */ - public static String convertAttributetoRtf(int iBorderStyle) { - // Added by Normand Masse - // "solid" is interpreted like "thin" - if (iBorderStyle == Constants.EN_NONE) { - return BorderAttributesConverter.BORDER_NIL; - } else if (iBorderStyle == Constants.EN_SOLID) { - return BorderAttributesConverter.BORDER_SINGLE_THICKNESS; -/* } else if (iBorderStyle==Constants.EN_THIN) { - return BorderAttributesConverter.BORDER_SINGLE_THICKNESS; - } else if (iBorderStyle==Constants.EN_THICK) { - return BorderAttributesConverter.BORDER_DOUBLE_THICKNESS; - } else if (iBorderStyle==Constants.EN_ value.equals("shadowed")) { - return BorderAttributesConverter.BORDER_SHADOWED;*/ - } else if (iBorderStyle == Constants.EN_DOUBLE) { - return BorderAttributesConverter.BORDER_DOUBLE; - } else if (iBorderStyle == Constants.EN_DOTTED) { - return BorderAttributesConverter.BORDER_DOTTED; - } else if (iBorderStyle == Constants.EN_DASHED) { - return BorderAttributesConverter.BORDER_DASH; -/* } else if (iBorderStyle==Constants value.equals("hairline")) { - return BorderAttributesConverter.BORDER_HAIRLINE;*/ -/* } else if (iBorderStyle==Constant value.equals("dot-dash")) { - return BorderAttributesConverter.BORDER_DOT_DASH; - } else if (iBorderStyle==Constant value.equals("dot-dot-dash")) { - return BorderAttributesConverter.BORDER_DOT_DOT_DASH; - } else if (iBorderStyle==Constant value.equals("triple")) { - return BorderAttributesConverter.BORDER_TRIPLE; - } else if (iBorderStyle==Constant value.equals("wavy")) { - return BorderAttributesConverter.BORDER_WAVY; - } else if (iBorderStyle==Constant value.equals("wavy-double")) { - return BorderAttributesConverter.BORDER_WAVY_DOUBLE; - } else if (iBorderStyle==Constant value.equals("striped")) { - return BorderAttributesConverter.BORDER_STRIPED; - } else if (iBorderStyle==Constant value.equals("emboss")) { - return BorderAttributesConverter.BORDER_EMBOSS; - } else if (iBorderStyle==Constant value.equals("engrave")) { - return BorderAttributesConverter.BORDER_ENGRAVE;*/ - } else { - return null; - } - - } -} \ No newline at end of file diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IBorderAttributes.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IBorderAttributes.java new file mode 100644 index 000000000..a0e957c73 --- /dev/null +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IBorderAttributes.java @@ -0,0 +1,105 @@ +/* + * Copyright 1999-2004 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id: BorderAttributesConverter.java 198175 2004-11-24 21:07:31Z gmazza $ */ + + +/* + * This file is part of the RTF library of the FOP project, which was originally + * created by Bertrand Delacretaz and by other + * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to + * the FOP project. + */ + +package org.apache.fop.render.rtf.rtflib.rtfdoc; + +/** Constants for RTF border attribute names. */ + +public interface IBorderAttributes { + + /** Constant for a single-thick border */ + public static final String BORDER_SINGLE_THICKNESS = "brdrs"; + /** Constant for a double-thick border */ + public static final String BORDER_DOUBLE_THICKNESS = "brdrth"; + /** Constant for a shadowed border */ + public static final String BORDER_SHADOWED = "brdrsh"; + /** Constant for a double border */ + public static final String BORDER_DOUBLE = "brdrdb"; + /** Constant for a dotted border */ + public static final String BORDER_DOTTED = "brdrdot"; + /** Constant for a dashed border */ + public static final String BORDER_DASH = "brdrdash"; + /** Constant for a hairline border */ + public static final String BORDER_HAIRLINE = "brdrhair"; + /** Constant for a small-dashed border */ + public static final String BORDER_DASH_SMALL = "brdrdashsm"; + /** Constant for a dot-dashed border */ + public static final String BORDER_DOT_DASH = "brdrdashd"; + /** Constant for a dot-dot-dashed border */ + public static final String BORDER_DOT_DOT_DASH = "brdrdashdd"; + /** Constant for a triple border */ + public static final String BORDER_TRIPLE = "brdrtriple"; + /** Constant for a think-thin-small border */ + public static final String BORDER_THINK_THIN_SMALL = "brdrtnthsg"; + /** Constant for a thin-thick-small border */ + public static final String BORDER_THIN_THICK_SMALL = "brdrthtnsg"; + /** Constant for a thin-thick-thin-small border */ + public static final String BORDER_THIN_THICK_THIN_SMALL = "brdrthtnthsg"; + /** Constant for a think-thin-medium border */ + public static final String BORDER_THINK_THIN_MEDIUM = "brdrtnthmg"; + /** Constant for a thin-thick-medium border */ + public static final String BORDER_THIN_THICK_MEDIUM = "brdrthtnmg"; + /** Constant for a thin-thick-thin-medium border */ + public static final String BORDER_THIN_THICK_THIN_MEDIUM = "brdrthtnthmg"; + /** Constant for a think-thin-large border */ + public static final String BORDER_THINK_THIN_LARGE = "brdrtnthlg"; + /** Constant for a thin-thick-large border */ + public static final String BORDER_THIN_THICK_LARGE = "brdrthtnlg"; + /** Constant for a thin-thick-thin-large border */ + public static final String BORDER_THIN_THICK_THIN_LARGE = "brdrthtnthlg"; + /** Constant for a wavy border */ + public static final String BORDER_WAVY = "brdrwavy"; + /** Constant for a double wavy border */ + public static final String BORDER_WAVY_DOUBLE = "brdrwavydb"; + /** Constant for a striped border */ + public static final String BORDER_STRIPED = "brdrdashdotstr"; + /** Constant for an embossed border */ + public static final String BORDER_EMBOSS = "brdremboss"; + /** Constant for an engraved border */ + public static final String BORDER_ENGRAVE = "brdrengrave"; + /** Constant for an nil border */ + public static final String BORDER_NIL = "brdrnil"; + /** Constant for border color */ + public static final String BORDER_COLOR = "brdrcf"; + /** Constant for border space */ + public static final String BORDER_SPACE = "brsp"; + /** Constant for border width */ + public static final String BORDER_WIDTH = "brdrw"; + + /** String array of border attributes */ + public static final String [] BORDERS = new String[] { + BORDER_SINGLE_THICKNESS, BORDER_DOUBLE_THICKNESS, BORDER_SHADOWED, + BORDER_DOUBLE, BORDER_DOTTED, BORDER_DASH, + BORDER_HAIRLINE, BORDER_DASH_SMALL, BORDER_DOT_DASH, + BORDER_DOT_DOT_DASH, BORDER_TRIPLE, BORDER_THINK_THIN_SMALL, + BORDER_THIN_THICK_SMALL, BORDER_THIN_THICK_THIN_SMALL, BORDER_THINK_THIN_MEDIUM, + BORDER_THIN_THICK_MEDIUM, BORDER_THIN_THICK_THIN_MEDIUM, BORDER_THINK_THIN_LARGE, + BORDER_THIN_THICK_LARGE, BORDER_THIN_THICK_THIN_LARGE, BORDER_WAVY, + BORDER_WAVY_DOUBLE, BORDER_STRIPED, BORDER_EMBOSS, + BORDER_ENGRAVE, BORDER_COLOR, BORDER_SPACE, + BORDER_WIDTH + }; +} diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfGenerator.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfGenerator.java index e2ee8b618..9f061cc9a 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfGenerator.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2004 The Apache Software Foundation. + * Copyright 2004-2005 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. @@ -21,8 +21,6 @@ package org.apache.fop.render.rtf.rtflib.rtfdoc; import java.io.IOException; import java.io.Writer; -import org.apache.fop.apps.Fop; - /** * Represents a generator element which says who generated the RTF document. */ @@ -40,8 +38,7 @@ public class RtfGenerator extends RtfElement { newLine(); writeGroupMark(true); writeStarControlWord("generator"); - writer.write("Apache FOP "); - writer.write(Fop.getVersion()); + writer.write("Apache XML Graphics RTF Library"); writer.write(";"); writeGroupMark(false); } diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java index f7a1b93b3..d772605ea 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2005 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. @@ -252,7 +252,7 @@ implements IRtfParagraphContainer, IRtfListContainer, IRtfTableContainer, writeAttributes (attrib, ITableAttributes.ATTRIB_CELL_PADDING); writeAttributes (attrib, ITableAttributes.CELL_BORDER); - writeAttributes (attrib, BorderAttributesConverter.BORDERS); + writeAttributes (attrib, IBorderAttributes.BORDERS); // cell width final int xPos = widthOffset + this.cellWidth; diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java index a0777e620..846a782d5 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2005 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. @@ -152,7 +152,7 @@ public class RtfTableRow extends RtfContainer implements ITableAttributes { writeAttributes(attrib, new String[]{ITableAttributes.ATTR_HEADER}); writeAttributes(attrib, ITableAttributes.ROW_BORDER); writeAttributes(attrib, ITableAttributes.CELL_BORDER); - writeAttributes(attrib, BorderAttributesConverter.BORDERS); + writeAttributes(attrib, IBorderAttributes.BORDERS); if (attrib.isSet(ITableAttributes.ROW_HEIGHT)) { writeOneAttribute(