CVS: jfor/src/org/jfor/jfor/rtflib/rtfdoc RtfTableRow.java,1.9,1.10 RtfElement.java,1.8,1.9 BorderAttributesConverter.java,1.2,1.3 RtfTable.java,1.8,1.9 RtfExternalGraphic.java,1.9,1.10 RtfParagraph.java,1.15,1.16 RtfAttributes.java,1.5,1.6 RtfColorTable.java,1.5,1.6
Marra Roberto <[email protected]> Tue, 18 Feb 2003 08:11:11 -0800
| Newsgroups | gmane.text.xml.jfor.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc
In directory sc8-pr-cvs1:/tmp/cvs-serv29650/src/org/jfor/jfor/rtflib/rtfdoc
Modified Files:
RtfTableRow.java RtfElement.java
BorderAttributesConverter.java RtfTable.java
RtfExternalGraphic.java RtfParagraph.java RtfAttributes.java
RtfColorTable.java
Log Message:
Contributions Normand Massé
inheritance and other fixes
Index: RtfTableRow.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfTableRow.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** RtfTableRow.java 12 Aug 2002 09:40:03 -0000 1.9
--- RtfTableRow.java 18 Feb 2003 16:10:51 -0000 1.10
***************
*** 62,65 ****
--- 62,69 ----
// $Id$
// $Log$
+ // Revision 1.10 2003/02/18 16:10:51 rmarra
+ // Contributions Normand Massé
+ // inheritance and other fixes
+ //
// Revision 1.9 2002/08/12 09:40:03 bdelacretaz
// V0.7.1dev-e, contributions from Boris Poudérous for number-columns-spanned
***************
*** 153,159 ****
* in order to add an empty cell that is merged with the previous cell.
*/
! public RtfTableCell newTableCellMergedHorizontally (int cellWidth) throws IOException {
highestCell++;
! m_cell = new RtfTableCell(this,m_writer,cellWidth,highestCell);
m_cell.setHMerge(RtfTableCell.MERGE_WITH_PREVIOUS);
return m_cell;
--- 157,168 ----
* in order to add an empty cell that is merged with the previous cell.
*/
! public RtfTableCell newTableCellMergedHorizontally (int cellWidth, RtfAttributes attrs) throws IOException {
highestCell++;
! // Added by Normand Masse
! // Inherit attributes from base cell for merge
! RtfAttributes wAttributes = (RtfAttributes)attrs.clone();
! wAttributes.unset( "number-columns-spanned" );
!
! m_cell = new RtfTableCell(this,m_writer,cellWidth,wAttributes,highestCell);
m_cell.setHMerge(RtfTableCell.MERGE_WITH_PREVIOUS);
return m_cell;
***************
*** 288,292 ****
}
/** - end - */
! xPos = ((RtfTableCell)e).writeCellDef(xPos);
}
index++; // Added by Boris POUDEROUS on 2002/07/02
--- 297,334 ----
}
/** - end - */
!
! // Added by Normand Masse
! // Adjust the cell's display attributes so the table's/row's borders
! // are drawn properly.
! RtfTableCell cell = (RtfTableCell)e;
! if ( index == 0 ) {
! if ( !cell.getRtfAttributes().isSet( ITableAttributes.CELL_BORDER_LEFT ) ) {
! cell.getRtfAttributes().set( ITableAttributes.CELL_BORDER_LEFT,
! (String)m_attrib.getValue( ITableAttributes.ROW_BORDER_LEFT ));
! }
! }
!
! if ( index == this.getChildCount() -1 ) {
! if ( !cell.getRtfAttributes().isSet( ITableAttributes.CELL_BORDER_RIGHT ) ) {
! cell.getRtfAttributes().set( ITableAttributes.CELL_BORDER_RIGHT,
! (String)m_attrib.getValue( ITableAttributes.ROW_BORDER_RIGHT ));
! }
! }
!
! if ( isFirstRow() ) {
! if ( !cell.getRtfAttributes().isSet( ITableAttributes.CELL_BORDER_TOP ) ) {
! cell.getRtfAttributes().set( ITableAttributes.CELL_BORDER_TOP,
! (String)m_attrib.getValue( ITableAttributes.ROW_BORDER_TOP ));
! }
! }
!
! if ( parentTable.isHighestRow(id) ) {
! if ( !cell.getRtfAttributes().isSet( ITableAttributes.CELL_BORDER_BOTTOM ) ) {
! cell.getRtfAttributes().set( ITableAttributes.CELL_BORDER_BOTTOM,
! (String)m_attrib.getValue( ITableAttributes.ROW_BORDER_BOTTOM ));
! }
! }
!
! xPos = cell.writeCellDef(xPos);
}
index++; // Added by Boris POUDEROUS on 2002/07/02
***************
*** 335,340 ****
writeAttributes(m_attrib, ATTRIB_ROW_PADDING);
}
-
-
public boolean isFirstRow(){
--- 377,380 ----
Index: RtfElement.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfElement.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** RtfElement.java 12 Jul 2002 08:08:31 -0000 1.8
--- RtfElement.java 18 Feb 2003 16:10:56 -0000 1.9
***************
*** 4,7 ****
--- 4,8 ----
import java.util.*;
import org.jfor.jfor.main.JForVersionInfo;
+ import org.xml.sax.Attributes;
/*-----------------------------------------------------------------------------
***************
*** 62,65 ****
--- 63,70 ----
// $Id$
// $Log$
+ // Revision 1.9 2003/02/18 16:10:56 rmarra
+ // Contributions Normand Massé
+ // inheritance and other fixes
+ //
// Revision 1.8 2002/07/12 08:08:31 bdelacretaz
// License changed to jfor Apache-style license
***************
*** 123,134 ****
private final int m_id;
private static int m_idCounter;
!
/** Create an RTF element as a child of given container */
RtfElement(RtfContainer parent,Writer w) throws IOException {
this(parent,w,null);
}
!
/** Create an RTF element as a child of given container with given attributes */
RtfElement(RtfContainer parent,Writer w,RtfAttributes attr) throws IOException {
m_id = m_idCounter++;
m_parent = parent;
--- 128,141 ----
private final int m_id;
private static int m_idCounter;
!
/** Create an RTF element as a child of given container */
RtfElement(RtfContainer parent,Writer w) throws IOException {
this(parent,w,null);
}
!
!
/** Create an RTF element as a child of given container with given attributes */
RtfElement(RtfContainer parent,Writer w,RtfAttributes attr) throws IOException {
+
m_id = m_idCounter++;
m_parent = parent;
***************
*** 138,142 ****
m_written = false;
}
!
/** Does nothing, meant to allow elements to write themselves without waiting
* for write(), but not implemented yet */
--- 145,149 ----
m_written = false;
}
!
/** Does nothing, meant to allow elements to write themselves without waiting
* for write(), but not implemented yet */
***************
*** 144,148 ****
m_closed = true;
}
!
/** write the RTF code of this element to our Writer */
public final void writeRtf() throws IOException {
--- 151,155 ----
m_closed = true;
}
!
/** write the RTF code of this element to our Writer */
public final void writeRtf() throws IOException {
***************
*** 156,160 ****
}
}
!
/** write an RTF control word to our Writer */
protected final void writeControlWord(String word)
--- 163,167 ----
}
}
!
/** write an RTF control word to our Writer */
protected final void writeControlWord(String word)
***************
*** 164,168 ****
m_writer.write(' ');
}
!
/** write an RTF control word to our Writer, preceeded by a star '*'
* meaning "ignore this if you don't know what it means"
--- 171,175 ----
m_writer.write(' ');
}
!
/** write an RTF control word to our Writer, preceeded by a star '*'
* meaning "ignore this if you don't know what it means"
***************
*** 174,178 ****
m_writer.write(' ');
}
!
protected final void writeStarControlWordNS(String word)
throws IOException {
--- 181,185 ----
m_writer.write(' ');
}
!
protected final void writeStarControlWordNS(String word)
throws IOException {
***************
*** 180,184 ****
m_writer.write(word);
}
!
/** write rtf control word without the space behind it */
protected final void writeControlWordNS(String word)
--- 187,191 ----
m_writer.write(word);
}
!
/** write rtf control word without the space behind it */
protected final void writeControlWordNS(String word)
***************
*** 187,202 ****
m_writer.write(word);
}
!
/** called before writeRtfContent() */
protected void writeRtfPrefix() throws IOException {
}
!
/** must be implemented to write RTF content to m_writer */
protected abstract void writeRtfContent() throws IOException;
!
/** called after writeRtfContent() */
protected void writeRtfSuffix() throws IOException {
}
!
/** Write a start or end group mark */
protected final void writeGroupMark(boolean isStart)
--- 194,209 ----
m_writer.write(word);
}
!
/** called before writeRtfContent() */
protected void writeRtfPrefix() throws IOException {
}
!
/** must be implemented to write RTF content to m_writer */
protected abstract void writeRtfContent() throws IOException;
!
/** called after writeRtfContent() */
protected void writeRtfSuffix() throws IOException {
}
!
/** Write a start or end group mark */
protected final void writeGroupMark(boolean isStart)
***************
*** 204,208 ****
m_writer.write(isStart ? "{" : "}");
}
!
/** write given attribute values to our Writer
* @param nameList if given, only attribute names from this list are considered
--- 211,215 ----
m_writer.write(isStart ? "{" : "}");
}
!
/** write given attribute values to our Writer
* @param nameList if given, only attribute names from this list are considered
***************
*** 211,215 ****
throws IOException {
if(attr==null) return;
!
if(nameList != null) {
// process only given attribute names
--- 218,222 ----
throws IOException {
if(attr==null) return;
!
if(nameList != null) {
// process only given attribute names
***************
*** 230,234 ****
}
}
!
/** write one attribute to our Writer */
protected void writeOneAttribute(String name,Object value)
--- 237,241 ----
}
}
!
/** write one attribute to our Writer */
protected void writeOneAttribute(String name,Object value)
***************
*** 255,264 ****
writeControlWordNS(cw);
}
!
/** can be overridden to suppress all RTF output */
protected boolean okToWriteRtf() {
return true;
}
!
/** debugging to given PrintWriter */
void dump(Writer w,int indent)
--- 262,271 ----
writeControlWordNS(cw);
}
!
/** can be overridden to suppress all RTF output */
protected boolean okToWriteRtf() {
return true;
}
!
/** debugging to given PrintWriter */
void dump(Writer w,int indent)
***************
*** 271,285 ****
w.flush();
}
!
/** minimal debugging display */
public String toString() {
return (this == null) ? "null" : (this.getClass().getName() + " #" + m_id);
}
!
/** true if close() has been called */
boolean isClosed() {
return m_closed;
}
!
/** access our RtfFile, which is always the topmost parent */
RtfFile getRtfFile() {
--- 278,292 ----
w.flush();
}
!
/** minimal debugging display */
public String toString() {
return (this == null) ? "null" : (this.getClass().getName() + " #" + m_id);
}
!
/** true if close() has been called */
boolean isClosed() {
return m_closed;
}
!
/** access our RtfFile, which is always the topmost parent */
RtfFile getRtfFile() {
***************
*** 289,298 ****
result = result.m_parent;
}
!
// topmost parent must be an RtfFile
// a ClassCastException here would mean that the parent-child structure is not as expected
return (RtfFile)result;
}
!
/** find the first parent where c.isAssignableFrom(parent.getClass()) is true
* @return null if not found
--- 296,305 ----
result = result.m_parent;
}
!
// topmost parent must be an RtfFile
// a ClassCastException here would mean that the parent-child structure is not as expected
return (RtfFile)result;
}
!
/** find the first parent where c.isAssignableFrom(parent.getClass()) is true
* @return null if not found
***************
*** 311,334 ****
return result;
}
!
/** true if this element would generate no "useful" RTF content */
public abstract boolean isEmpty();
!
!
protected void writeExceptionInRtf(Exception ie)
throws IOException {
writeGroupMark(true);
writeControlWord("par");
!
// make the exception message stand out so that the problem is visible
writeControlWord("fs48");
RtfStringConverter.getInstance().writeRtfString(m_writer,JForVersionInfo.getShortVersionInfo() + ": ");
RtfStringConverter.getInstance().writeRtfString(m_writer,ie.getClass().getName());
!
writeControlWord("fs20");
RtfStringConverter.getInstance().writeRtfString(m_writer," " + ie.toString());
!
writeControlWord("par");
writeGroupMark(false);
}
}
--- 318,347 ----
return result;
}
!
/** true if this element would generate no "useful" RTF content */
public abstract boolean isEmpty();
!
!
protected void writeExceptionInRtf(Exception ie)
throws IOException {
writeGroupMark(true);
writeControlWord("par");
!
// make the exception message stand out so that the problem is visible
writeControlWord("fs48");
RtfStringConverter.getInstance().writeRtfString(m_writer,JForVersionInfo.getShortVersionInfo() + ": ");
RtfStringConverter.getInstance().writeRtfString(m_writer,ie.getClass().getName());
!
writeControlWord("fs20");
RtfStringConverter.getInstance().writeRtfString(m_writer," " + ie.toString());
!
writeControlWord("par");
writeGroupMark(false);
+ }
+
+ // Added by Normand Masse
+ // Used for attribute inheritance
+ public RtfAttributes getRtfAttributes() {
+ return m_attrib;
}
}
Index: BorderAttributesConverter.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/BorderAttributesConverter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** BorderAttributesConverter.java 12 Jul 2002 08:08:31 -0000 1.2
--- BorderAttributesConverter.java 18 Feb 2003 16:10:56 -0000 1.3
***************
*** 56,59 ****
--- 56,63 ----
// $Id$
// $Log$
+ // Revision 1.3 2003/02/18 16:10:56 rmarra
+ // Contributions Normand Massé
+ // inheritance and other fixes
+ //
// Revision 1.2 2002/07/12 08:08:31 bdelacretaz
// License changed to jfor Apache-style license
***************
*** 113,117 ****
* to RTF control words*/
public static String convertAttributetoRtf(String value) {
! if(value.equals("thin")){
return BORDER_SINGLE_THICKNESS;
}else if (value.equals("thick")) {
--- 117,123 ----
* to RTF control words*/
public static String convertAttributetoRtf(String value) {
! // Added by Normand Masse
! // "solid" is interpreted like "thin"
! if(value.equals("thin") || value.equals("solid")){
return BORDER_SINGLE_THICKNESS;
}else if (value.equals("thick")) {
Index: RtfTable.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfTable.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** RtfTable.java 12 Aug 2002 09:40:03 -0000 1.8
--- RtfTable.java 18 Feb 2003 16:10:57 -0000 1.9
***************
*** 62,65 ****
--- 62,69 ----
// $Id$
// $Log$
+ // Revision 1.9 2003/02/18 16:10:57 rmarra
+ // Contributions Normand Massé
+ // inheritance and other fixes
+ //
// Revision 1.8 2002/08/12 09:40:03 bdelacretaz
// V0.7.1dev-e, contributions from Boris Poudérous for number-columns-spanned
***************
*** 127,150 ****
highestRow++;
! m_row = new RtfTableRow(this,m_writer,m_attrib,highestRow);
! return m_row;
! }
!
! /** close current row if any and start a new one */
! public RtfTableRow newTableRow(RtfAttributes attrs) throws IOException
! {
! RtfAttributes attr = null;
! if (m_attrib != null)
! {
! attr = (RtfAttributes) m_attrib.clone ();
! attr.set (attrs);
! }
! else
! attr = attrs;
!
! if(m_row != null) m_row.close();
! highestRow++;
! m_row = new RtfTableRow(this,m_writer,attr,highestRow);
return m_row;
}
--- 131,152 ----
highestRow++;
! m_row = new RtfTableRow(this,m_writer,m_attrib,highestRow);
! return m_row;
! }
! /** close current row if any and start a new one */
! public RtfTableRow newTableRow(RtfAttributes attrs) throws IOException
! {
! RtfAttributes attr = null;
! if (m_attrib != null)
! {
! attr = (RtfAttributes) m_attrib.clone ();
! attr.set (attrs);
! }
! else
! attr = attrs;
! if(m_row != null) m_row.close();
! highestRow++;
! m_row = new RtfTableRow(this,m_writer,attr,highestRow);
return m_row;
}
***************
*** 173,176 ****
--- 175,197 ----
{
return this.m_table_context;
+ }
+
+ private RtfAttributes m_header_attribs = null;
+
+ // Added by Normand Masse
+ // Support for table-header attributes (used instead of table attributes
+ public void setHeaderAttribs( RtfAttributes attrs ) {
+ m_header_attribs = attrs;
+ }
+
+ // Added by Normand Masse
+ // Returns the table-header attributes if they are present, otherwise the
+ // parent's attributes are returned normally.
+ public RtfAttributes getRtfAttributes() {
+ if ( m_header_attribs != null ) {
+ return m_header_attribs;
+ }
+
+ return super.getRtfAttributes();
}
/** - end - */
Index: RtfExternalGraphic.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfExternalGraphic.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** RtfExternalGraphic.java 12 Jul 2002 08:08:31 -0000 1.9
--- RtfExternalGraphic.java 18 Feb 2003 16:10:57 -0000 1.10
***************
*** 225,228 ****
--- 225,239 ----
}
+ String linkToRoot = System.getProperty( "jfor_link_to_root" );
+ if (linkToRoot != null)
+ {
+ m_writer.write( "{\\field {\\* \\fldinst { INCLUDEPICTURE \"" );
+ m_writer.write( linkToRoot );
+ File urlFile = new File( url.getFile() );
+ m_writer.write( urlFile.getName() );
+ m_writer.write( "\" \\\\* MERGEFORMAT \\\\d }}}" );
+ return;
+ }
+
getRtfFile ().getLog ().logInfo ("Writing image '" + url + "'.");
Index: RtfParagraph.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfParagraph.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** RtfParagraph.java 23 Sep 2002 13:15:52 -0000 1.15
--- RtfParagraph.java 18 Feb 2003 16:10:58 -0000 1.16
***************
*** 64,67 ****
--- 64,71 ----
// $Id$
// $Log$
+ // Revision 1.16 2003/02/18 16:10:58 rmarra
+ // Contributions Normand Massé
+ // inheritance and other fixes
+ //
// Revision 1.15 2002/09/23 13:15:52 rmarra
// Reset paragraph properties added
***************
*** 210,214 ****
// by RtfText
writeAttributes(m_attrib,PARA_ATTRIBUTES);
!
//Set keepn if needed (Keep paragraph with the next paragraph)
if(m_keepn) writeControlWord("keepn");
--- 214,223 ----
// by RtfText
writeAttributes(m_attrib,PARA_ATTRIBUTES);
! // Added by Normand Masse
! // Write alignment attributes after \intbl for cells
! if ( m_attrib.isSet( "intbl" ) && mustWriteAttributes() ) {
! writeAttributes(m_attrib, RtfText.ALIGNMENT);
! }
!
//Set keepn if needed (Keep paragraph with the next paragraph)
if(m_keepn) writeControlWord("keepn");
***************
*** 219,224 ****
if(mustWriteAttributes()) {
! writeAttributes(m_attrib, new String [] {"cs"});
! writeAttributes(m_attrib, RtfText.ALIGNMENT);
//this line added by Chris Scott, Westinghouse
writeAttributes(m_attrib, RtfText.BORDER);
--- 228,237 ----
if(mustWriteAttributes()) {
! // writeAttributes(m_attrib, new String [] {"cs"});
! // Added by Normand Masse
! // If \intbl then attributes have already been written (see higher in method)
! if ( !m_attrib.isSet( "intbl" ) ) {
! writeAttributes(m_attrib, RtfText.ALIGNMENT);
! }
//this line added by Chris Scott, Westinghouse
writeAttributes(m_attrib, RtfText.BORDER);
Index: RtfAttributes.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfAttributes.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** RtfAttributes.java 12 Jul 2002 08:08:31 -0000 1.5
--- RtfAttributes.java 18 Feb 2003 16:10:58 -0000 1.6
***************
*** 2,5 ****
--- 2,7 ----
import java.util.*;
+ import org.xml.sax.Attributes;
+ import org.xml.sax.helpers.AttributesImpl;
/*-----------------------------------------------------------------------------
***************
*** 60,63 ****
--- 62,69 ----
// $Id$
// $Log$
+ // Revision 1.6 2003/02/18 16:10:58 rmarra
+ // Contributions Normand Massé
+ // inheritance and other fixes
+ //
// Revision 1.5 2002/07/12 08:08:31 bdelacretaz
// License changed to jfor Apache-style license
***************
*** 87,124 ****
{
private HashMap m_values = new HashMap();
!
! /** set attributes from a other attributes object.
! * @return this object, for chaining calls
! */
! public RtfAttributes set (RtfAttributes attrs)
! {
! if (attrs != null)
! {
! Iterator it = attrs.nameIterator ();
! while (it.hasNext ())
! {
! String name = (String) it.next ();
! if (attrs.getValue(name) instanceof Integer){
! Integer value = (Integer)attrs.getValue (name);
! if (value == null)
! set (name);
! else
! set (name, value.intValue ());
! }
! else if(attrs.getValue(name) instanceof String){
! String value = (String)attrs.getValue (name);
! if (value == null)
! set (name);
! else
! set (name, value);
! }else{
! set (name);
! }
!
!
! }
! }
! return this;
! }
/** set an attribute that has no value.
--- 93,132 ----
{
private HashMap m_values = new HashMap();
!
! /** set attributes from a other attributes object.
! * @return this object, for chaining calls
! */
! public RtfAttributes set (RtfAttributes attrs)
! {
! if (attrs != null)
! {
! Iterator it = attrs.nameIterator ();
! while (it.hasNext ())
! {
! String name = (String) it.next ();
! if (attrs.getValue(name) instanceof Integer){
! Integer value = (Integer)attrs.getValue (name);
! if (value == null)
! set (name);
! else
! set (name, value.intValue ());
! }
! else if(attrs.getValue(name) instanceof String){
! String value = (String)attrs.getValue (name);
! if (value == null)
! set (name);
! else
! set (name, value);
! }else{
! set (name);
! }
!
!
! }
! // indicate the XSL attributes used to build the Rtf attributes
! setXslAttributes( attrs.getXslAttributes() );
! }
! return this;
! }
/** set an attribute that has no value.
***************
*** 130,134 ****
return this;
}
!
/** unset an attribute that has no value
* @return this object, for chaining calls
--- 138,142 ----
return this;
}
!
/** unset an attribute that has no value
* @return this object, for chaining calls
***************
*** 139,143 ****
return this;
}
!
/** debugging log */
public String toString()
--- 147,151 ----
return this;
}
!
/** debugging log */
public String toString()
***************
*** 145,149 ****
return m_values.toString() + "(" + super.toString() + ")";
}
!
/** implement cloning */
public Object clone()
--- 153,157 ----
return m_values.toString() + "(" + super.toString() + ")";
}
!
/** implement cloning */
public Object clone()
***************
*** 151,157 ****
final RtfAttributes result = new RtfAttributes();
result.m_values = (HashMap)m_values.clone();
return result;
}
!
/** set an attribute that has an integer value
* @return this object, for chaining calls
--- 159,172 ----
final RtfAttributes result = new RtfAttributes();
result.m_values = (HashMap)m_values.clone();
+
+ // Added by Normand Masse
+ // indicate the XSL attributes used to build the Rtf attributes
+ if ( m_xsl_attributes != null ) {
+ result.m_xsl_attributes = new org.xml.sax.helpers.AttributesImpl( m_xsl_attributes );
+ }
+
return result;
}
!
/** set an attribute that has an integer value
* @return this object, for chaining calls
***************
*** 162,172 ****
return this;
}
!
public RtfAttributes set(String name, String type)
{
! m_values.put(name,type);
! return this;
}
!
/** get the value of an attribute, null if not found */
public Object getValue(String name)
--- 177,187 ----
return this;
}
!
public RtfAttributes set(String name, String type)
{
! m_values.put(name,type);
! return this;
}
!
/** get the value of an attribute, null if not found */
public Object getValue(String name)
***************
*** 174,178 ****
return m_values.get(name);
}
!
/** true if given attribute is set */
public boolean isSet(String name)
--- 189,193 ----
return m_values.get(name);
}
!
/** true if given attribute is set */
public boolean isSet(String name)
***************
*** 180,188 ****
return m_values.containsKey(name);
}
!
/** return an Iterator on all names that are set */
public Iterator nameIterator()
{
return m_values.keySet().iterator();
}
}
--- 195,237 ----
return m_values.containsKey(name);
}
!
/** return an Iterator on all names that are set */
public Iterator nameIterator()
{
return m_values.keySet().iterator();
+ }
+
+ private Attributes m_xsl_attributes = null;
+
+ // Added by Normand Masse
+ // Used for attribute inheritance
+ public Attributes getXslAttributes() {
+ return m_xsl_attributes;
+ }
+
+ // Added by Normand Masse
+ // Used for attribute inheritance
+ public void setXslAttributes( Attributes pAttribs ) {
+ if ( pAttribs == null ) {
+ return;
+ }
+ // copy/replace the xsl attributes into the current attributes
+ if ( m_xsl_attributes != null ) {
+ for ( int i = 0; i < pAttribs.getLength(); i++ ) {
+ String wKey = pAttribs.getQName( i );
+ int wPos = m_xsl_attributes.getIndex( wKey );
+ if ( wPos == -1 ) {
+ ((AttributesImpl)m_xsl_attributes).addAttribute( pAttribs.getURI( i ),
+ pAttribs.getLocalName(i), pAttribs.getQName(i),
+ pAttribs.getType(i), pAttribs.getValue(i));
+ } else {
+ ((AttributesImpl)m_xsl_attributes).setAttribute( wPos, pAttribs.getURI( i ),
+ pAttribs.getLocalName(i), pAttribs.getQName(i),
+ pAttribs.getType(i), pAttribs.getValue(i));
+ }
+ }
+ } else {
+ m_xsl_attributes = new org.xml.sax.helpers.AttributesImpl( pAttribs );
+ }
}
}
Index: RtfColorTable.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfColorTable.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** RtfColorTable.java 12 Jul 2002 08:08:31 -0000 1.5
--- RtfColorTable.java 18 Feb 2003 16:10:59 -0000 1.6
***************
*** 72,75 ****
--- 72,79 ----
// $Id$
// $Log$
+ // Revision 1.6 2003/02/18 16:10:59 rmarra
+ // Contributions Normand Massé
+ // inheritance and other fixes
+ //
// Revision 1.5 2002/07/12 08:08:31 bdelacretaz
// License changed to jfor Apache-style license
***************
*** 150,159 ****
addNamedColor("black",getColorNumber (0, 0, 0));
addNamedColor("white",getColorNumber (255, 255, 255));
-
addNamedColor("red",getColorNumber (255, 0, 0));
addNamedColor("green",getColorNumber (0, 255, 0));
! addNamedColor("blue",getColorNumber (0, 0, 255));
!
! addNamedColor("cyan",getColorNumber (0, 255, 255));
addNamedColor("magenta",getColorNumber (255, 0, 255));
addNamedColor("yellow",getColorNumber (255, 255, 0));
--- 154,161 ----
addNamedColor("black",getColorNumber (0, 0, 0));
addNamedColor("white",getColorNumber (255, 255, 255));
addNamedColor("red",getColorNumber (255, 0, 0));
addNamedColor("green",getColorNumber (0, 255, 0));
! addNamedColor("blue",getColorNumber (0, 0, 255));
! addNamedColor("cyan",getColorNumber (0, 255, 255));
addNamedColor("magenta",getColorNumber (255, 0, 255));
addNamedColor("yellow",getColorNumber (255, 255, 0));
***************
*** 166,169 ****
--- 168,175 ----
getColorNumber (128, 128, 0);
getColorNumber (128, 128, 128);
+
+ // Added by Normand Masse
+ // Gray color added
+ addNamedColor( "gray", getColorNumber( 128, 128, 128 ) );
getColorNumber (192, 192, 192);
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf