Support for sprmPJc paragraph SPRM and handling of additional properties in ParagraphSprmCompressor, see Bugzilla 51389 and 51390

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1137143 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yegor Kozlov 2011-06-18 08:57:10 +00:00
parent 8bca63ee94
commit 545cde3374
6 changed files with 1631 additions and 1134 deletions

View File

@ -34,6 +34,8 @@
<changes>
<release version="3.8-beta4" date="2011-??-??">
<action dev="poi-developers" type="add">51390 - Added handling of additional properties to HWPF ParagraphSprmCompressor</action>
<action dev="poi-developers" type="add">51389 - Support for sprmPJc paragraph SPRM in HWPF</action>
<action dev="poi-developers" type="fix">48469 - New Case Study for PI web site </action>
<action dev="poi-developers" type="fix">50681 - Avoid exceptions in HSSFDataFormat.getDataFormatString() </action>
<action dev="poi-developers" type="fix">50681 - Fixed autosizing columns beyond 255 character limit </action>

View File

@ -34,13 +34,27 @@ public final class ParagraphSprmCompressor
public static byte[] compressParagraphProperty(ParagraphProperties newPAP,
ParagraphProperties oldPAP)
{
// page numbers links to Word97-2007BinaryFileFormat(doc)Specification.pdf, accessible from microsoft.com
List sprmList = new ArrayList();
int size = 0;
// Page 50 of public specification begins
if (newPAP.getIstd() != oldPAP.getIstd())
{
// sprmPIstd
size += SprmUtils.addSprm((short)0x4600, newPAP.getIstd(), null, sprmList);
}
if (newPAP.getJc() != oldPAP.getJc())
{
// sprmPJc80
size += SprmUtils.addSprm((short)0x2403, newPAP.getJc(), null, sprmList);
}
if (newPAP.getFSideBySide() != oldPAP.getFSideBySide())
{
// sprmPFSideBySide
size += SprmUtils.addSprm((short)0x2404, newPAP.getFSideBySide(), null, sprmList);
}
if (newPAP.getFKeep() != oldPAP.getFKeep())
{
size += SprmUtils.addSprm((short)0x2405, newPAP.getFKeep(), null, sprmList);
@ -73,54 +87,63 @@ public final class ParagraphSprmCompressor
{
size += SprmUtils.addSprm((short)0x240C, newPAP.getFNoLnn(), null, sprmList);
}
if (newPAP.getFSideBySide() != oldPAP.getFSideBySide())
{
size += SprmUtils.addSprm((short)0x2404, newPAP.getFSideBySide(), null, sprmList);
}
if (newPAP.getFNoAutoHyph() != oldPAP.getFNoAutoHyph())
{
size += SprmUtils.addSprm((short)0x242A, newPAP.getFNoAutoHyph(), null, sprmList);
}
if (newPAP.getFWidowControl() != oldPAP.getFWidowControl())
{
size += SprmUtils.addSprm((short)0x2431, newPAP.getFWidowControl(), null, sprmList);
}
if (newPAP.getItbdMac() != oldPAP.getItbdMac() ||
!Arrays.equals(newPAP.getRgdxaTab(), oldPAP.getRgdxaTab()) ||
!Arrays.equals(newPAP.getRgtbd(), oldPAP.getRgtbd()))
{
/** @todo revisit this */
// byte[] oldTabArray = oldPAP.getRgdxaTab();
// byte[] newTabArray = newPAP.getRgdxaTab();
// byte[] newTabDescriptors = newPAP.getRgtbd();
// byte[] varParam = new byte[2 + oldTabArray.length + newTabArray.length +
// newTabDescriptors.length];
// varParam[0] = (byte)(oldTabArray.length/2);
// int offset = 1;
// System.arraycopy(oldTabArray, 0, varParam, offset, oldTabArray.length);
// offset += oldTabArray.length;
// varParam[offset] = (byte)(newTabArray.length/2);
// offset += 1;
// System.arraycopy(newTabArray, 0, varParam, offset, newTabArray.length);
// offset += newTabArray.length;
// System.arraycopy(newTabDescriptors, 0, varParam, offset, newTabDescriptors.length);
//
// size += SprmUtils.addSprm((short)0xC60D, 0, varParam, sprmList);
}
if (newPAP.getDxaRight() != oldPAP.getDxaRight())
{
size += SprmUtils.addSprm((short)0x840E, newPAP.getDxaRight(), null, sprmList);
!Arrays.equals(newPAP.getRgdxaTab(), oldPAP.getRgdxaTab()) ||
!Arrays.equals(newPAP.getRgtbd(), oldPAP.getRgtbd()))
{
/** @todo revisit this */
// byte[] oldTabArray = oldPAP.getRgdxaTab();
// byte[] newTabArray = newPAP.getRgdxaTab();
// byte[] newTabDescriptors = newPAP.getRgtbd();
// byte[] varParam = new byte[2 + oldTabArray.length + newTabArray.length +
// newTabDescriptors.length];
// varParam[0] = (byte)(oldTabArray.length/2);
// int offset = 1;
// System.arraycopy(oldTabArray, 0, varParam, offset, oldTabArray.length);
// offset += oldTabArray.length;
// varParam[offset] = (byte)(newTabArray.length/2);
// offset += 1;
// System.arraycopy(newTabArray, 0, varParam, offset, newTabArray.length);
// offset += newTabArray.length;
// System.arraycopy(newTabDescriptors, 0, varParam, offset, newTabDescriptors.length);
//
// size += SprmUtils.addSprm((short)0xC60D, 0, varParam, sprmList);
}
if (newPAP.getDxaLeft() != oldPAP.getDxaLeft())
{
// sprmPDxaLeft80
size += SprmUtils.addSprm((short)0x840F, newPAP.getDxaLeft(), null, sprmList);
}
// Page 51 of public specification begins
if (newPAP.getDxaLeft1() != oldPAP.getDxaLeft1())
{
// sprmPDxaLeft180
size += SprmUtils.addSprm((short)0x8411, newPAP.getDxaLeft1(), null, sprmList);
}
if (newPAP.getDxaRight() != oldPAP.getDxaRight())
{
// sprmPDxaRight80
size += SprmUtils.addSprm((short)0x840E, newPAP.getDxaRight(), null, sprmList);
}
if (newPAP.getDxcLeft() != oldPAP.getDxcLeft())
{
// sprmPDxcLeft
size += SprmUtils.addSprm((short)0x4456, newPAP.getDxcLeft(), null, sprmList);
}
if (newPAP.getDxcLeft1() != oldPAP.getDxcLeft1())
{
// sprmPDxcLeft1
size += SprmUtils.addSprm((short)0x4457, newPAP.getDxcLeft1(), null, sprmList);
}
if (newPAP.getDxcRight() != oldPAP.getDxcRight())
{
// sprmPDxcRight
size += SprmUtils.addSprm((short)0x4455, newPAP.getDxcRight(), null, sprmList);
}
if (!newPAP.getLspd().equals(oldPAP.getLspd()))
{
// sprmPDyaLine
byte[] buf = new byte[4];
newPAP.getLspd().serialize(buf, 0);
@ -128,15 +151,132 @@ public final class ParagraphSprmCompressor
}
if (newPAP.getDyaBefore() != oldPAP.getDyaBefore())
{
// sprmPDyaBefore
size += SprmUtils.addSprm((short)0xA413, newPAP.getDyaBefore(), null, sprmList);
}
if (newPAP.getDyaAfter() != oldPAP.getDyaAfter())
{
// sprmPDyaAfter
size += SprmUtils.addSprm((short)0xA414, newPAP.getDyaAfter(), null, sprmList);
}
if (newPAP.getDyaBefore() != oldPAP.getDyaBefore())
if (newPAP.getFDyaBeforeAuto() != oldPAP.getFDyaBeforeAuto())
{
size += SprmUtils.addSprm((short)0x2404, newPAP.getDyaBefore(), null, sprmList);
// sprmPFDyaBeforeAuto
size += SprmUtils.addSprm((short)0x245B, newPAP.getFDyaBeforeAuto(), null, sprmList);
}
if (newPAP.getFDyaAfterAuto() != oldPAP.getFDyaAfterAuto())
{
// sprmPFDyaAfterAuto
size += SprmUtils.addSprm((short)0x245C, newPAP.getFDyaAfterAuto(), null, sprmList);
}
if (newPAP.getFInTable() != oldPAP.getFInTable())
{
// sprmPFInTable
size += SprmUtils.addSprm((short)0x2416, newPAP.getFInTable(), null, sprmList);
}
if (newPAP.getFTtp() != oldPAP.getFTtp())
{
// sprmPFTtp
size += SprmUtils.addSprm((short)0x2417, newPAP.getFTtp(), null, sprmList);
}
if (newPAP.getDxaAbs() != oldPAP.getDxaAbs())
{
// sprmPDxaAbs
size += SprmUtils.addSprm((short)0x8418, newPAP.getDxaAbs(), null, sprmList);
}
if (newPAP.getDyaAbs() != oldPAP.getDyaAbs())
{
// sprmPDyaAbs
size += SprmUtils.addSprm((short)0x8419, newPAP.getDyaAbs(), null, sprmList);
}
if (newPAP.getDxaWidth() != oldPAP.getDxaWidth())
{
// sprmPDxaWidth
size += SprmUtils.addSprm((short)0x841A, newPAP.getDxaWidth(), null, sprmList);
}
// Page 52 of public specification begins
if (newPAP.getWr() != oldPAP.getWr())
{
size += SprmUtils.addSprm((short)0x2423, newPAP.getWr(), null, sprmList);
}
if (newPAP.getBrcBar().equals(oldPAP.getBrcBar()))
{
// XXX: sprm code 0x6428 is sprmPBrcBetween80, but accessed property linked to sprmPBrcBar80 (0x6629)
int brc = newPAP.getBrcBar().toInt();
size += SprmUtils.addSprm((short)0x6428, brc, null, sprmList);
}
if (!newPAP.getBrcBottom().equals(oldPAP.getBrcBottom()))
{
// sprmPBrcBottom80
int brc = newPAP.getBrcBottom().toInt();
size += SprmUtils.addSprm((short)0x6426, brc, null, sprmList);
}
if (!newPAP.getBrcLeft().equals(oldPAP.getBrcLeft()))
{
// sprmPBrcLeft80
int brc = newPAP.getBrcLeft().toInt();
size += SprmUtils.addSprm((short)0x6425, brc, null, sprmList);
}
// Page 53 of public specification begins
if (!newPAP.getBrcRight().equals(oldPAP.getBrcRight()))
{
// sprmPBrcRight80
int brc = newPAP.getBrcRight().toInt();
size += SprmUtils.addSprm((short)0x6427, brc, null, sprmList);
}
if (!newPAP.getBrcTop().equals(oldPAP.getBrcTop()))
{
// sprmPBrcTop80
int brc = newPAP.getBrcTop().toInt();
size += SprmUtils.addSprm((short)0x6424, brc, null, sprmList);
}
if (newPAP.getFNoAutoHyph() != oldPAP.getFNoAutoHyph())
{
size += SprmUtils.addSprm((short)0x242A, newPAP.getFNoAutoHyph(), null, sprmList);
}
if (newPAP.getDyaHeight() != oldPAP.getDyaHeight() ||
newPAP.getFMinHeight() != oldPAP.getFMinHeight())
{
// sprmPWHeightAbs
short val = (short)newPAP.getDyaHeight();
if (newPAP.getFMinHeight() > 0)
{
val |= 0x8000;
}
size += SprmUtils.addSprm((short)0x442B, val, null, sprmList);
}
if (newPAP.getDcs() != null && !newPAP.getDcs().equals(oldPAP.getDcs()))
{
// sprmPDcs
size += SprmUtils.addSprm((short)0x442C, newPAP.getDcs().toShort(), null, sprmList);
}
if (newPAP.getShd() != null && !newPAP.getShd().equals(oldPAP.getShd()))
{
// sprmPShd80
size += SprmUtils.addSprm((short)0x442D, newPAP.getShd().toShort(), null, sprmList);
}
if (newPAP.getDyaFromText() != oldPAP.getDyaFromText())
{
// sprmPDyaFromText
size += SprmUtils.addSprm((short)0x842E, newPAP.getDyaFromText(), null, sprmList);
}
if (newPAP.getDxaFromText() != oldPAP.getDxaFromText())
{
// sprmPDxaFromText
size += SprmUtils.addSprm((short)0x842F, newPAP.getDxaFromText(), null, sprmList);
}
if (newPAP.getFLocked() != oldPAP.getFLocked())
{
// sprmPFLocked
size += SprmUtils.addSprm((short)0x2430, newPAP.getFLocked(), null, sprmList);
}
if (newPAP.getFWidowControl() != oldPAP.getFWidowControl())
{
// sprmPFWidowControl
size += SprmUtils.addSprm((short)0x2431, newPAP.getFWidowControl(), null, sprmList);
}
if (newPAP.getFKinsoku() != oldPAP.getFKinsoku())
{
@ -166,6 +306,8 @@ public final class ParagraphSprmCompressor
{
size += SprmUtils.addSprm((short)0x4439, newPAP.getWAlignFont(), null, sprmList);
}
// Page 54 of public specification begins
if (newPAP.isFBackward() != oldPAP.isFBackward() ||
newPAP.isFVertical() != oldPAP.isFVertical() ||
newPAP.isFRotateFont() != oldPAP.isFRotateFont())
@ -187,125 +329,58 @@ public final class ParagraphSprmCompressor
}
if (!Arrays.equals(newPAP.getAnld(), oldPAP.getAnld()))
{
// sprmPAnld80
size += SprmUtils.addSprm((short)0xC63E, 0, newPAP.getAnld(), sprmList);
}
if (newPAP.getFInTable() != oldPAP.getFInTable())
{
size += SprmUtils.addSprm((short)0x2416, newPAP.getFInTable(), null, sprmList);
}
if (newPAP.getFTtp() != oldPAP.getFTtp())
{
size += SprmUtils.addSprm((short)0x2417, newPAP.getFTtp(), null, sprmList);
}
if (newPAP.getWr() != oldPAP.getWr())
{
size += SprmUtils.addSprm((short)0x2423, newPAP.getWr(), null, sprmList);
}
if (newPAP.getFLocked() != oldPAP.getFLocked())
{
size += SprmUtils.addSprm((short)0x2430, newPAP.getFLocked(), null, sprmList);
}
if (newPAP.getDxaAbs() != oldPAP.getDxaAbs())
{
size += SprmUtils.addSprm((short)0x8418, newPAP.getDxaAbs(), null, sprmList);
}
if (newPAP.getDyaAbs() != oldPAP.getDyaAbs())
{
size += SprmUtils.addSprm((short)0x8419, newPAP.getDyaAbs(), null, sprmList);
}
if (newPAP.getDxaWidth() != oldPAP.getDxaWidth())
{
size += SprmUtils.addSprm((short)0x841A, newPAP.getDxaWidth(), null, sprmList);
}
if (!newPAP.getBrcTop().equals(oldPAP.getBrcTop()))
{
int brc = newPAP.getBrcTop().toInt();
size += SprmUtils.addSprm((short)0x6424, brc, null, sprmList);
}
if (!newPAP.getBrcLeft().equals(oldPAP.getBrcLeft()))
{
int brc = newPAP.getBrcLeft().toInt();
size += SprmUtils.addSprm((short)0x6425, brc, null, sprmList);
}
if (!newPAP.getBrcBottom().equals(oldPAP.getBrcBottom()))
{
int brc = newPAP.getBrcBottom().toInt();
size += SprmUtils.addSprm((short)0x6426, brc, null, sprmList);
}
if (!newPAP.getBrcRight().equals(oldPAP.getBrcRight()))
{
int brc = newPAP.getBrcRight().toInt();
size += SprmUtils.addSprm((short)0x6427, brc, null, sprmList);
}
if (newPAP.getBrcBar().equals(oldPAP.getBrcBar()))
{
int brc = newPAP.getBrcBar().toInt();
size += SprmUtils.addSprm((short)0x6428, brc, null, sprmList);
}
if (newPAP.getDxaFromText() != oldPAP.getDxaFromText())
{
size += SprmUtils.addSprm((short)0x842F, newPAP.getDxaFromText(), null, sprmList);
}
if (newPAP.getDyaFromText() != oldPAP.getDyaFromText())
{
size += SprmUtils.addSprm((short)0x842E, newPAP.getDyaFromText(), null, sprmList);
}
if (newPAP.getDyaHeight() != oldPAP.getDyaHeight() ||
newPAP.getFMinHeight() != oldPAP.getFMinHeight())
{
short val = (short)newPAP.getDyaHeight();
if (newPAP.getFMinHeight() > 0)
{
val |= 0x8000;
}
size += SprmUtils.addSprm((short)0x442B, val, null, sprmList);
}
if (newPAP.getShd() != null && !newPAP.getShd().equals(oldPAP.getShd()))
{
size += SprmUtils.addSprm((short)0x442D, newPAP.getShd().toShort(), null, sprmList);
}
if (newPAP.getDcs() != null && !newPAP.getDcs().equals(oldPAP.getDcs()))
{
size += SprmUtils.addSprm((short)0x442C, newPAP.getDcs().toShort(), null, sprmList);
}
if (newPAP.getLvl() != oldPAP.getLvl())
{
size += SprmUtils.addSprm((short)0x2640, newPAP.getLvl(), null, sprmList);
}
if (newPAP.getFNumRMIns() != oldPAP.getFNumRMIns())
{
size += SprmUtils.addSprm((short)0x2443, newPAP.getFNumRMIns(), null, sprmList);
}
if (newPAP.getFPropRMark() != oldPAP.getFPropRMark() ||
newPAP.getIbstPropRMark() != oldPAP.getIbstPropRMark() ||
!newPAP.getDttmPropRMark().equals(oldPAP.getDttmPropRMark()))
newPAP.getIbstPropRMark() != oldPAP.getIbstPropRMark() ||
!newPAP.getDttmPropRMark().equals(oldPAP.getDttmPropRMark()))
{
// sprmPPropRMark
byte[] buf = new byte[7];
buf[0] = (byte)newPAP.getFPropRMark();
LittleEndian.putShort(buf, 1, (short)newPAP.getIbstPropRMark());
newPAP.getDttmPropRMark().serialize(buf, 3);
size += SprmUtils.addSprm((short)0xC63F, 0, buf, sprmList);
}
if (newPAP.getLvl() != oldPAP.getLvl())
{
// sprmPOutLvl
size += SprmUtils.addSprm((short)0x2640, newPAP.getLvl(), null, sprmList);
}
if (newPAP.getFBiDi() != oldPAP.getFBiDi())
{
// sprmPFBiDi
size += SprmUtils.addSprm((short)0x2441, newPAP.getFBiDi(), null, sprmList);
}
if (newPAP.getFNumRMIns() != oldPAP.getFNumRMIns())
{
// sprmPFNumRMIns
size += SprmUtils.addSprm((short)0x2443, newPAP.getFNumRMIns(), null, sprmList);
}
if (!Arrays.equals(newPAP.getNumrm(), oldPAP.getNumrm()))
{
// sprmPNumRM
size += SprmUtils.addSprm((short)0xC645, 0, newPAP.getNumrm(), sprmList);
}
if (newPAP.getTableLevel() != oldPAP.getTableLevel())
{
size += SprmUtils.addSprm((short)0x6649, newPAP.getTableLevel(), null, sprmList);
}
if (newPAP.getEmbeddedCellMark() != oldPAP.getEmbeddedCellMark())
{
// sprmPFInnerTableCell
size += SprmUtils.addSprm((short)0x244b, newPAP.getEmbeddedCellMark(), null, sprmList);
}
if (newPAP.getFTtpEmbedded() != oldPAP.getFTtpEmbedded())
{
// sprmPFInnerTtp
size += SprmUtils.addSprm((short)0x244c, newPAP.getFTtpEmbedded(), null, sprmList);
}
// Page 55 of public specification begins
if (newPAP.getTableLevel() != oldPAP.getTableLevel())
{
// sprmPItap
size += SprmUtils.addSprm((short)0x6649, newPAP.getTableLevel(), null, sprmList);
}
return SprmUtils.getGrpprl(sprmList, size);
}

