cvs commit: xml-fop/src/java/org/apache/fop/render/rtf TableAttributesConverter.java

2004-01-30 Thread pherweg
pherweg 2004/01/30 02:51:53

  Modified:src/java/org/apache/fop/render/rtf
TableAttributesConverter.java
  Log:
  fixed runtime error while reading PR_BORDER_WIDTH or PR_BORDER_STYLE
  
  Revision  ChangesPath
  1.9   +29 -38
xml-fop/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java
  
  Index: TableAttributesConverter.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TableAttributesConverter.java 18 Jan 2004 21:21:41 -  1.8
  +++ TableAttributesConverter.java 30 Jan 2004 10:51:53 -  1.9
  @@ -218,17 +218,7 @@
   }
   
   // Border styles do not inherit from parent
  -if ((p = props.get(Constants.PR_BORDER_STYLE)) != null) {
  -log.warn("border-style not implemented. Please use border-style-left, "
  - + "...-right, ...-top or ...-bottom");
  -/*
  -attrib.set(ITableAttributes.CELL_BORDER_LEFT,  
"\\"+convertAttributetoRtf(e.getEnum()));
  -attrib.set(ITableAttributes.CELL_BORDER_RIGHT, 
"\\"+convertAttributetoRtf(e.getEnum()));
  -
attrib.set(ITableAttributes.CELL_BORDER_BOTTOM,"\\"+convertAttributetoRtf(e.getEnum()));
  -attrib.set(ITableAttributes.CELL_BORDER_TOP,   
"\\"+convertAttributetoRtf(e.getEnum()));
  -isBorderPresent=true;
  -*/
  -}
  +
   ep = (EnumProperty)props.get(Constants.PR_BORDER_TOP_STYLE);
   if (ep != null && ep.getEnum() != Constants.NONE) {
   attrib.set(ITableAttributes.CELL_BORDER_TOP,   "\\"
  @@ -254,9 +244,19 @@
   isBorderPresent = true;
   }
   
  -if ((p = props.get(Constants.PR_BORDER_WIDTH)) != null) {
  -ListProperty listprop = (ListProperty)p;
  -LengthProperty lengthprop = (LengthProperty)listprop.getList().get(0);
  +//Currently there is only one border width supported in each cell.  
  +p = props.get(Constants.PR_BORDER_LEFT_WIDTH);
  +if(p == null) {
  +p = props.get(Constants.PR_BORDER_RIGHT_WIDTH);
  +}
  +if(p == null) {
  +p = props.get(Constants.PR_BORDER_TOP_WIDTH);
  +}
  +if(p == null) {
  +p = props.get(Constants.PR_BORDER_BOTTOM_WIDTH);
  +}
  +if (p != null) {
  +LengthProperty lengthprop = (LengthProperty)p;
   
   Float f = new Float(lengthprop.getLength().getValue() / 1000f);
   String sValue = f.toString() + "pt";
  @@ -351,26 +351,7 @@
* it is implemented that the border type is the value of the border
* place.
*/
  -if ((p = props.get(Constants.PR_BORDER_STYLE)) != null) {
  -log.warn("border-style not implemented. Please use border-style-left, "
  - + "...-right, ...-top or ...-bottom");
  -/*
  -attrValue = new String(AbstractBuilder.getValue( attrs, "border-style", 
defAttrs ));
  -attrib.set(ITableAttributes.ROW_BORDER_LEFT,"\\"
  -   + 
BorderAttributesConverter.convertAttributetoRtf(attrValue));
  -attrib.set(ITableAttributes.ROW_BORDER_RIGHT,"\\"
  -   + 
BorderAttributesConverter.convertAttributetoRtf(attrValue));
  -attrib.set(ITableAttributes.ROW_BORDER_HORIZONTAL,"\\"
  -   + 
BorderAttributesConverter.convertAttributetoRtf(attrValue));
  -attrib.set(ITableAttributes.ROW_BORDER_VERTICAL,"\\"
  -   + 
BorderAttributesConverter.convertAttributetoRtf(attrValue));
  -attrib.set(ITableAttributes.ROW_BORDER_BOTTOM,"\\"
  -   + 
BorderAttributesConverter.convertAttributetoRtf(attrValue));
  -attrib.set(ITableAttributes.ROW_BORDER_TOP,"\\"
  -   + 
BorderAttributesConverter.convertAttributetoRtf(attrValue));
  -isBorderPresent=true;
  -*/
  -}
  +
   ep = (EnumProperty)props.get(Constants.PR_BORDER_TOP_STYLE);
   if (ep != null && ep.getEnum() != Constants.NONE) {
   attrib.set(ITableAttributes.ROW_BORDER_TOP,   "\\"
  @@ -424,9 +405,19 @@
   isBorderPresent = true;
   }
   
  -if ((p = props.get(Constants.PR_BORDER_WIDTH)) != null) {
  -ListProperty listprop = (ListProperty)p;
  -LengthProperty lengthprop = (LengthProperty)listprop.getList().get(0);
  +//Currently there is only one border width supported in e

cvs commit: xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc RtfPage.java

2004-01-28 Thread pherweg
pherweg 2004/01/28 11:00:10

  Modified:src/java/org/apache/fop/render/rtf
PageAttributesConverter.java RTFHandler.java
   src/java/org/apache/fop/render/rtf/rtflib/rtfdoc
RtfPage.java
  Log:
  improved support for margin-top and margin-bottom in fo:region-XXX
  
  Revision  ChangesPath
  1.4   +89 -25
xml-fop/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java
  
  Index: PageAttributesConverter.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PageAttributesConverter.java  29 Dec 2003 23:28:47 -  1.3
  +++ PageAttributesConverter.java  28 Jan 2004 19:00:09 -  1.4
  @@ -56,6 +56,8 @@
   //FOP
   import org.apache.fop.apps.FOPException;
   import org.apache.fop.fo.Constants;
  +import org.apache.fop.fo.pagination.Region;
  +import org.apache.fop.fo.pagination.SimplePageMaster;
   import org.apache.fop.fo.Property;
   import org.apache.fop.fo.PropertyList;
   import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes;
  @@ -72,48 +74,110 @@
   private static Logger log = new ConsoleLogger();
   
   /** convert xsl:fo attributes to RTF text attributes */
  -static RtfAttributes convertPageAttributes(PropertyList props, PropertyList 
defProps) {
  -RtfAttributes attrib = null;
  -
  +static RtfAttributes convertPageAttributes(SimplePageMaster pagemaster) {
  +RtfAttributes attrib = new RtfAttributes();
  +
   try {
  -Property p;
  -
  -if (defProps != null) {
  -attrib = convertPageAttributes(defProps, null);
  -} else {
  -attrib = new RtfAttributes();
  -}
  -
  +FoUnitsConverter converter = FoUnitsConverter.getInstance();
  +
  +float fPageTop = 0;
  +float fPageBottom = 0;
  +PropertyList props = null;
  +Property p = null;
  +Float f = null;
  +
  +Region before = pagemaster.getRegion("before");
  +Region body   = pagemaster.getRegion("body");
  +Region after  = pagemaster.getRegion("after");
  +
  +//page attributes
  +props = pagemaster.propertyList;
  +
   if ((p = props.get(Constants.PR_PAGE_WIDTH)) != null) {
  -Float f = new Float(p.getLength().getValue() / 1000f);
  +f = new Float(p.getLength().getValue() / 1000f);
   attrib.set(RtfPage.PAGE_WIDTH,
  -(int)FoUnitsConverter.getInstance().convertToTwips(f.toString() 
+ "pt"));
  +(int)converter.convertToTwips(f.toString() + "pt"));
   }
  +
   if ((p = props.get(Constants.PR_PAGE_HEIGHT)) != null) {
  -Float f = new Float(p.getLength().getValue() / 1000f);
  +f = new Float(p.getLength().getValue() / 1000f);
   attrib.set(RtfPage.PAGE_HEIGHT,
  -(int)FoUnitsConverter.getInstance().convertToTwips(f.toString() 
+ "pt"));
  +(int)converter.convertToTwips(f.toString() + "pt"));
   }
  + 
   if ((p = props.get(Constants.PR_MARGIN_TOP)) != null) {
  -Float f = new Float(p.getLength().getValue() / 1000f);
  -attrib.set(RtfPage.MARGIN_TOP,
  -(int)FoUnitsConverter.getInstance().convertToTwips(f.toString() 
+ "pt"));
  +fPageTop = p.getLength().getValue() / 1000f;
   }
  +
   if ((p = props.get(Constants.PR_MARGIN_BOTTOM)) != null) {
  -Float f = new Float(p.getLength().getValue() / 1000f);
  -attrib.set(RtfPage.MARGIN_BOTTOM,
  -(int)FoUnitsConverter.getInstance().convertToTwips(f.toString() 
+ "pt"));
  +fPageBottom = p.getLength().getValue() / 1000f;
   }
  +
   if ((p = props.get(Constants.PR_MARGIN_LEFT)) != null) {
  -Float f = new Float(p.getLength().getValue() / 1000f);
  +f = new Float(p.getLength().getValue() / 1000f);
   attrib.set(RtfPage.MARGIN_LEFT,
  -(int)FoUnitsConverter.getInstance().convertToTwips(f.toString() 
+ "pt"));
  +(int)converter.convertToTwips(f.toString() + "pt"));
   }
   if ((p = props.get(Constants.PR_MARGIN_RIGHT)) != null) {
  -Float f = new Float(p.getLength().getValue() / 1000f);
  +f = new Float(p.ge

cvs commit: xml-fop/src/java/org/apache/fop/render/rtf RTFHandler.java

2004-01-27 Thread pherweg
pherweg 2004/01/27 08:51:29

  Modified:src/java/org/apache/fop/render/rtf RTFHandler.java
  Log:
  added support for white-space-treatment and linefeed-treatment by deferring the 
processing of some FOs until execution of endBlock
  
  Revision  ChangesPath
  1.15  +283 -1xml-fop/src/java/org/apache/fop/render/rtf/RTFHandler.java
  
  Index: RTFHandler.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/RTFHandler.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- RTFHandler.java   24 Jan 2004 16:09:48 -  1.14
  +++ RTFHandler.java   27 Jan 2004 16:51:29 -  1.15
  @@ -54,12 +54,14 @@
   import java.io.IOException;
   import java.io.OutputStream;
   import java.io.OutputStreamWriter;
  +import java.util.Iterator;
   
   import org.apache.avalon.framework.logger.ConsoleLogger;
   import org.apache.avalon.framework.logger.Logger;
   import org.apache.fop.apps.FOPException;
   import org.apache.fop.fo.EnumProperty;
   import org.apache.fop.fo.FOInputHandler;
  +import org.apache.fop.fo.FObj;
   import org.apache.fop.datatypes.FixedLength;
   import org.apache.fop.fo.flow.BasicLink;
   import org.apache.fop.fo.flow.Block;
  @@ -71,6 +73,7 @@
   import org.apache.fop.fo.flow.Leader;
   import org.apache.fop.fo.flow.ListBlock;
   import org.apache.fop.fo.flow.ListItem;
  +import org.apache.fop.fo.flow.ListItemLabel;
   import org.apache.fop.fo.flow.PageNumber;
   import org.apache.fop.fo.flow.Table;
   import org.apache.fop.fo.flow.TableColumn;
  @@ -82,6 +85,7 @@
   import org.apache.fop.fo.pagination.PageSequence;
   import org.apache.fop.fo.pagination.SimplePageMaster;
   import org.apache.fop.fo.Constants;
  +import org.apache.fop.fo.FOText;
   import org.apache.fop.fo.Property;
   import org.apache.fop.fo.LengthProperty;
   import org.apache.fop.fo.StringProperty;
  @@ -129,6 +133,12 @@
   private final Logger log = new ConsoleLogger();
   private RtfSection sect;
   private RtfDocumentArea docArea;
  +private int iNestCount;
  +private boolean bDefer;  //true, if each called handler shall be
  + //processed at later time.
  +private boolean bDeferredExecution;  //true, if currently called handler was not
  + //called while SAX parsing, but was called
  + //by invokeDeferredEvent.
   private boolean bPrevHeaderSpecified = false;//true, if there has been a
//header in any page-sequence
   private boolean bPrevFooterSpecified = false;//true, if there has been a
  @@ -150,6 +160,9 @@
   public RTFHandler(Document doc, OutputStream os) {
   super(doc);
   this.os = os;
  +bDefer = false;
  +bDeferredExecution = false;
  +iNestCount=0;
   FontSetup.setup(doc, null);
   log.warn(ALPHA_WARNING);
   }
  @@ -185,6 +198,10 @@
*/
   public void startPageSequence(PageSequence pageSeq)  {
   try {
  +if (bDefer) {
  +return;
  +}
  +
   sect = docArea.newSection();
   
   //read page size and margins, if specified
  @@ -218,6 +235,10 @@
* @see org.apache.fop.fo.FOInputHandler#endPageSequence(PageSequence)
*/
   public void endPageSequence(PageSequence pageSeq) throws FOPException {
  +if (bDefer) {
  +return;
  +}
  +
   builderContext.popContainer();
   }
   
  @@ -225,6 +246,10 @@
* @see org.apache.fop.fo.FOInputHandler#startFlow(Flow)
*/
   public void startFlow(Flow fl) {
  +if (bDefer) {
  +return;
  +}
  +
   try {
   if (fl.getFlowName().equals("xsl-region-body")) {
   // if there is no header in current page-sequence but there has been
  @@ -300,6 +325,10 @@
* @see org.apache.fop.fo.FOInputHandler#endFlow(Flow)
*/
   public void endFlow(Flow fl) {
  +if (bDefer) {
  +return;
  +}
  +
   try {
   if (fl.getFlowName().equals("xsl-region-body")) {
   //just do nothing
  @@ -318,6 +347,19 @@
* @see org.apache.fop.fo.FOInputHandler#startBlock(Block)
*/
   public void startBlock(Block bl) {
  +++iNestCount;
  +
  +if (!bDeferredExecution) {
  +//If startBlock was called while SAX parsing, defer processing of this
  +//FO and all its elements until endBlock. This has to be done, because
  +//attributes (for example while-space-treatment, linefeed-treatment)
  +//are not available until endBlock.
  +bDefer = true;
  +}
  +if (bDefer) {
 

cvs commit: xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc RtfTextrun.java RtfParagraph.java

2004-01-27 Thread pherweg
pherweg 2004/01/27 09:33:27

  Modified:src/java/org/apache/fop/render/rtf/rtflib/rtfdoc
RtfTextrun.java RtfParagraph.java
  Log:
  Removed call of JFOR's WhiteSpaceCollapser; now this is done by FOP
  
  Revision  ChangesPath
  1.9   +4 -11 
xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java
  
  Index: RtfTextrun.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- RtfTextrun.java   10 Jan 2004 19:43:58 -  1.8
  +++ RtfTextrun.java   27 Jan 2004 17:33:27 -  1.9
  @@ -228,19 +228,12 @@
*/
   protected void writeRtfContent() throws IOException {
   /**
  - *TODO: The textrun's children are iterated threetimes:
  - * 1. In WhitespaceCollapser
  - * 2. To determine the last RtfParagraphBreak
  - * 3. To write the children
  + *TODO: The textrun's children are iterated twice:
  + * 1. To determine the last RtfParagraphBreak
  + * 2. To write the children
* Maybe this can be done more efficient.
*/
  -
  -if (attrib != null && attrib.isSet("WhiteSpaceFalse")) {
  -attrib.unset("WhiteSpaceFalse");
  -} else {
  -new WhitespaceCollapser(this);
  -}
  -
  +
   //determine, if this RtfTextrun is the last child of its parent
   boolean bLast = false;
   for (Iterator it = parent.getChildren().iterator(); it.hasNext();) {
  
  
  
  1.3   +1 -8  
xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraph.java
  
  Index: RtfParagraph.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraph.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RtfParagraph.java 8 Nov 2003 19:58:03 -   1.2
  +++ RtfParagraph.java 27 Jan 2004 17:33:27 -  1.3
  @@ -136,13 +136,6 @@
* @throws IOException for I/O problems
*/
   protected void writeRtfPrefix() throws IOException {
  -// collapse whitespace before writing out
  -// TODO could be made configurable
  -if (attrib != null && attrib.isSet("WhiteSpaceFalse")) {
  -attrib.unset("WhiteSpaceFalse");
  -} else {
  -new WhitespaceCollapser(this);
  -}
   
   //Reset paragraph properties if needed
  if (resetProperties) {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc RtfStringConverter.java

2004-01-27 Thread pherweg
pherweg 2004/01/27 08:58:59

  Modified:src/java/org/apache/fop/render/rtf/rtflib/rtfdoc
RtfStringConverter.java
  Log:
  Submitted by Lucas Bruand to JFOR: escape all characters > 127 instead of 255
  
  Revision  ChangesPath
  1.2   +2 -2  
xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfStringConverter.java
  
  Index: RtfStringConverter.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfStringConverter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RtfStringConverter.java   4 Nov 2003 23:59:11 -   1.1
  +++ RtfStringConverter.java   27 Jan 2004 16:58:58 -  1.2
  @@ -137,7 +137,7 @@
   w.write('\\');
   w.write(replacement);
   w.write(' ');
  -} else if (c.charValue() > 255) {
  +} else if (c.charValue() > 127) {
   // write unicode representation - contributed by Michel Jacobson
   // <[EMAIL PROTECTED]>
   w.write("\\u");
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc RtfListStyleNumber.java

2004-01-24 Thread pherweg
pherweg 2004/01/24 14:24:14

  Modified:src/java/org/apache/fop/render/rtf/rtflib/rtfdoc
RtfListStyleNumber.java
  Log:
  fixed wrong datatype in overriden method
  
  Revision  ChangesPath
  1.3   +10 -10
xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleNumber.java
  
  Index: RtfListStyleNumber.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleNumber.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RtfListStyleNumber.java   24 Jan 2004 16:09:48 -  1.2
  +++ RtfListStyleNumber.java   24 Jan 2004 22:24:14 -  1.3
  @@ -70,16 +70,16 @@
* 
* @see org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle#writeListPrefix()
*/
  -public void writeListPrefix(RtfList list)
  +public void writeListPrefix(RtfListItem item)
   throws IOException {
  -list.writeControlWord("pnlvlbody");
  -list.writeControlWord("ilvl0");
  -list.writeOneAttribute(RtfListTable.LIST_NUMBER, "0");
  -list.writeControlWord("pndec");
  -list.writeOneAttribute("pnstart", new Integer(1));
  -list.writeOneAttribute("pnindent",
  -list.attrib.getValue(RtfListTable.LIST_INDENT));
  -list.writeControlWord("pntxta.");
  +item.writeControlWord("pnlvlbody");
  +item.writeControlWord("ilvl0");
  +item.writeOneAttribute(RtfListTable.LIST_NUMBER, "0");
  +item.writeControlWord("pndec");
  +item.writeOneAttribute("pnstart", new Integer(1));
  +item.writeOneAttribute("pnindent",
  +item.attrib.getValue(RtfListTable.LIST_INDENT));
  +item.writeControlWord("pntxta.");
   }
   
   /**
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc RtfHeader.java RtfFootnote.java

2004-01-20 Thread pherweg
pherweg 2004/01/20 13:37:25

  Modified:src/java/org/apache/fop/render/rtf/rtflib/rtfdoc
RtfHeader.java RtfFootnote.java
  Log:
  Submitted by: Marc Wilhelm Kuester; added support for fo:list in fo:footnote; 
ensured Word displays footnote, not endnote
  
  Revision  ChangesPath
  1.2   +15 -4 
xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHeader.java
  
  Index: RtfHeader.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHeader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RtfHeader.java4 Nov 2003 23:59:11 -   1.1
  +++ RtfHeader.java20 Jan 2004 21:37:24 -  1.2
  @@ -68,6 +68,7 @@
   /**  RTF file header, contains style, font and other document-level information.
*  @author Bertrand Delacretaz [EMAIL PROTECTED]
*  @author Andreas Putz [EMAIL PROTECTED]
  + *  @author Marc Wilhelm Kuester
*/
   
   class RtfHeader extends RtfContainer {
  @@ -87,9 +88,9 @@
   writeUserProperties();
   RtfColorTable.getInstance().writeColors(this);
   super.writeRtfContent();
  - RtfTemplate.getInstance().writeTemplate(this);
  -   RtfStyleSheetTable.getInstance().writeStyleSheet(this);
  -
  +RtfTemplate.getInstance().writeTemplate(this);
  +RtfStyleSheetTable.getInstance().writeStyleSheet(this);
  +writeFootnoteProperties();
   }
   
   /** write user properties if any */
  @@ -126,5 +127,15 @@
   /** write to our Writer using an RtfStringConverter */
   void writeRtfString(String toWrite) throws IOException {
   RtfStringConverter.getInstance().writeRtfString(writer, toWrite);
  +}
  +
  +/**
  + *write properties for footnote handling
  + */
  +private void writeFootnoteProperties() throws IOException {
  +writeControlWord("fet0");  //footnotes, not endnotes
  +writeControlWord("ftnbj"); //place footnotes at the end of the
  +   //page (should be the default, but
  +   //Word 2000 thinks otherwise)
   }
   }
  
  
  
  1.2   +24 -7 
xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFootnote.java
  
  Index: RtfFootnote.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFootnote.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RtfFootnote.java  10 Jan 2004 19:43:58 -  1.1
  +++ RtfFootnote.java  20 Jan 2004 21:37:24 -  1.2
  @@ -60,23 +60,28 @@
   
   /**  Model of an RTF footnote
*  @author Peter Herweg, [EMAIL PROTECTED]
  + *  @author Marc Wilhelm Kuester
*/
   public class RtfFootnote extends RtfContainer
  -implements IRtfTextrunContainer {
  +implements IRtfTextrunContainer, IRtfListContainer {
   RtfTextrun textrunInline = null;
  -RtfTextrun textrunBody = null;
  +RtfContainer body = null;
  +RtfList list = null;
   boolean bBody = false;
   
   /** Create an RTF list item as a child of given container with default 
attributes */
   RtfFootnote(RtfContainer parent, Writer w) throws IOException {
   super(parent, w);
   textrunInline = new RtfTextrun(this, writer, null);
  -textrunBody = new RtfTextrun(this, writer, null);
  +body = new RtfContainer(this, writer);
   }
   
   public RtfTextrun getTextrun() throws IOException {
   if (bBody) {
  -return textrunBody;
  +RtfTextrun textrun = RtfTextrun.getTextrun(body, writer, null);
  +textrun.setSuppressLastPar(true);
  +
  +return textrun;
   } else {
   return textrunInline;
   }
  @@ -91,9 +96,21 @@
   
   writeGroupMark(true);
   writeControlWord("footnote");
  -writeControlWord("ftnalt");  
  -textrunBody.writeRtfContent();
  +writeControlWord("ftnallt");  
  +
  +body.writeRtfContent();
  +
   writeGroupMark(false);
  +}
  +
  +public RtfList newList(RtfAttributes attrs) throws IOException {
  +if (list != null) {
  +list.close();
  +}
  +
  +list = new RtfList(body, writer, attrs);
  +
  +return list;
   }
   
   public void startBody() {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: xml-fop/src/java/org/apache/fop/render/rtf TableAttributesConverter.java TextAttributesConverter.java

2004-01-18 Thread pherweg
pherweg 2004/01/18 13:21:41

  Modified:src/java/org/apache/fop/render/rtf
TableAttributesConverter.java
TextAttributesConverter.java
  Log:
  replaced string constants with int constants
  
  Revision  ChangesPath
  1.8   +10 -10
xml-fop/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java
  
  Index: TableAttributesConverter.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TableAttributesConverter.java 5 Jan 2004 00:44:59 -   1.7
  +++ TableAttributesConverter.java 18 Jan 2004 21:21:41 -  1.8
  @@ -229,25 +229,25 @@
   isBorderPresent=true;
   */
   }
  -ep = (EnumProperty)props.get("border-top-style");
  +ep = (EnumProperty)props.get(Constants.PR_BORDER_TOP_STYLE);
   if (ep != null && ep.getEnum() != Constants.NONE) {
   attrib.set(ITableAttributes.CELL_BORDER_TOP,   "\\"
  + convertAttributetoRtf(ep.getEnum()));
   isBorderPresent = true;
   }
  -ep = (EnumProperty)props.get("border-bottom-style");
  +ep = (EnumProperty)props.get(Constants.PR_BORDER_BOTTOM_STYLE);
   if (ep != null && ep.getEnum() != Constants.NONE) {
   attrib.set(ITableAttributes.CELL_BORDER_BOTTOM, "\\"
  + convertAttributetoRtf(ep.getEnum()));
   isBorderPresent = true;
   }
  -ep = (EnumProperty)props.get("border-left-style");
  +ep = (EnumProperty)props.get(Constants.PR_BORDER_LEFT_STYLE);
   if (ep != null && ep.getEnum() != Constants.NONE) {
   attrib.set(ITableAttributes.CELL_BORDER_LEFT,  "\\"
  + convertAttributetoRtf(ep.getEnum()));
   isBorderPresent = true;
   }
  -ep = (EnumProperty)props.get("border-right-style");
  +ep = (EnumProperty)props.get(Constants.PR_BORDER_RIGHT_STYLE);
   if (ep != null && ep.getEnum() != Constants.NONE) {
   attrib.set(ITableAttributes.CELL_BORDER_RIGHT, "\\"
  + convertAttributetoRtf(ep.getEnum()));
  @@ -272,7 +272,7 @@
   
   
   // Column spanning :
  -NumberProperty n = (NumberProperty)props.get("number-columns-spanned");
  +NumberProperty n = 
(NumberProperty)props.get(Constants.PR_NUMBER_COLUMNS_SPANNED);
   if (n != null && n.getNumber().intValue() > 1) {
   attrib.set(ITableAttributes.COLUMN_SPAN, n.getNumber().intValue());
   }
  @@ -371,7 +371,7 @@
   isBorderPresent=true;
   */
   }
  -ep = (EnumProperty)props.get("border-top-style");
  +ep = (EnumProperty)props.get(Constants.PR_BORDER_TOP_STYLE);
   if (ep != null && ep.getEnum() != Constants.NONE) {
   attrib.set(ITableAttributes.ROW_BORDER_TOP,   "\\"
  + convertAttributetoRtf(ep.getEnum()));
  @@ -379,7 +379,7 @@
  + convertAttributetoRtf(ep.getEnum()));
   isBorderPresent = true;
   }
  -ep = (EnumProperty)props.get("border-bottom-style");
  +ep = (EnumProperty)props.get(Constants.PR_BORDER_BOTTOM_STYLE);
   if (ep != null && ep.getEnum() != Constants.NONE) {
   attrib.set(ITableAttributes.ROW_BORDER_BOTTOM,"\\"
  + convertAttributetoRtf(ep.getEnum()));
  @@ -387,7 +387,7 @@
  + convertAttributetoRtf(ep.getEnum()));
   isBorderPresent = true;
   }
  -ep = (EnumProperty)props.get("border-left-style");
  +ep = (EnumProperty)props.get(Constants.PR_BORDER_LEFT_STYLE);
   if (ep != null && ep.getEnum() != Constants.NONE) {
   attrib.set(ITableAttributes.ROW_BORDER_LEFT, "\\"
  + convertAttributetoRtf(ep.getEnum()));
  @@ -395,7 +395,7 @@
  + convertAttributetoRtf(ep.getEnum()));
   isBorderPresent = true;
   }
  -ep = (EnumProperty)props.get("border-right-style");
  +ep = (EnumProperty)props.get(Constants.PR_BORDER_RIGHT_STYLE);
   if (ep != null && ep.getEnum() != Constants.NONE) {
   attrib.set(ITableAttributes.ROW_BORDER_RIGHT,"\\"
  + convertAttributetoRtf(ep.getEnum()));
  
  
  
  1.8   +4 -4  
xml-fop/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java
  
  Index: TextAttributesConv

cvs commit: xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc RtfFootnote.java RtfTextrun.java

2004-01-10 Thread pherweg
pherweg 2004/01/10 11:43:58

  Modified:src/java/org/apache/fop/fo FOInputHandler.java
FOTreeHandler.java
   src/java/org/apache/fop/render/mif MIFHandler.java
   src/java/org/apache/fop/render/rtf RTFHandler.java
   src/java/org/apache/fop/fo/flow Footnote.java
FootnoteBody.java
   src/java/org/apache/fop/render/rtf/rtflib/rtfdoc
RtfTextrun.java
  Added:   src/java/org/apache/fop/render/rtf/rtflib/rtfdoc
RtfFootnote.java
  Log:
  added support for fo:footnote
  
  Revision  ChangesPath
  1.13  +24 -3 xml-fop/src/java/org/apache/fop/fo/FOInputHandler.java
  
  Index: FOInputHandler.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOInputHandler.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- FOInputHandler.java   1 Jan 2004 21:19:55 -   1.12
  +++ FOInputHandler.java   10 Jan 2004 19:43:58 -  1.13
  @@ -58,6 +58,8 @@
   import org.apache.fop.fo.flow.BasicLink;
   import org.apache.fop.fo.flow.Block;
   import org.apache.fop.fo.flow.ExternalGraphic;
  +import org.apache.fop.fo.flow.Footnote;
  +import org.apache.fop.fo.flow.FootnoteBody;
   import org.apache.fop.fo.flow.Inline;
   import org.apache.fop.fo.flow.InstreamForeignObject;
   import org.apache.fop.fo.flow.Leader;
  @@ -365,9 +367,28 @@
   public abstract void foreignObject(InstreamForeignObject ifo);
   
   /**
  - * Process a footnote.
  + * Process the start of a footnote.
  + * @param footnote Footnote that is starting
*/
  -public abstract void footnote();
  +public abstract void startFootnote(Footnote footnote);
  +
  +/**
  + * Process the ending of a footnote.
  + * @param footnote Footnote that is ending
  + */
  +public abstract void endFootnote(Footnote footnote);
  +
  +/**
  + * Process the start of a footnote body.
  + * @param body FootnoteBody that is starting
  + */
  +public abstract void startFootnoteBody(FootnoteBody body);
  +
  +/**
  + * Process the ending of a footnote body.
  + * @param body FootnoteBody that is ending
  + */
  +public abstract void endFootnoteBody(FootnoteBody body);
   
   /**
* Process a Leader.
  
  
  
  1.12  +24 -4 xml-fop/src/java/org/apache/fop/fo/FOTreeHandler.java
  
  Index: FOTreeHandler.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOTreeHandler.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- FOTreeHandler.java1 Jan 2004 21:19:55 -   1.11
  +++ FOTreeHandler.java10 Jan 2004 19:43:58 -  1.12
  @@ -62,6 +62,8 @@
   import org.apache.fop.fo.flow.BasicLink;
   import org.apache.fop.fo.flow.Block;
   import org.apache.fop.fo.flow.ExternalGraphic;
  +import org.apache.fop.fo.flow.Footnote;
  +import org.apache.fop.fo.flow.FootnoteBody;
   import org.apache.fop.fo.flow.InstreamForeignObject;
   import org.apache.fop.fo.flow.Inline;
   import org.apache.fop.fo.flow.Leader;
  @@ -446,11 +448,29 @@
   }
   
   /**
  - * @see org.apache.fop.fo.FOInputHandler#footnote()
  + * @see org.apache.fop.fo.FOInputHandler#startFootnote()
*/
  -public void footnote() {
  +public void startFootnote(Footnote footnote) {
   }
  -
  +
  +/**
  + * @see org.apache.fop.fo.FOInputHandler#endFootnote()
  + */
  +public void endFootnote(Footnote footnote) {
  +}
  +
  +/**
  + * @see org.apache.fop.fo.FOInputHandler#startFootnoteBody()
  + */
  +public void startFootnoteBody(FootnoteBody body) {
  +}
  +
  +/**
  + * @see org.apache.fop.fo.FOInputHandler#endFootnoteBody()
  + */
  +public void endFootnoteBody(FootnoteBody body) {
  +}
  +
   /**
* @see org.apache.fop.fo.FOInputHandler#leader(Leader)
*/
  
  
  
  1.4   +24 -4 xml-fop/src/java/org/apache/fop/render/mif/MIFHandler.java
  
  Index: MIFHandler.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/mif/MIFHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MIFHandler.java   1 Jan 2004 21:19:55 -   1.3
  +++ MIFHandler.java   10 Jan 2004 19:43:58 -  1.4
  @@ -60,6 +60,8 @@
   import org.apache.fop.fo.flow.BasicLink;
   import org.apache.fop.fo.flow.Block;
   import org.apache.fop.fo.flow.ExternalGraphic;
  +import org.apache.fop.fo.flow.Footnote;
  +import org.apache.fop.fo.flow.FootnoteBody;
   import org.apache.fop.fo.flow.InstreamForeignObject;
   import org.apache.fop.fo.flow.Inline

cvs commit: xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc RtfColorTable.java

2004-01-03 Thread pherweg
pherweg 2004/01/03 05:43:12

  Modified:src/java/org/apache/fop/render/rtf/rtflib/rtfdoc
RtfColorTable.java
  Log:
  bug fixed: The first occurence of a custom color was displayed with wrong color
  
  Revision  ChangesPath
  1.3   +12 -3 
xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfColorTable.java
  
  Index: RtfColorTable.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfColorTable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RtfColorTable.java15 Nov 2003 23:45:34 -  1.2
  +++ RtfColorTable.java3 Jan 2004 13:43:12 -   1.3
  @@ -187,14 +187,21 @@
   int retVal;
   
   if (o == null) {
  +//The color currently does not exist, so add it to the table.
  +//First add it, then read the size as index (to return it).
  +//So the first added color gets index 1. That is OK, because
  +//index 0 is reserved for auto-colored. 
   addColor (identifier);
   
   retVal = colorTable.size ();
   } else {
  -retVal = ((Integer) o).intValue ();
  +//The color was found. Before returning the index, increment
  +//it by one. Because index 0 is reserved for auto-colored, but
  +//is not contained in colorTable.
  +retVal = ((Integer) o).intValue () + 1;
   }
   
  -return new Integer(retVal + 1);
  +return new Integer(retVal);
   }
   
   /**
  @@ -212,6 +219,8 @@
   header.writeGroupMark (true);
   //Don't use writeControlWord, because it appends a blank,
   //which may confuse Wordpad.
  +//This also implicitly writes the first color (=index 0), which
  +//is reserved for auto-colored.
   header.write ("\\colortbl;");
   
   int len = colorTable.size ();
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc RtfHyperLink.java RtfTextrun.java

2004-01-01 Thread pherweg
pherweg 2004/01/01 13:19:55

  Modified:src/java/org/apache/fop/fo/flow BasicLink.java
   src/java/org/apache/fop/fo FOInputHandler.java
FOTreeHandler.java
   src/java/org/apache/fop/render/mif MIFHandler.java
   src/java/org/apache/fop/render/rtf RTFHandler.java
   src/java/org/apache/fop/render/rtf/rtflib/rtfdoc
RtfHyperLink.java RtfTextrun.java
  Log:
  added support for fo:basic-link
  
  Revision  ChangesPath
  1.9   +21 -0 xml-fop/src/java/org/apache/fop/fo/flow/BasicLink.java
  
  Index: BasicLink.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/BasicLink.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- BasicLink.java28 Dec 2003 17:10:16 -  1.8
  +++ BasicLink.java1 Jan 2004 21:19:54 -   1.9
  @@ -50,7 +50,11 @@
*/
   package org.apache.fop.fo.flow;
   
  +// XML
  +import org.xml.sax.Attributes;
  +
   // FOP
  +import org.apache.fop.apps.FOPException;
   import org.apache.fop.fo.FONode;
   import org.apache.fop.fo.FOTreeVisitor;
   import org.apache.fop.fo.properties.CommonAccessibility;
  @@ -157,4 +161,21 @@
   fotv.serveBasicLink(this);
   }
   
  +/**
  + * @see org.apache.fop.fo.FObj#handleAttrs
  + */
  +public void handleAttrs(Attributes attlist) throws FOPException {
  +super.handleAttrs(attlist);
  +
  +getFOTreeControl().getFOInputHandler().startLink(this);
  +}
  +
  +/**
  + * @see org.apache.fop.fo.FONode#end
  + */
  +public void end() {
  +super.end();
  +
  +getFOTreeControl().getFOInputHandler().endLink();
  +}
   }
  
  
  
  1.12  +4 -2  xml-fop/src/java/org/apache/fop/fo/FOInputHandler.java
  
  Index: FOInputHandler.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOInputHandler.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- FOInputHandler.java   1 Nov 2003 14:23:49 -   1.11
  +++ FOInputHandler.java   1 Jan 2004 21:19:55 -   1.12
  @@ -55,6 +55,7 @@
   
   // FOP
   import org.apache.fop.apps.FOPException;
  +import org.apache.fop.fo.flow.BasicLink;
   import org.apache.fop.fo.flow.Block;
   import org.apache.fop.fo.flow.ExternalGraphic;
   import org.apache.fop.fo.flow.Inline;
  @@ -337,8 +338,9 @@
   
   /**
* Process start of a Link.
  + * @param basicLink BasicLink that is ending
*/
  -public abstract void startLink();
  +public abstract void startLink(BasicLink basicLink);
   
   /**
* Process end of a Link.
  
  
  
  1.11  +4 -3  xml-fop/src/java/org/apache/fop/fo/FOTreeHandler.java
  
  Index: FOTreeHandler.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOTreeHandler.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- FOTreeHandler.java1 Nov 2003 14:23:49 -   1.10
  +++ FOTreeHandler.java1 Jan 2004 21:19:55 -   1.11
  @@ -59,6 +59,7 @@
   
   // FOP
   import org.apache.fop.apps.FOPException;
  +import org.apache.fop.fo.flow.BasicLink;
   import org.apache.fop.fo.flow.Block;
   import org.apache.fop.fo.flow.ExternalGraphic;
   import org.apache.fop.fo.flow.InstreamForeignObject;
  @@ -415,9 +416,9 @@
   }
   
   /**
  - * @see org.apache.fop.fo.FOInputHandler#startLink()
  + * @see org.apache.fop.fo.FOInputHandler#startLink(BasicLink basicLink)
*/
  -public void startLink() {
  +public void startLink(BasicLink basicLink) {
   }
   
   /**
  
  
  
  1.3   +4 -3  xml-fop/src/java/org/apache/fop/render/mif/MIFHandler.java
  
  Index: MIFHandler.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/mif/MIFHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MIFHandler.java   12 Dec 2003 22:37:39 -  1.2
  +++ MIFHandler.java   1 Jan 2004 21:19:55 -   1.3
  @@ -57,6 +57,7 @@
   import org.apache.fop.apps.Document;
   import org.apache.fop.apps.FOPException;
   import org.apache.fop.fo.FOInputHandler;
  +import org.apache.fop.fo.flow.BasicLink;
   import org.apache.fop.fo.flow.Block;
   import org.apache.fop.fo.flow.ExternalGraphic;
   import org.apache.fop.fo.flow.InstreamForeignObject;
  @@ -398,9 +399,9 @@
   }
   
   /**
  - * @see org.apache.fop.fo.FOInputHandler#startLink()
  + * @see org.apache.fop.fo.FOInputHandler#startLink(BasicLink basicLink)
*/
  -public void startLink() {
  +public void startLink(BasicLink basicLink