From 65cfe469b07e7078840d000b54519e3c84e0f2ee Mon Sep 17 00:00:00 2001 From: Yegor Kozlov Date: Mon, 6 Jun 2011 12:43:17 +0000 Subject: [PATCH] Bug 51305: Add sprmTCellPaddingDefault support; Update Table Cell Descriptor, make it non-from-file; git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1132616 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/status.xml | 1 + src/documentation/release-guide.txt | 20 +- .../poi/hwpf/model/types/TCAbstractType.java | 555 ++++++++++++++---- .../poi/hwpf/sprm/TableSprmUncompressor.java | 36 +- .../hwpf/usermodel/TableCellDescriptor.java | 39 +- src/types/definitions/tc_type.xml | 20 +- 6 files changed, 546 insertions(+), 125 deletions(-) diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 090b2109f..af03d5562 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 51305 - Add sprmTCellPaddingDefault support in HWPF 51265 - Enhanced Handling of Picture Parts in XWPF 51292 - Additional HWPF Table Cell Descriptor values diff --git a/src/documentation/release-guide.txt b/src/documentation/release-guide.txt index 7dc13fc20..be1103fd7 100644 --- a/src/documentation/release-guide.txt +++ b/src/documentation/release-guide.txt @@ -102,24 +102,20 @@ cd build/dist 8. Upload to the dev svn dist repo, https://dist.apache.org/repos/dist/dev/poi/ eg - https://dist.apache.org/repos/dist/dev/poi/3.8-RC2/ + https://dist.apache.org/repos/dist/dev/poi/3.8-RC3/ How to upload: -8a svn co https://dist.apache.org/repos/dist/dev/poi -8b add .gz and .zip packages along with checksums. +svn co https://dist.apache.org/repos/dist/dev/poi +mkdir 3.8-RC3/ +svn add 3.8-RC3 -you should have a similar structure of files: -$ ls -README.html poi-bin-3.8-beta3-20110606.zip poi-src-3.8-beta3-20110606.tar.gz.md5 -maven poi-bin-3.8-beta3-20110606.zip.asc poi-src-3.8-beta3-20110606.tar.gz.sha1 -poi-bin-3.8-beta3-20110606.tar.gz poi-bin-3.8-beta3-20110606.zip.md5 poi-src-3.8-beta3-20110606.zip -poi-bin-3.8-beta3-20110606.tar.gz.asc poi-bin-3.8-beta3-20110606.zip.sha1 poi-src-3.8-beta3-20110606.zip.asc -poi-bin-3.8-beta3-20110606.tar.gz.md5 poi-src-3.8-beta3-20110606.tar.gz poi-src-3.8-beta3-20110606.zip.md5 -poi-bin-3.8-beta3-20110606.tar.gz.sha1 poi-src-3.8-beta3-20110606.tar.gz.asc poi-src-3.8-beta3-20110606.zip.sha1 +then add .gz and .zip packages along with checksums. + + binaries should be in ./bin, sources in ./src sub-directories 8c. commit -After commit the files should be acessible at https://dist.apache.org/repos/dist/dev/poi/ +After commit the files should be acessible at https://dist.apache.org/repos/dist/dev/poi/3.8-RC2/ (III) After the vote: diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/types/TCAbstractType.java b/src/scratchpad/src/org/apache/poi/hwpf/model/types/TCAbstractType.java index a0cd02c89..13ebdd9bc 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/types/TCAbstractType.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/types/TCAbstractType.java @@ -18,11 +18,10 @@ package org.apache.poi.hwpf.model.types; + import org.apache.poi.hdf.model.hdftypes.HDFType; import org.apache.poi.hwpf.usermodel.BorderCode; import org.apache.poi.util.BitField; -import org.apache.poi.util.BitFieldFactory; -import org.apache.poi.util.LittleEndian; /** * Table Cell Descriptor. @@ -31,25 +30,44 @@ import org.apache.poi.util.LittleEndian; * @author S. Ryan Ackley */ -public abstract class TCAbstractType implements HDFType { +public abstract class TCAbstractType + implements HDFType +{ + protected short field_1_rgf; - private static BitField fFirstMerged = BitFieldFactory.getInstance(0x0001); - private static BitField fMerged = BitFieldFactory.getInstance(0x0002); - private static BitField fVertical = BitFieldFactory.getInstance(0x0004); - private static BitField fBackward = BitFieldFactory.getInstance(0x0008); - private static BitField fRotateFont = BitFieldFactory.getInstance(0x0010); - private static BitField fVertMerge = BitFieldFactory.getInstance(0x0020); - private static BitField fVertRestart = BitFieldFactory.getInstance(0x0040); - private static BitField vertAlign = BitFieldFactory.getInstance(0x0180); - private static BitField ftsWidth = new BitField(0x0E00); - private static BitField fFitText = new BitField(0x1000); - private static BitField fNoWrap = new BitField(0x2000); - private static BitField fUnused = new BitField(0xC000); - protected short field_2_unused; - protected BorderCode field_3_brcTop; - protected BorderCode field_4_brcLeft; - protected BorderCode field_5_brcBottom; - protected BorderCode field_6_brcRight; + private static BitField fFirstMerged = new BitField(0x0001); + private static BitField fMerged = new BitField(0x0002); + private static BitField fVertical = new BitField(0x0004); + private static BitField fBackward = new BitField(0x0008); + private static BitField fRotateFont = new BitField(0x0010); + private static BitField fVertMerge = new BitField(0x0020); + private static BitField fVertRestart = new BitField(0x0040); + private static BitField vertAlign = new BitField(0x0180); + private static BitField ftsWidth = new BitField(0x0E00); + private static BitField fFitText = new BitField(0x1000); + private static BitField fNoWrap = new BitField(0x2000); + private static BitField fUnused = new BitField(0xC000); + protected short field_2_wWidth; + protected short field_3_wCellPaddingLeft; + protected short field_4_wCellPaddingTop; + protected short field_5_wCellPaddingBottom; + protected short field_6_wCellPaddingRight; + protected byte field_7_ftsCellPaddingLeft; + protected byte field_8_ftsCellPaddingTop; + protected byte field_9_ftsCellPaddingBottom; + protected byte field_10_ftsCellPaddingRight; + protected short field_11_wCellSpacingLeft; + protected short field_12_wCellSpacingTop; + protected short field_13_wCellSpacingBottom; + protected short field_14_wCellSpacingRight; + protected byte field_15_ftsCellSpacingLeft; + protected byte field_16_ftsCellSpacingTop; + protected byte field_17_ftsCellSpacingBottom; + protected byte field_18_ftsCellSpacingRight; + protected BorderCode field_19_brcTop; + protected BorderCode field_20_brcLeft; + protected BorderCode field_21_brcBottom; + protected BorderCode field_22_brcRight; public TCAbstractType() @@ -57,26 +75,6 @@ public abstract class TCAbstractType implements HDFType { } - protected void fillFields(byte [] data, int offset) - { - field_1_rgf = LittleEndian.getShort(data, 0x0 + offset); - field_2_unused = LittleEndian.getShort(data, 0x2 + offset); - field_3_brcTop = new BorderCode(data, 0x4 + offset); - field_4_brcLeft = new BorderCode(data, 0x8 + offset); - field_5_brcBottom = new BorderCode(data, 0xc + offset); - field_6_brcRight = new BorderCode(data, 0x10 + offset); - - } - - public void serialize(byte[] data, int offset) - { - LittleEndian.putShort(data, 0x0 + offset, field_1_rgf); - LittleEndian.putShort(data, 0x2 + offset, field_2_unused); - field_3_brcTop.serialize(data, 0x4 + offset); - field_4_brcLeft.serialize(data, 0x8 + offset); - field_5_brcBottom.serialize(data, 0xc + offset); - field_6_brcRight.serialize(data, 0x10 + offset); - } public String toString() { @@ -99,8 +97,56 @@ public abstract class TCAbstractType implements HDFType { buffer.append(" .fNoWrap = ").append(isFNoWrap()).append('\n'); buffer.append(" .fUnused = ").append(getFUnused()).append('\n'); - buffer.append(" .unused = "); - buffer.append(" (").append(getUnused()).append(" )\n"); + buffer.append(" .wWidth = "); + buffer.append(" (").append(getWWidth()).append(" )\n"); + + buffer.append(" .wCellPaddingLeft = "); + buffer.append(" (").append(getWCellPaddingLeft()).append(" )\n"); + + buffer.append(" .wCellPaddingTop = "); + buffer.append(" (").append(getWCellPaddingTop()).append(" )\n"); + + buffer.append(" .wCellPaddingBottom = "); + buffer.append(" (").append(getWCellPaddingBottom()).append(" )\n"); + + buffer.append(" .wCellPaddingRight = "); + buffer.append(" (").append(getWCellPaddingRight()).append(" )\n"); + + buffer.append(" .ftsCellPaddingLeft = "); + buffer.append(" (").append(getFtsCellPaddingLeft()).append(" )\n"); + + buffer.append(" .ftsCellPaddingTop = "); + buffer.append(" (").append(getFtsCellPaddingTop()).append(" )\n"); + + buffer.append(" .ftsCellPaddingBottom = "); + buffer.append(" (").append(getFtsCellPaddingBottom()).append(" )\n"); + + buffer.append(" .ftsCellPaddingRight = "); + buffer.append(" (").append(getFtsCellPaddingRight()).append(" )\n"); + + buffer.append(" .wCellSpacingLeft = "); + buffer.append(" (").append(getWCellSpacingLeft()).append(" )\n"); + + buffer.append(" .wCellSpacingTop = "); + buffer.append(" (").append(getWCellSpacingTop()).append(" )\n"); + + buffer.append(" .wCellSpacingBottom = "); + buffer.append(" (").append(getWCellSpacingBottom()).append(" )\n"); + + buffer.append(" .wCellSpacingRight = "); + buffer.append(" (").append(getWCellSpacingRight()).append(" )\n"); + + buffer.append(" .ftsCellSpacingLeft = "); + buffer.append(" (").append(getFtsCellSpacingLeft()).append(" )\n"); + + buffer.append(" .ftsCellSpacingTop = "); + buffer.append(" (").append(getFtsCellSpacingTop()).append(" )\n"); + + buffer.append(" .ftsCellSpacingBottom = "); + buffer.append(" (").append(getFtsCellSpacingBottom()).append(" )\n"); + + buffer.append(" .ftsCellSpacingRight = "); + buffer.append(" (").append(getFtsCellSpacingRight()).append(" )\n"); buffer.append(" .brcTop = "); buffer.append(" (").append(getBrcTop()).append(" )\n"); @@ -123,7 +169,7 @@ public abstract class TCAbstractType implements HDFType { */ public int getSize() { - return 4 + + 2 + 2 + 4 + 4 + 4 + 4; + return 4 + + 2 + 2 + 2 + 2 + 2 + 2 + 1 + 1 + 1 + 1 + 2 + 2 + 2 + 2 + 1 + 1 + 1 + 1 + 4 + 4 + 4 + 4; } @@ -145,19 +191,275 @@ public abstract class TCAbstractType implements HDFType { } /** - * Get the unused field for the TC record. + * Get the wWidth field for the TC record. */ - public short getUnused() + public short getWWidth() { - return field_2_unused; + return field_2_wWidth; } /** - * Set the unused field for the TC record. + * Set the wWidth field for the TC record. */ - public void setUnused(short field_2_unused) + public void setWWidth(short field_2_wWidth) { - this.field_2_unused = field_2_unused; + this.field_2_wWidth = field_2_wWidth; + } + + /** + * Get the wCellPaddingLeft field for the TC record. + */ + public short getWCellPaddingLeft() + { + return field_3_wCellPaddingLeft; + } + + /** + * Set the wCellPaddingLeft field for the TC record. + */ + public void setWCellPaddingLeft(short field_3_wCellPaddingLeft) + { + this.field_3_wCellPaddingLeft = field_3_wCellPaddingLeft; + } + + /** + * Get the wCellPaddingTop field for the TC record. + */ + public short getWCellPaddingTop() + { + return field_4_wCellPaddingTop; + } + + /** + * Set the wCellPaddingTop field for the TC record. + */ + public void setWCellPaddingTop(short field_4_wCellPaddingTop) + { + this.field_4_wCellPaddingTop = field_4_wCellPaddingTop; + } + + /** + * Get the wCellPaddingBottom field for the TC record. + */ + public short getWCellPaddingBottom() + { + return field_5_wCellPaddingBottom; + } + + /** + * Set the wCellPaddingBottom field for the TC record. + */ + public void setWCellPaddingBottom(short field_5_wCellPaddingBottom) + { + this.field_5_wCellPaddingBottom = field_5_wCellPaddingBottom; + } + + /** + * Get the wCellPaddingRight field for the TC record. + */ + public short getWCellPaddingRight() + { + return field_6_wCellPaddingRight; + } + + /** + * Set the wCellPaddingRight field for the TC record. + */ + public void setWCellPaddingRight(short field_6_wCellPaddingRight) + { + this.field_6_wCellPaddingRight = field_6_wCellPaddingRight; + } + + /** + * Get the ftsCellPaddingLeft field for the TC record. + */ + public byte getFtsCellPaddingLeft() + { + return field_7_ftsCellPaddingLeft; + } + + /** + * Set the ftsCellPaddingLeft field for the TC record. + */ + public void setFtsCellPaddingLeft(byte field_7_ftsCellPaddingLeft) + { + this.field_7_ftsCellPaddingLeft = field_7_ftsCellPaddingLeft; + } + + /** + * Get the ftsCellPaddingTop field for the TC record. + */ + public byte getFtsCellPaddingTop() + { + return field_8_ftsCellPaddingTop; + } + + /** + * Set the ftsCellPaddingTop field for the TC record. + */ + public void setFtsCellPaddingTop(byte field_8_ftsCellPaddingTop) + { + this.field_8_ftsCellPaddingTop = field_8_ftsCellPaddingTop; + } + + /** + * Get the ftsCellPaddingBottom field for the TC record. + */ + public byte getFtsCellPaddingBottom() + { + return field_9_ftsCellPaddingBottom; + } + + /** + * Set the ftsCellPaddingBottom field for the TC record. + */ + public void setFtsCellPaddingBottom(byte field_9_ftsCellPaddingBottom) + { + this.field_9_ftsCellPaddingBottom = field_9_ftsCellPaddingBottom; + } + + /** + * Get the ftsCellPaddingRight field for the TC record. + */ + public byte getFtsCellPaddingRight() + { + return field_10_ftsCellPaddingRight; + } + + /** + * Set the ftsCellPaddingRight field for the TC record. + */ + public void setFtsCellPaddingRight(byte field_10_ftsCellPaddingRight) + { + this.field_10_ftsCellPaddingRight = field_10_ftsCellPaddingRight; + } + + /** + * Get the wCellSpacingLeft field for the TC record. + */ + public short getWCellSpacingLeft() + { + return field_11_wCellSpacingLeft; + } + + /** + * Set the wCellSpacingLeft field for the TC record. + */ + public void setWCellSpacingLeft(short field_11_wCellSpacingLeft) + { + this.field_11_wCellSpacingLeft = field_11_wCellSpacingLeft; + } + + /** + * Get the wCellSpacingTop field for the TC record. + */ + public short getWCellSpacingTop() + { + return field_12_wCellSpacingTop; + } + + /** + * Set the wCellSpacingTop field for the TC record. + */ + public void setWCellSpacingTop(short field_12_wCellSpacingTop) + { + this.field_12_wCellSpacingTop = field_12_wCellSpacingTop; + } + + /** + * Get the wCellSpacingBottom field for the TC record. + */ + public short getWCellSpacingBottom() + { + return field_13_wCellSpacingBottom; + } + + /** + * Set the wCellSpacingBottom field for the TC record. + */ + public void setWCellSpacingBottom(short field_13_wCellSpacingBottom) + { + this.field_13_wCellSpacingBottom = field_13_wCellSpacingBottom; + } + + /** + * Get the wCellSpacingRight field for the TC record. + */ + public short getWCellSpacingRight() + { + return field_14_wCellSpacingRight; + } + + /** + * Set the wCellSpacingRight field for the TC record. + */ + public void setWCellSpacingRight(short field_14_wCellSpacingRight) + { + this.field_14_wCellSpacingRight = field_14_wCellSpacingRight; + } + + /** + * Get the ftsCellSpacingLeft field for the TC record. + */ + public byte getFtsCellSpacingLeft() + { + return field_15_ftsCellSpacingLeft; + } + + /** + * Set the ftsCellSpacingLeft field for the TC record. + */ + public void setFtsCellSpacingLeft(byte field_15_ftsCellSpacingLeft) + { + this.field_15_ftsCellSpacingLeft = field_15_ftsCellSpacingLeft; + } + + /** + * Get the ftsCellSpacingTop field for the TC record. + */ + public byte getFtsCellSpacingTop() + { + return field_16_ftsCellSpacingTop; + } + + /** + * Set the ftsCellSpacingTop field for the TC record. + */ + public void setFtsCellSpacingTop(byte field_16_ftsCellSpacingTop) + { + this.field_16_ftsCellSpacingTop = field_16_ftsCellSpacingTop; + } + + /** + * Get the ftsCellSpacingBottom field for the TC record. + */ + public byte getFtsCellSpacingBottom() + { + return field_17_ftsCellSpacingBottom; + } + + /** + * Set the ftsCellSpacingBottom field for the TC record. + */ + public void setFtsCellSpacingBottom(byte field_17_ftsCellSpacingBottom) + { + this.field_17_ftsCellSpacingBottom = field_17_ftsCellSpacingBottom; + } + + /** + * Get the ftsCellSpacingRight field for the TC record. + */ + public byte getFtsCellSpacingRight() + { + return field_18_ftsCellSpacingRight; + } + + /** + * Set the ftsCellSpacingRight field for the TC record. + */ + public void setFtsCellSpacingRight(byte field_18_ftsCellSpacingRight) + { + this.field_18_ftsCellSpacingRight = field_18_ftsCellSpacingRight; } /** @@ -165,15 +467,15 @@ public abstract class TCAbstractType implements HDFType { */ public BorderCode getBrcTop() { - return field_3_brcTop; + return field_19_brcTop; } /** * Set the brcTop field for the TC record. */ - public void setBrcTop(BorderCode field_3_brcTop) + public void setBrcTop(BorderCode field_19_brcTop) { - this.field_3_brcTop = field_3_brcTop; + this.field_19_brcTop = field_19_brcTop; } /** @@ -181,15 +483,15 @@ public abstract class TCAbstractType implements HDFType { */ public BorderCode getBrcLeft() { - return field_4_brcLeft; + return field_20_brcLeft; } /** * Set the brcLeft field for the TC record. */ - public void setBrcLeft(BorderCode field_4_brcLeft) + public void setBrcLeft(BorderCode field_20_brcLeft) { - this.field_4_brcLeft = field_4_brcLeft; + this.field_20_brcLeft = field_20_brcLeft; } /** @@ -197,15 +499,15 @@ public abstract class TCAbstractType implements HDFType { */ public BorderCode getBrcBottom() { - return field_5_brcBottom; + return field_21_brcBottom; } /** * Set the brcBottom field for the TC record. */ - public void setBrcBottom(BorderCode field_5_brcBottom) + public void setBrcBottom(BorderCode field_21_brcBottom) { - this.field_5_brcBottom = field_5_brcBottom; + this.field_21_brcBottom = field_21_brcBottom; } /** @@ -213,219 +515,272 @@ public abstract class TCAbstractType implements HDFType { */ public BorderCode getBrcRight() { - return field_6_brcRight; + return field_22_brcRight; } /** * Set the brcRight field for the TC record. */ - public void setBrcRight(BorderCode field_6_brcRight) + public void setBrcRight(BorderCode field_22_brcRight) { - this.field_6_brcRight = field_6_brcRight; + this.field_22_brcRight = field_22_brcRight; } /** * Sets the fFirstMerged field value. - * + * */ public void setFFirstMerged(boolean value) { field_1_rgf = (short)fFirstMerged.setBoolean(field_1_rgf, value); + + } /** - * + * * @return the fFirstMerged field value. */ public boolean isFFirstMerged() { return fFirstMerged.isSet(field_1_rgf); + } /** * Sets the fMerged field value. - * + * */ public void setFMerged(boolean value) { field_1_rgf = (short)fMerged.setBoolean(field_1_rgf, value); + + } /** - * + * * @return the fMerged field value. */ public boolean isFMerged() { return fMerged.isSet(field_1_rgf); + } /** * Sets the fVertical field value. - * + * */ public void setFVertical(boolean value) { field_1_rgf = (short)fVertical.setBoolean(field_1_rgf, value); + + } /** - * + * * @return the fVertical field value. */ public boolean isFVertical() { return fVertical.isSet(field_1_rgf); + } /** * Sets the fBackward field value. - * + * */ public void setFBackward(boolean value) { field_1_rgf = (short)fBackward.setBoolean(field_1_rgf, value); + + } /** - * + * * @return the fBackward field value. */ public boolean isFBackward() { return fBackward.isSet(field_1_rgf); + } /** * Sets the fRotateFont field value. - * + * */ public void setFRotateFont(boolean value) { field_1_rgf = (short)fRotateFont.setBoolean(field_1_rgf, value); + + } /** - * + * * @return the fRotateFont field value. */ public boolean isFRotateFont() { return fRotateFont.isSet(field_1_rgf); + } /** * Sets the fVertMerge field value. - * + * */ public void setFVertMerge(boolean value) { field_1_rgf = (short)fVertMerge.setBoolean(field_1_rgf, value); + + } /** - * + * * @return the fVertMerge field value. */ public boolean isFVertMerge() { return fVertMerge.isSet(field_1_rgf); + } /** * Sets the fVertRestart field value. - * + * */ public void setFVertRestart(boolean value) { field_1_rgf = (short)fVertRestart.setBoolean(field_1_rgf, value); + + } /** - * + * * @return the fVertRestart field value. */ public boolean isFVertRestart() { return fVertRestart.isSet(field_1_rgf); + } /** * Sets the vertAlign field value. - * + * */ public void setVertAlign(byte value) { field_1_rgf = (short)vertAlign.setValue(field_1_rgf, value); + + } /** - * + * * @return the vertAlign field value. */ public byte getVertAlign() { - return (byte)vertAlign.getValue(field_1_rgf); + return ( byte )vertAlign.getValue(field_1_rgf); + } /** - * Sets the ftsWidth field value + * Sets the ftsWidth field value. + * */ - public void setFtsWidth(byte value) { - field_1_rgf = (short)ftsWidth.setValue(field_1_rgf, value); + public void setFtsWidth(byte value) + { + field_1_rgf = (short)ftsWidth.setValue(field_1_rgf, value); + + } /** - * @return the ftsWidth field value + * + * @return the ftsWidth field value. */ - public byte getFtsWidth() { - return (byte)ftsWidth.getValue(field_1_rgf); + public byte getFtsWidth() + { + return ( byte )ftsWidth.getValue(field_1_rgf); + } - + /** * Sets the fFitText field value. * */ - public void setFFitText(boolean value) { - field_1_rgf = (short)fFitText.setBoolean(field_1_rgf, value); + public void setFFitText(boolean value) + { + field_1_rgf = (short)fFitText.setBoolean(field_1_rgf, value); + + } /** + * * @return the fFitText field value. */ - public boolean isFFitText() { - return fFitText.isSet(field_1_rgf); + public boolean isFFitText() + { + return fFitText.isSet(field_1_rgf); + } - + /** * Sets the fNoWrap field value. * */ - public void setFNoWrap(boolean value) { - field_1_rgf = (short)fNoWrap.setBoolean(field_1_rgf, value); + public void setFNoWrap(boolean value) + { + field_1_rgf = (short)fNoWrap.setBoolean(field_1_rgf, value); + + } /** * * @return the fNoWrap field value. */ - public boolean isFNoWrap() { - return fNoWrap.isSet(field_1_rgf); + public boolean isFNoWrap() + { + return fNoWrap.isSet(field_1_rgf); + } - + /** * Sets the fUnused field value. * */ - public void setFUnused(byte value) { - field_1_rgf = (short)fUnused.setValue(field_1_rgf, value); + public void setFUnused(byte value) + { + field_1_rgf = (short)fUnused.setValue(field_1_rgf, value); + + } /** * * @return the fUnused field value. */ - public byte getFUnused() { - return ( byte )fUnused.getValue(field_1_rgf); + public byte getFUnused() + { + return ( byte )fUnused.getValue(field_1_rgf); + } -} + + +} // END OF CLASS + + + + diff --git a/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmUncompressor.java b/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmUncompressor.java index 85ea44797..8f9455d7b 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmUncompressor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmUncompressor.java @@ -17,10 +17,9 @@ package org.apache.poi.hwpf.sprm; -import org.apache.poi.hwpf.usermodel.TableProperties; -import org.apache.poi.hwpf.usermodel.TableCellDescriptor; import org.apache.poi.hwpf.usermodel.BorderCode; - +import org.apache.poi.hwpf.usermodel.TableCellDescriptor; +import org.apache.poi.hwpf.usermodel.TableProperties; import org.apache.poi.util.LittleEndian; public final class TableSprmUncompressor @@ -252,6 +251,37 @@ public final class TableSprmUncompressor case 0x2b: case 0x2c: break; + case 0x34: + // sprmTCellPaddingDefault -- (0xd634) + // TODO: extract into CSSA structure + byte itcFirst = sprm.getGrpprl()[sprm.getGrpprlOffset()]; + byte itcLim = sprm.getGrpprl()[sprm.getGrpprlOffset() + 1]; + byte grfbrc = sprm.getGrpprl()[sprm.getGrpprlOffset() + 2]; + byte ftsWidth = sprm.getGrpprl()[sprm.getGrpprlOffset() + 3]; + short wWidth = LittleEndian.getShort(sprm.getGrpprl(), + sprm.getGrpprlOffset() + 4); + + for (int c = itcFirst; c < itcLim; c++) { + TableCellDescriptor tableCellDescriptor = newTAP.getRgtc()[c]; + + if ((grfbrc & 0x01) != 0) { + tableCellDescriptor.setFtsCellPaddingTop(ftsWidth); + tableCellDescriptor.setWCellPaddingTop(wWidth); + } + if ((grfbrc & 0x02) != 0) { + tableCellDescriptor.setFtsCellPaddingLeft(ftsWidth); + tableCellDescriptor.setWCellPaddingLeft(wWidth); + } + if ((grfbrc & 0x04) != 0) { + tableCellDescriptor.setFtsCellPaddingBottom(ftsWidth); + tableCellDescriptor.setWCellPaddingBottom(wWidth); + } + if ((grfbrc & 0x08) != 0) { + tableCellDescriptor.setFtsCellPaddingRight(ftsWidth); + tableCellDescriptor.setWCellPaddingRight(wWidth); + } + } + break; default: break; } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableCellDescriptor.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableCellDescriptor.java index 8d196fce7..963ce0c6c 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableCellDescriptor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableCellDescriptor.java @@ -18,29 +18,52 @@ package org.apache.poi.hwpf.usermodel; import org.apache.poi.hwpf.model.types.TCAbstractType; +import org.apache.poi.util.LittleEndian; public final class TableCellDescriptor extends TCAbstractType { public static final int SIZE = 20; + protected short field_x_unused; + public TableCellDescriptor() { - field_3_brcTop = new BorderCode(); - field_4_brcLeft = new BorderCode(); - field_5_brcBottom = new BorderCode(); - field_6_brcRight = new BorderCode(); + setBrcTop(new BorderCode()); + setBrcLeft(new BorderCode()); + setBrcBottom(new BorderCode()); + setBrcRight(new BorderCode()); } + protected void fillFields(byte[] data, int offset) + { + field_1_rgf = LittleEndian.getShort(data, 0x0 + offset); + field_x_unused = LittleEndian.getShort(data, 0x2 + offset); + setBrcTop(new BorderCode(data, 0x4 + offset)); + setBrcLeft(new BorderCode(data, 0x8 + offset)); + setBrcBottom(new BorderCode(data, 0xc + offset)); + setBrcRight(new BorderCode(data, 0x10 + offset)); + } + + public void serialize(byte[] data, int offset) + { + LittleEndian.putShort(data, 0x0 + offset, field_1_rgf); + LittleEndian.putShort(data, 0x2 + offset, field_x_unused); + getBrcTop().serialize(data, 0x4 + offset); + getBrcLeft().serialize(data, 0x8 + offset); + getBrcBottom().serialize(data, 0xc + offset); + getBrcRight().serialize(data, 0x10 + offset); + } + public Object clone() throws CloneNotSupportedException { TableCellDescriptor tc = (TableCellDescriptor)super.clone(); - tc.field_3_brcTop = (BorderCode)field_3_brcTop.clone(); - tc.field_4_brcLeft = (BorderCode)field_4_brcLeft.clone(); - tc.field_5_brcBottom = (BorderCode)field_5_brcBottom.clone(); - tc.field_6_brcRight = (BorderCode)field_6_brcRight.clone(); + tc.setBrcTop((BorderCode)getBrcTop().clone()); + tc.setBrcLeft((BorderCode)getBrcLeft().clone()); + tc.setBrcBottom((BorderCode)getBrcBottom().clone()); + tc.setBrcRight((BorderCode)getBrcRight().clone()); return tc; } diff --git a/src/types/definitions/tc_type.xml b/src/types/definitions/tc_type.xml index 47ee8a7f3..c3d794406 100644 --- a/src/types/definitions/tc_type.xml +++ b/src/types/definitions/tc_type.xml @@ -17,7 +17,7 @@ limitations under the License. ==================================================================== --> - + AbstractType HDFType Table Cell Descriptor. @@ -37,7 +37,23 @@ - + + + + + + + + + + + + + + + + +