From f3b6cc03d44083eeaa994daacdb55d49e3c21013 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Tue, 31 May 2011 14:21:32 +0000 Subject: [PATCH] Patch from Sergey from bug #51292 - Additional HWPF Table Cell descriptor values git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1129690 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/status.xml | 3 + .../poi/hwpf/model/types/TCAbstractType.java | 92 ++++++++++++++++--- src/types/definitions/tc_type.xml | 4 + 3 files changed, 87 insertions(+), 12 deletions(-) diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 4aa14c64b..730555cbb 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -33,6 +33,9 @@ + + 51292 - Additional HWPF Table Cell Descriptor values + 51098 - Correct calculate image width/height, if image fits into one cell 47147 - Correct extra paragraphs from XWPF Table Cells 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 68b4a108c..a0cd02c89 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,11 @@ 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; -import org.apache.poi.hdf.model.hdftypes.HDFType; -import org.apache.poi.hwpf.usermodel.*; /** * Table Cell Descriptor. @@ -32,16 +32,19 @@ import org.apache.poi.hwpf.usermodel.*; * @author S. Ryan Ackley */ 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 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; @@ -91,6 +94,10 @@ public abstract class TCAbstractType implements HDFType { buffer.append(" .fVertMerge = ").append(isFVertMerge()).append('\n'); buffer.append(" .fVertRestart = ").append(isFVertRestart()).append('\n'); buffer.append(" .vertAlign = ").append(getVertAlign()).append('\n'); + buffer.append(" .ftsWidth = ").append(getFtsWidth()).append('\n'); + buffer.append(" .fFitText = ").append(isFFitText()).append('\n'); + buffer.append(" .fNoWrap = ").append(isFNoWrap()).append('\n'); + buffer.append(" .fUnused = ").append(getFUnused()).append('\n'); buffer.append(" .unused = "); buffer.append(" (").append(getUnused()).append(" )\n"); @@ -358,6 +365,67 @@ public abstract class TCAbstractType implements HDFType { */ public byte getVertAlign() { - return ( byte )vertAlign.getValue(field_1_rgf); + return (byte)vertAlign.getValue(field_1_rgf); + } + + /** + * Sets the ftsWidth field value + */ + public void setFtsWidth(byte value) { + field_1_rgf = (short)ftsWidth.setValue(field_1_rgf, value); + } + + /** + * @return the ftsWidth field value + */ + 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); + } + + /** + * @return the fFitText field value. + */ + 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); + } + + /** + * + * @return the fNoWrap field value. + */ + 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); + } + + /** + * + * @return the fUnused field value. + */ + public byte getFUnused() { + return ( byte )fUnused.getValue(field_1_rgf); } } diff --git a/src/types/definitions/tc_type.xml b/src/types/definitions/tc_type.xml index 6a7707320..47ee8a7f3 100644 --- a/src/types/definitions/tc_type.xml +++ b/src/types/definitions/tc_type.xml @@ -32,6 +32,10 @@ + + + +