diff --git a/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/CharacterProperties.java b/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/CharacterProperties.java index 22893e43f..387f6f4a8 100644 --- a/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/CharacterProperties.java +++ b/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/CharacterProperties.java @@ -55,162 +55,41 @@ package org.apache.poi.hdf.model.hdftypes; - +import org.apache.poi.hdf.model.hdftypes.definitions.CHPAbstractType; /** - * Comment me + * Properties for character runs. * * @author Ryan Ackley */ -public class CharacterProperties implements Cloneable, HDFType +public class CharacterProperties extends CHPAbstractType implements Cloneable { - public boolean _bold; - public boolean _italic; - public boolean _fRMarkDel; - public boolean _fOutline; - public boolean _fSmallCaps; - public boolean _fCaps; - public boolean _fVanish; - public boolean _fRMark; - public boolean _fSpec; - public boolean _fStrike; - public boolean _fObj; - public boolean _fShadow; - public boolean _fLowerCase; - public boolean _fData; - public boolean _fOle2; - public boolean _fEmboss; - public boolean _fImprint; - public boolean _fDStrike; - - public short _ftcAscii; - public short _ftcFE; - public short _ftcOther; - public short _ftc; - public int _hps;//font size in half points - public int _dxaSpace;//space following each character in the run expressed in twip units - public byte _iss;//superscript/subscript indices 0 means no super/subscripting 1 means text in run is superscripted 2 means text in run is subscripted - public byte _kul;//underline code see spec - public byte _ico;//color of text see spec - public short _hpsPos;//super/subscript position in half points; positive means text is raised; negative means text is lowered - public short _lidDefault;//language for non-Far East text - public short _lidFE;//language for Far East text - public byte _idctHint; - public int _wCharScale; - public short _chse; - - public int _specialFC;//varies depending on whether this is a special char - public short _ibstRMark;//index to author IDs stored in hsttbfRMark. used when text in run was newly typed when revision marking was enabled - public short _ibstRMarkDel;//index to author IDs stored in hsttbfRMark. used when text in run was newly typed when revision marking was enabled - public int[] _dttmRMark = new int[2];//Date/time at which this run of text was - public int[] _dttmRMarkDel = new int[2];//entered/modified by the author. (Only - //recorded when revision marking is on.)Date/time at which this run of text was deleted by the author. (Only recorded when revision marking is on.) - public int _istd; - public int _baseIstd = -1; - public int _fcPic; - public short _ftcSym;// see spec - public short _xchSym;//see spec - public byte _ysr;//hyphenation rules - public byte _chYsr;//used for hyphenation see spec - public int _hpsKern;//kerning distance for characters in run recorded in half points - public int _fcObj; - public byte _icoHighlight;//highlight color - public boolean _fChsDiff; - public boolean _highlighted;//when true characters are highlighted with color specified by chp.icoHighlight - public boolean _fPropMark;//when true, properties have been changed with revision marking on - public short _ibstPropRMark;//index to author IDs stored in hsttbfRMark. used when properties have been changed when revision marking was enabled - public int _dttmPropRMark;//Date/time at which properties of this were changed for this run of text by the author - public byte _sfxtText;//text animation see spec - public boolean _fDispFldRMark;//see spec - public short _ibstDispFldRMark;//Index to author IDs stored in hsttbfRMark. used when ListNum field numbering has been changed when revision marking was enabled - public int _dttmDispFldRMark;//The date for the ListNum field number change - public byte[] _xstDispFldRMark = new byte[32];//The string value of the ListNum field when revision mark tracking began - public short _shd;//shading - public short[] _brc = new short[2];//border - public short _paddingStart = 0; - public short _paddingEnd = 0; public CharacterProperties() { - _istd = 10; - _hps = 20; - _lidDefault = 0x0400; - _lidFE = 0x0400; - + setDttmRMark(new short[2]); + setDttmRMarkDel(new short[2]); + setXstDispFldRMark(new byte[32]); + setBrc(new short[2]);; + setHps(20); + setFcPic(-1); + setIstd(10); + setLidFE(0x0400); + setLidDefault(0x0400); + setWCharScale(100); + //setFUsePgsuSettings(-1); } - public void copy(CharacterProperties toCopy) - { - _bold = toCopy._bold; - _italic = toCopy._italic; - _fRMarkDel = toCopy._fRMarkDel; - _fOutline = toCopy._fOutline; - _fSmallCaps = toCopy._fSmallCaps; - _fCaps = toCopy._fCaps; - _fVanish = toCopy._fVanish; - _fRMark = toCopy._fRMark; - _fSpec = toCopy._fSpec; - _fStrike = toCopy._fStrike; - _fObj = toCopy._fObj; - _fShadow = toCopy._fShadow; - _fLowerCase = toCopy._fLowerCase; - _fData = toCopy._fData; - _fOle2 = toCopy._fOle2; - _fEmboss = toCopy._fEmboss; - _fImprint = toCopy._fImprint; - _fDStrike = toCopy._fDStrike; - - _ftcAscii = toCopy._ftcAscii; - _ftcFE = toCopy._ftcFE; - _ftcOther = toCopy._ftcOther; - _ftc = toCopy._ftc; - _hps = toCopy._hps; - _dxaSpace = toCopy._dxaSpace; - _iss = toCopy._iss; - _kul = toCopy._kul; - _ico = toCopy._ico; - _hpsPos = toCopy._hpsPos; - _lidDefault = toCopy._lidDefault; - _lidFE = toCopy._lidFE; - _idctHint = toCopy._idctHint; - _wCharScale = toCopy._wCharScale; - _chse = toCopy._chse; - - _specialFC = toCopy._specialFC; - _ibstRMark = toCopy._ibstRMark; - _ibstRMarkDel = toCopy._ibstRMarkDel; - _dttmRMark = toCopy._dttmRMark; - _dttmRMarkDel = toCopy._dttmRMarkDel; - - _istd = toCopy._istd; - _baseIstd = toCopy._baseIstd; - _fcPic = toCopy._fcPic; - _ftcSym = toCopy._ftcSym; - _xchSym = toCopy._xchSym; - _ysr = toCopy._ysr; - _chYsr = toCopy._chYsr; - _hpsKern = toCopy._hpsKern; - _fcObj = toCopy._fcObj; - _icoHighlight = toCopy._icoHighlight; - _fChsDiff = toCopy._fChsDiff; - _highlighted = toCopy._highlighted; - _fPropMark = toCopy._fPropMark; - _ibstPropRMark = toCopy._ibstPropRMark; - _dttmPropRMark = toCopy._dttmPropRMark; - _sfxtText = toCopy._sfxtText; - _fDispFldRMark = toCopy._fDispFldRMark; - _ibstDispFldRMark = toCopy._ibstDispFldRMark; - _dttmDispFldRMark = toCopy._dttmDispFldRMark; - _xstDispFldRMark = toCopy._xstDispFldRMark; - _shd = toCopy._shd; - _brc = toCopy._brc; - - } - + /** + * Used to make a deep copy of this object. + */ public Object clone() throws CloneNotSupportedException { CharacterProperties clone = (CharacterProperties)super.clone(); - clone._brc = new short[2]; - System.arraycopy(_brc, 0, clone._brc, 0, 2); + clone.setBrc(new short[2]); + System.arraycopy(getBrc(), 0, clone.getBrc(), 0, 2); + System.arraycopy(getDttmRMark(), 0, clone.getDttmRMark(), 0, 2); + System.arraycopy(getDttmRMarkDel(), 0, clone.getDttmRMarkDel(), 0, 2); + System.arraycopy(getXstDispFldRMark(), 0, clone.getXstDispFldRMark(), 0, 32); return clone; } } \ No newline at end of file diff --git a/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/ParagraphProperties.java b/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/ParagraphProperties.java index 15cc3ff0d..db74c8d22 100644 --- a/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/ParagraphProperties.java +++ b/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/ParagraphProperties.java @@ -55,114 +55,79 @@ package org.apache.poi.hdf.model.hdftypes; +import org.apache.poi.hdf.model.hdftypes.definitions.PAPAbstractType; /** * Comment me * * @author Ryan Ackley */ -public class ParagraphProperties implements Cloneable, HDFType +public class ParagraphProperties extends PAPAbstractType implements Cloneable { - public int _istd;//index to style descriptor. - public byte _jc;//justification code - public byte _fKeep;//keep entire paragraph on one page if possible - public byte _fKeepFollow;//keep paragraph on same page with next paragraph if possible - public byte _fPageBreakBefore;//start this paragraph on new page - public byte _positionByte;//multiple flags see spec; - public byte _brcp;//rectangle border codes for Macword 3.0 - public byte _brcl;//border line styles for Macword 3.0 - public byte _ilvl;//when non-zero, list level for this paragraph - public byte _fNoLnn;//no line numbering for this paragraph. (makes this an exception to the section property of line numbering) - public int _ilfo;//when non-zero, (1-based) index into the pllfo identifying the list to which the paragraph belongs - public byte _fSideBySide;//when 1, paragraph is a side by side paragraph - public byte _fNoAutoHyph;//when 0, text in paragraph may be auto hyphenated. - public byte _fWindowControl;//when 1, Word will prevent widowed lines in this paragraph from being placed at the beginning of a page - public int _dxaRight;//indent from right margin (signed). - public int _dxaLeft;//indent from left margin (signed) - public int _dxaLeft1;//first line indent; signed number relative to dxaLeft - public int[] _lspd = new int[2];//line spacing descriptor see spec - public int _dyaBefore;// vertical spacing before paragraph (unsigned) - public int _dyaAfter;//vertical spacing after paragraph (unsigned) - public byte[] _phe = new byte[12];//height of current paragraph - public byte _fCrLf;//undocumented - public byte _fUsePgsuSettings;//undocumented - public byte _fAdjustRight;//undocumented - public byte _fKinsoku;// when 1, apply kinsoku rules when performing line wrapping - public byte _fWordWrap;//when 1, perform word wrap - public byte _fOverflowPunct;//when 1, apply overflow punctuation rules when performing line wrapping - public byte _fTopLinePunct;//when 1, perform top line punctuation processing - public byte _fAutoSpaceDE;//when 1, auto space FE and alphabetic characters - public byte _fAutoSpaceDN;// when 1, auto space FE and numeric characters - public int _wAlignFont;//font alignment 0 Hanging 1 Centered 2 Roman 3 Variable 4 Auto - public short _fontAlign;//multiVal see Spec. - public byte _fInTable;//when 1, paragraph is contained in a table row - public byte _fTtp;//when 1, paragraph consists only of the row mark special character and marks the end of a table row - public byte _wr;//Wrap Code for absolute objects - public byte _fLocked;//when 1, paragraph may not be edited - public int _dxaAbs;//see spec - public int _dyaAbs;//see spec - public int _dxaWidth;//when not == 0, paragraph is constrained to be dxaWidth wide, independent of current margin or column settings - public short[] _brcTop = new short[2];//spec for border above paragraph - public short[] _brcLeft = new short[2];//specification for border to the left of - public short[] _brcBottom = new short[2];//paragraphspecification for border below - public short[] _brcRight = new short[2];//paragraphspecification for border to the - public short[] _brcBetween = new short[2];//right of paragraphsee spec - public short[] _brcBar = new short[2];//specification of border to place on - public short _brcTop1;//outside of text when facing pages are to be displayed.spec - public short _brcLeft1;//for border above paragraphspecification for border to the - public short _brcBottom1;//left ofparagraphspecification for border below - public short _brcRight1;//paragraphspecification for border to the - public short _brcBetween1;//right of paragraphsee spec - public short _brcBar1;//specification of border to place on outside of text when facing pages are to be displayed. - public int _dxaFromText;//horizontal distance to be maintained between an absolutely positioned paragraph and any non-absolute positioned text - public int _dyaFromText;//vertical distance to be maintained between an absolutely positioned paragraph and any non-absolute positioned text - public int _dyaHeight;//see spec - public int _shd;//shading - public int _dcs;//drop cap specifier - public byte[] _anld = new byte[84];//autonumber list descriptor (see ANLD definition) - public short _fPropRMark;//when 1, properties have been changed with revision marking on - public short _ibstPropRMark;//index to author IDs stored in hsttbfRMark. used when properties have been changed when revision marking was enabled - public byte[] _dttmPropRMark = new byte[4];//Date/time at which properties of this were changed for this run of text by the author. (Only recorded when revision marking is on.) - public byte[] _numrm = new byte[8];//paragraph numbering revision mark data (see NUMRM) - public short _itbdMac;//number of tabs stops defined for paragraph. Must be >= 0 and <= 64. - public ParagraphProperties() { - _fWindowControl = 1; + short[] lspd = new short[2]; + setFWidowControl((byte)1); //lspd[0] = 240; - _lspd[1] = 1; - _ilvl = 9; + lspd[1] = 1; + setIlvl((byte)9); + + setLspd(lspd); + setBrcBar(new short[2]); + setBrcBottom(new short[2]); + setBrcLeft(new short[2]); + setBrcBetween(new short[2]); + setBrcRight(new short[2]); + setBrcTop(new short[2]); + setPhe(new byte[12]); + setAnld(new byte[84]); + setDttmPropRMark(new byte[4]); + setNumrm(new byte[8]); + + } public Object clone() throws CloneNotSupportedException { ParagraphProperties clone = (ParagraphProperties)super.clone(); - clone._brcBar = new short[2]; - clone._brcBottom = new short[2]; - clone._brcLeft = new short[2]; - clone._brcBetween = new short[2]; - clone._brcRight = new short[2]; - clone._brcTop = new short[2]; - clone._lspd = new int[2]; - clone._phe = new byte[12]; - clone._anld = new byte[84]; - clone._dttmPropRMark = new byte[4]; - clone._numrm = new byte[8]; + short[] brcBar = new short[2]; + short[] brcBottom = new short[2]; + short[] brcLeft = new short[2]; + short[] brcBetween = new short[2]; + short[] brcRight = new short[2]; + short[] brcTop = new short[2]; + short[] lspd = new short[2]; + byte[] phe = new byte[12]; + byte[] anld = new byte[84]; + byte[] dttmPropRMark = new byte[4]; + byte[] numrm = new byte[8]; - System.arraycopy(_brcBar, 0, clone._brcBar, 0, 2); - System.arraycopy(_brcBottom, 0, clone._brcBottom, 0, 2); - System.arraycopy(_brcLeft, 0, clone._brcLeft, 0, 2); - System.arraycopy(_brcBetween, 0, clone._brcBetween, 0, 2); - System.arraycopy(_brcRight, 0, clone._brcRight, 0, 2); - System.arraycopy(_brcTop, 0, clone._brcTop, 0, 2); - System.arraycopy(_lspd, 0, clone._lspd, 0, 2); - System.arraycopy(_phe, 0, clone._phe, 0, 12); - System.arraycopy(_anld, 0, clone._anld, 0, 84); - System.arraycopy(_dttmPropRMark, 0, clone._dttmPropRMark, 0, 4); - System.arraycopy(_numrm, 0, clone._numrm, 0, 8); + System.arraycopy(getBrcBar(), 0, brcBar, 0, 2); + System.arraycopy(getBrcBottom(), 0, brcBottom, 0, 2); + System.arraycopy(getBrcLeft(), 0, brcLeft, 0, 2); + System.arraycopy(getBrcBetween(), 0, brcBetween, 0, 2); + System.arraycopy(getBrcRight(), 0, brcRight, 0, 2); + System.arraycopy(getBrcTop(), 0, brcTop, 0, 2); + System.arraycopy(getLspd(), 0, lspd, 0, 2); + System.arraycopy(getPhe(), 0, phe, 0, 12); + System.arraycopy(getAnld(), 0, anld, 0, 84); + System.arraycopy(getDttmPropRMark(), 0, dttmPropRMark, 0, 4); + System.arraycopy(getNumrm(), 0, numrm, 0, 8); + + clone.setBrcBar(brcBar); + clone.setBrcBottom(brcBottom); + clone.setBrcLeft(brcLeft); + clone.setBrcBetween(brcBetween); + clone.setBrcRight(brcRight); + clone.setBrcTop(brcTop); + clone.setLspd(lspd); + clone.setPhe(phe); + clone.setAnld(anld); + clone.setDttmPropRMark(dttmPropRMark); + clone.setNumrm(numrm); return clone; } diff --git a/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/SectionProperties.java b/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/SectionProperties.java index 009df8673..7564d1c68 100644 --- a/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/SectionProperties.java +++ b/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/SectionProperties.java @@ -55,15 +55,16 @@ package org.apache.poi.hdf.model.hdftypes; +import org.apache.poi.hdf.model.hdftypes.definitions.SEPAbstractType; /** * Comment me * * @author Ryan Ackley */ -public class SectionProperties implements HDFType +public class SectionProperties extends SEPAbstractType implements HDFType { - int _index; + /*int _index; byte _bkc; boolean _fTitlePage; boolean _fAutoPgn; @@ -111,28 +112,28 @@ public class SectionProperties implements HDFType int _dxaColumns; int[] _rgdxaColumnWidthSpacing; byte _dmOrientFirst; - byte[] _olstAnn; + byte[] _olstAnn;*/ public SectionProperties() { - _bkc = 2; - _dyaPgn = 720; - _dxaPgn = 720; - _fEndNote = true; - _fEvenlySpaced = true; - _xaPage = 12240; - _yaPage = 15840; - _dyaHdrTop = 720; - _dyaHdrBottom = 720; - _dmOrientPage = 1; - _dxaColumns = 720; - _dyaTop = 1440; - _dxaLeft = 1800; - _dyaBottom = 1440; - _dxaRight = 1800; - _pgnStart = 1; + setBkc((byte)2); + setDyaPgn(720); + setDxaPgn(720); + setFEndNote(true); + setFEvenlySpaced(true); + setXaPage(12240); + setYaPage(15840); + setDyaHdrTop(720); + setDyaHdrBottom(720); + setDmOrientPage((byte)1); + setDxaColumns(720); + setDyaTop(1440); + setDxaLeft(1800); + setDyaBottom(1440); + setDxaRight(1800); + setPgnStart(1); } } \ No newline at end of file diff --git a/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/StyleSheet.java b/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/StyleSheet.java index 7b464e3df..a7cb893ee 100644 --- a/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/StyleSheet.java +++ b/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/StyleSheet.java @@ -59,6 +59,7 @@ package org.apache.poi.hdf.model.hdftypes; import java.util.*; import org.apache.poi.util.LittleEndian; +import org.apache.poi.hdf.model.hdftypes.definitions.TCAbstractType; /** * Comment me * @@ -181,54 +182,56 @@ public class StyleSheet implements HDFType switch(operand) { case 0: - newCHP._fRMarkDel = getFlag(param); + newCHP.setFRMarkDel(getFlag(param)); break; case 0x1: - newCHP._fRMark = getFlag(param); + newCHP.setFRMark(getFlag(param)); break; case 0x2: break; case 0x3: - newCHP._fcPic = param; - newCHP._fSpec = true; + newCHP.setFcPic(param); + newCHP.setFSpec(true); break; case 0x4: - newCHP._ibstRMark = (short)param; + newCHP.setIbstRMark((short)param); break; case 0x5: - newCHP._dttmRMark[0] = LittleEndian.getShort(grpprl, (offset - 4)); - newCHP._dttmRMark[1] = LittleEndian.getShort(grpprl, (offset - 2)); + short[] dttmRMark = new short[2]; + dttmRMark[0] = LittleEndian.getShort(grpprl, (offset - 4)); + dttmRMark[1] = LittleEndian.getShort(grpprl, (offset - 2)); + newCHP.setDttmRMark(dttmRMark); break; case 0x6: - newCHP._fData = getFlag(param); + newCHP.setFData(getFlag(param)); break; case 0x7: //don't care about this break; case 0x8: short chsDiff = (short)((param & 0xff0000) >>> 8); - newCHP._fChsDiff = getFlag(chsDiff); - newCHP._chse = (short)(param & 0xffff); + newCHP.setFChsDiff(getFlag(chsDiff)); + newCHP.setChse((short)(param & 0xffff)); break; case 0x9: - newCHP._fSpec = true; - newCHP._ftcSym = (short)LittleEndian.getShort(varParam, 0); - newCHP._xchSym = (short)LittleEndian.getShort(varParam, 2); + newCHP.setFSpec(true); + newCHP.setFtcSym((short)LittleEndian.getShort(varParam, 0)); + newCHP.setXchSym((short)LittleEndian.getShort(varParam, 2)); break; case 0xa: - newCHP._fOle2 = getFlag(param); + newCHP.setFOle2(getFlag(param)); break; case 0xb: //? break; case 0xc: - newCHP._icoHighlight = (byte)param; - newCHP._highlighted = getFlag(param); + newCHP.setIcoHighlight((byte)param); + newCHP.setFHighlight(getFlag(param)); break; case 0xd: break; case 0xe: - newCHP._fcObj = param; + newCHP.setFcObj(param); break; case 0xf: break; @@ -298,246 +301,253 @@ public class StyleSheet implements HDFType case 0x2f: break; case 0x30: - newCHP._istd = param; + newCHP.setIstd(param); break; case 0x31: - //permutation vector for fast saves who cares! + //permutation vector for fast saves, who cares! break; case 0x32: - newCHP._bold = false; - newCHP._italic = false; - newCHP._fOutline = false; - newCHP._fStrike = false; - newCHP._fShadow = false; - newCHP._fSmallCaps = false; - newCHP._fCaps = false; - newCHP._fVanish = false; - newCHP._kul = 0; - newCHP._ico = 0; + newCHP.setFBold(false); + newCHP.setFItalic(false); + newCHP.setFOutline(false); + newCHP.setFStrike(false); + newCHP.setFShadow(false); + newCHP.setFSmallCaps(false); + newCHP.setFCaps(false); + newCHP.setFVanish(false); + newCHP.setKul((byte)0); + newCHP.setIco((byte)0); break; case 0x33: - newCHP.copy(oldCHP); + try + { + newCHP = (CharacterProperties)oldCHP.clone(); + } + catch(CloneNotSupportedException e) + { + //do nothing + } return; case 0x34: break; case 0x35: - newCHP._bold = getCHPFlag((byte)param, oldCHP._bold); + newCHP.setFBold(getCHPFlag((byte)param, oldCHP.isFBold())); break; case 0x36: - newCHP._italic = getCHPFlag((byte)param, oldCHP._italic); + newCHP.setFItalic(getCHPFlag((byte)param, oldCHP.isFItalic())); break; case 0x37: - newCHP._fStrike = getCHPFlag((byte)param, oldCHP._fStrike); + newCHP.setFStrike(getCHPFlag((byte)param, oldCHP.isFStrike())); break; case 0x38: - newCHP._fOutline = getCHPFlag((byte)param, oldCHP._fOutline); + newCHP.setFOutline(getCHPFlag((byte)param, oldCHP.isFOutline())); break; case 0x39: - newCHP._fShadow = getCHPFlag((byte)param, oldCHP._fShadow); + newCHP.setFShadow(getCHPFlag((byte)param, oldCHP.isFShadow())); break; case 0x3a: - newCHP._fSmallCaps = getCHPFlag((byte)param, oldCHP._fSmallCaps); + newCHP.setFSmallCaps(getCHPFlag((byte)param, oldCHP.isFSmallCaps())); break; case 0x3b: - newCHP._fCaps = getCHPFlag((byte)param, oldCHP._fCaps); + newCHP.setFCaps(getCHPFlag((byte)param, oldCHP.isFCaps())); break; case 0x3c: - newCHP._fVanish = getCHPFlag((byte)param, oldCHP._fVanish); + newCHP.setFVanish(getCHPFlag((byte)param, oldCHP.isFVanish())); break; case 0x3d: - newCHP._ftc = (short)param; + newCHP.setFtcAscii((short)param); break; case 0x3e: - newCHP._kul = (byte)param; + newCHP.setKul((byte)param); break; case 0x3f: int hps = param & 0xff; if(hps != 0) { - newCHP._hps = hps; + newCHP.setHps(hps); } byte cInc = (byte)(((byte)(param & 0xfe00) >>> 4) >> 1); if(cInc != 0) { - newCHP._hps = Math.max(newCHP._hps + (cInc * 2), 2); + newCHP.setHps(Math.max(newCHP.getHps() + (cInc * 2), 2)); } byte hpsPos = (byte)((param & 0xff0000) >>> 8); if(hpsPos != 0x80) { - newCHP._hpsPos = hpsPos; + newCHP.setHpsPos(hpsPos); } boolean fAdjust = (param & 0x0100) > 0; - if(fAdjust && hpsPos != 128 && hpsPos != 0 && oldCHP._hpsPos == 0) + if(fAdjust && hpsPos != 128 && hpsPos != 0 && oldCHP.getHpsPos() == 0) { - newCHP._hps = Math.max(newCHP._hps + (-2), 2); + newCHP.setHps(Math.max(newCHP.getHps() + (-2), 2)); } - if(fAdjust && hpsPos == 0 && oldCHP._hpsPos != 0) + if(fAdjust && hpsPos == 0 && oldCHP.getHpsPos() != 0) { - newCHP._hps = Math.max(newCHP._hps + 2, 2); + newCHP.setHps(Math.max(newCHP.getHps() + 2, 2)); } break; case 0x40: - newCHP._dxaSpace = param; + newCHP.setDxaSpace(param); break; case 0x41: - newCHP._lidDefault = (short)param; + newCHP.setLidDefault((short)param); break; case 0x42: - newCHP._ico = (byte)param; + newCHP.setIco((byte)param); break; case 0x43: - newCHP._hps = param; + newCHP.setHps(param); break; case 0x44: byte hpsLvl = (byte)param; - newCHP._hps = Math.max(newCHP._hps + (hpsLvl * 2), 2); + newCHP.setHps(Math.max(newCHP.getHps() + (hpsLvl * 2), 2)); break; case 0x45: - newCHP._hpsPos = (short)param; + newCHP.setHpsPos((short)param); break; case 0x46: if(param != 0) { - if(oldCHP._hpsPos == 0) + if(oldCHP.getHpsPos() == 0) { - newCHP._hps = Math.max(newCHP._hps + (-2), 2); + newCHP.setHps(Math.max(newCHP.getHps() + (-2), 2)); } } else { - if(oldCHP._hpsPos != 0) + if(oldCHP.getHpsPos() != 0) { - newCHP._hps = Math.max(newCHP._hps + 2, 2); + newCHP.setHps(Math.max(newCHP.getHps() + 2, 2)); } } break; case 0x47: CharacterProperties genCHP = new CharacterProperties(); - genCHP._ftc = 4; + genCHP.setFtcAscii(4); genCHP = (CharacterProperties)uncompressProperty(varParam, genCHP, styleSheet); - CharacterProperties styleCHP = styleSheet.getStyleDescription(oldCHP._baseIstd).getCHP(); - if(genCHP._bold == newCHP._bold) + CharacterProperties styleCHP = styleSheet.getStyleDescription(oldCHP.getBaseIstd()).getCHP(); + if(genCHP.isFBold() == newCHP.isFBold()) { - newCHP._bold = styleCHP._bold; + newCHP.setFBold(styleCHP.isFBold()); } - if(genCHP._italic == newCHP._italic) + if(genCHP.isFItalic() == newCHP.isFItalic()) { - newCHP._italic = styleCHP._italic; + newCHP.setFItalic(styleCHP.isFItalic()); } - if(genCHP._fSmallCaps == newCHP._fSmallCaps) + if(genCHP.isFSmallCaps() == newCHP.isFSmallCaps()) { - newCHP._fSmallCaps = styleCHP._fSmallCaps; + newCHP.setFSmallCaps(styleCHP.isFSmallCaps()); } - if(genCHP._fVanish == newCHP._fVanish) + if(genCHP.isFVanish() == newCHP.isFVanish()) { - newCHP._fVanish = styleCHP._fVanish; + newCHP.setFVanish(styleCHP.isFVanish()); } - if(genCHP._fStrike == newCHP._fStrike) + if(genCHP.isFStrike() == newCHP.isFStrike()) { - newCHP._fStrike = styleCHP._fStrike; + newCHP.setFStrike(styleCHP.isFStrike()); } - if(genCHP._fCaps == newCHP._fCaps) + if(genCHP.isFCaps() == newCHP.isFCaps()) { - newCHP._fCaps = styleCHP._fCaps; + newCHP.setFCaps(styleCHP.isFCaps()); } - if(genCHP._ftcAscii == newCHP._ftcAscii) + if(genCHP.getFtcAscii() == newCHP.getFtcAscii()) { - newCHP._ftcAscii = styleCHP._ftcAscii; + newCHP.setFtcAscii(styleCHP.getFtcAscii()); } - if(genCHP._ftcFE == newCHP._ftcFE) + if(genCHP.getFtcFE() == newCHP.getFtcFE()) { - newCHP._ftcFE = styleCHP._ftcFE; + newCHP.setFtcFE(styleCHP.getFtcFE()); } - if(genCHP._ftcOther == newCHP._ftcOther) + if(genCHP.getFtcOther() == newCHP.getFtcOther()) { - newCHP._ftcOther = styleCHP._ftcOther; + newCHP.setFtcOther(styleCHP.getFtcOther()); } - if(genCHP._hps == newCHP._hps) + if(genCHP.getHps() == newCHP.getHps()) { - newCHP._hps = styleCHP._hps; + newCHP.setHps(styleCHP.getHps()); } - if(genCHP._hpsPos == newCHP._hpsPos) + if(genCHP.getHpsPos() == newCHP.getHpsPos()) { - newCHP._hpsPos = styleCHP._hpsPos; + newCHP.setHpsPos(styleCHP.getHpsPos()); } - if(genCHP._kul == newCHP._kul) + if(genCHP.getKul() == newCHP.getKul()) { - newCHP._kul = styleCHP._kul; + newCHP.setKul(styleCHP.getKul()); } - if(genCHP._dxaSpace == newCHP._dxaSpace) + if(genCHP.getDxaSpace() == newCHP.getDxaSpace()) { - newCHP._dxaSpace = styleCHP._dxaSpace; + newCHP.setDxaSpace(styleCHP.getDxaSpace()); } - if(genCHP._ico == newCHP._ico) + if(genCHP.getIco() == newCHP.getIco()) { - newCHP._ico = styleCHP._ico; + newCHP.setIco(styleCHP.getIco()); } - if(genCHP._lidDefault == newCHP._lidDefault) + if(genCHP.getLidDefault() == newCHP.getLidDefault()) { - newCHP._lidDefault = styleCHP._lidDefault; + newCHP.setLidDefault(styleCHP.getLidDefault()); } - if(genCHP._lidFE == newCHP._lidFE) + if(genCHP.getLidFE() == newCHP.getLidFE()) { - newCHP._lidFE = styleCHP._lidFE; + newCHP.setLidFE(styleCHP.getLidFE()); } break; case 0x48: - newCHP._iss = (byte)param; + newCHP.setIss((byte)param); break; case 0x49: - newCHP._hps = LittleEndian.getShort(varParam, 0); + newCHP.setHps(LittleEndian.getShort(varParam, 0)); break; case 0x4a: int increment = LittleEndian.getShort(varParam, 0); - newCHP._hps = Math.max(newCHP._hps + increment, 8); + newCHP.setHps(Math.max(newCHP.getHps() + increment, 8)); break; case 0x4b: - newCHP._hpsKern = param; + newCHP.setHpsKern(param); break; case 0x4c: doCHPOperation(oldCHP, newCHP, 0x47, param, varParam, grpprl, offset, styleSheet); break; case 0x4d: float percentage = (float)param/100.0f; - int add = (int)((float)percentage * (float)newCHP._hps); - newCHP._hps += add; + int add = (int)((float)percentage * (float)newCHP.getHps()); + newCHP.setHps(newCHP.getHps() + add); break; case 0x4e: - newCHP._ysr = (byte)param; + newCHP.setYsr((byte)param); break; case 0x4f: - newCHP._ftcAscii = (short)param; + newCHP.setFtcAscii((short)param); break; case 0x50: - newCHP._ftcFE = (short)param; + newCHP.setFtcFE((short)param); break; case 0x51: - newCHP._ftcOther = (short)param; + newCHP.setFtcOther((short)param); break; case 0x52: break; case 0x53: - newCHP._fDStrike = getFlag(param); + newCHP.setFDStrike(getFlag(param)); break; case 0x54: - newCHP._fImprint = getFlag(param); + newCHP.setFImprint(getFlag(param)); break; case 0x55: - newCHP._fSpec = getFlag(param); + newCHP.setFSpec(getFlag(param)); break; case 0x56: - newCHP._fObj = getFlag(param); + newCHP.setFObj(getFlag(param)); break; case 0x57: - newCHP._fPropMark = getFlag(varParam[0]); - newCHP._ibstPropRMark = (short)LittleEndian.getShort(varParam, 1); - newCHP._dttmPropRMark = LittleEndian.getInt(varParam, 3); + newCHP.setFPropMark(varParam[0]); + newCHP.setIbstPropRMark((short)LittleEndian.getShort(varParam, 1)); + newCHP.setDttmPropRMark(LittleEndian.getInt(varParam, 3)); break; case 0x58: - newCHP._fEmboss = getFlag(param); + newCHP.setFEmboss(getFlag(param)); break; case 0x59: - newCHP._sfxtText = (byte)param; + newCHP.setSfxtText((byte)param); break; case 0x5a: break; @@ -556,24 +566,30 @@ public class StyleSheet implements HDFType case 0x61: break; case 0x62: - newCHP._fDispFldRMark = getFlag(varParam[0]); - newCHP._ibstDispFldRMark = (short)LittleEndian.getShort(varParam, 1); - newCHP._dttmDispFldRMark = LittleEndian.getInt(varParam, 3); - System.arraycopy(varParam, 7, newCHP._xstDispFldRMark, 0, 32); + byte[] xstDispFldRMark = new byte[32]; + newCHP.setFDispFldRMark(varParam[0]); + newCHP.setIbstDispFldRMark((short)LittleEndian.getShort(varParam, 1)); + newCHP.setDttmDispFldRMark(LittleEndian.getInt(varParam, 3)); + System.arraycopy(varParam, 7, xstDispFldRMark, 0, 32); + newCHP.setXstDispFldRMark(xstDispFldRMark); break; case 0x63: - newCHP._ibstRMarkDel = (short)param; + newCHP.setIbstRMarkDel((short)param); break; case 0x64: - newCHP._dttmRMarkDel[0] = LittleEndian.getShort(grpprl, offset - 4); - newCHP._dttmRMarkDel[1] = LittleEndian.getShort(grpprl, offset - 2); + short[] dttmRMarkDel = new short[2]; + dttmRMarkDel[0] = LittleEndian.getShort(grpprl, offset - 4); + dttmRMarkDel[1] = LittleEndian.getShort(grpprl, offset - 2); + newCHP.setDttmRMarkDel(dttmRMarkDel); break; case 0x65: - newCHP._brc[0] = (short)LittleEndian.getShort(grpprl, offset - 4); - newCHP._brc[1] = (short)LittleEndian.getShort(grpprl, offset - 2); + short[] brc = new short[2]; + brc[0] = (short)LittleEndian.getShort(grpprl, offset - 4); + brc[1] = (short)LittleEndian.getShort(grpprl, offset - 2); + newCHP.setBrc(brc); break; case 0x66: - newCHP._shd = (short)param; + newCHP.setShd((short)param); break; case 0x67: break; @@ -588,13 +604,13 @@ public class StyleSheet implements HDFType case 0x6c: break; case 0x6d: - newCHP._lidDefault = (short)param; + newCHP.setLidDefault((short)param); break; case 0x6e: - newCHP._lidFE = (short)param; + newCHP.setLidFE((short)param); break; case 0x6f: - newCHP._idctHint = (byte)param; + newCHP.setIdctHint((byte)param); break; } } @@ -621,7 +637,7 @@ public class StyleSheet implements HDFType catch(Exception e){} if(doIstd) { - ((ParagraphProperties)newProperty)._istd = LittleEndian.getShort(grpprl, 0); + ((ParagraphProperties)newProperty).setIstd(LittleEndian.getShort(grpprl, 0)); offset = 2; } @@ -631,7 +647,7 @@ public class StyleSheet implements HDFType try { newProperty = ((CharacterProperties)parent).clone(); - ((CharacterProperties)newProperty)._baseIstd = ((CharacterProperties)parent)._istd; + ((CharacterProperties)newProperty).setBaseIstd(((CharacterProperties)parent).getIstd()); } catch(Exception e){} propertyType = CHP_TYPE; @@ -756,98 +772,99 @@ public class StyleSheet implements HDFType switch(operand) { case 0: - newPAP._istd = param; + newPAP.setIstd(param); break; case 0x1: //permuteIstd(newPAP, varParam); break; case 0x2: - if(newPAP._istd <=9 || newPAP._istd >=1) + if(newPAP.getIstd() <=9 || newPAP.getIstd() >=1) { - newPAP._istd += param; + newPAP.setIstd(newPAP.getIstd() + param); if(param > 0) { - newPAP._istd = Math.max(newPAP._istd, 9); + newPAP.setIstd(Math.max(newPAP.getIstd(), 9)); } else { - newPAP._istd = Math.min(newPAP._istd, 1); + newPAP.setIstd(Math.min(newPAP.getIstd(), 1)); } } break; case 0x3: - newPAP._jc = (byte)param; + newPAP.setJc((byte)param); break; case 0x4: - newPAP._fSideBySide = (byte)param; + newPAP.setFSideBySide((byte)param); break; case 0x5: - newPAP._fKeep = (byte)param; + newPAP.setFKeep((byte)param); break; case 0x6: - newPAP._fKeepFollow = (byte)param; + newPAP.setFKeepFollow((byte)param); break; case 0x7: - newPAP._fPageBreakBefore = (byte)param; + newPAP.setFPageBreakBefore((byte)param); break; case 0x8: - newPAP._brcl = (byte)param; + newPAP.setBrcl((byte)param); break; case 0x9: - newPAP._brcp = (byte)param; + newPAP.setBrcp((byte)param); break; case 0xa: - newPAP._ilvl = (byte)param; + newPAP.setIlvl((byte)param); break; case 0xb: - newPAP._ilfo = param; + newPAP.setIlfo(param); break; case 0xc: - newPAP._fNoLnn = (byte)param; + newPAP.setFNoLnn((byte)param); break; case 0xd: /**@todo handle tabs*/ break; case 0xe: - newPAP._dxaRight = param; + newPAP.setDxaRight(param); break; case 0xf: - newPAP._dxaLeft = param; + newPAP.setDxaLeft(param); break; case 0x10: - newPAP._dxaLeft += param; - newPAP._dxaLeft = Math.max(0, newPAP._dxaLeft); + newPAP.setDxaLeft(newPAP.getDxaLeft() + param); + newPAP.setDxaLeft(Math.max(0, newPAP.getDxaLeft())); break; case 0x11: - newPAP._dxaLeft1 = param; + newPAP.setDxaLeft1(param); break; case 0x12: - newPAP._lspd[0] = LittleEndian.getShort(grpprl, offset - 4); - newPAP._lspd[1] = LittleEndian.getShort(grpprl, offset - 2); + short[] lspd = newPAP.getLspd(); + lspd[0] = LittleEndian.getShort(grpprl, offset - 4); + lspd[1] = LittleEndian.getShort(grpprl, offset - 2); break; case 0x13: - newPAP._dyaBefore = param; + newPAP.setDyaBefore(param); break; case 0x14: - newPAP._dyaAfter = param; + newPAP.setDyaAfter(param); break; case 0x15: /**@todo handle tabs*/ break; case 0x16: - newPAP._fInTable = (byte)param; + newPAP.setFInTable((byte)param); break; case 0x17: - newPAP._fTtp =(byte)param; + newPAP.setFTtp((byte)param); break; case 0x18: - newPAP._dxaAbs = param; + newPAP.setDxaAbs(param); break; case 0x19: - newPAP._dyaAbs = param; + newPAP.setDyaAbs(param); break; case 0x1a: - newPAP._dxaWidth = param; + newPAP.setDxaWidth(param); break; case 0x1b: /** @todo handle paragraph postioning*/ @@ -863,109 +880,115 @@ public class StyleSheet implements HDFType }*/ break; case 0x1c: - newPAP._brcTop1 = (short)param; + //newPAP.setBrcTop1((short)param); break; case 0x1d: - newPAP._brcLeft1 = (short)param; + //newPAP.setBrcLeft1((short)param); break; case 0x1e: - newPAP._brcBottom1 = (short)param; + //newPAP.setBrcBottom1((short)param); break; case 0x1f: - newPAP._brcRight1 = (short)param; + //newPAP.setBrcRight1((short)param); break; case 0x20: - newPAP._brcBetween1 = (short)param; + //newPAP.setBrcBetween1((short)param); break; case 0x21: - newPAP._brcBar1 = (byte)param; + //newPAP.setBrcBar1((byte)param); break; case 0x22: - newPAP._dxaFromText = param; + newPAP.setDxaFromText(param); break; case 0x23: - newPAP._wr = (byte)param; + newPAP.setWr((byte)param); break; case 0x24: - newPAP._brcTop[0] = (short)LittleEndian.getShort(grpprl, offset - 4); - newPAP._brcTop[1] = (short)LittleEndian.getShort(grpprl, offset - 2); + short[] brcTop = newPAP.getBrcTop(); + brcTop[0] = (short)LittleEndian.getShort(grpprl, offset - 4); + brcTop[1] = (short)LittleEndian.getShort(grpprl, offset - 2); break; case 0x25: - newPAP._brcLeft[0] = (short)LittleEndian.getShort(grpprl, offset - 4); - newPAP._brcLeft[1] = (short)LittleEndian.getShort(grpprl, offset - 2); + short[] brcLeft = newPAP.getBrcLeft(); + brcLeft[0] = (short)LittleEndian.getShort(grpprl, offset - 4); + brcLeft[1] = (short)LittleEndian.getShort(grpprl, offset - 2); break; case 0x26: - newPAP._brcBottom[0] = (short)LittleEndian.getShort(grpprl, offset - 4); - newPAP._brcBottom[1] = (short)LittleEndian.getShort(grpprl, offset - 2); + short[] brcBottom = newPAP.getBrcBottom(); + brcBottom[0] = (short)LittleEndian.getShort(grpprl, offset - 4); + brcBottom[1] = (short)LittleEndian.getShort(grpprl, offset - 2); break; case 0x27: - newPAP._brcRight[0] = (short)LittleEndian.getShort(grpprl, offset - 4); - newPAP._brcRight[1] = (short)LittleEndian.getShort(grpprl, offset - 2); + short[] brcRight = newPAP.getBrcRight(); + brcRight[0] = (short)LittleEndian.getShort(grpprl, offset - 4); + brcRight[1] = (short)LittleEndian.getShort(grpprl, offset - 2); break; case 0x28: - newPAP._brcBetween[0] = (short)LittleEndian.getShort(grpprl, offset - 4); - newPAP._brcBetween[1] = (short)LittleEndian.getShort(grpprl, offset - 2); + short[] brcBetween = newPAP.getBrcBetween(); + brcBetween[0] = (short)LittleEndian.getShort(grpprl, offset - 4); + brcBetween[1] = (short)LittleEndian.getShort(grpprl, offset - 2); break; case 0x29: - newPAP._brcBar[0] = (short)LittleEndian.getShort(grpprl, offset - 4); - newPAP._brcBar[1] = (short)LittleEndian.getShort(grpprl, offset - 2); + short[] brcBar = newPAP.getBrcBar(); + brcBar[0] = (short)LittleEndian.getShort(grpprl, offset - 4); + brcBar[1] = (short)LittleEndian.getShort(grpprl, offset - 2); break; case 0x2a: - newPAP._fNoAutoHyph = (byte)param; + newPAP.setFNoAutoHyph((byte)param); break; case 0x2b: - newPAP._dyaHeight = param; + newPAP.setDyaHeight(param); break; case 0x2c: - newPAP._dcs = param; + newPAP.setDcs((short)param); break; case 0x2d: - newPAP._shd = param; + newPAP.setShd((short)param); break; case 0x2e: - newPAP._dyaFromText = param; + newPAP.setDyaFromText(param); break; case 0x2f: - newPAP._dxaFromText = param; + newPAP.setDxaFromText(param); break; case 0x30: - newPAP._fLocked = (byte)param; + newPAP.setFLocked((byte)param); break; case 0x31: - newPAP._fWindowControl = (byte)param; + newPAP.setFWidowControl((byte)param); break; case 0x32: //undocumented break; case 0x33: - newPAP._fKinsoku = (byte)param; + newPAP.setFKinsoku((byte)param); break; case 0x34: - newPAP._fWordWrap = (byte)param; + newPAP.setFWordWrap((byte)param); break; case 0x35: - newPAP._fOverflowPunct = (byte)param; + newPAP.setFOverflowPunct((byte)param); break; case 0x36: - newPAP._fTopLinePunct = (byte)param; + newPAP.setFTopLinePunct((byte)param); break; case 0x37: - newPAP._fAutoSpaceDE = (byte)param; + newPAP.setFAutoSpaceDE((byte)param); break; case 0x38: - newPAP._fAutoSpaceDN = (byte)param; + newPAP.setFAutoSpaceDN((byte)param); break; case 0x39: - newPAP._wAlignFont = param; + newPAP.setWAlignFont(param); break; case 0x3a: - newPAP._fontAlign = (short)param; + newPAP.setFontAlign((short)param); break; case 0x3b: //obsolete break; case 0x3e: - newPAP._anld = varParam; + newPAP.setAnld(varParam); break; case 0x3f: //don't really need this. spec is confusing regarding this @@ -986,7 +1009,7 @@ public class StyleSheet implements HDFType case 0x45: if(spra == 6) { - newPAP._numrm = varParam; + newPAP.setNumrm(varParam); } else { @@ -995,10 +1018,10 @@ public class StyleSheet implements HDFType break; case 0x47: - newPAP._fUsePgsuSettings = (byte)param; + newPAP.setFUsePgsuSettings((byte)param); break; case 0x48: - newPAP._fAdjustRight = (byte)param; + newPAP.setFAdjustRight((byte)param); break; default: break; @@ -1009,70 +1032,88 @@ public class StyleSheet implements HDFType switch(operand) { case 0: - newTAP._jc = (short)param; + newTAP.setJc((short)param); break; case 0x01: { - int adjust = param - (newTAP._rgdxaCenter[0] + newTAP._dxaGapHalf); - for(int x = 0; x < newTAP._itcMac; x++) + short[] rgdxaCenter = newTAP.getRgdxaCenter(); + short itcMac = newTAP.getItcMac(); + int adjust = param - (rgdxaCenter[0] + newTAP.getDxaGapHalf()); + for(int x = 0; x < itcMac; x++) { - newTAP._rgdxaCenter[x] += adjust; + rgdxaCenter[x] += adjust; } break; } case 0x02: - if(newTAP._rgdxaCenter != null) + { + short[] rgdxaCenter = newTAP.getRgdxaCenter(); + if(rgdxaCenter != null) { - int adjust = newTAP._dxaGapHalf - param; - newTAP._rgdxaCenter[0] += adjust; + int adjust = newTAP.getDxaGapHalf() - param; + rgdxaCenter[0] += adjust; } - newTAP._dxaGapHalf = param; + newTAP.setDxaGapHalf(param); break; + } case 0x03: - newTAP._fCantSplit = getFlag(param); + newTAP.setFCantSplit(getFlag(param)); break; case 0x04: - newTAP._fTableHeader = getFlag(param); + newTAP.setFTableHeader(getFlag(param)); break; case 0x05: + { + short[] brcTop = newTAP.getBrcTop(); + short[] brcLeft = newTAP.getBrcLeft(); + short[] brcBottom = newTAP.getBrcBottom(); + short[] brcRight = newTAP.getBrcRight(); + short[] brcVertical = newTAP.getBrcVertical(); + short[] brcHorizontal = newTAP.getBrcHorizontal(); - newTAP._brcTop[0] = LittleEndian.getShort(varParam, 0); - newTAP._brcTop[1] = LittleEndian.getShort(varParam, 2); + brcTop[0] = LittleEndian.getShort(varParam, 0); + brcTop[1] = LittleEndian.getShort(varParam, 2); - newTAP._brcLeft[0] = LittleEndian.getShort(varParam, 4); - newTAP._brcLeft[1] = LittleEndian.getShort(varParam, 6); + brcLeft[0] = LittleEndian.getShort(varParam, 4); + brcLeft[1] = LittleEndian.getShort(varParam, 6); - newTAP._brcBottom[0] = LittleEndian.getShort(varParam, 8); - newTAP._brcBottom[1] = LittleEndian.getShort(varParam, 10); + brcBottom[0] = LittleEndian.getShort(varParam, 8); + brcBottom[1] = LittleEndian.getShort(varParam, 10); - newTAP._brcRight[0] = LittleEndian.getShort(varParam, 12); - newTAP._brcRight[1] = LittleEndian.getShort(varParam, 14); + brcRight[0] = LittleEndian.getShort(varParam, 12); + brcRight[1] = LittleEndian.getShort(varParam, 14); - newTAP._brcHorizontal[0] = LittleEndian.getShort(varParam, 16); - newTAP._brcHorizontal[1] = LittleEndian.getShort(varParam, 18); + brcHorizontal[0] = LittleEndian.getShort(varParam, 16); + brcHorizontal[1] = LittleEndian.getShort(varParam, 18); - newTAP._brcVertical[0] = LittleEndian.getShort(varParam, 20); - newTAP._brcVertical[1] = LittleEndian.getShort(varParam, 22); + brcVertical[0] = LittleEndian.getShort(varParam, 20); + brcVertical[1] = LittleEndian.getShort(varParam, 22); break; + } case 0x06: //obsolete, used in word 1.x break; case 0x07: - newTAP._dyaRowHeight = param; + newTAP.setDyaRowHeight(param); break; case 0x08: + { + short[] rgdxaCenter = new short[varParam[0] + 1]; + TableCellDescriptor[] rgtc = new TableCellDescriptor[varParam[0]]; + short itcMac = varParam[0]; //I use varParam[0] and newTAP._itcMac interchangably - newTAP._itcMac = varParam[0]; - newTAP._rgdxaCenter = new short[varParam[0] + 1]; - newTAP._rgtc = new TableCellDescriptor[varParam[0]]; + newTAP.setItcMac(itcMac); + newTAP.setRgdxaCenter(rgdxaCenter) ; + newTAP.setRgtc(rgtc); - for(int x = 0; x < newTAP._itcMac; x++) + for(int x = 0; x < itcMac; x++) { - newTAP._rgdxaCenter[x] = LittleEndian.getShort(varParam , 1 + (x * 2)); - newTAP._rgtc[x] = TableCellDescriptor.convertBytesToTC(varParam, 1 + ((varParam[0] + 1) * 2) + (x * 20)); + rgdxaCenter[x] = LittleEndian.getShort(varParam , 1 + (x * 2)); + rgtc[x] = TableCellDescriptor.convertBytesToTC(varParam, 1 + ((itcMac + 1) * 2) + (x * 20)); } - newTAP._rgdxaCenter[newTAP._itcMac] = LittleEndian.getShort(varParam , 1 + (newTAP._itcMac * 2)); + rgdxaCenter[itcMac] = LittleEndian.getShort(varParam , 1 + (itcMac * 2)); break; + } case 0x09: /** @todo handle cell shading*/ break; @@ -1080,51 +1121,61 @@ public class StyleSheet implements HDFType /** @todo handle word defined table styles*/ break; case 0x20: + { + TCAbstractType[] rgtc = newTAP.getRgtc(); + for(int x = varParam[0]; x < varParam[1]; x++) { + if((varParam[2] & 0x08) > 0) { - newTAP._rgtc[x]._brcRight[0] = LittleEndian.getShort(varParam, 6); - newTAP._rgtc[x]._brcRight[1] = LittleEndian.getShort(varParam, 8); + short[] brcRight = rgtc[x].getBrcRight(); + brcRight[0] = LittleEndian.getShort(varParam, 6); + brcRight[1] = LittleEndian.getShort(varParam, 8); } else if((varParam[2] & 0x04) > 0) { - newTAP._rgtc[x]._brcBottom[0] = LittleEndian.getShort(varParam, 6); - newTAP._rgtc[x]._brcBottom[1] = LittleEndian.getShort(varParam, 8); + short[] brcBottom = rgtc[x].getBrcBottom(); + brcBottom[0] = LittleEndian.getShort(varParam, 6); + brcBottom[1] = LittleEndian.getShort(varParam, 8); } else if((varParam[2] & 0x02) > 0) { - newTAP._rgtc[x]._brcLeft[0] = LittleEndian.getShort(varParam, 6); - newTAP._rgtc[x]._brcLeft[1] = LittleEndian.getShort(varParam, 8); + short[] brcLeft = rgtc[x].getBrcLeft(); + brcLeft[0] = LittleEndian.getShort(varParam, 6); + brcLeft[1] = LittleEndian.getShort(varParam, 8); } else if((varParam[2] & 0x01) > 0) { - newTAP._rgtc[x]._brcTop[0] = LittleEndian.getShort(varParam, 6); - newTAP._rgtc[x]._brcTop[1] = LittleEndian.getShort(varParam, 8); + short[] brcTop = rgtc[x].getBrcTop(); + brcTop[0] = LittleEndian.getShort(varParam, 6); + brcTop[1] = LittleEndian.getShort(varParam, 8); } } break; + } case 0x21: int index = (param & 0xff000000) >> 24; int count = (param & 0x00ff0000) >> 16; int width = (param & 0x0000ffff); + int itcMac = newTAP.getItcMac(); - short[] rgdxaCenter = new short[newTAP._itcMac + count + 1]; - TableCellDescriptor[] rgtc = new TableCellDescriptor[newTAP._itcMac + count]; - if(index >= newTAP._itcMac) + short[] rgdxaCenter = new short[itcMac + count + 1]; + TableCellDescriptor[] rgtc = new TableCellDescriptor[itcMac + count]; + if(index >= itcMac) { - index = newTAP._itcMac; - System.arraycopy(newTAP._rgdxaCenter, 0, rgdxaCenter, 0, newTAP._itcMac + 1); - System.arraycopy(newTAP._rgtc, 0, rgtc, 0, newTAP._itcMac); + index = itcMac; + System.arraycopy(newTAP.getRgdxaCenter(), 0, rgdxaCenter, 0, itcMac + 1); + System.arraycopy(newTAP.getRgtc(), 0, rgtc, 0, itcMac); } else { //copy rgdxaCenter - System.arraycopy(newTAP._rgdxaCenter, 0, rgdxaCenter, 0, index + 1); - System.arraycopy(newTAP._rgdxaCenter, index + 1, rgdxaCenter, index + count, (newTAP._itcMac) - (index)); + System.arraycopy(newTAP.getRgdxaCenter(), 0, rgdxaCenter, 0, index + 1); + System.arraycopy(newTAP.getRgdxaCenter(), index + 1, rgdxaCenter, index + count, itcMac - (index)); //copy rgtc - System.arraycopy(newTAP._rgtc, 0, rgtc, 0, index); - System.arraycopy(newTAP._rgtc, index, rgtc, index + count, newTAP._itcMac - index); + System.arraycopy(newTAP.getRgtc(), 0, rgtc, 0, index); + System.arraycopy(newTAP.getRgtc(), index, rgtc, index + count, itcMac - index); } for(int x = index; x < index + count; x++) @@ -1156,13 +1207,13 @@ public class StyleSheet implements HDFType switch(operand) { case 0: - newSEP._cnsPgn = (byte)param; + newSEP.setCnsPgn((byte)param); break; case 0x1: - newSEP._iHeadingPgn = (byte)param; + newSEP.setIHeadingPgn((byte)param); break; case 0x2: - newSEP._olstAnn = varParam; + newSEP.setOlstAnm(varParam); break; case 0x3: //not quite sure @@ -1171,109 +1222,109 @@ public class StyleSheet implements HDFType //not quite sure break; case 0x5: - newSEP._fEvenlySpaced = getFlag(param); + newSEP.setFEvenlySpaced(getFlag(param)); break; case 0x6: - newSEP._fUnlocked = getFlag(param); + newSEP.setFUnlocked(getFlag(param)); break; case 0x7: - newSEP._dmBinFirst = (short)param; + newSEP.setDmBinFirst((short)param); break; case 0x8: - newSEP._dmBinOther = (short)param; + newSEP.setDmBinOther((short)param); break; case 0x9: - newSEP._bkc = (byte)param; + newSEP.setBkc((byte)param); break; case 0xa: - newSEP._fTitlePage = getFlag(param); + newSEP.setFTitlePage(getFlag(param)); break; case 0xb: - newSEP._ccolM1 = (short)param; + newSEP.setCcolM1((short)param); break; case 0xc: - newSEP._dxaColumns = param; + newSEP.setDxaColumns(param); break; case 0xd: - newSEP._fAutoPgn = getFlag(param); + newSEP.setFAutoPgn(getFlag(param)); break; case 0xe: - newSEP._nfcPgn = (byte)param; + newSEP.setNfcPgn((byte)param); break; case 0xf: - newSEP._dyaPgn = (short)param; + newSEP.setDyaPgn((short)param); break; case 0x10: - newSEP._dxaPgn = (short)param; + newSEP.setDxaPgn((short)param); break; case 0x11: - newSEP._fPgnRestart = getFlag(param); + newSEP.setFPgnRestart(getFlag(param)); break; case 0x12: - newSEP._fEndNote = getFlag(param); + newSEP.setFEndNote(getFlag(param)); break; case 0x13: - newSEP._lnc = (byte)param; + newSEP.setLnc((byte)param); break; case 0x14: - newSEP._grpfIhdt = (byte)param; + newSEP.setGrpfIhdt((byte)param); break; case 0x15: - newSEP._nLnnMod = (short)param; + newSEP.setNLnnMod((short)param); break; case 0x16: - newSEP._dxaLnn = param; + newSEP.setDxaLnn(param); break; case 0x17: - newSEP._dyaHdrTop = param; + newSEP.setDyaHdrTop(param); break; case 0x18: - newSEP._dyaHdrBottom = param; + newSEP.setDyaHdrBottom(param); break; case 0x19: - newSEP._fLBetween = getFlag(param); + newSEP.setFLBetween(getFlag(param)); break; case 0x1a: - newSEP._vjc = (byte)param; + newSEP.setVjc((byte)param); break; case 0x1b: - newSEP._lnnMin = (short)param; + newSEP.setLnnMin((short)param); break; case 0x1c: - newSEP._pgnStart = (short)param; + newSEP.setPgnStart((short)param); break; case 0x1d: - newSEP._dmOrientPage = (byte)param; + newSEP.setDmOrientPage((byte)param); break; case 0x1e: //nothing break; case 0x1f: - newSEP._xaPage = param; + newSEP.setXaPage(param); break; case 0x20: - newSEP._yaPage = param; + newSEP.setYaPage(param); break; case 0x21: - newSEP._dxaLeft = param; + newSEP.setDxaLeft(param); break; case 0x22: - newSEP._dxaRight = param; + newSEP.setDxaRight(param); break; case 0x23: - newSEP._dyaTop = param; + newSEP.setDyaTop(param); break; case 0x24: - newSEP._dyaBottom = param; + newSEP.setDyaBottom(param); break; case 0x25: - newSEP._dzaGutter = param; + newSEP.setDzaGutter(param); break; case 0x26: - newSEP._dmPaperReq = (short)param; + newSEP.setDmPaperReq((short)param); break; case 0x27: - newSEP._fPropMark = getFlag(varParam[0]); + newSEP.setFPropMark(getFlag(varParam[0])); break; case 0x28: break; @@ -1282,32 +1333,36 @@ public class StyleSheet implements HDFType case 0x2a: break; case 0x2b: - newSEP._brcTop[0] = (short)(param & 0xffff); - newSEP._brcTop[1] = (short)((param & 0xffff0000) >> 16); + short[] brcTop = newSEP.getBrcTop(); + brcTop[0] = (short)(param & 0xffff); + brcTop[1] = (short)((param & 0xffff0000) >> 16); break; case 0x2c: - newSEP._brcLeft[0] = (short)(param & 0xffff); - newSEP._brcLeft[1] = (short)((param & 0xffff0000) >> 16); + short[] brcLeft = newSEP.getBrcLeft(); + brcLeft[0] = (short)(param & 0xffff); + brcLeft[1] = (short)((param & 0xffff0000) >> 16); break; case 0x2d: - newSEP._brcBottom[0] = (short)(param & 0xffff); - newSEP._brcBottom[1] = (short)((param & 0xffff0000) >> 16); + short[] brcBottom = newSEP.getBrcBottom(); + brcBottom[0] = (short)(param & 0xffff); + brcBottom[1] = (short)((param & 0xffff0000) >> 16); break; case 0x2e: - newSEP._brcRight[0] = (short)(param & 0xffff); - newSEP._brcRight[1] = (short)((param & 0xffff0000) >> 16); + short[] brcRight = newSEP.getBrcRight(); + brcRight[0] = (short)(param & 0xffff); + brcRight[1] = (short)((param & 0xffff0000) >> 16); break; case 0x2f: - newSEP._pgbProp = (short)param; + newSEP.setPgbProp(param); break; case 0x30: - newSEP._dxtCharSpace = param; + newSEP.setDxtCharSpace(param); break; case 0x31: - newSEP._dyaLinePitch = param; + newSEP.setDyaLinePitch(param); break; case 0x33: - newSEP._wTextFlow = (short)param; + newSEP.setWTextFlow((short)param); break; default: break; diff --git a/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/TableCellDescriptor.java b/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/TableCellDescriptor.java index d94d29cbf..da27c8b66 100644 --- a/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/TableCellDescriptor.java +++ b/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/TableCellDescriptor.java @@ -55,6 +55,7 @@ package org.apache.poi.hdf.model.hdftypes; +import org.apache.poi.hdf.model.hdftypes.definitions.TCAbstractType; import org.apache.poi.util.LittleEndian; /** * Comment me @@ -62,10 +63,10 @@ import org.apache.poi.util.LittleEndian; * @author Ryan Ackley */ -public class TableCellDescriptor implements HDFType +public class TableCellDescriptor extends TCAbstractType implements HDFType { - boolean _fFirstMerged; + /*boolean _fFirstMerged; boolean _fMerged; boolean _fVertical; boolean _fBackward; @@ -76,7 +77,7 @@ public class TableCellDescriptor implements HDFType short[] _brcTop = new short[2]; short[] _brcLeft = new short[2]; short[] _brcBottom = new short[2]; - short[] _brcRight = new short [2]; + short[] _brcRight = new short [2];*/ public TableCellDescriptor() { @@ -85,26 +86,31 @@ public class TableCellDescriptor implements HDFType { TableCellDescriptor tc = new TableCellDescriptor(); int rgf = LittleEndian.getShort(array, offset); - tc._fFirstMerged = (rgf & 0x0001) > 0; - tc._fMerged = (rgf & 0x0002) > 0; - tc._fVertical = (rgf & 0x0004) > 0; - tc._fBackward = (rgf & 0x0008) > 0; - tc._fRotateFont = (rgf & 0x0010) > 0; - tc._fVertMerge = (rgf & 0x0020) > 0; - tc._fVertRestart = (rgf & 0x0040) > 0; - tc._vertAlign = (short)((rgf & 0x0180) >> 7); + tc.setFFirstMerged((rgf & 0x0001) > 0); + tc.setFMerged((rgf & 0x0002) > 0); + tc.setFVertical((rgf & 0x0004) > 0); + tc.setFBackward((rgf & 0x0008) > 0); + tc.setFRotateFont((rgf & 0x0010) > 0); + tc.setFVertMerge((rgf & 0x0020) > 0); + tc.setFVertRestart((rgf & 0x0040) > 0); + tc.setVertAlign((byte)((rgf & 0x0180) >> 7)); - tc._brcTop[0] = LittleEndian.getShort(array, offset + 4); - tc._brcTop[1] = LittleEndian.getShort(array, offset + 6); + short[] brcTop = new short[2]; + short[] brcLeft = new short[2]; + short[] brcBottom = new short[2]; + short[] brcRight = new short[2]; - tc._brcLeft[0] = LittleEndian.getShort(array, offset + 8); - tc._brcLeft[1] = LittleEndian.getShort(array, offset + 10); + brcTop[0] = LittleEndian.getShort(array, offset + 4); + brcTop[1] = LittleEndian.getShort(array, offset + 6); - tc._brcBottom[0] = LittleEndian.getShort(array, offset + 12); - tc._brcBottom[1] = LittleEndian.getShort(array, offset + 14); + brcLeft[0] = LittleEndian.getShort(array, offset + 8); + brcLeft[1] = LittleEndian.getShort(array, offset + 10); - tc._brcRight[0] = LittleEndian.getShort(array, offset + 16); - tc._brcRight[1] = LittleEndian.getShort(array, offset + 18); + brcBottom[0] = LittleEndian.getShort(array, offset + 12); + brcBottom[1] = LittleEndian.getShort(array, offset + 14); + + brcRight[0] = LittleEndian.getShort(array, offset + 16); + brcRight[1] = LittleEndian.getShort(array, offset + 18); return tc; } diff --git a/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/TableProperties.java b/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/TableProperties.java index 303a15a3f..96b6954bf 100644 --- a/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/TableProperties.java +++ b/src/scratchpad/src/org/apache/poi/hdf/model/hdftypes/TableProperties.java @@ -55,30 +55,16 @@ package org.apache.poi.hdf.model.hdftypes; +import org.apache.poi.hdf.model.hdftypes.definitions.TAPAbstractType; + /** * Comment me * * @author Ryan Ackley */ -public class TableProperties implements HDFType +public class TableProperties extends TAPAbstractType { - short _jc; - int _dxaGapHalf; - int _dyaRowHeight; - boolean _fCantSplit; - boolean _fTableHeader; - boolean _fLastRow; - short _itcMac; - short[] _rgdxaCenter; - short[] _brcLeft = new short[2]; - short[] _brcRight = new short[2]; - short[] _brcTop = new short[2]; - short[] _brcBottom = new short[2]; - short[] _brcHorizontal = new short[2]; - short[] _brcVertical = new short[2]; - - TableCellDescriptor[] _rgtc; public TableProperties()