CVS: jfor/src/org/jfor/jfor/rtflib/rtfdoc RtfPageNumber.java,1.2,1.3 RtfPageNumberCitation.java,1.2,1.3 RtfParagraph.java,1.11,1.12 RtfText.java,1.9,1.10

Bertrand Delacretaz <[email protected]> Tue, 30 Jul 2002 07:48:07 -0700
Newsgroups gmane.text.xml.jfor.cvs
Message-ID <[email protected]>
Update of /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc
In directory usw-pr-cvs1:/tmp/cvs-serv8178/src/org/jfor/jfor/rtflib/rtfdoc

Modified Files:
	RtfPageNumber.java RtfPageNumberCitation.java 
	RtfParagraph.java RtfText.java 
Log Message:
V0.7.1dev-d, page-number-citation attributes bug corrected

Index: RtfPageNumber.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfPageNumber.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RtfPageNumber.java	12 Jul 2002 08:08:31 -0000	1.2
--- RtfPageNumber.java	30 Jul 2002 14:48:05 -0000	1.3
***************
*** 59,62 ****
--- 59,65 ----
  // $Id$
  // $Log$
+ // Revision 1.3  2002/07/30 14:48:05  bdelacretaz
+ // V0.7.1dev-d, page-number-citation attributes bug corrected
+ //
  // Revision 1.2  2002/07/12 08:08:31  bdelacretaz
  // License changed to jfor Apache-style license
***************
*** 83,87 ****
      }
      
!     /** overridden to write our attributes before our content */
      protected void writeRtfContent() throws IOException
      {
--- 86,104 ----
      }
      
!     /** Create an RTF page number as a child of given paragraph,
!      *  copying the paragraph attributes
!      */
!      RtfPageNumber(RtfParagraph parent, Writer w) throws IOException
!      {
!          // Adds the attributes of the parent paragraph
!          super((RtfContainer)parent,w, parent.m_attrib);
! 
!          // copy parent's text attributes
!          if (parent.getTextAttributes() != null) {
!              m_attrib.set(parent.getTextAttributes());
!          }
!      }
!     
!     /** write our attributes and content */
      protected void writeRtfContent() throws IOException
      {
***************
*** 89,92 ****
--- 106,110 ----
          writeControlWord(RTF_FIELD);
          writeGroupMark(true);
+         writeAttributes(m_attrib,RtfText.ATTR_NAMES); // Added by Boris Poudérous
          writeStarControlWord(RTF_FIELD_PAGE);
          writeGroupMark(false);
***************
*** 95,99 ****
          writeGroupMark(false);
          writeGroupMark(false);
!     }   
      
      /** true if this element would generate no "useful" RTF content */
--- 113,117 ----
          writeGroupMark(false);
          writeGroupMark(false);
!     }
      
      /** true if this element would generate no "useful" RTF content */

Index: RtfPageNumberCitation.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfPageNumberCitation.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RtfPageNumberCitation.java	29 Jul 2002 14:39:53 -0000	1.2
--- RtfPageNumberCitation.java	30 Jul 2002 14:48:05 -0000	1.3
***************
*** 60,71 ****
  	//  "{\field {\*\fldinst {PAGEREF xx}} {\fldrslt}}" where xx represents the
    // 'id' of the referenced page
! 	public static String RTF_FIELD = "field";
! 	public String RTF_FIELD_PAGEREF = "fldinst { PAGEREF }"; // non static to avoid enlargment
! 	public static String RTF_FIELD_RESULT = "fldrslt";
  
    // The 'id' of the referenced page
    private String id = null;
  
