CVS: jfor/src/org/jfor/jfor/rtflib/rtfdoc IRtfTableContainer.java,1.4,1.5 ITableAttributes.java,1.6,1.7 RtfContainer.java,1.3,1.4 RtfExtraRowSet.java,1.4,1.5 RtfSection.java,1.9,1.10 RtfTable.java,1.7,1.8 RtfTableCell.java,1.8,1.9 RtfTableRow.java,1.8,1.9
Bertrand Delacretaz <[email protected]> Mon, 12 Aug 2002 02:40:05 -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-serv13488/src/org/jfor/jfor/rtflib/rtfdoc
Modified Files:
IRtfTableContainer.java ITableAttributes.java
RtfContainer.java RtfExtraRowSet.java RtfSection.java
RtfTable.java RtfTableCell.java RtfTableRow.java
Log Message:
V0.7.1dev-e, contributions from Boris Poudérous for number-columns-spanned
and vertical merging of tables cells.
Index: IRtfTableContainer.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/IRtfTableContainer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** IRtfTableContainer.java 12 Jul 2002 08:08:31 -0000 1.4
--- IRtfTableContainer.java 12 Aug 2002 09:40:02 -0000 1.5
***************
*** 2,5 ****
--- 2,6 ----
import java.io.IOException;
+ import org.jfor.jfor.interfaces.ITableColumnsInfo;
/*-----------------------------------------------------------------------------
***************
*** 59,62 ****
--- 60,67 ----
// $Id$
// $Log$
+ // Revision 1.5 2002/08/12 09:40:02 bdelacretaz
+ // V0.7.1dev-e, contributions from Boris Poudérous for number-columns-spanned
+ // and vertical merging of tables cells.
+ //
// Revision 1.4 2002/07/12 08:08:31 bdelacretaz
// License changed to jfor Apache-style license
***************
*** 79,85 ****
{
/** close current table if any and start a new one */
! public RtfTable newTable() throws IOException;
! /** close current table if any and start a new one */
! public RtfTable newTable(RtfAttributes attrs) throws IOException;
}
--- 84,92 ----
{
/** close current table if any and start a new one */
! public RtfTable newTable(ITableColumnsInfo tc) throws IOException;
! /** close current table if any and start a new one
! * @param tc added by Boris Poudérous on july 2002 in order to process number-columns-spanned attribute
! **/
! public RtfTable newTable(RtfAttributes attrs, ITableColumnsInfo tc) throws IOException;
}
Index: ITableAttributes.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/ITableAttributes.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ITableAttributes.java 12 Jul 2002 08:08:31 -0000 1.6
--- ITableAttributes.java 12 Aug 2002 09:40:02 -0000 1.7
***************
*** 56,63 ****
/** Constants for RTF table attribute names */
public interface ITableAttributes {
// RTF 1.5 attributes (word 97)
// half the space between the cells of a table row in twips
String ATTR_RTF_15_TRGAPH = "trgaph";
!
// RTF 1.6 Row and table attributes
String ATTR_ROW_PADDING_TOP = "trpaddt";
--- 56,70 ----
/** Constants for RTF table attribute names */
public interface ITableAttributes {
+ /**
+ * Added by Boris POUDEROUS on 2002/06/27 in order to
+ * process column/row spanning :
+ */
+ public static final String COLUMN_SPAN = "number-columns-spanned";
+ public static final String ROW_SPAN = "number-rows-spanned";
+
// RTF 1.5 attributes (word 97)
// half the space between the cells of a table row in twips
String ATTR_RTF_15_TRGAPH = "trgaph";
!
// RTF 1.6 Row and table attributes
String ATTR_ROW_PADDING_TOP = "trpaddt";
***************
*** 65,74 ****
String ATTR_ROW_PADDING_LEFT = "trpaddl";
String ATTR_ROW_PADDING_RIGHT = "trpaddr";
!
String ATTR_ROW_U_PADDING_TOP = "trpaddft";
String ATTR_ROW_U_PADDING_BOTTOM = "trpaddfb";
String ATTR_ROW_U_PADDING_LEFT = "trpaddfl";
String ATTR_ROW_U_PADDING_RIGHT = "trpaddfr";
!
// list of ALL ROW PADDING attributes, used to select them
// when writing attributes
--- 72,81 ----
String ATTR_ROW_PADDING_LEFT = "trpaddl";
String ATTR_ROW_PADDING_RIGHT = "trpaddr";
!
String ATTR_ROW_U_PADDING_TOP = "trpaddft";
String ATTR_ROW_U_PADDING_BOTTOM = "trpaddfb";
String ATTR_ROW_U_PADDING_LEFT = "trpaddfl";
String ATTR_ROW_U_PADDING_RIGHT = "trpaddfr";
!
// list of ALL ROW PADDING attributes, used to select them
// when writing attributes
***************
*** 80,84 ****
ATTR_RTF_15_TRGAPH
};
!
// Cell attributes
String ATTR_CELL_PADDING_TOP = "clpadt";
--- 87,91 ----
ATTR_RTF_15_TRGAPH
};
!
// Cell attributes
String ATTR_CELL_PADDING_TOP = "clpadt";
***************
*** 86,98 ****
String ATTR_CELL_PADDING_LEFT = "clpadl";
String ATTR_CELL_PADDING_RIGHT = "clpadr";
!
String ATTR_CELL_U_PADDING_TOP = "clpadft";
String ATTR_CELL_U_PADDING_BOTTOM = "clpadfb";
String ATTR_CELL_U_PADDING_LEFT = "clpadfl";
String ATTR_CELL_U_PADDING_RIGHT = "clpadfr";
!
// These lines added by Chris Scott, Westinghouse
// need to make a border style file
!
String CELL_BORDER_TOP = "clbrdrt";
String CELL_BORDER_BOTTOM = "clbrdrb";
--- 93,105 ----
String ATTR_CELL_PADDING_LEFT = "clpadl";
String ATTR_CELL_PADDING_RIGHT = "clpadr";
!
String ATTR_CELL_U_PADDING_TOP = "clpadft";
String ATTR_CELL_U_PADDING_BOTTOM = "clpadfb";
String ATTR_CELL_U_PADDING_LEFT = "clpadfl";
String ATTR_CELL_U_PADDING_RIGHT = "clpadfr";
!
// These lines added by Chris Scott, Westinghouse
// need to make a border style file
!
String CELL_BORDER_TOP = "clbrdrt";
String CELL_BORDER_BOTTOM = "clbrdrb";
***************
*** 106,113 ****
String ROW_BORDER_HORIZONTAL = "trbrdrh";
String ROW_BORDER_VERTICAL = "trbrdrv";
!
//Table row attributes
String ROW_KEEP_TOGETHER = "trkeep";
!
//This control word is nonexistent in RTF, used
//to simulate the FO:keep-with-next attribute.
--- 113,120 ----
String ROW_BORDER_HORIZONTAL = "trbrdrh";
String ROW_BORDER_VERTICAL = "trbrdrv";
!
//Table row attributes
String ROW_KEEP_TOGETHER = "trkeep";
!
//This control word is nonexistent in RTF, used
//to simulate the FO:keep-with-next attribute.
***************
*** 117,126 ****
//to simulate the FO:keep-with-previous attribute.
String ROW_KEEP_WITH_PREVIOUS = "kprevious";
!
//shading and color, all are unit based attributes
String CELL_SHADE = "clshdng";
String CELL_COLOR_BACKGROUND = "clcbpat";
String CELL_COLOR_FOREGROUND = "clcfpat";
!
// list of ALL CELL PADDING attributes, used to select them
// when writing attributes
--- 124,133 ----
//to simulate the FO:keep-with-previous attribute.
String ROW_KEEP_WITH_PREVIOUS = "kprevious";
!
//shading and color, all are unit based attributes
String CELL_SHADE = "clshdng";
String CELL_COLOR_BACKGROUND = "clcbpat";
String CELL_COLOR_FOREGROUND = "clcfpat";
!
// list of ALL CELL PADDING attributes, used to select them
// when writing attributes
***************
*** 131,145 ****
ATTR_CELL_PADDING_RIGHT, ATTR_CELL_U_PADDING_RIGHT,
};
!
String[] CELL_BORDER = {
CELL_BORDER_TOP, CELL_BORDER_BOTTOM,
CELL_BORDER_LEFT, CELL_BORDER_RIGHT
};
!
String[] ROW_BORDER = {
ROW_BORDER_TOP, ROW_BORDER_BOTTOM, ROW_BORDER_LEFT,
ROW_BORDER_RIGHT, ROW_BORDER_HORIZONTAL, ROW_BORDER_VERTICAL
};
!
String[] CELL_COLOR = {
CELL_SHADE, CELL_COLOR_BACKGROUND, CELL_COLOR_FOREGROUND
--- 138,152 ----
ATTR_CELL_PADDING_RIGHT, ATTR_CELL_U_PADDING_RIGHT,
};
!
String[] CELL_BORDER = {
CELL_BORDER_TOP, CELL_BORDER_BOTTOM,
CELL_BORDER_LEFT, CELL_BORDER_RIGHT
};
!
String[] ROW_BORDER = {
ROW_BORDER_TOP, ROW_BORDER_BOTTOM, ROW_BORDER_LEFT,
ROW_BORDER_RIGHT, ROW_BORDER_HORIZONTAL, ROW_BORDER_VERTICAL
};
!
String[] CELL_COLOR = {
CELL_SHADE, CELL_COLOR_BACKGROUND, CELL_COLOR_FOREGROUND
Index: RtfContainer.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfContainer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** RtfContainer.java 12 Jul 2002 08:08:31 -0000 1.3
--- RtfContainer.java 12 Aug 2002 09:40:03 -0000 1.4
***************
*** 62,65 ****
--- 62,69 ----
// $Id$
// $Log$
+ // Revision 1.4 2002/08/12 09:40:03 bdelacretaz
+ // V0.7.1dev-e, contributions from Boris Poudérous for number-columns-spanned
+ // and vertical merging of tables cells.
+ //
// Revision 1.3 2002/07/12 08:08:31 bdelacretaz
// License changed to jfor Apache-style license
***************
*** 104,116 ****
public class RtfContainer extends RtfElement {
! private final LinkedList m_children;
private RtfOptions m_options = new RtfOptions();
private RtfElement m_lastChild;
!
/** Create an RTF container as a child of given container */
RtfContainer(RtfContainer parent, Writer w) throws IOException {
this(parent,w,null);
}
!
/** Create an RTF container as a child of given container with given attributes */
RtfContainer(RtfContainer parent, Writer w,RtfAttributes attr) throws IOException {
--- 108,120 ----
public class RtfContainer extends RtfElement {
! private LinkedList m_children; // 'final' removed by Boris Poudérous on 07/22/2002
private RtfOptions m_options = new RtfOptions();
private RtfElement m_lastChild;
!
/** Create an RTF container as a child of given container */
RtfContainer(RtfContainer parent, Writer w) throws IOException {
this(parent,w,null);
}
!
/** Create an RTF container as a child of given container with given attributes */
RtfContainer(RtfContainer parent, Writer w,RtfAttributes attr) throws IOException {
***************
*** 118,127 ****
m_children = new LinkedList();
}
!
/** set options */
public void setOptions(RtfOptions opt) {
m_options = opt;
}
!
/** add a child element to this */
protected void addChild(RtfElement e)
--- 122,131 ----
m_children = new LinkedList();
}
!
/** set options */
public void setOptions(RtfOptions opt) {
m_options = opt;
}
!
/** add a child element to this */
protected void addChild(RtfElement e)
***************
*** 136,140 ****
sb.append(")");
final String msg = sb.toString();
!
// warn of this problem
final RtfFile rf = getRtfFile();
--- 140,144 ----
sb.append(")");
final String msg = sb.toString();
!
// warn of this problem
final RtfFile rf = getRtfFile();
***************
*** 142,146 ****
rf.getLog().logWarning(msg);
}
!
// TODO this should be activated to help detect XSL-FO constructs
// that we do not handle properly.
--- 146,150 ----
rf.getLog().logWarning(msg);
}
!
// TODO this should be activated to help detect XSL-FO constructs
// that we do not handle properly.
***************
*** 149,167 ****
*/
}
!
m_children.add(e);
m_lastChild = e;
}
!
/** return a copy of our children's list */
public List getChildren() {
return (List)m_children.clone();
}
!
/** return the number of children */
public int getChildCount() {
return m_children.size();
}
!
/** write RTF code of all our children */
protected void writeRtfContent()
--- 153,186 ----
*/
}
!
m_children.add(e);
m_lastChild = e;
}
!
/** return a copy of our children's list */
public List getChildren() {
return (List)m_children.clone();
}
!
/** return the number of children */
public int getChildCount() {
return m_children.size();
}
!
! /**
! * Add by Boris Poudérous on 07/22/2002
! * Set the children list
! */
! public boolean setChildren (List children)
! {
! if (children instanceof LinkedList)
! {
! this.m_children = (LinkedList)children;
! return true;
! }
!
! return false;
! }
!
/** write RTF code of all our children */
protected void writeRtfContent()
***************
*** 172,181 ****
}
}
!
/** return our options */
RtfOptions getOptions() {
return m_options;
}
!
/** true if this (recursively) contains at least one RtfText object */
boolean containsText() {
--- 191,200 ----
}
}
!
/** return our options */
RtfOptions getOptions() {
return m_options;
}
!
/** true if this (recursively) contains at least one RtfText object */
boolean containsText() {
***************
*** 194,198 ****
return result;
}
!
/** debugging to given Writer */
void dump(Writer w,int indent)
--- 213,217 ----
return result;
}
!
/** debugging to given Writer */
void dump(Writer w,int indent)
***************
*** 204,213 ****
}
}
!
/** minimal debugging display */
public String toString() {
return super.toString() + " (" + getChildCount() + " children)";
}
!
/** don't write any RTF if empty of if our options block it */
protected boolean okToWriteRtf() {
--- 223,232 ----
}
}
!
/** minimal debugging display */
public String toString() {
return super.toString() + " (" + getChildCount() + " children)";
}
!
/** don't write any RTF if empty of if our options block it */
protected boolean okToWriteRtf() {
***************
*** 218,222 ****
return result;
}
!
/** true if this element would generate no "useful" RTF content.
* For an RtfContainer, true if it has no children where isEmpty() is false
--- 237,241 ----
return result;
}
!
/** true if this element would generate no "useful" RTF content.
* For an RtfContainer, true if it has no children where isEmpty() is false
Index: RtfExtraRowSet.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfExtraRowSet.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** RtfExtraRowSet.java 12 Jul 2002 08:08:31 -0000 1.4
--- RtfExtraRowSet.java 12 Aug 2002 09:40:03 -0000 1.5
***************
*** 3,6 ****
--- 3,7 ----
import java.io.*;
import java.util.*;
+ import org.jfor.jfor.interfaces.ITableColumnsInfo;
/*-----------------------------------------------------------------------------
***************
*** 68,71 ****
--- 69,76 ----
// $Id$
// $Log$
+ // Revision 1.5 2002/08/12 09:40:03 bdelacretaz
+ // V0.7.1dev-e, contributions from Boris Poudérous for number-columns-spanned
+ // and vertical merging of tables cells.
+ //
// Revision 1.4 2002/07/12 08:08:31 bdelacretaz
// License changed to jfor Apache-style license
***************
*** 100,104 ****
// TODO what is idnum?
final int DEFAULT_IDNUM = 0;
!
/** While a top-level RtfTableRow is being rendered, we build a list of
* RtfTableCells that must be rendered in extra rows.
--- 105,114 ----
// TODO what is idnum?
final int DEFAULT_IDNUM = 0;
!
! /** Parent table context
! * (added by Boris Poudérous on july 2002 in order to process nested tables)
! */
! private ITableColumnsInfo parentITableColumnsInfo = null;
!
/** While a top-level RtfTableRow is being rendered, we build a list of
* RtfTableCells that must be rendered in extra rows.
***************
*** 111,115 ****
final int xOffset;
final int rowIndex;
!
PositionedCell(RtfTableCell c,int index,int offset) {
cell = c;
--- 121,125 ----
final int xOffset;
final int rowIndex;
!
PositionedCell(RtfTableCell c,int index,int offset) {
cell = c;
***************
*** 117,126 ****
rowIndex = index;
}
!
/** debugging dump */
public String toString() {
return "PositionedCell: row " + rowIndex + ", offset " + xOffset;
}
!
/** cells need to be sorted by row index and then by x offset */
public int compareTo(Object o) {
--- 127,136 ----
rowIndex = index;
}
!
/** debugging dump */
public String toString() {
return "PositionedCell: row " + rowIndex + ", offset " + xOffset;
}
!
/** cells need to be sorted by row index and then by x offset */
public int compareTo(Object o) {
***************
*** 142,157 ****
}
}
!
return result;
}
!
public boolean equals(Object o) {
return o!=null && this.compareTo(o) == 0;
}
}
!
/** our maximum row index */
private int m_maxRowIndex;
!
/** an RtfExtraRowSet has no parent, it is only used temporary during
* generation of RTF for an RtfTableRow
--- 152,167 ----
}
}
!
return result;
}
!
public boolean equals(Object o) {
return o!=null && this.compareTo(o) == 0;
}
}
!
/** our maximum row index */
private int m_maxRowIndex;
!
/** an RtfExtraRowSet has no parent, it is only used temporary during
* generation of RTF for an RtfTableRow
***************
*** 161,165 ****
super(null,w);
}
!
/** Add all cells of given Table to this set for later rendering in extra rows
* @return index of extra row to use for elements that follow this table in the same cell
--- 171,175 ----
super(null,w);
}
!
/** Add all cells of given Table to this set for later rendering in extra rows
* @return index of extra row to use for elements that follow this table in the same cell
***************
*** 179,183 ****
return rowIndex;
}
!
/** add all cells of given row to this set */
private void addRow(RtfTableRow row,int rowIndex,int xOffset) {
--- 189,193 ----
return rowIndex;
}
!
/** add all cells of given row to this set */
private void addRow(RtfTableRow row,int rowIndex,int xOffset) {
***************
*** 191,208 ****
}
}
!
! /** create an extra cell to hold content that comes after a nested table in a cell */
! RtfTableCell createExtraCell(int rowIndex,int xOffset,int cellWidth)
throws IOException {
! final RtfTableCell c = new RtfTableCell(null,m_writer,cellWidth,DEFAULT_IDNUM);
m_cells.add(new PositionedCell(c,rowIndex,xOffset));
return c;
}
!
/** render extra RtfTableRows containing all the extra RtfTableCells that we contain */
protected void writeRtfContent() throws IOException {
// sort cells by rowIndex and xOffset
Collections.sort(m_cells);
!
// process all extra cells by rendering them into extra rows
List rowCells = null;
--- 201,220 ----
}
}
!
! /** create an extra cell to hold content that comes after a nested table in a cell
! * Modified by Boris Poudérous in order to permit the extra cell to have the attributes of its parent cell
! */
! RtfTableCell createExtraCell(int rowIndex,int xOffset,int cellWidth,RtfAttributes parentCellAttributes)
throws IOException {
! final RtfTableCell c = new RtfTableCell(null,m_writer,cellWidth,parentCellAttributes,DEFAULT_IDNUM);
m_cells.add(new PositionedCell(c,rowIndex,xOffset));
return c;
}
!
/** render extra RtfTableRows containing all the extra RtfTableCells that we contain */
protected void writeRtfContent() throws IOException {
// sort cells by rowIndex and xOffset
Collections.sort(m_cells);
!
// process all extra cells by rendering them into extra rows
List rowCells = null;
***************
*** 218,248 ****
rowCells.add(pc);
}
!
// render last row
if(rowCells!=null) writeRow(rowCells);
}
!
/** write one RtfTableRow containing given PositionedCells */
private void writeRow(List cells)
throws IOException {
if(allCellsEmpty(cells)) return;
!
final RtfTableRow row = new RtfTableRow(null,m_writer,DEFAULT_IDNUM);
int cellIndex = 0;
for(Iterator it = cells.iterator(); it.hasNext(); ) {
final PositionedCell pc = (PositionedCell)it.next();
!
// if first cell is not at offset 0, add placeholder cell
// TODO should be merged with the cell that is above it
if(cellIndex==0 && pc.xOffset > 0) {
! row.newTableCell(pc.xOffset);
}
!
row.addChild(pc.cell);
cellIndex++;
}
row.writeRtf();
}
!
/** true if all cells of given list are empty
* @param cells List of PositionedCell objects
--- 230,304 ----
rowCells.add(pc);
}
!
// render last row
if(rowCells!=null) writeRow(rowCells);
}
!
/** write one RtfTableRow containing given PositionedCells */
private void writeRow(List cells)
throws IOException {
if(allCellsEmpty(cells)) return;
!
final RtfTableRow row = new RtfTableRow(null,m_writer,DEFAULT_IDNUM);
int cellIndex = 0;
+
+ // Get the context of the table that holds the nested table
+ ITableColumnsInfo parentITableColumnsInfo = getParentITableColumnsInfo();
+ parentITableColumnsInfo.selectFirstColumn();
+
+ // X offset of the current empty cell to add
+ float xOffset = 0;
+ float xOffsetOfLastPositionedCell = 0;
+
for(Iterator it = cells.iterator(); it.hasNext(); ) {
final PositionedCell pc = (PositionedCell)it.next();
!
// if first cell is not at offset 0, add placeholder cell
// TODO should be merged with the cell that is above it
if(cellIndex==0 && pc.xOffset > 0) {
! /**
! * Added by Boris Poudérous
! */
! // Add empty cells merged vertically with the cells above and with the same widths
! // (BEFORE the cell that contains the nested table)
! for (int i = 0; (xOffset < pc.xOffset) && (i < parentITableColumnsInfo.getNumberOfColumns()); i++) {
! // Get the width of the cell above
! xOffset += parentITableColumnsInfo.getColumnWidth();
! // Create the empty cell merged vertically
! row.newTableCellMergedVertically((int)parentITableColumnsInfo.getColumnWidth(), pc.cell.m_attrib);
! // Select next column in order to have its width
! parentITableColumnsInfo.selectNextColumn();
! }
}
!
row.addChild(pc.cell);
+ // Line added by Boris Poudérous
+ xOffsetOfLastPositionedCell = pc.xOffset + pc.cell.getCellWidth();
cellIndex++;
}
+
+ /**
+ * Added by Boris Poudérous
+ */
+ // Add empty cells merged vertically with the cells above AFTER the cell that contains the nested table
+ // The cells added have the same widths than the cells above.
+ if (parentITableColumnsInfo.getColumnIndex() < (parentITableColumnsInfo.getNumberOfColumns() - 1))
+ {
+ parentITableColumnsInfo.selectNextColumn();
+
+ while (parentITableColumnsInfo.getColumnIndex() < parentITableColumnsInfo.getNumberOfColumns())
+ {
+ // Create the empty cell merged vertically
+ // TODO : the new cells after the extra cell don't have its attributes as we did for the previous cells.
+ // => in fact the m_attrib below (last argument) is empty => should be the attributes of the above cells.
+ row.newTableCellMergedVertically((int)parentITableColumnsInfo.getColumnWidth(), m_attrib);
+ // Select next column in order to have its width
+ parentITableColumnsInfo.selectNextColumn();
+ }
+ }
+
row.writeRtf();
}
!
/** true if all cells of given list are empty
* @param cells List of PositionedCell objects
***************
*** 259,263 ****
return empty;
}
!
/** As this contains cells from several rows, we say that it's empty
* only if we have no cells.
--- 315,319 ----
return empty;
}
!
/** As this contains cells from several rows, we say that it's empty
* only if we have no cells.
***************
*** 267,269 ****
--- 323,340 ----
return false;
}
+
+ /**
+ * @return The table context of the parent table
+ * Added by Boris Poudérous on july 2002 in order to process nested tables
+ */
+ public ITableColumnsInfo getParentITableColumnsInfo()
+ {
+ return this.parentITableColumnsInfo;
+ }
+
+ public void setParentITableColumnsInfo (ITableColumnsInfo parentITableColumnsInfo)
+ {
+ this.parentITableColumnsInfo = parentITableColumnsInfo;
+ }
+ /** - end - */
}
Index: RtfSection.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfSection.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** RtfSection.java 15 Jul 2002 06:43:30 -0000 1.9
--- RtfSection.java 12 Aug 2002 09:40:03 -0000 1.10
***************
*** 5,8 ****
--- 5,9 ----
import java.util.*;
import java.io.IOException;
+ import org.jfor.jfor.interfaces.ITableColumnsInfo;
/*-----------------------------------------------------------------------------
***************
*** 63,66 ****
--- 64,71 ----
// $Id$
// $Log$
+ // Revision 1.10 2002/08/12 09:40:03 bdelacretaz
+ // V0.7.1dev-e, contributions from Boris Poudérous for number-columns-spanned
+ // and vertical merging of tables cells.
+ //
// Revision 1.9 2002/07/15 06:43:30 bdelacretaz
// footer code contributed by Andreas Lambert <[email protected]>
***************
*** 103,107 ****
public class RtfSection
extends RtfContainer
! implements
IRtfParagraphContainer,
IRtfTableContainer,
--- 108,112 ----
public class RtfSection
extends RtfContainer
! implements
IRtfParagraphContainer,
IRtfTableContainer,
***************
*** 118,127 ****
private RtfBefore m_before;
private RtfAfter m_after;
!
/** Create an RTF container as a child of given container */
RtfSection(RtfDocumentArea parent, Writer w) throws IOException {
super(parent,w);
}
!
/** start a new external graphic after closing current paragraph, list and table */
public RtfExternalGraphic newImage() throws IOException {
--- 123,132 ----
private RtfBefore m_before;
private RtfAfter m_after;
!
/** Create an RTF container as a child of given container */
RtfSection(RtfDocumentArea parent, Writer w) throws IOException {
super(parent,w);
}
!
/** start a new external graphic after closing current paragraph, list and table */
public RtfExternalGraphic newImage() throws IOException {
***************
*** 130,134 ****
return m_externalGraphic;
}
!
/** start a new paragraph after closing current paragraph, list and table */
public RtfParagraph newParagraph(RtfAttributes attrs) throws IOException {
--- 135,139 ----
return m_externalGraphic;
}
!
/** start a new paragraph after closing current paragraph, list and table */
public RtfParagraph newParagraph(RtfAttributes attrs) throws IOException {
***************
*** 148,163 ****
}
! /** start a new table after closing current paragraph, list and table */
! public RtfTable newTable() throws IOException {
closeAll();
! m_table = new RtfTable(this,m_writer);
return m_table;
}
! /** start a new table after closing current paragraph, list and table */
! public RtfTable newTable(RtfAttributes attrs) throws IOException
{
! closeAll();
! m_table = new RtfTable(this,m_writer, attrs);
return m_table;
}
--- 153,172 ----
}
! /** start a new table after closing current paragraph, list and table
! * @param tc Table context used for number-columns-spanned attribute (added by Boris Poudérous on july 2002)
! */
! public RtfTable newTable(ITableColumnsInfo tc) throws IOException {
closeAll();
! m_table = new RtfTable(this,m_writer,tc);
return m_table;
}
! /** start a new table after closing current paragraph, list and table
! * @param tc Table context used for number-columns-spanned attribute (added by Boris Poudérous on july 2002)
! */
! public RtfTable newTable(RtfAttributes attrs, ITableColumnsInfo tc) throws IOException
{
! closeAll();
! m_table = new RtfTable(this,m_writer, attrs, tc);
return m_table;
}
***************
*** 169,180 ****
return m_list;
}
!
/** IRtfBeforeContainer */
public RtfBefore newBefore(RtfAttributes attrs) throws IOException {
closeAll();
m_before = new RtfBefore(this,m_writer,attrs);
! return m_before;
}
!
/** IRtfAfterContainer */
public RtfAfter newAfter(RtfAttributes attrs) throws IOException {
--- 178,189 ----
return m_list;
}
!
/** IRtfBeforeContainer */
public RtfBefore newBefore(RtfAttributes attrs) throws IOException {
closeAll();
m_before = new RtfBefore(this,m_writer,attrs);
! return m_before;
}
!
/** IRtfAfterContainer */
public RtfAfter newAfter(RtfAttributes attrs) throws IOException {
***************
*** 194,198 ****
}
-
private void closeCurrentTable() throws IOException {
if(m_table != null) m_table.close();
--- 203,206 ----
***************
*** 210,224 ****
if(m_externalGraphic!=null) m_externalGraphic.close();
}
!
private void closeCurrentBefore() throws IOException {
if(m_before!=null) m_before.close();
}
-
-
-
private void closeAll()
throws IOException {
-
closeCurrentTable();
closeCurrentParagraph();
--- 218,228 ----
if(m_externalGraphic!=null) m_externalGraphic.close();
}
!
private void closeCurrentBefore() throws IOException {
if(m_before!=null) m_before.close();
}
private void closeAll()
throws IOException {
closeCurrentTable();
closeCurrentParagraph();
***************
*** 227,229 ****
closeCurrentBefore();
}
! }
--- 231,233 ----
closeCurrentBefore();
}
! }
\ No newline at end of file
Index: RtfTable.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfTable.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** RtfTable.java 12 Jul 2002 08:08:31 -0000 1.7
--- RtfTable.java 12 Aug 2002 09:40:03 -0000 1.8
***************
*** 3,6 ****
--- 3,7 ----
import java.io.*;
import java.util.Iterator;
+ import org.jfor.jfor.interfaces.ITableColumnsInfo;
/*-----------------------------------------------------------------------------
***************
*** 61,64 ****
--- 62,69 ----
// $Id$
// $Log$
+ // Revision 1.8 2002/08/12 09:40:03 bdelacretaz
+ // V0.7.1dev-e, contributions from Boris Poudérous for number-columns-spanned
+ // and vertical merging of tables cells.
+ //
// Revision 1.7 2002/07/12 08:08:31 bdelacretaz
// License changed to jfor Apache-style license
***************
*** 94,108 ****
private RtfTableRow m_row;
private int highestRow=0;
!
/** Create an RTF element as a child of given container */
! RtfTable(IRtfTableContainer parent, Writer w) throws IOException
{
super((RtfContainer)parent,w);
}
!
! /** Create an RTF element as a child of given container */
! RtfTable(IRtfTableContainer parent, Writer w, RtfAttributes attrs) throws IOException
{
super((RtfContainer)parent,w,attrs);
}
--- 99,122 ----
private RtfTableRow m_row;
private int highestRow=0;
!
! /** Added by Boris Poudérous on 07/22/2002 in order to process number-columns-spanned attribute */
! private ITableColumnsInfo m_table_context;
!
/** Create an RTF element as a child of given container */
! RtfTable(IRtfTableContainer parent, Writer w, ITableColumnsInfo tc) throws IOException
{
super((RtfContainer)parent,w);
+ // Line added by Boris Poudérous on 07/22/2002
+ m_table_context = tc;
}
!
! /** Create an RTF element as a child of given container
! * Modified by Boris Poudérous in order to process 'number-columns-spanned' attribute
! */
! RtfTable(IRtfTableContainer parent, Writer w, RtfAttributes attrs, ITableColumnsInfo tc) throws IOException
{
super((RtfContainer)parent,w,attrs);
+ // Line added by Boris Poudérous on 07/22/2002
+ m_table_context = tc;
}
***************
*** 111,116 ****
{
if(m_row != null) m_row.close();
!
! highestRow++;
m_row = new RtfTableRow(this,m_writer,m_attrib,highestRow);
return m_row;
--- 125,130 ----
{
if(m_row != null) m_row.close();
!
! highestRow++;
m_row = new RtfTableRow(this,m_writer,m_attrib,highestRow);
return m_row;
***************
*** 135,141 ****
return m_row;
}
-
!
/** overridden to write RTF prefix code, what comes before our children */
protected void writeRtfPrefix() throws IOException
--- 149,155 ----
return m_row;
}
!
!
/** overridden to write RTF prefix code, what comes before our children */
protected void writeRtfPrefix() throws IOException
***************
*** 143,147 ****
writeGroupMark(true);
}
!
/** overridden to write RTF suffix code, what comes after our children */
protected void writeRtfSuffix() throws IOException
--- 157,161 ----
writeGroupMark(true);
}
!
/** overridden to write RTF suffix code, what comes after our children */
protected void writeRtfSuffix() throws IOException
***************
*** 149,156 ****
writeGroupMark(false);
}
!
public boolean isHighestRow(int id)
{
return (highestRow == id) ? true : false;
}
}
--- 163,177 ----
writeGroupMark(false);
}
!
public boolean isHighestRow(int id)
{
return (highestRow == id) ? true : false;
}
+
+ /** Added by Boris Poudérous on 07/22/2002 */
+ public ITableColumnsInfo getITableColumnsInfo()
+ {
+ return this.m_table_context;
+ }
+ /** - end - */
}
Index: RtfTableCell.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfTableCell.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** RtfTableCell.java 17 Jul 2002 18:13:07 -0000 1.8
--- RtfTableCell.java 12 Aug 2002 09:40:03 -0000 1.9
***************
*** 3,6 ****
--- 3,7 ----
import java.io.*;
import java.util.*;
+ import org.jfor.jfor.interfaces.ITableColumnsInfo;
/*-----------------------------------------------------------------------------
***************
*** 62,65 ****
--- 63,70 ----
// $Id$
// $Log$
+ // Revision 1.9 2002/08/12 09:40:03 bdelacretaz
+ // V0.7.1dev-e, contributions from Boris Poudérous for number-columns-spanned
+ // and vertical merging of tables cells.
+ //
// Revision 1.8 2002/07/17 18:13:07 rmarra
// Contributions for background-color processing and
***************
*** 163,166 ****
--- 168,206 ----
m_parentRow = parent;
m_cellWidth = cellWidth;
+
+ /** Added by Boris Poudérous on 07/22/2002 in order to process number-columns-spanned attribute */
+ // If the cell is spanned horizontally
+ if (attrs.getValue("number-columns-spanned") != null)
+ {
+ // Start horizontal merge
+ this.setHMerge(MERGE_START);
+
+ // Get the number of columns spanned
+ int nbMergedCells = ((Integer)attrs.getValue("number-columns-spanned")).intValue();
+
+ if (parent.m_parent instanceof RtfTable)
+ {
+ // Get the context of the current table in order to get the width of each column
+ ITableColumnsInfo ITableColumnsInfo = ((RtfTable)parent.m_parent).getITableColumnsInfo();
+ ITableColumnsInfo.selectFirstColumn();
+
+ // Reach the column index in table context corresponding to the current column cell
+ // id is the index of the current cell (it begins at 1)
+ // getColumnIndex() is the index of the current column in table context (it begins at 0)
+ // => so we must widthdraw 1 when comparing these two variables.
+ while ((this.id-1) != ITableColumnsInfo.getColumnIndex())
+ ITableColumnsInfo.selectNextColumn();
+
+ // We widthdraw one cell because the first cell is already created (it's the current cell) !
+ int i = nbMergedCells - 1;
+ while (i > 0)
+ {
+ ITableColumnsInfo.selectNextColumn();
+ parent.newTableCellMergedHorizontally((int)ITableColumnsInfo.getColumnWidth());
+ i--;
+ }
+ }
+ }
+ /** - end - */
}
***************
*** 174,178 ****
m_paragraph = new RtfParagraph(this,m_writer,attrs);
!
//lines modified by Chris Scott, Westinghouse
if(m_paragraph.m_attrib.isSet("qc"))
--- 214,218 ----
m_paragraph = new RtfParagraph(this,m_writer,attrs);
!
//lines modified by Chris Scott, Westinghouse
if(m_paragraph.m_attrib.isSet("qc"))
***************
*** 203,217 ****
/** start a new nested table after closing current paragraph, list and table */
! public RtfTable newTable() throws IOException {
closeAll();
! m_table = new RtfTable(this,m_writer);
return m_table;
}
! /** start a new nested table after closing current paragraph, list and table */
! public RtfTable newTable(RtfAttributes attrs) throws IOException
{
closeAll();
! m_table = new RtfTable(this,m_writer, attrs);
return m_table;
}
--- 243,257 ----
/** start a new nested table after closing current paragraph, list and table */
! public RtfTable newTable(ITableColumnsInfo tc) throws IOException {
closeAll();
! m_table = new RtfTable(this,m_writer,tc);
return m_table;
}
! /** start a new nested table after closing current paragraph, list and table */ // Modified by Boris Poudérous on 07/22/2002
! public RtfTable newTable(RtfAttributes attrs, ITableColumnsInfo tc) throws IOException
{
closeAll();
! m_table = new RtfTable(this,m_writer, attrs, tc); // Added tc Boris Poudérous 07/22/2002
return m_table;
}
***************
*** 237,241 ****
writeControlWord("clmrg");
}
!
/**
* Added by Boris POUDEROUS on 2002/06/26
--- 277,281 ----
writeControlWord("clmrg");
}
!
/**
* Added by Boris POUDEROUS on 2002/06/26
***************
*** 251,255 ****
// cell width
final int xPos = widthOffset + this.m_cellWidth;
!
//these lines added by Chris Scott, Westinghouse
//some attributes need to be writting before opening block
--- 291,295 ----
// cell width
final int xPos = widthOffset + this.m_cellWidth;
!
//these lines added by Chris Scott, Westinghouse
//some attributes need to be writting before opening block
***************
*** 257,262 ****
{
writeControlWord("qc");
! }
!
writeControlWord("cellx" + xPos);
--- 297,302 ----
{
writeControlWord("qc");
! }
!
writeControlWord("cellx" + xPos);
***************
*** 269,277 ****
// TODO this is what causes the extra spaces in nested table of test 004-spacing-in-tables.fo,
// but if is not here we generate invalid RTF for word97
!
if(!containsText()) {
writeControlWord("intbl");
! //R.Marra this create useless paragraph
//Seem working into Word97 with the "intbl" only
// writeControlWord("par");
--- 309,317 ----
// TODO this is what causes the extra spaces in nested table of test 004-spacing-in-tables.fo,
// but if is not here we generate invalid RTF for word97
!
if(!containsText()) {
writeControlWord("intbl");
! //R.Marra this create useless paragraph
//Seem working into Word97 with the "intbl" only
// writeControlWord("par");
***************
*** 284,288 ****
//modified by Chris Scott, Westinghouse
private void closeCurrentParagraph() throws IOException {
! if(m_paragraph!=null)
{
m_paragraph.close();
--- 324,328 ----
//modified by Chris Scott, Westinghouse
private void closeCurrentParagraph() throws IOException {
! if(m_paragraph!=null)
{
m_paragraph.close();
***************
*** 335,340 ****
// nested table - render its cells in supplementary rows after current row,
// and put the remaining content of this cell in a new cell after nested table
! extraRowIndex = m_parentRow.getExtraRowSet().addTable((RtfTable)e,extraRowIndex,m_widthOffset);
! extraCell = m_parentRow.getExtraRowSet().createExtraCell(extraRowIndex,m_widthOffset,this.getCellWidth());
extraRowIndex++;
--- 375,383 ----
// nested table - render its cells in supplementary rows after current row,
// and put the remaining content of this cell in a new cell after nested table
! // Line added by Boris Poudérous
! m_parentRow.getExtraRowSet().setParentITableColumnsInfo(((RtfTable)this.getParentOfClass(e.getClass())).getITableColumnsInfo());
! extraRowIndex = m_parentRow.getExtraRowSet().addTable((RtfTable)e,extraRowIndex,m_widthOffset);
! // Boris Poudérous added the passing of the current cell attributes to the new cells (in order not to have cell without border for example)
! extraCell = m_parentRow.getExtraRowSet().createExtraCell(extraRowIndex,m_widthOffset,this.getCellWidth(), m_attrib);
extraRowIndex++;
Index: RtfTableRow.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfTableRow.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** RtfTableRow.java 12 Jul 2002 08:08:31 -0000 1.8
--- RtfTableRow.java 12 Aug 2002 09:40:03 -0000 1.9
***************
*** 62,65 ****
--- 62,69 ----
// $Id$
// $Log$
+ // Revision 1.9 2002/08/12 09:40:03 bdelacretaz
+ // V0.7.1dev-e, contributions from Boris Poudérous for number-columns-spanned
+ // and vertical merging of tables cells.
+ //
// Revision 1.8 2002/07/12 08:08:31 bdelacretaz
// License changed to jfor Apache-style license
***************
*** 105,110 ****
private int id;
private int highestCell=0;
!
!
/** Create an RTF element as a child of given container */
RtfTableRow(RtfTable parent, Writer w, int idNum) throws IOException {
--- 109,114 ----
private int id;
private int highestCell=0;
!
!
/** Create an RTF element as a child of given container */
RtfTableRow(RtfTable parent, Writer w, int idNum) throws IOException {
***************
*** 112,116 ****
id = idNum;
}
!
/** Create an RTF element as a child of given container */
RtfTableRow(RtfTable parent, Writer w, RtfAttributes attrs, int idNum) throws IOException {
--- 116,120 ----
id = idNum;
}
!
/** Create an RTF element as a child of given container */
RtfTableRow(RtfTable parent, Writer w, RtfAttributes attrs, int idNum) throws IOException {
***************
*** 118,122 ****
id=idNum;
}
!
/** close current cell if any and start a new one */
public RtfTableCell newTableCell(int cellWidth) throws IOException {
--- 122,126 ----
id=idNum;
}
!
/** close current cell if any and start a new one */
public RtfTableCell newTableCell(int cellWidth) throws IOException {
***************
*** 125,129 ****
return m_cell;
}
!
/** close current cell if any and start a new one */
public RtfTableCell newTableCell(int cellWidth, RtfAttributes attrs) throws IOException {
--- 129,133 ----
return m_cell;
}
!
/** close current cell if any and start a new one */
public RtfTableCell newTableCell(int cellWidth, RtfAttributes attrs) throws IOException {
***************
*** 132,161 ****
return m_cell;
}
!
protected void writeRtfPrefix() throws IOException {
writeGroupMark(true);
}
!
/** overridden to write trowd and cell definitions before writing our cells */
protected void writeRtfContent() throws IOException {
!
// create new extra row set to allow our cells to put nested tables
// in rows that will be rendered after this one
m_extraRowSet = new RtfExtraRowSet(m_writer);
!
// render the row and cells definitions
writeControlWord("trowd");
!
//check for keep-together
if(m_attrib != null && m_attrib.isSet(ITableAttributes.ROW_KEEP_TOGETHER)) {
writeControlWord(ROW_KEEP_TOGETHER);
}
!
writePaddingAttributes();
!
// if we have attributes, manipulate border properties
final RtfTable parentTable = (RtfTable) m_parent;
if(m_attrib != null && parentTable != null) {
!
//if table is only one row long
if(isFirstRow() && parentTable.isHighestRow(id)){
--- 136,188 ----
return m_cell;
}
!
! /**
! * Added by Boris POUDEROUS on 07/02/2002
! * in order to add an empty cell that is merged with the cell above.
! * This cell is placed before or after the nested table.
! */
! public RtfTableCell newTableCellMergedVertically(int cellWidth, RtfAttributes attrs) throws IOException {
! highestCell++;
! m_cell = new RtfTableCell (this, m_writer, cellWidth, attrs, highestCell);
! m_cell.setVMerge(RtfTableCell.MERGE_WITH_PREVIOUS);
! return m_cell;
! }
!
! /**
! * Added by Boris POUDEROUS on 07/02/2002
! * 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;
! }
!
protected void writeRtfPrefix() throws IOException {
writeGroupMark(true);
}
!
/** overridden to write trowd and cell definitions before writing our cells */
protected void writeRtfContent() throws IOException {
!
// create new extra row set to allow our cells to put nested tables
// in rows that will be rendered after this one
m_extraRowSet = new RtfExtraRowSet(m_writer);
!
// render the row and cells definitions
writeControlWord("trowd");
!
//check for keep-together
if(m_attrib != null && m_attrib.isSet(ITableAttributes.ROW_KEEP_TOGETHER)) {
writeControlWord(ROW_KEEP_TOGETHER);
}
!
writePaddingAttributes();
!
// if we have attributes, manipulate border properties
final RtfTable parentTable = (RtfTable) m_parent;
if(m_attrib != null && parentTable != null) {
!
//if table is only one row long
if(isFirstRow() && parentTable.isHighestRow(id)){
***************
*** 173,207 ****
}
}
!
writeAttributes(m_attrib,ITableAttributes.ROW_BORDER);
writeAttributes(m_attrib,ITableAttributes.CELL_BORDER);
writeAttributes(m_attrib,BorderAttributesConverter.BORDERS);
!
// write X positions of our cells
int xPos = 0;
for(Iterator it = getChildren().iterator(); it.hasNext(); ) {
final RtfElement e = (RtfElement)it.next();
if(e instanceof RtfTableCell) {
xPos = ((RtfTableCell)e).writeCellDef(xPos);
}
}
!
// now children can write themselves, we have the correct RTF prefix code
super.writeRtfContent();
}
!
/** overridden to write RTF suffix code, what comes after our children */
protected void writeRtfSuffix() throws IOException {
writeControlWord("row");
!
// write extra rows if any
m_extraRowSet.writeRtf();
writeGroupMark(false);
}
!
RtfExtraRowSet getExtraRowSet() {
return m_extraRowSet;
}
!
private void writePaddingAttributes()
throws IOException {
--- 200,313 ----
}
}
!
writeAttributes(m_attrib,ITableAttributes.ROW_BORDER);
writeAttributes(m_attrib,ITableAttributes.CELL_BORDER);
writeAttributes(m_attrib,BorderAttributesConverter.BORDERS);
!
! /**
! * Added by Boris POUDEROUS on 07/02/2002
! * in order to get the indexes of the cells preceding a cell that contains a nested table.
! * Thus, the cells of the extra row will be merged with the cells above.
! */
! boolean nestedTableFound = false;
! int index = 0; // Used to store the index of the cell that contains a nested table
! int numberOfCellsBeforeNestedTable = 0;
!
! java.util.Vector indexesFound = new java.util.Vector();
! for (Iterator it = getChildren().iterator(); it.hasNext(); )
! {
! final RtfElement e = (RtfElement)it.next();
!
! if (e instanceof RtfTableCell)
! {
! if (!nestedTableFound)
! ++numberOfCellsBeforeNestedTable;
!
! for (Iterator it2 = ((RtfTableCell)e).getChildren().iterator(); it2.hasNext(); )
! {
! final RtfElement subElement = (RtfElement)it2.next();
! if (subElement instanceof RtfTable)
! {
! nestedTableFound = true;
! indexesFound.addElement(new Integer(index));
! }
! else if (subElement instanceof RtfParagraph)
! {
! for (Iterator it3 = ((RtfParagraph)subElement).getChildren().iterator(); it3.hasNext(); )
! {
! final RtfElement subSubElement = (RtfElement)it3.next();
! if (subSubElement instanceof RtfTable)
! {
! nestedTableFound = true;
! indexesFound.addElement(new Integer(index));
! }
! }
! }
! }
! }
!
! index++;
! }
! /** - end - */
!
// write X positions of our cells
int xPos = 0;
+ index = 0; // Line added by Boris POUDEROUS on 07/02/2002
for(Iterator it = getChildren().iterator(); it.hasNext(); ) {
final RtfElement e = (RtfElement)it.next();
if(e instanceof RtfTableCell) {
+ /**
+ * Added by Boris POUDEROUS on 2002/07/02
+ */
+ // If one of the row's child cells contains a nested table :
+ if (!indexesFound.isEmpty())
+ {
+ for (int i = 0; i < indexesFound.size(); i++)
+ {
+ // If the current cell index is equals to the index of the cell that
+ // contains a nested table => NO MERGE
+ if (index == ((Integer)indexesFound.get(i)).intValue())
+ break;
+
+ // If the current cell index is lower than the index of the cell that
+ // contains a nested table => START VERTICAL MERGE
+ else if (index < ((Integer)indexesFound.get(i)).intValue())
+ {
+ ((RtfTableCell)e).setVMerge(RtfTableCell.MERGE_START);
+ break;
+ }
+
+ // If the current cell index is greater than the index of the cell that
+ // contains a nested table => START VERTICAL MERGE
+ else if (index > ((Integer)indexesFound.get(i)).intValue())
+ {
+ ((RtfTableCell)e).setVMerge(RtfTableCell.MERGE_START);
+ break;
+ }
+ }
+ }
+ /** - end - */
xPos = ((RtfTableCell)e).writeCellDef(xPos);
}
+ index++; // Added by Boris POUDEROUS on 2002/07/02
}
!
// now children can write themselves, we have the correct RTF prefix code
super.writeRtfContent();
}
!
/** overridden to write RTF suffix code, what comes after our children */
protected void writeRtfSuffix() throws IOException {
writeControlWord("row");
!
// write extra rows if any
m_extraRowSet.writeRtf();
writeGroupMark(false);
}
!
RtfExtraRowSet getExtraRowSet() {
return m_extraRowSet;
}
!
private void writePaddingAttributes()
throws IOException {
***************
*** 225,235 ****
}
}
!
// write all padding attributes
writeAttributes(m_attrib, ATTRIB_ROW_PADDING);
}
!
!
!
public boolean isFirstRow(){
if(id == 1)
--- 331,341 ----
}
}
!
// write all padding attributes
writeAttributes(m_attrib, ATTRIB_ROW_PADDING);
}
!
!
!
public boolean isFirstRow(){
if(id == 1)
***************
*** 238,242 ****
return false;
}
!
public boolean isHighestCell(int id) {
return (highestCell == id) ? true : false;
--- 344,348 ----
return false;
}
!
public boolean isHighestCell(int id) {
return (highestCell == id) ? true : false;
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf