update PAP definition

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1147398 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-07-16 10:09:57 +00:00
parent ff7328a1d2
commit 020c6d70c0
9 changed files with 979 additions and 947 deletions

View File

@ -52,19 +52,19 @@ public final class ParagraphSprmCompressor
if (newPAP.getFSideBySide() != oldPAP.getFSideBySide())
{
// sprmPFSideBySide
size += SprmUtils.addSprm((short)0x2404, newPAP.getFSideBySide(), null, sprmList);
size += SprmUtils.addSprm((short)0x2404, newPAP.getFSideBySide(), sprmList);
}
if (newPAP.getFKeep() != oldPAP.getFKeep())
{
size += SprmUtils.addSprm((short)0x2405, newPAP.getFKeep(), null, sprmList);
size += SprmUtils.addSprm((short)0x2405, newPAP.getFKeep(), sprmList);
}
if (newPAP.getFKeepFollow() != oldPAP.getFKeepFollow())
{
size += SprmUtils.addSprm((short)0x2406, newPAP.getFKeepFollow(), null, sprmList);
size += SprmUtils.addSprm((short)0x2406, newPAP.getFKeepFollow(), sprmList);
}
if (newPAP.getFPageBreakBefore() != oldPAP.getFPageBreakBefore())
{
size += SprmUtils.addSprm((short)0x2407, newPAP.getFPageBreakBefore(), null, sprmList);
size += SprmUtils.addSprm((short)0x2407, newPAP.getFPageBreakBefore(), sprmList);
}
if (newPAP.getBrcl() != oldPAP.getBrcl())
{
@ -84,7 +84,7 @@ public final class ParagraphSprmCompressor
}
if (newPAP.getFNoLnn() != oldPAP.getFNoLnn())
{
size += SprmUtils.addSprm((short)0x240C, newPAP.getFNoLnn(), null, sprmList);
size += SprmUtils.addSprm((short)0x240C, newPAP.getFNoLnn(), sprmList);
}
if (newPAP.getItbdMac() != oldPAP.getItbdMac() ||
!Arrays.equals(newPAP.getRgdxaTab(), oldPAP.getRgdxaTab()) ||
@ -161,22 +161,22 @@ public final class ParagraphSprmCompressor
if (newPAP.getFDyaBeforeAuto() != oldPAP.getFDyaBeforeAuto())
{
// sprmPFDyaBeforeAuto
size += SprmUtils.addSprm((short)0x245B, newPAP.getFDyaBeforeAuto(), null, sprmList);
size += SprmUtils.addSprm((short)0x245B, newPAP.getFDyaBeforeAuto(), sprmList);
}
if (newPAP.getFDyaAfterAuto() != oldPAP.getFDyaAfterAuto())
{
// sprmPFDyaAfterAuto
size += SprmUtils.addSprm((short)0x245C, newPAP.getFDyaAfterAuto(), null, sprmList);
size += SprmUtils.addSprm((short)0x245C, newPAP.getFDyaAfterAuto(), sprmList);
}
if (newPAP.getFInTable() != oldPAP.getFInTable())
{
// sprmPFInTable
size += SprmUtils.addSprm((short)0x2416, newPAP.getFInTable(), null, sprmList);
size += SprmUtils.addSprm((short)0x2416, newPAP.getFInTable(), sprmList);
}
if (newPAP.getFTtp() != oldPAP.getFTtp())
{
// sprmPFTtp
size += SprmUtils.addSprm((short)0x2417, newPAP.getFTtp(), null, sprmList);
size += SprmUtils.addSprm((short)0x2417, newPAP.getFTtp(), sprmList);
}
if (newPAP.getDxaAbs() != oldPAP.getDxaAbs())
{
@ -234,14 +234,14 @@ public final class ParagraphSprmCompressor
}
if (newPAP.getFNoAutoHyph() != oldPAP.getFNoAutoHyph())
{
size += SprmUtils.addSprm((short)0x242A, newPAP.getFNoAutoHyph(), null, sprmList);
size += SprmUtils.addSprm((short)0x242A, newPAP.getFNoAutoHyph(), sprmList);
}
if (newPAP.getDyaHeight() != oldPAP.getDyaHeight() ||
newPAP.getFMinHeight() != oldPAP.getFMinHeight())
{
// sprmPWHeightAbs
short val = (short)newPAP.getDyaHeight();
if (newPAP.getFMinHeight() > 0)
if (newPAP.getFMinHeight())
{
val |= 0x8000;
}
@ -270,12 +270,12 @@ public final class ParagraphSprmCompressor
if (newPAP.getFLocked() != oldPAP.getFLocked())
{
// sprmPFLocked
size += SprmUtils.addSprm((short)0x2430, newPAP.getFLocked(), null, sprmList);
size += SprmUtils.addSprm((short)0x2430, newPAP.getFLocked(), sprmList);
}
if (newPAP.getFWidowControl() != oldPAP.getFWidowControl())
{
// sprmPFWidowControl
size += SprmUtils.addSprm((short)0x2431, newPAP.getFWidowControl(), null, sprmList);
size += SprmUtils.addSprm((short)0x2431, newPAP.getFWidowControl(), sprmList);
}
if (newPAP.getFKinsoku() != oldPAP.getFKinsoku())
{
@ -283,23 +283,23 @@ public final class ParagraphSprmCompressor
}
if (newPAP.getFWordWrap() != oldPAP.getFWordWrap())
{
size += SprmUtils.addSprm((short)0x2434, newPAP.getFWordWrap(), null, sprmList);
size += SprmUtils.addSprm((short)0x2434, newPAP.getFWordWrap(), sprmList);
}
if (newPAP.getFOverflowPunct() != oldPAP.getFOverflowPunct())
{
size += SprmUtils.addSprm((short)0x2435, newPAP.getFOverflowPunct(), null, sprmList);
size += SprmUtils.addSprm((short)0x2435, newPAP.getFOverflowPunct(), sprmList);
}
if (newPAP.getFTopLinePunct() != oldPAP.getFTopLinePunct())
{
size += SprmUtils.addSprm((short)0x2436, newPAP.getFTopLinePunct(), null, sprmList);
size += SprmUtils.addSprm((short)0x2436, newPAP.getFTopLinePunct(), sprmList);
}
if (newPAP.getFAutoSpaceDE() != oldPAP.getFAutoSpaceDE())
{
size += SprmUtils.addSprm((short)0x2437, newPAP.getFAutoSpaceDE(), null, sprmList);
size += SprmUtils.addSprm((short)0x2437, newPAP.getFAutoSpaceDE(), sprmList);
}
if (newPAP.getFAutoSpaceDN() != oldPAP.getFAutoSpaceDN())
{
size += SprmUtils.addSprm((short)0x2438, newPAP.getFAutoSpaceDN(), null, sprmList);
size += SprmUtils.addSprm((short)0x2438, newPAP.getFAutoSpaceDN(), sprmList);
}
if (newPAP.getWAlignFont() != oldPAP.getWAlignFont())
{
@ -337,7 +337,7 @@ public final class ParagraphSprmCompressor
{
// sprmPPropRMark
byte[] buf = new byte[7];
buf[0] = (byte)newPAP.getFPropRMark();
buf[0] = (byte) ( newPAP.getFPropRMark() ? 1 : 0 );
LittleEndian.putShort(buf, 1, (short)newPAP.getIbstPropRMark());
newPAP.getDttmPropRMark().serialize(buf, 3);
size += SprmUtils.addSprm((short)0xC63F, 0, buf, sprmList);
@ -350,12 +350,12 @@ public final class ParagraphSprmCompressor
if (newPAP.getFBiDi() != oldPAP.getFBiDi())
{
// sprmPFBiDi
size += SprmUtils.addSprm((short)0x2441, newPAP.getFBiDi(), null, sprmList);
size += SprmUtils.addSprm((short)0x2441, newPAP.getFBiDi(), sprmList);
}
if (newPAP.getFNumRMIns() != oldPAP.getFNumRMIns())
{
// sprmPFNumRMIns
size += SprmUtils.addSprm((short)0x2443, newPAP.getFNumRMIns(), null, sprmList);
size += SprmUtils.addSprm((short)0x2443, newPAP.getFNumRMIns(), sprmList);
}
if (!Arrays.equals(newPAP.getNumrm(), oldPAP.getNumrm()))
{
@ -365,12 +365,12 @@ public final class ParagraphSprmCompressor
if (newPAP.getFInnerTableCell() != oldPAP.getFInnerTableCell())
{
// sprmPFInnerTableCell
size += SprmUtils.addSprm((short)0x244b, newPAP.getFInnerTableCell(), null, sprmList);
size += SprmUtils.addSprm((short)0x244b, newPAP.getFInnerTableCell(), sprmList);
}
if (newPAP.getFTtpEmbedded() != oldPAP.getFTtpEmbedded())
{
// sprmPFInnerTtp
size += SprmUtils.addSprm((short)0x244c, newPAP.getFTtpEmbedded(), null, sprmList);
size += SprmUtils.addSprm((short)0x244c, newPAP.getFTtpEmbedded(), sprmList);
}
// Page 55 of public specification begins

View File

@ -64,7 +64,7 @@ public final class ParagraphSprmUncompressor
// PAPXs can contain table sprms if the paragraph marks the end of a
// table row
if (sprm.getType() == SprmOperation.PAP_TYPE)
if (sprm.getType() == SprmOperation.TYPE_PAP)
{
try
{
@ -135,16 +135,16 @@ public final class ParagraphSprmUncompressor
newPAP.setJc ((byte) sprm.getOperand());
break;
case 0x4:
newPAP.setFSideBySide ((byte) sprm.getOperand());
newPAP.setFSideBySide (sprm.getOperand() != 0);
break;
case 0x5:
newPAP.setFKeep ((byte) sprm.getOperand());
newPAP.setFKeep (sprm.getOperand() != 0);
break;
case 0x6:
newPAP.setFKeepFollow ((byte) sprm.getOperand());
newPAP.setFKeepFollow (sprm.getOperand() != 0);
break;
case 0x7:
newPAP.setFPageBreakBefore ((byte) sprm.getOperand());
newPAP.setFPageBreakBefore (sprm.getOperand() != 0);
break;
case 0x8:
newPAP.setBrcl ((byte) sprm.getOperand());
@ -159,7 +159,7 @@ public final class ParagraphSprmUncompressor
newPAP.setIlfo (sprm.getOperand());
break;
case 0xc:
newPAP.setFNoLnn ((byte) sprm.getOperand());
newPAP.setFNoLnn (sprm.getOperand() != 0);
break;
case 0xd:
/**handle tabs . variable parameter. seperate processing needed*/
@ -195,10 +195,10 @@ public final class ParagraphSprmUncompressor
break;
case 0x16:
// sprmPFInTable -- 0x2416
newPAP.setFInTable( (byte) sprm.getOperand() );
newPAP.setFInTable( sprm.getOperand() != 0);
break;
case 0x17:
newPAP.setFTtp ((byte) sprm.getOperand());
newPAP.setFTtp ( sprm.getOperand() != 0);
break;
case 0x18:
newPAP.setDxaAbs (sprm.getOperand());
@ -274,7 +274,7 @@ public final class ParagraphSprmUncompressor
newPAP.setBrcBar (new BorderCode(sprm.getGrpprl(), sprm.getGrpprlOffset()));
break;
case 0x2a:
newPAP.setFNoAutoHyph ((byte) sprm.getOperand());
newPAP.setFNoAutoHyph (sprm.getOperand() != 0);
break;
case 0x2b:
newPAP.setDyaHeight (sprm.getOperand());
@ -292,32 +292,32 @@ public final class ParagraphSprmUncompressor
newPAP.setDxaFromText (sprm.getOperand());
break;
case 0x30:
newPAP.setFLocked ((byte) sprm.getOperand());
newPAP.setFLocked (sprm.getOperand() != 0);
break;
case 0x31:
newPAP.setFWidowControl ((byte) sprm.getOperand());
newPAP.setFWidowControl (sprm.getOperand() != 0);
break;
case 0x32:
//undocumented
break;
case 0x33:
newPAP.setFKinsoku ((byte) sprm.getOperand());
newPAP.setFKinsoku (sprm.getOperand() != 0);
break;
case 0x34:
newPAP.setFWordWrap ((byte) sprm.getOperand());
newPAP.setFWordWrap (sprm.getOperand() != 0);
break;
case 0x35:
newPAP.setFOverflowPunct ((byte) sprm.getOperand());
newPAP.setFOverflowPunct (sprm.getOperand() != 0);
break;
case 0x36:
newPAP.setFTopLinePunct ((byte) sprm.getOperand());
newPAP.setFTopLinePunct (sprm.getOperand() != 0);
break;
case 0x37:
newPAP.setFAutoSpaceDE ((byte) sprm.getOperand());
newPAP.setFAutoSpaceDE (sprm.getOperand() != 0);
break;
case 0x38:
newPAP.setFAutoSpaceDN ((byte) sprm.getOperand());
newPAP.setFAutoSpaceDN (sprm.getOperand() != 0);
break;
case 0x39:
newPAP.setWAlignFont (sprm.getOperand());
@ -344,7 +344,7 @@ public final class ParagraphSprmUncompressor
{
byte[] varParam = sprm.getGrpprl();
int offset = sprm.getGrpprlOffset();
newPAP.setFPropRMark (varParam[offset]);
newPAP.setFPropRMark (varParam[offset] != 0 );
newPAP.setIbstPropRMark (LittleEndian.getShort (varParam, offset + 1));
newPAP.setDttmPropRMark (new DateAndTime(varParam, offset + 3));
}
@ -364,12 +364,12 @@ public final class ParagraphSprmUncompressor
break;
case 0x41:
// sprmPFBiDi
newPAP.setFBiDi((byte) sprm.getOperand());
newPAP.setFBiDi(sprm.getOperand() != 0);
break;
case 0x43:
//pap.fNumRMIns
newPAP.setFNumRMIns ((byte) sprm.getOperand());
newPAP.setFNumRMIns (sprm.getOperand() != 0);
break;
case 0x44:
@ -389,10 +389,10 @@ public final class ParagraphSprmUncompressor
break;
case 0x47:
newPAP.setFUsePgsuSettings ((byte) sprm.getOperand());
newPAP.setFUsePgsuSettings (sprm.getOperand() != 0);
break;
case 0x48:
newPAP.setFAdjustRight ((byte) sprm.getOperand());
newPAP.setFAdjustRight (sprm.getOperand() != 0);
break;
case 0x49:
// sprmPItap -- 0x6649
@ -404,11 +404,11 @@ public final class ParagraphSprmUncompressor
break;
case 0x4b:
// sprmPFInnerTableCell -- 0x244b
newPAP.setFInnerTableCell( (byte) sprm.getOperand() );
newPAP.setFInnerTableCell( sprm.getOperand() != 0);
break;
case 0x4c:
// sprmPFInnerTtp -- 0x244c
newPAP.setFTtpEmbedded( (byte) sprm.getOperand() );
newPAP.setFTtpEmbedded( sprm.getOperand() != 0);
break;
case 0x61:
// sprmPJc

View File

@ -199,6 +199,17 @@ public final class SprmBuffer implements Cloneable
addSprm(opcode, operand);
}
public void updateSprm( short opcode, boolean operand )
{
int grpprlOffset = findSprmOffset( opcode );
if ( grpprlOffset != -1 )
{
_buf[grpprlOffset] = (byte) ( operand ? 1 : 0 );
return;
}
addSprm( opcode, operand ? 1 : 0 );
}
public void updateSprm(short opcode, int operand)
{
int grpprlOffset = findSprmOffset(opcode);

View File

@ -50,6 +50,12 @@ public final class SprmUtils
return sprm.length;
}
public static int addSprm( short instruction, boolean param,
List<byte[]> list )
{
return addSprm( instruction, param ? 1 : 0, null, list );
}
public static int addSprm(short instruction, int param, byte[] varParam, List<byte[]> list)
{
int type = (instruction & 0xe000) >> 13;

View File

@ -124,7 +124,7 @@ public class Paragraph extends Range implements Cloneable {
public boolean isInTable()
{
return _props.getFInTable() != 0;
return _props.getFInTable();
}
/**
@ -133,7 +133,7 @@ public class Paragraph extends Range implements Cloneable {
*/
public boolean isTableRowEnd()
{
return _props.getFTtp() != 0 || _props.getFTtpEmbedded() != 0;
return _props.getFTtp() || _props.getFTtpEmbedded();
}
public int getTableLevel()
@ -147,7 +147,7 @@ public class Paragraph extends Range implements Cloneable {
*/
public boolean isEmbeddedCellMark()
{
return _props.getFInnerTableCell() != 0;
return _props.getFInnerTableCell();
}
public int getJustification()
@ -163,86 +163,79 @@ public class Paragraph extends Range implements Cloneable {
public boolean keepOnPage()
{
return _props.getFKeep() != 0;
return _props.getFKeep();
}
public void setKeepOnPage(boolean fKeep)
{
byte keep = (byte)(fKeep ? 1 : 0);
_props.setFKeep(keep);
_papx.updateSprm(SPRM_FKEEP, keep);
_props.setFKeep(fKeep);
_papx.updateSprm(SPRM_FKEEP, fKeep);
}
public boolean keepWithNext()
{
return _props.getFKeepFollow() != 0;
return _props.getFKeepFollow();
}
public void setKeepWithNext(boolean fKeepFollow)
{
byte keepFollow = (byte)(fKeepFollow ? 1 : 0);
_props.setFKeepFollow(keepFollow);
_papx.updateSprm(SPRM_FKEEPFOLLOW, keepFollow);
_props.setFKeepFollow(fKeepFollow);
_papx.updateSprm(SPRM_FKEEPFOLLOW, fKeepFollow);
}
public boolean pageBreakBefore()
{
return _props.getFPageBreakBefore() != 0;
return _props.getFPageBreakBefore();
}
public void setPageBreakBefore(boolean fPageBreak)
{
byte pageBreak = (byte)(fPageBreak ? 1 : 0);
_props.setFPageBreakBefore(pageBreak);
_papx.updateSprm(SPRM_FPAGEBREAKBEFORE, pageBreak);
_props.setFPageBreakBefore(fPageBreak);
_papx.updateSprm(SPRM_FPAGEBREAKBEFORE, fPageBreak);
}
public boolean isLineNotNumbered()
{
return _props.getFNoLnn() != 0;
return _props.getFNoLnn();
}
public void setLineNotNumbered(boolean fNoLnn)
{
byte noLnn = (byte)(fNoLnn ? 1 : 0);
_props.setFNoLnn(noLnn);
_papx.updateSprm(SPRM_FNOLINENUMB, noLnn);
_props.setFNoLnn(fNoLnn);
_papx.updateSprm(SPRM_FNOLINENUMB, fNoLnn);
}
public boolean isSideBySide()
{
return _props.getFSideBySide() != 0;
return _props.getFSideBySide();
}
public void setSideBySide(boolean fSideBySide)
{
byte sideBySide = (byte)(fSideBySide ? 1 : 0);
_props.setFSideBySide(sideBySide);
_papx.updateSprm(SPRM_FSIDEBYSIDE, sideBySide);
_props.setFSideBySide(fSideBySide);
_papx.updateSprm(SPRM_FSIDEBYSIDE, fSideBySide);
}
public boolean isAutoHyphenated()
{
return _props.getFNoAutoHyph() == 0;
return !_props.getFNoAutoHyph();
}
public void setAutoHyphenated(boolean autoHyph)
{
byte auto = (byte)(!autoHyph ? 1 : 0);
_props.setFNoAutoHyph(auto);
_papx.updateSprm(SPRM_FNOAUTOHYPH, auto);
_props.setFNoAutoHyph(!autoHyph);
_papx.updateSprm(SPRM_FNOAUTOHYPH, !autoHyph);
}
public boolean isWidowControlled()
{
return _props.getFWidowControl() != 0;
return _props.getFWidowControl();
}
public void setWidowControl(boolean widowControl)
{
byte widow = (byte)(widowControl ? 1 : 0);
_props.setFWidowControl(widow);
_papx.updateSprm(SPRM_FWIDOWCONTROL, widow);
_props.setFWidowControl(widowControl);
_papx.updateSprm(SPRM_FWIDOWCONTROL, widowControl);
}
public int getIndentFromRight()
@ -313,26 +306,24 @@ public class Paragraph extends Range implements Cloneable {
public boolean isKinsoku()
{
return _props.getFKinsoku() != 0;
return _props.getFKinsoku();
}
public void setKinsoku(boolean kinsoku)
{
byte kin = (byte)(kinsoku ? 1 : 0);
_props.setFKinsoku(kin);
_papx.updateSprm(SPRM_FKINSOKU, kin);
_props.setFKinsoku(kinsoku);
_papx.updateSprm(SPRM_FKINSOKU, kinsoku);
}
public boolean isWordWrapped()
{
return _props.getFWordWrap() != 0;
return _props.getFWordWrap();
}
public void setWordWrapped(boolean wrap)
{
byte wordWrap = (byte)(wrap ? 1 : 0);
_props.setFWordWrap(wordWrap);
_papx.updateSprm(SPRM_FWORDWRAP, wordWrap);
_props.setFWordWrap(wrap);
_papx.updateSprm(SPRM_FWORDWRAP, wrap);
}
public int getFontAlignment()
@ -476,12 +467,12 @@ public class Paragraph extends Range implements Cloneable {
void setTableRowEnd(TableProperties props)
{
setTableRowEnd((byte)1);
setTableRowEnd(true);
byte[] grpprl = TableSprmCompressor.compressTableProperty(props);
_papx.append(grpprl);
}
private void setTableRowEnd(byte val)
private void setTableRowEnd(boolean val)
{
_props.setFTtp(val);
_papx.updateSprm(SPRM_FTTP, val);

View File

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

View File

@ -24,90 +24,107 @@
<author>S. Ryan Ackley</author>
<fields>
<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="boolean" size="1" name="fSideBySide"/>
<field type="boolean" size="1" name="fKeep"/>
<field type="boolean" size="1" name="fKeepFollow"/>
<field type="boolean" 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="brcl" description="Border line style">
<const type="byte" value="0" name="SINGLE"/>
<const type="byte" value="1" name="THICK"/>
<const type="byte" value="2" name="DOUBLE"/>
<const type="byte" value="3" name="SHADOW"/>
</field>
<field type="byte" size="1" name="brcp" description="Rectangle border codes">
<const type="byte" value="0" name="NONE"/>
<const type="byte" value="1" name="BORDER_ABOVE"/>
<const type="byte" value="2" name="BORDER_BELOW"/>
<const type="byte" value="15" name="BOX_AROUND"/>
<const type="byte" value="16" name="BAR_TO_LEFT_OF_PARAGRAPH"/>
</field>
<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="boolean" size="1" name="fNoLnn" description="No line numbering"/>
<field type="LineSpacingDescriptor" size="4" name="lspd" description="Line spacing descriptor"/>
<field type="LineSpacingDescriptor" size="4" default="new LineSpacingDescriptor()" 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="boolean" size="1" name="fInTable" description="Paragraph is in table flag"/>
<field type="boolean" size="1" name="finTableW97" description="Archaic paragraph is in table flag"/>
<field type="boolean" 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="boolean" size="1" name="fBrLnAbove"/>
<field type="boolean" size="1" name="fBrLnBelow"/>
<field type="byte" size="1" name="pcVert"/>
<field type="byte" size="1" name="pcHorz"/>
<field type="byte" size="1" name="wr"/>
<field type="byte" size="1" name="fNoAutoHyph"/>
<field type="boolean" size="1" name="fNoAutoHyph"/>
<!-- wHeightAbs? -->
<field type="int" size="2" name="dyaHeight"/>
<field type="byte" size="1" name="fMinHeight"/>
<field type="boolean" size="1" name="fMinHeight" description="Minimum height is exact or auto">
<const type="boolean" value="false" name="EXACT"/>
<const type="boolean" value="true" name="AT_LEAST"/>
</field>
<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="fKinsoku"/>
<field type="byte" size="1" name="fWordWrap"/>
<field type="byte" size="1" name="fOverflowPunct"/>
<field type="byte" size="1" name="fTopLinePunct"/>
<field type="byte" size="1" name="fAutoSpaceDE"/>
<field type="byte" size="1" name="fAutoSpaceDN"/>
<field type="int" size="2" name="wAlignFont"/>
<field type="short" size="2" name="fontAlign">
<field type="boolean" size="1" name="fLocked" description="Anchor of an absolutely positioned frame is locked"/>
<field type="boolean" size="1" default="true" name="fWidowControl" description="1, Word will prevent widowed lines in this paragraph from being placed at the beginning of a page"/>
<field type="boolean" size="1" name="fKinsoku" description="apply Kinsoku rules when performing line wrapping"/>
<field type="boolean" size="1" name="fWordWrap" description="perform word wrap"/>
<field type="boolean" size="1" name="fOverflowPunct" description="apply overflow punctuation rules when performing line wrapping"/>
<field type="boolean" size="1" name="fTopLinePunct" description="perform top line punctuation processing"/>
<field type="boolean" size="1" name="fAutoSpaceDE" description="auto space East Asian and alphabetic characters"/>
<field type="boolean" size="1" name="fAutoSpaceDN" description="auto space East Asian and numeric characters"/>
<field type="int" size="2" name="wAlignFont">
<const type="byte" value="0" name="HANGING"/>
<const type="byte" value="1" name="CENTERED"/>
<const type="byte" value="2" name="ROMAN"/>
<const type="byte" value="3" name="VARIABLE"/>
<const type="byte" value="4" name="AUTO"/>
</field>
<field type="short" size="2" name="fontAlign" description="Used internally by Word">
<bit number="0" mask="0x0001" name="fVertical"/>
<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="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"/>
<field type="byte" size="1" default="9" name="lvl" description="Outline level"/>
<field type="boolean" size="1" name="fBiDi"/>
<field type="boolean" size="1" name="fNumRMIns"/>
<field type="boolean" size="1" name="fCrLf"/>
<field type="boolean" size="1" name="fUsePgsuSettings"/>
<field type="boolean" size="1" name="fAdjustRight"/>
<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"/>
<field type="boolean" 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="boolean" 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="boolean" 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"/>
<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="boolean" size="1" name="fDyaBeforeAuto" description="Vertical spacing before is automatic"/>
<field type="boolean" size="1" name="fDyaAfterAuto" description="Vertical spacing after is automatic"/>
<field type="int" size="4" name="dxaRight"/>
<field type="int" size="4" name="dxaLeft"/>
@ -115,7 +132,7 @@
<field type="byte" size="1" name="jc"/>
<field type="byte" size="1" name="fNoAllowOverlap"/>
<field type="boolean" size="1" name="fNoAllowOverlap"/>
<field type="BorderCode" size="4" name="brcTop"/>
<field type="BorderCode" size="4" name="brcLeft"/>
@ -127,7 +144,7 @@
<field type="ShadingDescriptor" size="2" name="shd"/>
<field type="byte[]" size="84" name="anld"/>
<field type="byte[]" size="12" name="phe"/>
<field type="int" size="1" name="fPropRMark"/>
<field type="boolean" size="1" name="fPropRMark"/>
<field type="int" size="2" name="ibstPropRMark"/>
<field type="DateAndTime" size="4" name="dttmPropRMark"/>

View File

@ -82,6 +82,33 @@ public abstract class </xsl:text><xsl:value-of select="@name"/><xsl:text>Abstrac
<xsl:text>;</xsl:text>
<xsl:call-template name="linebreak"/>
</xsl:if>
<xsl:choose>
<xsl:when test="@type='boolean'"/>
<xsl:when test="@type='byte'"/>
<xsl:when test="@type='int'"/>
<xsl:when test="@type='short'"/>
<xsl:when test="@type='long'"/>
<xsl:when test="substring(@type, string-length(@type) - 1) = '[]'">
<xsl:call-template name="indent"/>
<xsl:call-template name="indent"/>
<xsl:text>this.</xsl:text>
<xsl:value-of select="recutil:getFieldName(position(),@name,0)"/>
<xsl:text> = new </xsl:text>
<xsl:value-of select="substring(@type, 0, string-length(@type) - 1)"/>
<xsl:text>[0];</xsl:text>
<xsl:call-template name="linebreak"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="indent"/>
<xsl:call-template name="indent"/>
<xsl:text>this.</xsl:text>
<xsl:value-of select="recutil:getFieldName(position(),@name,0)"/>
<xsl:text> = new </xsl:text>
<xsl:value-of select="@type"/>
<xsl:text>();</xsl:text>
<xsl:call-template name="linebreak"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:call-template name="indent"/>
<xsl:text>}</xsl:text>
@ -275,11 +302,19 @@ public abstract class </xsl:text><xsl:value-of select="@name"/><xsl:text>Abstrac
<xsl:text>builder.append(" (").append(get</xsl:text>
<xsl:value-of select="recutil:getFieldName1stCap(@name,0)"/>
<xsl:text>()).append(" )\n");</xsl:text>
<xsl:apply-templates select="bit" mode="bittostring"/>
<xsl:call-template name="linebreak"/>
<xsl:apply-templates select="bit" mode="bittostring"/>
</xsl:template>
<xsl:template match="bit" mode="bittostring"> buffer.append(" .<xsl:value-of select="recutil:getFieldName(@name,20)"/> = ").append(<xsl:value-of select="recutil:getBitFieldFunction(@name, @mask, ../@type, 'false')"/>()).append('\n');
<xsl:template match="bit" mode="bittostring">
<xsl:call-template name="indent"/>
<xsl:call-template name="indent"/>
<xsl:text>builder.append(" .</xsl:text>
<xsl:value-of select="recutil:getFieldName(@name,20)"/>
<xsl:text> = ").append(</xsl:text>
<xsl:value-of select="recutil:getBitFieldFunction(@name, @mask, ../@type, 'false')"/>
<xsl:text>()).append('\n');</xsl:text>
<xsl:call-template name="linebreak"/>
</xsl:template>
<xsl:template match="author">