bckfnn      2004/10/01 01:58:52

  Modified:    src/java/org/apache/fop/render/rtf RTFHandler.java
  Log:
  Support fo:character.
  
  Revision  Changes    Path
  1.33      +38 -1     xml-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.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- RTFHandler.java   6 Sep 2004 18:44:33 -0000       1.32
  +++ RTFHandler.java   1 Oct 2004 08:58:52 -0000       1.33
  @@ -32,6 +32,7 @@
   import org.apache.fop.fo.FObj;
   import org.apache.fop.fo.flow.BasicLink;
   import org.apache.fop.fo.flow.Block;
  +import org.apache.fop.fo.flow.Character;
   import org.apache.fop.fo.flow.ExternalGraphic;
   import org.apache.fop.fo.flow.Footnote;
   import org.apache.fop.fo.flow.FootnoteBody;
  @@ -1067,6 +1068,37 @@
       }
   
       /**
  +     * @see org.apache.fop.fo.FOEventHandler#character(Character)
  +     */
  +    public void character(Character c) {
  +        if (bDefer) {
  +            return;
  +        }
  +        
  +        try {
  +            RtfAttributes rtfAttr= 
  +                    TextAttributesConverter.convertCharacterAttributes(c);
  +
  +            IRtfTextrunContainer container
  +                = (IRtfTextrunContainer)builderContext.getContainer(
  +                    IRtfTextrunContainer.class, true, this);
  +                    
  +            RtfTextrun textrun = container.getTextrun();
  +            
  +            textrun.pushAttributes(rtfAttr);            
  +            textrun.addString(c.getPropString(Constants.PR_CHARACTER));
  +            textrun.popAttributes();
  +         } catch (IOException ioe) {
  +            // FIXME could we throw Exception in all FOEventHandler events?
  +            log.error("character: " + ioe.getMessage());
  +            throw new RuntimeException(ioe.getMessage());
  +        } catch (Exception e) {
  +            log.error("character:" + e.getMessage());
  +            throw new RuntimeException(e.getMessage());
  +        }
  +    }
  +
  +    /**
        * @see org.apache.fop.fo.FOEventHandler#characters(char[], int, int)
        */
       public void characters(char[] data, int start, int length) {
  @@ -1153,6 +1185,11 @@
               if (bStart) {
                   FOText text = (FOText) fobj;
                   characters(text.ca, text.startIndex, text.endIndex);
  +            }
  +        } else if (fobj instanceof Character) {
  +            if (bStart) {
  +                Character c = (Character) fobj;
  +                character(c);
               }
           } else if (fobj instanceof BasicLink) {
               if (bStart) {
  
  
  

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

Reply via email to