You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by sa...@apache.org on 2004/04/06 06:44:03 UTC
cvs commit: jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel CharacterProperties.java Range.java TableCell.java TableRow.java
sackley 2004/04/05 21:44:03
Modified: src/scratchpad/src/org/apache/poi/hwpf/usermodel
CharacterProperties.java Range.java TableCell.java
TableRow.java
Log:
latest patches and changes
Revision Changes Path
1.8 +1 -1 jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java
Index: CharacterProperties.java
===================================================================
RCS file: /home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- CharacterProperties.java 23 Mar 2004 05:51:54 -0000 1.7
+++ CharacterProperties.java 6 Apr 2004 04:44:03 -0000 1.8
@@ -268,7 +268,7 @@
return isFDStrike();
}
- public void setDoubleStrikethrough(boolean dstrike)
+ public void setDoubleStrikeThrough(boolean dstrike)
{
super.setFDStrike(dstrike);
}
1.7 +3 -3 jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java
Index: Range.java
===================================================================
RCS file: /home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Range.java 23 Mar 2004 05:51:54 -0000 1.6
+++ Range.java 6 Apr 2004 04:44:03 -0000 1.7
@@ -662,15 +662,15 @@
r.initAll();
int tableEnd = r._parEnd;
- if (r._parStart != 0 && ((Paragraph)r._paragraphs.get(r._parStart - 1)).isInTable())
+ if (r._parStart != 0 && getParagraph(r._parStart - 1).isInTable())
{
throw new IllegalArgumentException("This paragraph is not the first one in the table");
}
- int limit = r._paragraphs.size();
+ int limit = _paragraphs.size();
for (; tableEnd < limit; tableEnd++)
{
- if (!((Paragraph)r._paragraphs.get(tableEnd)).isInTable())
+ if (!getParagraph(tableEnd).isInTable())
{
break;
}
1.3 +77 -3 jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableCell.java
Index: TableCell.java
===================================================================
RCS file: /home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableCell.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TableCell.java 5 Mar 2004 13:07:55 -0000 1.2
+++ TableCell.java 6 Apr 2004 04:44:03 -0000 1.3
@@ -1,16 +1,90 @@
package org.apache.poi.hwpf.usermodel;
-
public class TableCell
extends Range
{
- int _levelNum;
+ private int _levelNum;
+ private TableCellDescriptor _tcd;
+ private int _leftEdge;
+ private int _width;
- public TableCell(int startIdx, int endIdx, TableRow parent, int levelNum, TableCellDescriptor tcd)
+ public TableCell(int startIdx, int endIdx, TableRow parent, int levelNum, TableCellDescriptor tcd, int leftEdge, int width)
{
super(startIdx, endIdx, Range.TYPE_PARAGRAPH, parent);
+ _tcd = tcd;
+ _leftEdge = leftEdge;
+ _width = width;
_levelNum = levelNum;
}
+ public boolean isFirstMerged()
+ {
+ return _tcd.isFFirstMerged();
+ }
+
+ public boolean isMerged()
+ {
+ return _tcd.isFMerged();
+ }
+
+ public boolean isVertical()
+ {
+ return _tcd.isFVertical();
+ }
+
+ public boolean isBackward()
+ {
+ return _tcd.isFBackward();
+ }
+
+ public boolean isRotateFont()
+ {
+ return _tcd.isFRotateFont();
+ }
+
+ public boolean isVerticallyMerged()
+ {
+ return _tcd.isFVertMerge();
+ }
+
+ public boolean isFirstVerticallyMerged()
+ {
+ return _tcd.isFVertRestart();
+ }
+
+ public byte getVertAlign()
+ {
+ return _tcd.getVertAlign();
+ }
+
+ public BorderCode getBrcTop()
+ {
+ return _tcd.getBrcTop();
+ }
+
+ public BorderCode getBrcBottom()
+ {
+ return _tcd.getBrcBottom();
+ }
+
+ public BorderCode getBrcLeft()
+ {
+ return _tcd.getBrcLeft();
+ }
+
+ public BorderCode getBrcRight()
+ {
+ return _tcd.getBrcRight();
+ }
+
+ public int getLeftEdge() // twips
+ {
+ return _leftEdge;
+ }
+
+ public int getWidth() // twips
+ {
+ return _width;
+ }
}
1.3 +26 -9 jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableRow.java
Index: TableRow.java
===================================================================
RCS file: /home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableRow.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TableRow.java 10 Mar 2004 04:18:56 -0000 1.2
+++ TableRow.java 6 Apr 2004 04:44:03 -0000 1.3
@@ -1,6 +1,5 @@
package org.apache.poi.hwpf.usermodel;
-
import org.apache.poi.hwpf.sprm.TableSprmUncompressor;
import org.apache.poi.hwpf.sprm.SprmBuffer;
@@ -16,8 +15,8 @@
private final static short SPRM_DYAROWHEIGHT = (short)0x9407;
int _levelNum;
- TableProperties _tprops;
- TableCell[] _cells;
+ private TableProperties _tprops;
+ private TableCell[] _cells;
public TableRow(int startIdx, int endIdx, Table parent, int levelNum)
{
@@ -28,17 +27,26 @@
_cells = new TableCell[_tprops.getItcMac()];
int start = 0;
- int cellIndex = 0;
- for (int x = 0; x < numParagraphs(); x++)
+ int end = 0;
+
+ for (int cellIndex = 0; cellIndex < _cells.length; cellIndex++)
{
- Paragraph p = getParagraph(x);
+ Paragraph p = getParagraph(start);
String s = p.text();
- if ((levelNum == 1 && s.charAt(s.length()-1) == TABLE_CELL_MARK) ||
- p.isEmbeddedCellMark() && p.getTableLevel() == levelNum)
+ while (! ( (levelNum == 1 && s.charAt(s.length() - 1) == TABLE_CELL_MARK) ||
+ p.isEmbeddedCellMark() && p.getTableLevel() == levelNum))
{
- _cells[cellIndex] = new TableCell(start, x+1, this, levelNum, _tprops.getRgtc()[cellIndex]);
+ end++;
+ p = getParagraph(end);
+ s = p.text();
}
+ _cells[cellIndex] = new TableCell(start, end, this, levelNum,
+ _tprops.getRgtc()[cellIndex],
+ _tprops.getRgdxaCenter()[cellIndex],
+ _tprops.getRgdxaCenter()[cellIndex+1]-_tprops.getRgdxaCenter()[cellIndex]);
+ end++;
+ start = end;
}
}
@@ -97,4 +105,13 @@
_papx.updateSprm(SPRM_FTABLEHEADER, (byte)(tableHeader ? 1 : 0));
}
+ public int numCells()
+ {
+ return _cells.length;
+ }
+
+ public TableCell getCell(int index)
+ {
+ return _cells[index];
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-dev-help@jakarta.apache.org