poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ye...@apache.org
Subject svn commit: r1137143 [2/2] - in /poi/trunk/src: documentation/content/xdocs/ scratchpad/src/org/apache/poi/hwpf/model/types/ scratchpad/src/org/apache/poi/hwpf/sprm/ scratchpad/src/org/apache/poi/hwpf/usermodel/ types/definitions/
Date Sat, 18 Jun 2011 08:57:11 GMT
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ParagraphProperties.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ParagraphProperties.java?rev=1137143&r1=1137142&r2=1137143&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ParagraphProperties.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ParagraphProperties.java Sat
Jun 18 08:57:10 2011
@@ -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();
-
-  }
-
-  public int getJustification()
-  {
-    return super.getJc();
-  }
-
-  public void setJustification(byte jc)
-  {
-    super.setJc(jc);
-  }
-
-  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
-  {
-    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;
-  }
+    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() {
+        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 {
+        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;
+    }
 
 }

Modified: poi/trunk/src/types/definitions/pap_type.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/types/definitions/pap_type.xml?rev=1137143&r1=1137142&r2=1137143&view=diff
==============================================================================
--- poi/trunk/src/types/definitions/pap_type.xml (original)
+++ poi/trunk/src/types/definitions/pap_type.xml Sat Jun 18 08:57:10 2011
@@ -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"/>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message