View File

@ -346,8 +346,7 @@ public final class ParagraphSprmUncompressor
}
break;
case 0x41:
// undocumented
// sprmPFBiDi
break;
case 0x43:
@ -387,7 +386,8 @@ public final class ParagraphSprmUncompressor
newPAP.setFTtpEmbedded((byte)sprm.getOperand());
break;
case 0x61:
// Logicial justification of the paragraph, eg left, centre, right
// sprmPJc
newPAP.setJustificationLogical((byte) sprm.getOperand());
break;
default:
break;

View File

@ -19,303 +19,272 @@ package org.apache.poi.hwpf.usermodel;
import org.apache.poi.hwpf.model.types.PAPAbstractType;
public final class ParagraphProperties extends PAPAbstractType implements Cloneable {
public final class ParagraphProperties extends PAPAbstractType implements
Cloneable {
public ParagraphProperties()
{
field_21_lspd = new LineSpacingDescriptor();
field_24_phe = new byte[12];
field_46_brcTop = new BorderCode();
field_47_brcLeft = new BorderCode();
field_48_brcBottom = new BorderCode();
field_49_brcRight = new BorderCode();
field_50_brcBetween = new BorderCode();
field_51_brcBar = new BorderCode();
field_60_anld = new byte[84];
this.field_17_fWidowControl = 1;
this.field_21_lspd.setMultiLinespace((short)1);
this.field_21_lspd.setDyaLine((short)240);
this.field_58_lvl = (byte)9;
this.field_66_rgdxaTab = new int[0];
this.field_67_rgtbd = new byte[0];
this.field_63_dttmPropRMark = new DateAndTime();
private boolean jcLogical = false;
public ParagraphProperties() {
setLspd(new LineSpacingDescriptor());
setPhe(new byte[12]);
setBrcTop(new BorderCode());
setBrcLeft(new BorderCode());
setBrcBottom(new BorderCode());
setBrcRight(new BorderCode());
setBrcBetween(new BorderCode());
setBrcBar(new BorderCode());
setAnld(new byte[84]);
}
setWidowControl(true);
getLspd().setMultiLinespace((short) 1);
getLspd().setDyaLine((short) 240);
setLvl((byte) 9);
setRgdxaTab(new int[0]);
setRgtbd(new byte[0]);
setDttmPropRMark(new DateAndTime());
}
public int getJustification()
{
return super.getJc();
}
public int getJustification() {
if (jcLogical) {
if (getFBiDi() == 0) {
return getJc();
}
public void setJustification(byte jc)
{
super.setJc(jc);
}
switch (getJc()) {
case 0:
return 2;
case 2:
return 0;
default:
return getJc();
}
}
public boolean keepOnPage()
{
return super.getFKeep() != 0;
}
return getJc();
}
public void setKeepOnPage(boolean fKeep)
{
super.setFKeep((byte)(fKeep ? 1 : 0));
}
public void setJustification(byte jc) {
super.setJc(jc);
this.jcLogical = false;
}
public boolean keepWithNext()
{
return super.getFKeepFollow() != 0;
}
public void setJustificationLogical(byte jc) {
super.setJc(jc);
this.jcLogical = true;
}
public void setKeepWithNext(boolean fKeepFollow)
{
super.setFKeepFollow((byte)(fKeepFollow ? 1 : 0));
}
public boolean keepOnPage() {
return super.getFKeep() != 0;
}
public boolean pageBreakBefore()
{
return super.getFPageBreakBefore() != 0;
}
public void setKeepOnPage(boolean fKeep) {
super.setFKeep((byte) (fKeep ? 1 : 0));
}
public void setPageBreakBefore(boolean fPageBreak)
{
super.setFPageBreakBefore((byte)(fPageBreak ? 1 : 0));
}
public boolean keepWithNext() {
return super.getFKeepFollow() != 0;
}
public boolean isLineNotNumbered()
{
return super.getFNoLnn() != 0;
}
public void setKeepWithNext(boolean fKeepFollow) {
super.setFKeepFollow((byte) (fKeepFollow ? 1 : 0));
}
public void setLineNotNumbered(boolean fNoLnn)
{
super.setFNoLnn((byte)(fNoLnn ? 1 : 0));
}
public boolean pageBreakBefore() {
return super.getFPageBreakBefore() != 0;
}
public boolean isSideBySide()
{
return super.getFSideBySide() != 0;
}
public void setPageBreakBefore(boolean fPageBreak) {
super.setFPageBreakBefore((byte) (fPageBreak ? 1 : 0));
}
public void setSideBySide(boolean fSideBySide)
{
super.setFSideBySide((byte)(fSideBySide ? 1 : 0));
}
public boolean isLineNotNumbered() {
return super.getFNoLnn() != 0;
}
public boolean isAutoHyphenated()
{
return super.getFNoAutoHyph() == 0;
}
public void setLineNotNumbered(boolean fNoLnn) {
super.setFNoLnn((byte) (fNoLnn ? 1 : 0));
}
public void setAutoHyphenated(boolean auto)
{
super.setFNoAutoHyph((byte)(!auto ? 1 : 0));
}
public boolean isSideBySide() {
return super.getFSideBySide() != 0;
}
public boolean isWidowControlled()
{
return super.getFWidowControl() != 0;
}
public void setSideBySide(boolean fSideBySide) {
super.setFSideBySide((byte) (fSideBySide ? 1 : 0));
}
public void setWidowControl(boolean widowControl)
{
super.setFWidowControl((byte)(widowControl ? 1 : 0));
}
public boolean isAutoHyphenated() {
return super.getFNoAutoHyph() == 0;
}
public int getIndentFromRight()
{
return super.getDxaRight();
}
public void setAutoHyphenated(boolean auto) {
super.setFNoAutoHyph((byte) (!auto ? 1 : 0));
}
public void setIndentFromRight(int dxaRight)
{
super.setDxaRight(dxaRight);
}
public boolean isWidowControlled() {
return super.getFWidowControl() != 0;
}
public int getIndentFromLeft()
{
return super.getDxaLeft();
}
public void setWidowControl(boolean widowControl) {
super.setFWidowControl((byte) (widowControl ? 1 : 0));
}
public void setIndentFromLeft(int dxaLeft)
{
super.setDxaLeft(dxaLeft);
}
public int getIndentFromRight() {
return super.getDxaRight();
}
public int getFirstLineIndent()
{
return super.getDxaLeft1();
}
public void setIndentFromRight(int dxaRight) {
super.setDxaRight(dxaRight);
}
public void setFirstLineIndent(int first)
{
super.setDxaLeft1(first);
}
public int getIndentFromLeft() {
return super.getDxaLeft();
}
public LineSpacingDescriptor getLineSpacing()
{
return super.getLspd();
}
public void setIndentFromLeft(int dxaLeft) {
super.setDxaLeft(dxaLeft);
}
public void setLineSpacing(LineSpacingDescriptor lspd)
{
super.setLspd(lspd);
}
public int getFirstLineIndent() {
return super.getDxaLeft1();
}
public int getSpacingBefore()
{
return super.getDyaBefore();
}
public void setFirstLineIndent(int first) {
super.setDxaLeft1(first);
}
public void setSpacingBefore(int before)
{
super.setDyaBefore(before);
}
public LineSpacingDescriptor getLineSpacing() {
return super.getLspd();
}
public int getSpacingAfter()
{
return super.getDyaAfter();
}
public void setLineSpacing(LineSpacingDescriptor lspd) {
super.setLspd(lspd);
}
public void setSpacingAfter(int after)
{
super.setDyaAfter(after);
}
public int getSpacingBefore() {
return super.getDyaBefore();
}
public boolean isKinsoku()
{
return super.getFKinsoku() != 0;
}
public void setSpacingBefore(int before) {
super.setDyaBefore(before);
}
public void setKinsoku(boolean kinsoku)
{
super.setFKinsoku((byte)(kinsoku ? 1 : 0));
}
public int getSpacingAfter() {
return super.getDyaAfter();
}
public boolean isWordWrapped()
{
return super.getFWordWrap() != 0;
}
public void setSpacingAfter(int after) {
super.setDyaAfter(after);
}
public void setWordWrapped(boolean wrap)
{
super.setFWordWrap((byte)(wrap ? 1 : 0));
}
public boolean isKinsoku() {
return super.getFKinsoku() != 0;
}
public int getFontAlignment()
{
return super.getWAlignFont();
}
public void setKinsoku(boolean kinsoku) {
super.setFKinsoku((byte) (kinsoku ? 1 : 0));
}
public void setFontAlignment(int align)
{
super.setWAlignFont(align);
}
public boolean isWordWrapped() {
return super.getFWordWrap() != 0;
}
public boolean isVertical()
{
return super.isFVertical();
}
public void setWordWrapped(boolean wrap) {
super.setFWordWrap((byte) (wrap ? 1 : 0));
}
public void setVertical(boolean vertical)
{
super.setFVertical(vertical);
}
public int getFontAlignment() {
return super.getWAlignFont();
}
public boolean isBackward()
{
return super.isFBackward();
}
public void setFontAlignment(int align) {
super.setWAlignFont(align);
}
public void setBackward(boolean bward)
{
super.setFBackward(bward);
}
public boolean isVertical() {
return super.isFVertical();
}
public BorderCode getTopBorder()
{
return super.getBrcTop();
}
public void setVertical(boolean vertical) {
super.setFVertical(vertical);
}
public void setTopBorder(BorderCode top)
{
super.setBrcTop(top);
}
public boolean isBackward() {
return super.isFBackward();
}
public BorderCode getLeftBorder()
{
return super.getBrcLeft();
}
public void setBackward(boolean bward) {
super.setFBackward(bward);
}
public void setLeftBorder(BorderCode left)
{
super.setBrcLeft(left);
}
public BorderCode getTopBorder() {
return super.getBrcTop();
}
public BorderCode getBottomBorder()
{
return super.getBrcBottom();
}
public void setTopBorder(BorderCode top) {
super.setBrcTop(top);
}
public void setBottomBorder(BorderCode bottom)
{
super.setBrcBottom(bottom);
}
public BorderCode getLeftBorder() {
return super.getBrcLeft();
}
public BorderCode getRightBorder()
{
return super.getBrcRight();
}
public void setLeftBorder(BorderCode left) {
super.setBrcLeft(left);
}
public void setRightBorder(BorderCode right)
{
super.setBrcRight(right);
}
public BorderCode getBottomBorder() {
return super.getBrcBottom();
}
public BorderCode getBarBorder()
{
return super.getBrcBar();
}
public void setBottomBorder(BorderCode bottom) {
super.setBrcBottom(bottom);
}
public void setBarBorder(BorderCode bar)
{
super.setBrcBar(bar);
}
public BorderCode getRightBorder() {
return super.getBrcRight();
}
public ShadingDescriptor getShading()
{
return super.getShd();
}
public void setRightBorder(BorderCode right) {
super.setBrcRight(right);
}
public void setShading(ShadingDescriptor shd)
{
super.setShd(shd);
}
public BorderCode getBarBorder() {
return super.getBrcBar();
}
public DropCapSpecifier getDropCap()
{
return super.getDcs();
}
public void setBarBorder(BorderCode bar) {
super.setBrcBar(bar);
}
public void setDropCap(DropCapSpecifier dcs)
{
super.setDcs(dcs);
}
public ShadingDescriptor getShading() {
return super.getShd();
}
public Object clone()
throws CloneNotSupportedException
{
ParagraphProperties pp = (ParagraphProperties)super.clone();
pp.field_21_lspd = (LineSpacingDescriptor)field_21_lspd.clone();
pp.field_24_phe = field_24_phe.clone();
pp.field_46_brcTop = (BorderCode)field_46_brcTop.clone();
pp.field_47_brcLeft = (BorderCode)field_47_brcLeft.clone();
pp.field_48_brcBottom = (BorderCode)field_48_brcBottom.clone();
pp.field_49_brcRight = (BorderCode)field_49_brcRight.clone();
pp.field_50_brcBetween = (BorderCode)field_50_brcBetween.clone();
pp.field_51_brcBar = (BorderCode)field_51_brcBar.clone();
pp.field_60_anld = field_60_anld.clone();
return pp;
}
public void setShading(ShadingDescriptor shd) {
super.setShd(shd);
}
public DropCapSpecifier getDropCap() {
return super.getDcs();
}
public void setDropCap(DropCapSpecifier dcs) {
super.setDcs(dcs);
}
public Object clone() throws CloneNotSupportedException {
ParagraphProperties pp = (ParagraphProperties) super.clone();
pp.setLspd((LineSpacingDescriptor) this.getLspd().clone());
pp.setPhe(getPhe().clone());
pp.setBrcTop((BorderCode) getBrcTop().clone());
pp.setBrcLeft((BorderCode) getBrcLeft().clone());
pp.setBrcBottom((BorderCode) getBrcBottom().clone());
pp.setBrcRight((BorderCode) getBrcRight().clone());
pp.setBrcBetween((BorderCode) getBrcBetween().clone());
pp.setBrcBar((BorderCode) getBrcBar().clone());
pp.setAnld(getAnld().clone());
return pp;
}
}

View File

@ -23,33 +23,56 @@
<description>Paragraph Properties.</description>
<author>S. Ryan Ackley</author>
<fields>
<field type="int" size="2" name="istd"/>
<field type="byte" size="1" name="jc"/>
<field type="int" size="2" name="istd" description="Index to style descriptor"/>
<field type="byte" size="1" name="fSideBySide"/>
<field type="byte" size="1" name="fKeep"/>
<field type="byte" size="1" name="fKeepFollow"/>
<field type="byte" size="1" name="fPageBreakBefore"/>
<field type="byte" size="1" name="brcl" description="Border line style"/>
<field type="byte" size="1" name="brcp" description="Rectangle border codes"/>
<field type="byte" size="1" name="ilvl" description="List level if non-zero"/>
<!-- According to PAPX doc pointer is byte, but according to sprmPIlfo documentation pointer is short,
we will use int -->
<field type="int" size="2" name="ilfo" description="1-based index into the pllfo (lists structure), if non-zero"/>
<field type="byte" size="1" name="fNoLnn" description="No line numbering"/>
<field type="LineSpacingDescriptor" size="4" name="lspd" description="Line spacing descriptor"/>
<field type="int" size="4" name="dyaBefore" description="Space before paragraph"/>
<field type="int" size="4" name="dyaAfter" description="Space after paragraph"/>
<!-- Not documented in PAP, but referenced by SPRM doc -->
<field type="byte" size="1" name="fInTable" description="Paragraph is in table flag"/>
<field type="byte" size="1" name="finTableW97" description="Archaic paragraph is in table flag"/>
<field type="byte" size="1" name="fTtp" description="Table trailer paragraph (last in table row)"/>
<field type="int" size="4" name="dxaAbs"/>
<field type="int" size="4" name="dyaAbs"/>
<field type="int" size="4" name="dxaWidth"/>
<field type="byte" size="1" name="fBrLnAbove"/>
<field type="byte" size="1" name="fBrLnBelow"/>
<field type="byte" size="1" name="pcVert"/>
<field type="byte" size="1" name="pcHorz"/>
<field type="byte" size="1" name="brcp"/>
<field type="byte" size="1" name="brcl"/>
<field type="byte" size="1" name="ilvl"/>
<field type="byte" size="1" name="fNoLnn"/>
<field type="int" size="2" name="ilfo"/>
<field type="byte" size="1" name="fSideBySide"/>
<field type="byte" size="1" name="wr"/>
<field type="byte" size="1" name="fNoAutoHyph"/>
<!-- wHeightAbs? -->
<field type="int" size="2" name="dyaHeight"/>
<field type="byte" size="1" name="fMinHeight"/>
<field type="DropCapSpecifier" size="2" name="dcs"/>
<field type="int" size="4" name="dyaFromText" description="Vertical distance between text and absolutely positioned object"/>
<field type="int" size="4" name="dxaFromText" description="Horizontal distance between text and absolutely positioned object"/>
<field type="byte" size="1" name="fLocked"/>
<field type="byte" size="1" name="fWidowControl"/>
<field type="int" size="4" name="dxaRight"/>
<field type="int" size="4" name="dxaLeft"/>
<field type="int" size="4" name="dxaLeft1"/>
<field type="LineSpacingDescriptor" size="4" name="lspd"/>
<field type="int" size="4" name="dyaBefore"/>
<field type="int" size="4" name="dyaAfter"/>
<field type="byte[]" size="12" name="phe"/>
<field type="byte" size="1" name="fCrLf"/>
<field type="byte" size="1" name="fUsePgsuSettings"/>
<field type="byte" size="1" name="fAdjustRight"/>
<field type="byte" size="1" name="fKinsoku"/>
<field type="byte" size="1" name="fWordWrap"/>
<field type="byte" size="1" name="fOverflowPunct"/>
@ -62,38 +85,57 @@
<bit number="1" mask="0x0002" name="fBackward"/>
<bit number="2" mask="0x0004" name="fRotateFont"/>
</field>
<field type="byte" size="1" name="fVertical"/>
<field type="byte" size="1" name="fBackward"/>
<field type="byte" size="1" name="fRotateFont"/>
<field type="byte" size="1" name="fInTable"/>
<field type="byte" size="1" name="fTtp"/>
<field type="byte" size="1" name="wr"/>
<field type="byte" size="1" name="fLocked"/>
<field type="byte[]" size="4" name="ptap"/>
<field type="int" size="4" name="dxaAbs"/>
<field type="int" size="4" name="dyaAbs"/>
<field type="int" size="4" name="dxaWidth"/>
<field type="byte" size="1" name="lvl"/>
<field type="byte" size="1" name="fBiDi"/>
<field type="byte" size="1" name="fNumRMIns"/>
<field type="byte" size="1" name="fCrLf"/>
<field type="byte" size="1" name="fUsePgsuSettings"/>
<field type="byte" size="1" name="fAdjustRight"/>
<!-- itap? -->
<!-- fInnerTableCell? -->
<!-- fOpenTch? -->
<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"/>
<field type="short" size="2" name="dxcLeft1" description="First line indent in character units"/>
<field type="byte" size="1" name="fDyaBeforeAuto" description="Vertical spacing before is automatic"/>
<field type="byte" size="1" name="fDyaAfterAuto" description="Vertical spacing after is automatic"/>
<field type="int" size="4" name="dxaRight"/>
<field type="int" size="4" name="dxaLeft"/>
<field type="int" size="4" name="dxaLeft1"/>
<field type="byte" size="1" name="jc"/>
<field type="byte" size="1" name="fNoAllowOverlap"/>
<field type="BorderCode" size="4" name="brcTop"/>
<field type="BorderCode" size="4" name="brcLeft"/>
<field type="BorderCode" size="4" name="brcBottom"/>
<field type="BorderCode" size="4" name="brcRight"/>
<field type="BorderCode" size="4" name="brcBetween"/>
<field type="BorderCode" size="4" name="brcBar"/>
<field type="int" size="4" name="dxaFromText"/>
<field type="int" size="4" name="dyaFromText"/>
<field type="int" size="2" name="dyaHeight"/>
<field type="byte" size="1" name="fMinHeight"/>
<field type="ShadingDescriptor" size="2" name="shd"/>
<field type="DropCapSpecifier" size="2" name="dcs"/>
<field type="byte" size="1" name="lvl"/>
<field type="byte" size="1" name="fNumRMIns"/>
<field type="byte[]" size="84" name="anld"/>
<field type="byte[]" size="12" name="phe"/>
<field type="int" size="1" name="fPropRMark"/>
<field type="int" size="2" name="ibstPropRMark"/>
<field type="DateAndTime" size="4" name="dttmPropRMark"/>
<field type="byte[]" size="128" name="numrm"/>
<field type="int" size="2" name="itbdMac"/>
<field type="int[]" size="128" name="rgdxaTab"/>
<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"/>