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> <changes>
<release version="3.8-beta4" date="2011-??-??"> <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">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 - Avoid exceptions in HSSFDataFormat.getDataFormatString() </action>
<action dev="poi-developers" type="fix">50681 - Fixed autosizing columns beyond 255 character limit </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, public static byte[] compressParagraphProperty(ParagraphProperties newPAP,
ParagraphProperties oldPAP) ParagraphProperties oldPAP)
{ {
// page numbers links to Word97-2007BinaryFileFormat(doc)Specification.pdf, accessible from microsoft.com
List sprmList = new ArrayList(); List sprmList = new ArrayList();
int size = 0; 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()) if (newPAP.getJc() != oldPAP.getJc())
{ {
// sprmPJc80
size += SprmUtils.addSprm((short)0x2403, newPAP.getJc(), null, sprmList); 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()) if (newPAP.getFKeep() != oldPAP.getFKeep())
{ {
size += SprmUtils.addSprm((short)0x2405, newPAP.getFKeep(), null, sprmList); size += SprmUtils.addSprm((short)0x2405, newPAP.getFKeep(), null, sprmList);
@ -73,18 +87,6 @@ public final class ParagraphSprmCompressor
{ {
size += SprmUtils.addSprm((short)0x240C, newPAP.getFNoLnn(), null, sprmList); 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() || if (newPAP.getItbdMac() != oldPAP.getItbdMac() ||
!Arrays.equals(newPAP.getRgdxaTab(), oldPAP.getRgdxaTab()) || !Arrays.equals(newPAP.getRgdxaTab(), oldPAP.getRgdxaTab()) ||
!Arrays.equals(newPAP.getRgtbd(), oldPAP.getRgtbd())) !Arrays.equals(newPAP.getRgtbd(), oldPAP.getRgtbd()))
@ -107,20 +109,41 @@ public final class ParagraphSprmCompressor
// //
// size += SprmUtils.addSprm((short)0xC60D, 0, varParam, sprmList); // size += SprmUtils.addSprm((short)0xC60D, 0, varParam, sprmList);
} }
if (newPAP.getDxaRight() != oldPAP.getDxaRight())
{
size += SprmUtils.addSprm((short)0x840E, newPAP.getDxaRight(), null, sprmList);
}
if (newPAP.getDxaLeft() != oldPAP.getDxaLeft()) if (newPAP.getDxaLeft() != oldPAP.getDxaLeft())
{ {
// sprmPDxaLeft80
size += SprmUtils.addSprm((short)0x840F, newPAP.getDxaLeft(), null, sprmList); size += SprmUtils.addSprm((short)0x840F, newPAP.getDxaLeft(), null, sprmList);
} }
// Page 51 of public specification begins
if (newPAP.getDxaLeft1() != oldPAP.getDxaLeft1()) if (newPAP.getDxaLeft1() != oldPAP.getDxaLeft1())
{ {
// sprmPDxaLeft180
size += SprmUtils.addSprm((short)0x8411, newPAP.getDxaLeft1(), null, sprmList); 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())) if (!newPAP.getLspd().equals(oldPAP.getLspd()))
{ {
// sprmPDyaLine
byte[] buf = new byte[4]; byte[] buf = new byte[4];
newPAP.getLspd().serialize(buf, 0); newPAP.getLspd().serialize(buf, 0);
@ -128,15 +151,132 @@ public final class ParagraphSprmCompressor
} }
if (newPAP.getDyaBefore() != oldPAP.getDyaBefore()) if (newPAP.getDyaBefore() != oldPAP.getDyaBefore())
{ {
// sprmPDyaBefore
size += SprmUtils.addSprm((short)0xA413, newPAP.getDyaBefore(), null, sprmList); size += SprmUtils.addSprm((short)0xA413, newPAP.getDyaBefore(), null, sprmList);
} }
if (newPAP.getDyaAfter() != oldPAP.getDyaAfter()) if (newPAP.getDyaAfter() != oldPAP.getDyaAfter())
{ {
// sprmPDyaAfter
size += SprmUtils.addSprm((short)0xA414, newPAP.getDyaAfter(), null, sprmList); 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()) if (newPAP.getFKinsoku() != oldPAP.getFKinsoku())
{ {
@ -166,6 +306,8 @@ public final class ParagraphSprmCompressor
{ {
size += SprmUtils.addSprm((short)0x4439, newPAP.getWAlignFont(), null, sprmList); size += SprmUtils.addSprm((short)0x4439, newPAP.getWAlignFont(), null, sprmList);
} }
// Page 54 of public specification begins
if (newPAP.isFBackward() != oldPAP.isFBackward() || if (newPAP.isFBackward() != oldPAP.isFBackward() ||
newPAP.isFVertical() != oldPAP.isFVertical() || newPAP.isFVertical() != oldPAP.isFVertical() ||
newPAP.isFRotateFont() != oldPAP.isFRotateFont()) newPAP.isFRotateFont() != oldPAP.isFRotateFont())
@ -187,125 +329,58 @@ public final class ParagraphSprmCompressor
} }
if (!Arrays.equals(newPAP.getAnld(), oldPAP.getAnld())) if (!Arrays.equals(newPAP.getAnld(), oldPAP.getAnld()))
{ {
// sprmPAnld80
size += SprmUtils.addSprm((short)0xC63E, 0, newPAP.getAnld(), sprmList); 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() || if (newPAP.getFPropRMark() != oldPAP.getFPropRMark() ||
newPAP.getIbstPropRMark() != oldPAP.getIbstPropRMark() || newPAP.getIbstPropRMark() != oldPAP.getIbstPropRMark() ||
!newPAP.getDttmPropRMark().equals(oldPAP.getDttmPropRMark())) !newPAP.getDttmPropRMark().equals(oldPAP.getDttmPropRMark()))
{ {
// sprmPPropRMark
byte[] buf = new byte[7]; byte[] buf = new byte[7];
buf[0] = (byte)newPAP.getFPropRMark(); buf[0] = (byte)newPAP.getFPropRMark();
LittleEndian.putShort(buf, 1, (short)newPAP.getIbstPropRMark()); LittleEndian.putShort(buf, 1, (short)newPAP.getIbstPropRMark());
newPAP.getDttmPropRMark().serialize(buf, 3); newPAP.getDttmPropRMark().serialize(buf, 3);
size += SprmUtils.addSprm((short)0xC63F, 0, buf, sprmList); 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())) if (!Arrays.equals(newPAP.getNumrm(), oldPAP.getNumrm()))
{ {
// sprmPNumRM
size += SprmUtils.addSprm((short)0xC645, 0, newPAP.getNumrm(), sprmList); 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()) if (newPAP.getEmbeddedCellMark() != oldPAP.getEmbeddedCellMark())
{ {
// sprmPFInnerTableCell
size += SprmUtils.addSprm((short)0x244b, newPAP.getEmbeddedCellMark(), null, sprmList); size += SprmUtils.addSprm((short)0x244b, newPAP.getEmbeddedCellMark(), null, sprmList);
} }
if (newPAP.getFTtpEmbedded() != oldPAP.getFTtpEmbedded()) if (newPAP.getFTtpEmbedded() != oldPAP.getFTtpEmbedded())
{ {
// sprmPFInnerTtp
size += SprmUtils.addSprm((short)0x244c, newPAP.getFTtpEmbedded(), null, sprmList); 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); return SprmUtils.getGrpprl(sprmList, size);
} }

View File

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

View File

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

View File

@ -23,33 +23,56 @@
<description>Paragraph Properties.</description> <description>Paragraph Properties.</description>
<author>S. Ryan Ackley</author> <author>S. Ryan Ackley</author>
<fields> <fields>
<field type="int" size="2" name="istd"/> <field type="int" size="2" name="istd" description="Index to style descriptor"/>
<field type="byte" size="1" name="jc"/> <field type="byte" size="1" name="fSideBySide"/>
<field type="byte" size="1" name="fKeep"/> <field type="byte" size="1" name="fKeep"/>
<field type="byte" size="1" name="fKeepFollow"/> <field type="byte" size="1" name="fKeepFollow"/>
<field type="byte" size="1" name="fPageBreakBefore"/> <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="fBrLnAbove"/>
<field type="byte" size="1" name="fBrLnBelow"/> <field type="byte" size="1" name="fBrLnBelow"/>
<field type="byte" size="1" name="pcVert"/> <field type="byte" size="1" name="pcVert"/>
<field type="byte" size="1" name="pcHorz"/> <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="wr"/>
<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="fNoAutoHyph"/> <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="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="fKinsoku"/>
<field type="byte" size="1" name="fWordWrap"/> <field type="byte" size="1" name="fWordWrap"/>
<field type="byte" size="1" name="fOverflowPunct"/> <field type="byte" size="1" name="fOverflowPunct"/>
@ -62,38 +85,57 @@
<bit number="1" mask="0x0002" name="fBackward"/> <bit number="1" mask="0x0002" name="fBackward"/>
<bit number="2" mask="0x0004" name="fRotateFont"/> <bit number="2" mask="0x0004" name="fRotateFont"/>
</field> </field>
<field type="byte" size="1" name="fVertical"/>
<field type="byte" size="1" name="fBackward"/> <field type="byte" size="1" name="fBackward"/>
<field type="byte" size="1" name="fRotateFont"/> <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="lvl"/>
<field type="byte" size="1" name="wr"/> <field type="byte" size="1" name="fBiDi"/>
<field type="byte" size="1" name="fLocked"/> <field type="byte" size="1" name="fNumRMIns"/>
<field type="byte[]" size="4" name="ptap"/> <field type="byte" size="1" name="fCrLf"/>
<field type="int" size="4" name="dxaAbs"/> <field type="byte" size="1" name="fUsePgsuSettings"/>
<field type="int" size="4" name="dyaAbs"/> <field type="byte" size="1" name="fAdjustRight"/>
<field type="int" size="4" name="dxaWidth"/>
<!-- 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="brcTop"/>
<field type="BorderCode" size="4" name="brcLeft"/> <field type="BorderCode" size="4" name="brcLeft"/>
<field type="BorderCode" size="4" name="brcBottom"/> <field type="BorderCode" size="4" name="brcBottom"/>
<field type="BorderCode" size="4" name="brcRight"/> <field type="BorderCode" size="4" name="brcRight"/>
<field type="BorderCode" size="4" name="brcBetween"/> <field type="BorderCode" size="4" name="brcBetween"/>
<field type="BorderCode" size="4" name="brcBar"/> <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="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="84" name="anld"/>
<field type="byte[]" size="12" name="phe"/>
<field type="int" size="1" name="fPropRMark"/> <field type="int" size="1" name="fPropRMark"/>
<field type="int" size="2" name="ibstPropRMark"/> <field type="int" size="2" name="ibstPropRMark"/>
<field type="DateAndTime" size="4" name="dttmPropRMark"/> <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="2" name="itbdMac"/>
<field type="int[]" size="128" name="rgdxaTab"/> <field type="int[]" size="128" name="rgdxaTab"/>
<field type="byte[]" size="128" name="rgtbd"/> <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="tableLevel"/>
<field type="byte" size="1" name="fTtpEmbedded"/> <field type="byte" size="1" name="fTtpEmbedded"/>
<field type="byte" size="1" name="embeddedCellMark"/> <field type="byte" size="1" name="embeddedCellMark"/>