!   /** Create an RTF paragraph as a child of given container with default attributes */
    RtfPageNumberCitation (IRtfPageNumberCitationContainer parent, Writer w, String id) throws IOException
    {
--- 60,71 ----
  	//  "{\field {\*\fldinst {PAGEREF xx}} {\fldrslt}}" where xx represents the
    // 'id' of the referenced page
! 	public static final String RTF_FIELD = "field";
! 	public static final String RTF_FIELD_PAGEREF_MODEL = "fldinst { PAGEREF }";
! 	public static final String RTF_FIELD_RESULT = "fldrslt";
  
    // The 'id' of the referenced page
    private String id = null;
  
!   /** Create an RTF page number citation as a child of given container with default attributes */
    RtfPageNumberCitation (IRtfPageNumberCitationContainer parent, Writer w, String id) throws IOException
    {
***************
*** 74,101 ****
    }
  
!   /** overridden to write our attributes before our content */
!   protected void writeRtfContent() throws IOException
    {
!       // If the <fo:page-citation-number> contains a 'ref-id' attribute
!       if (isValid())
!         {
!           // Update page reference
!           int insertionIndex = RTF_FIELD_PAGEREF.indexOf("}");
!           RTF_FIELD_PAGEREF = RTF_FIELD_PAGEREF.substring(0,insertionIndex) + "\"" + id + "\"" + " " +
!                               RTF_FIELD_PAGEREF.substring(insertionIndex, RTF_FIELD_PAGEREF.length());
!           id = null;
  
!           // Write RTF content
!           writeGroupMark(true);
!           writeControlWord(RTF_FIELD);
!           writeGroupMark(true);
!           writeStarControlWord(RTF_FIELD_PAGEREF);
!           writeGroupMark(false);
!           writeGroupMark(true);
!           writeControlWord(RTF_FIELD_RESULT);
!           writeGroupMark(false);
!           writeGroupMark(false);
          }
!   }
  
    /** checks that the 'ref-id' attribute exists */
--- 74,116 ----
    }
  
!   /** Create an RTF page number citation as a child of given 
!    *    paragraph, copying its attributes */
!   RtfPageNumberCitation (RtfParagraph parent, Writer w, String id)
!     throws IOException
    {
!       // add the attributes ant text attributes of the parent paragraph
!       super((RtfContainer)parent,w, parent.m_attrib);
!       if (parent.getTextAttributes() != null) {
!           m_attrib.set(parent.getTextAttributes());
!       }
!       this.id = id;
!   }
  
!     protected void writeRtfContent() throws IOException
!     {
!         // If we have a valid ID
!         if (isValid()) {
!             // Build page reference field
!             String pageRef = RTF_FIELD_PAGEREF_MODEL;
!             final int insertionIndex = pageRef.indexOf("}");
!             pageRef = 
!                 pageRef.substring(0,insertionIndex) + "\"" + id + "\"" + " " 
!                 + pageRef.substring(insertionIndex, pageRef.length())
!             ;
!             id = null;
! 
!             // Write RTF content
!             writeGroupMark(true);
!             writeControlWord(RTF_FIELD);
!             writeGroupMark(true);
!             writeAttributes(m_attrib,RtfText.ATTR_NAMES); // Added by Boris Poudérous
!             writeStarControlWord(pageRef);
!             writeGroupMark(false);
!             writeGroupMark(true);
!             writeControlWord(RTF_FIELD_RESULT);
!             writeGroupMark(false);
!             writeGroupMark(false);
          }
!     }
  
    /** checks that the 'ref-id' attribute exists */

Index: RtfParagraph.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfParagraph.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** RtfParagraph.java	29 Jul 2002 13:50:40 -0000	1.11
--- RtfParagraph.java	30 Jul 2002 14:48:05 -0000	1.12
***************
*** 64,67 ****
--- 64,70 ----
  // $Id$
  // $Log$
+ // Revision 1.12  2002/07/30 14:48:05  bdelacretaz
+ // V0.7.1dev-d, page-number-citation attributes bug corrected
+ //
  // Revision 1.11  2002/07/29 13:50:40  rmarra
  // added page-number-citation M.Boris Poudérous contribution
***************
*** 332,334 ****
--- 335,342 ----
      }
      
+     /** get the attributes of our text */
+     public RtfAttributes getTextAttributes(){
+         if(m_text == null) return null;
+         return m_text.getTextAttributes();
+     }
  }

Index: RtfText.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfText.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** RtfText.java	17 Jul 2002 18:13:07 -0000	1.9
--- RtfText.java	30 Jul 2002 14:48:05 -0000	1.10
***************
*** 61,64 ****
--- 61,67 ----
  // $Id$
  // $Log$
+ // Revision 1.10  2002/07/30 14:48:05  bdelacretaz
+ // V0.7.1dev-d, page-number-citation attributes bug corrected
+ //
  // Revision 1.9  2002/07/17 18:13:07  rmarra
  // Contributions for background-color processing and
***************
*** 336,339 ****
  	}
  				
! 			
  }
--- 339,345 ----
  	}
  				
!     /** get the attributes of our text */
!     public RtfAttributes getTextAttributes(){
!         return m_attr;
!     }
  }



-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31