Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jfor.jfor.rtflib.rtfdoc
Class RtfTableCell  view RtfTableCell download RtfTableCell.java

java.lang.Object
  extended byorg.jfor.jfor.rtflib.rtfdoc.RtfElement
      extended byorg.jfor.jfor.rtflib.rtfdoc.RtfContainer
          extended byorg.jfor.jfor.rtflib.rtfdoc.RtfTableCell
All Implemented Interfaces:
IRtfExternalGraphicContainer, IRtfListContainer, IRtfParagraphContainer, IRtfTableContainer

public class RtfTableCell
extends RtfContainer
implements IRtfParagraphContainer, IRtfListContainer, IRtfTableContainer, IRtfExternalGraphicContainer

A cell in an RTF table, container for paragraphs, lists, etc.


Field Summary
static int DEFAULT_CELL_WIDTH
           
private  int id
           
private  int m_cellWidth
          cell width in twips
private  RtfExternalGraphic m_externalGraphic
           
private  int m_hMerge
           
private  RtfList m_list
           
private  RtfParagraph m_paragraph
           
private  RtfTableRow m_parentRow
           
private  RtfTable m_table
           
private  int m_vMerge
          cell merging has three states
private  int m_widthOffset
           
static int MERGE_START
          cell merging: this cell is the start of a range of merged cells
static int MERGE_WITH_PREVIOUS
          cell merging: this cell is part of (but not the start of) a range of merged cells
static int NO_MERGE
          cell merging: this cell is not merged
private  boolean set_center
           
private  boolean set_right
           
 
Fields inherited from class org.jfor.jfor.rtflib.rtfdoc.RtfContainer
 
Fields inherited from class org.jfor.jfor.rtflib.rtfdoc.RtfElement
m_attrib, m_parent, m_writer
 
Constructor Summary
(package private) RtfTableCell(RtfTableRow parent, java.io.Writer w, int cellWidth, int idNum)
          Create an RTF element as a child of given container
(package private) RtfTableCell(RtfTableRow parent, java.io.Writer w, int cellWidth, RtfAttributes attrs, int idNum)
          Create an RTF element as a child of given container
 
Method Summary
private  void closeAll()
           
private  void closeCurrentExternalGraphic()
           
private  void closeCurrentList()
           
private  void closeCurrentParagraph()
           
private  void closeCurrentTable()
           
(package private)  int getCellWidth()
          get cell width
 int getHMerge()
          get horizontal cell merging status
 int getVMerge()
          get vertical cell merging status
 boolean isEmpty()
          A table cell always contains "useful" content, as it is here to take some space in a row.
 RtfExternalGraphic newImage()
          start a new external graphic after closing current paragraph, list and table
 RtfList newList(RtfAttributes attrib)
          start a new list after closing current paragraph, list and table
 RtfParagraph newParagraph()
          start a new paragraph with default attributes after closing current paragraph, list and table
 RtfParagraph newParagraph(RtfAttributes attrs)
          start a new paragraph after closing current current paragraph, list and table
 RtfTable newTable(org.jfor.jfor.interfaces.ITableColumnsInfo tc)
          start a new nested table after closing current paragraph, list and table
 RtfTable newTable(RtfAttributes attrs, org.jfor.jfor.interfaces.ITableColumnsInfo tc)
          start a new nested table after closing current paragraph, list and table
(package private)  boolean paragraphNeedsPar(RtfParagraph p)
          true if the "par" control word must be written for given RtfParagraph (which is not the case for the last non-empty paragraph of the cell)
 void setHMerge(int mergeStatus)
          set horizontal cell merging status
 void setVMerge(int mergeStatus)
          set vertical cell merging status
(package private)  int writeCellDef(int widthOffset)
          used by RtfTableRow to write the cell definition control words
protected  void writeRtfContent()
          overridden so that nested tables cause extra rows to be added after the row that contains this cell disabled for V0.3 - nested table support is not done yet
protected  void writeRtfSuffix()
          the "cell" control word marks the end of a cell
 
Methods inherited from class org.jfor.jfor.rtflib.rtfdoc.RtfContainer
addChild, containsText, dump, getChildCount, getChildren, getOptions, okToWriteRtf, setChildren, setOptions, toString
 
Methods inherited from class org.jfor.jfor.rtflib.rtfdoc.RtfElement
close, getParentOfClass, getRtfAttributes, getRtfFile, isClosed, writeAttributes, writeControlWord, writeControlWordNS, writeExceptionInRtf, writeGroupMark, writeOneAttribute, writeOneAttributeNS, writeRtf, writeRtfPrefix, writeStarControlWord, writeStarControlWordNS
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_paragraph

private RtfParagraph m_paragraph

m_list

private RtfList m_list

m_table

private RtfTable m_table

m_externalGraphic

private RtfExternalGraphic m_externalGraphic

m_parentRow

private final RtfTableRow m_parentRow

set_center

private boolean set_center

set_right

private boolean set_right

id

private int id

DEFAULT_CELL_WIDTH

public static final int DEFAULT_CELL_WIDTH
See Also:
Constant Field Values

m_cellWidth

private int m_cellWidth
cell width in twips


m_widthOffset

private int m_widthOffset

m_vMerge

private int m_vMerge
cell merging has three states


m_hMerge

private int m_hMerge

NO_MERGE

public static final int NO_MERGE
cell merging: this cell is not merged

See Also:
Constant Field Values

MERGE_START

public static final int MERGE_START
cell merging: this cell is the start of a range of merged cells

See Also:
Constant Field Values

MERGE_WITH_PREVIOUS

public static final int MERGE_WITH_PREVIOUS
cell merging: this cell is part of (but not the start of) a range of merged cells

See Also:
Constant Field Values
Constructor Detail

RtfTableCell

RtfTableCell(RtfTableRow parent,
             java.io.Writer w,
             int cellWidth,
             int idNum)
       throws java.io.IOException
Create an RTF element as a child of given container


RtfTableCell

RtfTableCell(RtfTableRow parent,
             java.io.Writer w,
             int cellWidth,
             RtfAttributes attrs,
             int idNum)
       throws java.io.IOException
Create an RTF element as a child of given container

Method Detail

newParagraph

public RtfParagraph newParagraph(RtfAttributes attrs)
                          throws java.io.IOException
start a new paragraph after closing current current paragraph, list and table

Specified by:
newParagraph in interface IRtfParagraphContainer

newImage

public RtfExternalGraphic newImage()
                            throws java.io.IOException
start a new external graphic after closing current paragraph, list and table

Specified by:
newImage in interface IRtfExternalGraphicContainer

newParagraph

public RtfParagraph newParagraph()
                          throws java.io.IOException
start a new paragraph with default attributes after closing current paragraph, list and table

Specified by:
newParagraph in interface IRtfParagraphContainer

newList

public RtfList newList(RtfAttributes attrib)
                throws java.io.IOException
start a new list after closing current paragraph, list and table

Specified by:
newList in interface IRtfListContainer

newTable

public RtfTable newTable(org.jfor.jfor.interfaces.ITableColumnsInfo tc)
                  throws java.io.IOException
start a new nested table after closing current paragraph, list and table

Specified by:
newTable in interface IRtfTableContainer

newTable

public RtfTable newTable(RtfAttributes attrs,
                         org.jfor.jfor.interfaces.ITableColumnsInfo tc)
                  throws java.io.IOException
start a new nested table after closing current paragraph, list and table

Specified by:
newTable in interface IRtfTableContainer

writeCellDef

int writeCellDef(int widthOffset)
           throws java.io.IOException
used by RtfTableRow to write the cell definition control words


writeRtfSuffix

protected void writeRtfSuffix()
                       throws java.io.IOException
the "cell" control word marks the end of a cell

Overrides:
writeRtfSuffix in class RtfElement

closeCurrentParagraph

private void closeCurrentParagraph()
                            throws java.io.IOException

closeCurrentList

private void closeCurrentList()
                       throws java.io.IOException

closeCurrentTable

private void closeCurrentTable()
                        throws java.io.IOException

closeCurrentExternalGraphic

private void closeCurrentExternalGraphic()
                                  throws java.io.IOException

closeAll

private void closeAll()
               throws java.io.IOException

setVMerge

public void setVMerge(int mergeStatus)
set vertical cell merging status


getVMerge

public int getVMerge()
get vertical cell merging status


setHMerge

public void setHMerge(int mergeStatus)
set horizontal cell merging status


getHMerge

public int getHMerge()
get horizontal cell merging status


getCellWidth

int getCellWidth()
get cell width


writeRtfContent

protected void writeRtfContent()
                        throws java.io.IOException
overridden so that nested tables cause extra rows to be added after the row that contains this cell disabled for V0.3 - nested table support is not done yet

Overrides:
writeRtfContent in class RtfContainer

isEmpty

public boolean isEmpty()
A table cell always contains "useful" content, as it is here to take some space in a row. Use containsText() to find out if there is really some useful content in the cell. TODO: containsText could use the original isEmpty implementation?

Overrides:
isEmpty in class RtfContainer

paragraphNeedsPar

boolean paragraphNeedsPar(RtfParagraph p)
true if the "par" control word must be written for given RtfParagraph (which is not the case for the last non-empty paragraph of the cell)