rename PAP structure fields according to specification

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1142864 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-07-05 01:11:42 +00:00
parent f5c03d6194
commit 6abfa5742a
6 changed files with 536 additions and 515 deletions

View File

@ -17,13 +17,12 @@
package org.apache.poi.hwpf.sprm;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
import org.apache.poi.util.LittleEndian;
import java.util.List;
import org.apache.poi.hwpf.usermodel.ParagraphProperties;
import org.apache.poi.util.LittleEndian;
public final class ParagraphSprmCompressor
{
@ -363,10 +362,10 @@ public final class ParagraphSprmCompressor
// sprmPNumRM
size += SprmUtils.addSprm((short)0xC645, 0, newPAP.getNumrm(), sprmList);
}
if (newPAP.getEmbeddedCellMark() != oldPAP.getEmbeddedCellMark())
if (newPAP.getFInnerTableCell() != oldPAP.getFInnerTableCell())
{
// sprmPFInnerTableCell
size += SprmUtils.addSprm((short)0x244b, newPAP.getEmbeddedCellMark(), null, sprmList);
size += SprmUtils.addSprm((short)0x244b, newPAP.getFInnerTableCell(), null, sprmList);
}
if (newPAP.getFTtpEmbedded() != oldPAP.getFTtpEmbedded())
{
@ -375,10 +374,10 @@ public final class ParagraphSprmCompressor
}
// Page 55 of public specification begins
if (newPAP.getTableLevel() != oldPAP.getTableLevel())
if (newPAP.getItap() != oldPAP.getItap())
{
// sprmPItap
size += SprmUtils.addSprm((short)0x6649, newPAP.getTableLevel(), null, sprmList);
size += SprmUtils.addSprm((short)0x6649, newPAP.getItap(), null, sprmList);
}
return SprmUtils.getGrpprl(sprmList, size);

View File

@ -17,21 +17,21 @@
package org.apache.poi.hwpf.sprm;
import org.apache.poi.hwpf.usermodel.ParagraphProperties;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import org.apache.poi.hwpf.usermodel.BorderCode;
import org.apache.poi.hwpf.usermodel.DateAndTime;
import org.apache.poi.hwpf.usermodel.LineSpacingDescriptor;
import org.apache.poi.hwpf.usermodel.ShadingDescriptor;
import org.apache.poi.hwpf.usermodel.DropCapSpecifier;
import org.apache.poi.hwpf.usermodel.LineSpacingDescriptor;
import org.apache.poi.hwpf.usermodel.ParagraphProperties;
import org.apache.poi.hwpf.usermodel.ShadingDescriptor;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Collections;
import java.util.ArrayList;
public final class ParagraphSprmUncompressor
extends SprmUncompressor
{
@ -192,9 +192,10 @@ public final class ParagraphSprmUncompressor
// fast saved only
//applySprmPChgTabs (newPAP, varParam, opSize);
break;
case 0x16:
newPAP.setFInTable ((byte) sprm.getOperand());
break;
case 0x16:
// sprmPFInTable -- 0x2416
newPAP.setFInTable( (byte) sprm.getOperand() );
break;
case 0x17:
newPAP.setFTtp ((byte) sprm.getOperand());
break;
@ -392,15 +393,22 @@ public final class ParagraphSprmUncompressor
case 0x48:
newPAP.setFAdjustRight ((byte) sprm.getOperand());
break;
case 0x49:
newPAP.setTableLevel((byte)sprm.getOperand());
break;
case 0x4b:
newPAP.setEmbeddedCellMark((byte)sprm.getOperand());
break;
case 0x4c:
newPAP.setFTtpEmbedded((byte)sprm.getOperand());
break;
case 0x49:
// sprmPItap -- 0x6649
newPAP.setItap( sprm.getOperand() );
break;
case 0x4a:
// sprmPDtap -- 0x664a
newPAP.setItap( (byte) ( newPAP.getItap() + sprm.getOperand() ) );
break;
case 0x4b:
// sprmPFInnerTableCell -- 0x244b
newPAP.setFInnerTableCell( (byte) sprm.getOperand() );
break;
case 0x4c:
// sprmPFInnerTtp -- 0x244c
newPAP.setFTtpEmbedded( (byte) sprm.getOperand() );
break;
case 0x61:
// sprmPJc
newPAP.setJustificationLogical((byte) sprm.getOperand());

View File

@ -131,12 +131,12 @@ public class Paragraph extends Range implements Cloneable {
public int getTableLevel()
{
return _props.getTableLevel();
return _props.getItap();
}
public boolean isEmbeddedCellMark()
{
return _props.getEmbeddedCellMark() != 0;
return _props.getFInnerTableCell() != 0;
}
public int getJustification()

View File

@ -649,7 +649,7 @@ public class Range { // TODO -instantiable superclass
public Table insertBefore(TableProperties props, int rows) {
ParagraphProperties parProps = new ParagraphProperties();
parProps.setFInTable((byte) 1);
parProps.setTableLevel((byte) 1);
parProps.setItap( 1 );
int columns = props.getItcMac();
for (int x = 0; x < rows; x++) {

View File

@ -96,9 +96,11 @@
<field type="byte" size="1" name="fUsePgsuSettings"/>
<field type="byte" size="1" name="fAdjustRight"/>
<!-- itap? -->
<!-- fInnerTableCell? -->
<!-- fOpenTch? -->
<field type="int" size="4" name="itap" description="Table nesting level"/>
<field type="byte" size="1" name="fInnerTableCell" description="When 1, the end of paragraph mark is really an end of cell mark for a nested table cell"/>
<field type="byte" size="1" name="fOpenTch" description="Ensure the Table Cell char doesn't show up as zero height"/>
<!-- not part of properties structure, but used anyway. See sprmPFInnerTtp doc. -->
<field type="byte" size="1" name="fTtpEmbedded" description="Word 97 compatibility indicates this end of paragraph mark is really an end of row marker for a nested table."/>
<field type="short" size="2" name="dxcRight" description="Right indent in character units"/>
<field type="short" size="2" name="dxcLeft" description="Left indent in character units"/>
@ -134,10 +136,5 @@
<field type="byte[]" size="128" name="rgtbd"/>
<field type="byte[]" size="128" name="numrm"/>
<field type="byte[]" size="4" name="ptap"/>
<!-- Unknown old fields -->
<field type="byte" size="1" name="tableLevel"/>
<field type="byte" size="1" name="fTtpEmbedded"/>
<field type="byte" size="1" name="embeddedCellMark"/>
</fields>
</record>