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
This commit is contained in:
Nick Burch 2011-05-31 14:21:32 +00:00
parent ad58cfe61e
commit f3b6cc03d4
3 changed files with 87 additions and 12 deletions

View File

@ -33,6 +33,9 @@
</developers>
<changes>
<release version="3.8-beta4" date="2011-??-??">
<action dev="poi-developers" type="add">51292 - Additional HWPF Table Cell Descriptor values</action>
</release>
<release version="3.8-beta3" date="2011-??-??">
<action dev="poi-developers" type="fix">51098 - Correct calculate image width/height, if image fits into one cell</action>
<action dev="poi-developers" type="fix">47147 - Correct extra paragraphs from XWPF Table Cells</action>

View File

@ -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,7 +32,6 @@ 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);
@ -42,6 +41,10 @@ public abstract class TCAbstractType implements HDFType {
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);
}
}

View File

@ -32,6 +32,10 @@
<bit number="5" mask="0x0020" name="fVertMerge"/>
<bit number="6" mask="0x0040" name="fVertRestart"/>
<bit number="7" mask="0x0180" name="vertAlign"/>
<bit number="8" mask="0x0E00" name="ftsWidth"/>
<bit number="9" mask="0x1000" name="fFitText"/>
<bit number="10" mask="0x2000" name="fNoWrap"/>
<bit number="11" mask="0xC000" name="fUnused"/>
</field>
<field type="short" size="2" name="unused"/>
<field type="BorderCode" size="4" name="brcTop"/>