Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/PAPAbstractType.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/PAPAbstractType.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/PAPAbstractType.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/PAPAbstractType.java Tue Dec 24 11:56:42 2019 @@ -19,6 +19,7 @@ package org.apache.poi.hwpf.model.types; import java.util.Arrays; +import java.util.stream.Stream; import org.apache.poi.hwpf.model.TabDescriptor; import org.apache.poi.hwpf.usermodel.BorderCode; @@ -31,18 +32,34 @@ import org.apache.poi.util.Internal; /** * Paragraph Properties. - * <p> - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/types/definitions. - * <p> - * This class is internal. It content or properties may change without notice - * due to changes in our knowledge of internal Microsoft Word binary structures. - - * @author S. Ryan Ackley */ +@SuppressWarnings("unused") @Internal -public abstract class PAPAbstractType -{ +public abstract class PAPAbstractType { + + protected static final byte BRCL_SINGLE = 0; + protected static final byte BRCL_THICK = 1; + protected static final byte BRCL_DOUBLE = 2; + protected static final byte BRCL_SHADOW = 3; + + protected static final byte BRCP_NONE = 0; + protected static final byte BRCP_BORDER_ABOVE = 1; + protected static final byte BRCP_BORDER_BELOW = 2; + protected static final byte BRCP_BOX_AROUND = 15; + protected static final byte BRCP_BAR_TO_LEFT_OF_PARAGRAPH = 16; + + protected static final boolean FMINHEIGHT_EXACT = false; + protected static final boolean FMINHEIGHT_AT_LEAST = true; + + protected static final byte WALIGNFONT_HANGING = 0; + protected static final byte WALIGNFONT_CENTERED = 1; + protected static final byte WALIGNFONT_ROMAN = 2; + protected static final byte WALIGNFONT_VARIABLE = 3; + protected static final byte WALIGNFONT_AUTO = 4; + + private static final BitField fVertical = new BitField(0x0001); + private static final BitField fBackward = new BitField(0x0002); + private static final BitField fRotateFont = new BitField(0x0004); protected int field_1_istd; protected boolean field_2_fSideBySide; @@ -50,16 +67,7 @@ public abstract class PAPAbstractType protected boolean field_4_fKeepFollow; protected boolean field_5_fPageBreakBefore; protected byte field_6_brcl; - /**/protected final static byte BRCL_SINGLE = 0; - /**/protected final static byte BRCL_THICK = 1; - /**/protected final static byte BRCL_DOUBLE = 2; - /**/protected final static byte BRCL_SHADOW = 3; protected byte field_7_brcp; - /**/protected final static byte BRCP_NONE = 0; - /**/protected final static byte BRCP_BORDER_ABOVE = 1; - /**/protected final static byte BRCP_BORDER_BELOW = 2; - /**/protected final static byte BRCP_BOX_AROUND = 15; - /**/protected final static byte BRCP_BAR_TO_LEFT_OF_PARAGRAPH = 16; protected byte field_8_ilvl; protected int field_9_ilfo; protected boolean field_10_fNoLnn; @@ -80,8 +88,6 @@ public abstract class PAPAbstractType protected boolean field_25_fNoAutoHyph; protected int field_26_dyaHeight; protected boolean field_27_fMinHeight; - /**/protected final static boolean FMINHEIGHT_EXACT = false; - /**/protected final static boolean FMINHEIGHT_AT_LEAST = true; protected DropCapSpecifier field_28_dcs; protected int field_29_dyaFromText; protected int field_30_dxaFromText; @@ -94,15 +100,7 @@ public abstract class PAPAbstractType protected boolean field_37_fAutoSpaceDE; protected boolean field_38_fAutoSpaceDN; protected int field_39_wAlignFont; - /**/protected final static byte WALIGNFONT_HANGING = 0; - /**/protected final static byte WALIGNFONT_CENTERED = 1; - /**/protected final static byte WALIGNFONT_ROMAN = 2; - /**/protected final static byte WALIGNFONT_VARIABLE = 3; - /**/protected final static byte WALIGNFONT_AUTO = 4; protected short field_40_fontAlign; - /**/private static BitField fVertical = new BitField(0x0001); - /**/private static BitField fBackward = new BitField(0x0002); - /**/private static BitField fRotateFont = new BitField(0x0004); protected byte field_41_lvl; protected boolean field_42_fBiDi; protected boolean field_43_fNumRMIns; @@ -143,29 +141,111 @@ public abstract class PAPAbstractType protected long field_78_ipgp; protected long field_79_rsid; - protected PAPAbstractType() - { - this.field_11_lspd = new LineSpacingDescriptor(); - this.field_11_lspd = new LineSpacingDescriptor(); - this.field_28_dcs = new DropCapSpecifier(); - this.field_32_fWidowControl = true; - this.field_41_lvl = 9; - this.field_60_brcTop = new BorderCode(); - this.field_61_brcLeft = new BorderCode(); - this.field_62_brcBottom = new BorderCode(); - this.field_63_brcRight = new BorderCode(); - this.field_64_brcBetween = new BorderCode(); - this.field_65_brcBar = new BorderCode(); - this.field_66_shd = new ShadingDescriptor(); - this.field_67_anld = new byte[0]; - this.field_68_phe = new byte[0]; - this.field_71_dttmPropRMark = new DateAndTime(); - this.field_73_rgdxaTab = new int[0]; - this.field_74_rgtbd = new TabDescriptor[0]; - this.field_75_numrm = new byte[0]; - this.field_76_ptap = new byte[0]; - } + protected PAPAbstractType() { + field_11_lspd = new LineSpacingDescriptor(); + field_11_lspd = new LineSpacingDescriptor(); + field_28_dcs = new DropCapSpecifier(); + field_32_fWidowControl = true; + field_41_lvl = 9; + field_60_brcTop = new BorderCode(); + field_61_brcLeft = new BorderCode(); + field_62_brcBottom = new BorderCode(); + field_63_brcRight = new BorderCode(); + field_64_brcBetween = new BorderCode(); + field_65_brcBar = new BorderCode(); + field_66_shd = new ShadingDescriptor(); + field_67_anld = new byte[0]; + field_68_phe = new byte[0]; + field_71_dttmPropRMark = new DateAndTime(); + field_73_rgdxaTab = new int[0]; + field_74_rgtbd = new TabDescriptor[0]; + field_75_numrm = new byte[0]; + field_76_ptap = new byte[0]; + } + + protected PAPAbstractType(PAPAbstractType other) { + field_1_istd = other.field_1_istd; + field_2_fSideBySide = other.field_2_fSideBySide; + field_3_fKeep = other.field_3_fKeep; + field_4_fKeepFollow = other.field_4_fKeepFollow; + field_5_fPageBreakBefore = other.field_5_fPageBreakBefore; + field_6_brcl = other.field_6_brcl; + field_7_brcp = other.field_7_brcp; + field_8_ilvl = other.field_8_ilvl; + field_9_ilfo = other.field_9_ilfo; + field_10_fNoLnn = other.field_10_fNoLnn; + field_11_lspd = (other.field_11_lspd == null) ? null : other.field_11_lspd.copy(); + field_12_dyaBefore = other.field_12_dyaBefore; + field_13_dyaAfter = other.field_13_dyaAfter; + field_14_fInTable = other.field_14_fInTable; + field_15_finTableW97 = other.field_15_finTableW97; + field_16_fTtp = other.field_16_fTtp; + field_17_dxaAbs = other.field_17_dxaAbs; + field_18_dyaAbs = other.field_18_dyaAbs; + field_19_dxaWidth = other.field_19_dxaWidth; + field_20_fBrLnAbove = other.field_20_fBrLnAbove; + field_21_fBrLnBelow = other.field_21_fBrLnBelow; + field_22_pcVert = other.field_22_pcVert; + field_23_pcHorz = other.field_23_pcHorz; + field_24_wr = other.field_24_wr; + field_25_fNoAutoHyph = other.field_25_fNoAutoHyph; + field_26_dyaHeight = other.field_26_dyaHeight; + field_27_fMinHeight = other.field_27_fMinHeight; + field_28_dcs = (other.field_28_dcs == null) ? null : other.field_28_dcs.copy(); + field_29_dyaFromText = other.field_29_dyaFromText; + field_30_dxaFromText = other.field_30_dxaFromText; + field_31_fLocked = other.field_31_fLocked; + field_32_fWidowControl = other.field_32_fWidowControl; + field_33_fKinsoku = other.field_33_fKinsoku; + field_34_fWordWrap = other.field_34_fWordWrap; + field_35_fOverflowPunct = other.field_35_fOverflowPunct; + field_36_fTopLinePunct = other.field_36_fTopLinePunct; + field_37_fAutoSpaceDE = other.field_37_fAutoSpaceDE; + field_38_fAutoSpaceDN = other.field_38_fAutoSpaceDN; + field_39_wAlignFont = other.field_39_wAlignFont; + field_40_fontAlign = other.field_40_fontAlign; + field_41_lvl = other.field_41_lvl; + field_42_fBiDi = other.field_42_fBiDi; + field_43_fNumRMIns = other.field_43_fNumRMIns; + field_44_fCrLf = other.field_44_fCrLf; + field_45_fUsePgsuSettings = other.field_45_fUsePgsuSettings; + field_46_fAdjustRight = other.field_46_fAdjustRight; + field_47_itap = other.field_47_itap; + field_48_fInnerTableCell = other.field_48_fInnerTableCell; + field_49_fOpenTch = other.field_49_fOpenTch; + field_50_fTtpEmbedded = other.field_50_fTtpEmbedded; + field_51_dxcRight = other.field_51_dxcRight; + field_52_dxcLeft = other.field_52_dxcLeft; + field_53_dxcLeft1 = other.field_53_dxcLeft1; + field_54_fDyaBeforeAuto = other.field_54_fDyaBeforeAuto; + field_55_fDyaAfterAuto = other.field_55_fDyaAfterAuto; + field_56_dxaRight = other.field_56_dxaRight; + field_57_dxaLeft = other.field_57_dxaLeft; + field_58_dxaLeft1 = other.field_58_dxaLeft1; + field_59_jc = other.field_59_jc; + field_60_brcTop = (other.field_60_brcTop == null) ? null : other.field_60_brcTop.copy(); + field_61_brcLeft = (other.field_61_brcLeft == null) ? null : other.field_61_brcLeft.copy(); + field_62_brcBottom = (other.field_62_brcBottom == null) ? null : other.field_62_brcBottom.copy(); + field_63_brcRight = (other.field_63_brcRight == null) ? null : other.field_63_brcRight.copy(); + field_64_brcBetween = (other.field_64_brcBetween == null) ? null : other.field_64_brcBetween.copy(); + field_65_brcBar = (other.field_65_brcBar == null) ? null : other.field_65_brcBar.copy(); + field_66_shd = (other.field_66_shd == null) ? null : other.field_66_shd.copy(); + field_67_anld = (other.field_67_anld == null) ? null : other.field_67_anld.clone(); + field_68_phe = (other.field_68_phe == null) ? null : other.field_68_phe.clone(); + field_69_fPropRMark = other.field_69_fPropRMark; + field_70_ibstPropRMark = other.field_70_ibstPropRMark; + field_71_dttmPropRMark = (other.field_71_dttmPropRMark == null) ? null : other.field_71_dttmPropRMark.copy(); + field_72_itbdMac = other.field_72_itbdMac; + field_73_rgdxaTab = (other.field_73_rgdxaTab == null) ? null : other.field_73_rgdxaTab.clone(); + field_74_rgtbd = (other.field_74_rgtbd == null) ? null + : Stream.of(other.field_74_rgtbd).map(TabDescriptor::copy).toArray(TabDescriptor[]::new); + field_75_numrm = (other.field_75_numrm == null) ? null : other.field_75_numrm.clone(); + field_76_ptap = (other.field_76_ptap == null) ? null : other.field_76_ptap.clone(); + field_77_fNoAllowOverlap = other.field_77_fNoAllowOverlap; + field_78_ipgp = other.field_78_ipgp; + field_79_rsid = other.field_79_rsid; + } public String toString() { @@ -430,7 +510,7 @@ public abstract class PAPAbstractType /** * Border line style. * - * @return One of + * @return One of * <li>{@link #BRCL_SINGLE} * <li>{@link #BRCL_THICK} * <li>{@link #BRCL_DOUBLE} @@ -446,7 +526,7 @@ public abstract class PAPAbstractType * Border line style. * * @param field_6_brcl - * One of + * One of * <li>{@link #BRCL_SINGLE} * <li>{@link #BRCL_THICK} * <li>{@link #BRCL_DOUBLE} @@ -461,7 +541,7 @@ public abstract class PAPAbstractType /** * Rectangle border codes. * - * @return One of + * @return One of * <li>{@link #BRCP_NONE} * <li>{@link #BRCP_BORDER_ABOVE} * <li>{@link #BRCP_BORDER_BELOW} @@ -478,7 +558,7 @@ public abstract class PAPAbstractType * Rectangle border codes. * * @param field_7_brcp - * One of + * One of * <li>{@link #BRCP_NONE} * <li>{@link #BRCP_BORDER_ABOVE} * <li>{@link #BRCP_BORDER_BELOW} @@ -512,23 +592,23 @@ public abstract class PAPAbstractType /** * "A 16-bit signed integer value that is used to determine which list * contains the paragraph. This value MUST be one of the following: - * + * * 0x0000 -- This paragraph is not in a list, and any list formatting on the * paragraph is removed. - * + * * 0x0001 - 0x07FE -- The value is a 1-based index into PlfLfo.rgLfo. The * LFO at this index defines the list that this paragraph is in. - * + * * 0xF801 -- This paragraph is not in a list. - * + * * 0xF802 - 0xFFFF -- The value is the negation of a 1-based index into * PlfLfo.rgLfo. The LFO at this index defines the list that this paragraph * is in. The logical left indentation (see sprmPDxaLeft) and the logical * left first line indentation (see sprmPDxaLeft1) of the paragraph MUST be * preserved despite any list formatting. - * + * * By default, a paragraph is not in a list." - * + * * Quote from [MS-DOC] -- v20110315, page 125 */ @Internal @@ -540,22 +620,22 @@ public abstract class PAPAbstractType /** * "A 16-bit signed integer value that is used to determine which list * contains the paragraph. This value MUST be one of the following: - * + * * 0x0000 -- This paragraph is not in a list, and any list formatting on the * paragraph is removed. - * + * * 0x0001 - 0x07FE -- The value is a 1-based index into PlfLfo.rgLfo. The * LFO at this index defines the list that this paragraph is in. - * + * * 0xF801 -- This paragraph is not in a list. - * + * * 0xF802 - 0xFFFF -- The value is the negation of a 1-based index into * PlfLfo.rgLfo. The LFO at this index defines the list that this paragraph * is in. The logical left indentation (see sprmPDxaLeft) and the logical * left first line indentation (see sprmPDxaLeft1) of the paragraph MUST be * preserved despite any list formatting. By default, a paragraph is not in * a list." - * + * * Quote from [MS-DOC] -- v20110315, page 125 */ @Internal @@ -873,7 +953,7 @@ public abstract class PAPAbstractType /** * Minimum height is exact or auto. * - * @return One of + * @return One of * <li>{@link #FMINHEIGHT_EXACT} * <li>{@link #FMINHEIGHT_AT_LEAST} */ @@ -887,7 +967,7 @@ public abstract class PAPAbstractType * Minimum height is exact or auto. * * @param field_27_fMinHeight - * One of + * One of * <li>{@link #FMINHEIGHT_EXACT} * <li>{@link #FMINHEIGHT_AT_LEAST} */ @@ -1098,7 +1178,7 @@ public abstract class PAPAbstractType /** * Get the wAlignFont field for the PAP record. * - * @return One of + * @return One of * <li>{@link #WALIGNFONT_HANGING} * <li>{@link #WALIGNFONT_CENTERED} * <li>{@link #WALIGNFONT_ROMAN} @@ -1115,7 +1195,7 @@ public abstract class PAPAbstractType * Set the wAlignFont field for the PAP record. * * @param field_39_wAlignFont - * One of + * One of * <li>{@link #WALIGNFONT_HANGING} * <li>{@link #WALIGNFONT_CENTERED} * <li>{@link #WALIGNFONT_ROMAN} @@ -1850,7 +1930,7 @@ public abstract class PAPAbstractType /** * Sets the fVertical field value. - * + * */ @Internal public void setFVertical( boolean value ) @@ -1859,7 +1939,7 @@ public abstract class PAPAbstractType } /** - * + * * @return the fVertical field value. */ @Internal @@ -1870,7 +1950,7 @@ public abstract class PAPAbstractType /** * Sets the fBackward field value. - * + * */ @Internal public void setFBackward( boolean value ) @@ -1879,7 +1959,7 @@ public abstract class PAPAbstractType } /** - * + * * @return the fBackward field value. */ @Internal @@ -1890,7 +1970,7 @@ public abstract class PAPAbstractType /** * Sets the fRotateFont field value. - * + * */ @Internal public void setFRotateFont( boolean value ) @@ -1899,7 +1979,7 @@ public abstract class PAPAbstractType } /** - * + * * @return the fRotateFont field value. */ @Internal
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SEPAbstractType.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SEPAbstractType.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SEPAbstractType.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SEPAbstractType.java Tue Dec 24 11:56:42 2019 @@ -26,39 +26,40 @@ import org.apache.poi.util.Internal; /** * Section Properties. - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - * - * @author S. Ryan Ackley */ @Internal -public abstract class SEPAbstractType -{ +public abstract class SEPAbstractType { - protected byte field_1_bkc; /** No break */ - /**/public final static byte BKC_NO_BREAK = 0; + public static final byte BKC_NO_BREAK = 0; /** New column */ - /**/public final static byte BKC_NEW_COLUMN = 1; + public static final byte BKC_NEW_COLUMN = 1; /** New page */ - /**/public final static byte BKC_NEW_PAGE = 2; + public static final byte BKC_NEW_PAGE = 2; /** Even page */ - /**/public final static byte BKC_EVEN_PAGE = 3; + public static final byte BKC_EVEN_PAGE = 3; /** Odd page */ - /**/public final static byte BKC_ODD_PAGE = 4; - protected boolean field_2_fTitlePage; - protected boolean field_3_fAutoPgn; - protected byte field_4_nfcPgn; + public static final byte BKC_ODD_PAGE = 4; + /** Arabic */ - /**/public final static byte NFCPGN_ARABIC = 0; + public static final byte NFCPGN_ARABIC = 0; /** Roman (upper case) */ - /**/public final static byte NFCPGN_ROMAN_UPPER_CASE = 1; + public static final byte NFCPGN_ROMAN_UPPER_CASE = 1; /** Roman (lower case) */ - /**/public final static byte NFCPGN_ROMAN_LOWER_CASE = 2; + public static final byte NFCPGN_ROMAN_LOWER_CASE = 2; /** Letter (upper case) */ - /**/public final static byte NFCPGN_LETTER_UPPER_CASE = 3; + public static final byte NFCPGN_LETTER_UPPER_CASE = 3; /** Letter (lower case) */ - /**/public final static byte NFCPGN_LETTER_LOWER_CASE = 4; + public static final byte NFCPGN_LETTER_LOWER_CASE = 4; + + public static final boolean DMORIENTPAGE_LANDSCAPE = false; + public static final boolean DMORIENTPAGE_PORTRAIT = true; + + + protected byte field_1_bkc; + protected boolean field_2_fTitlePage; + protected boolean field_3_fAutoPgn; + protected byte field_4_nfcPgn; protected boolean field_5_fUnlocked; protected byte field_6_cnsPgn; protected boolean field_7_fPgnRestart; @@ -86,8 +87,6 @@ public abstract class SEPAbstractType protected int field_29_clm; protected int field_30_unused2; protected boolean field_31_dmOrientPage; - /**/public final static boolean DMORIENTPAGE_LANDSCAPE = false; - /**/public final static boolean DMORIENTPAGE_PORTRAIT = true; protected byte field_32_iHeadingPgn; protected int field_33_pgnStart; protected int field_34_lnnMin; @@ -117,8 +116,7 @@ public abstract class SEPAbstractType protected short field_58_unused6; protected byte[] field_59_olstAnm; - protected SEPAbstractType() - { + protected SEPAbstractType() { this.field_1_bkc = 2; this.field_8_fEndNote = true; this.field_13_dxaPgn = 720; @@ -139,6 +137,68 @@ public abstract class SEPAbstractType this.field_53_dxaColumns = 720; } + protected SEPAbstractType(SEPAbstractType other) { + field_1_bkc = other.field_1_bkc; + field_2_fTitlePage = other.field_2_fTitlePage; + field_3_fAutoPgn = other.field_3_fAutoPgn; + field_4_nfcPgn = other.field_4_nfcPgn; + field_5_fUnlocked = other.field_5_fUnlocked; + field_6_cnsPgn = other.field_6_cnsPgn; + field_7_fPgnRestart = other.field_7_fPgnRestart; + field_8_fEndNote = other.field_8_fEndNote; + field_9_lnc = other.field_9_lnc; + field_10_grpfIhdt = other.field_10_grpfIhdt; + field_11_nLnnMod = other.field_11_nLnnMod; + field_12_dxaLnn = other.field_12_dxaLnn; + field_13_dxaPgn = other.field_13_dxaPgn; + field_14_dyaPgn = other.field_14_dyaPgn; + field_15_fLBetween = other.field_15_fLBetween; + field_16_vjc = other.field_16_vjc; + field_17_dmBinFirst = other.field_17_dmBinFirst; + field_18_dmBinOther = other.field_18_dmBinOther; + field_19_dmPaperReq = other.field_19_dmPaperReq; + field_20_brcTop = (other.field_20_brcTop == null) ? null : other.field_20_brcTop.copy(); + field_21_brcLeft = (other.field_21_brcLeft == null) ? null : other.field_21_brcLeft.copy(); + field_22_brcBottom = (other.field_22_brcBottom == null) ? null : other.field_22_brcBottom.copy(); + field_23_brcRight = (other.field_23_brcRight == null) ? null : other.field_23_brcRight.copy(); + field_24_fPropMark = other.field_24_fPropMark; + field_25_ibstPropRMark = other.field_25_ibstPropRMark; + field_26_dttmPropRMark = (other.field_26_dttmPropRMark == null) ? null : other.field_26_dttmPropRMark.copy(); + field_27_dxtCharSpace = other.field_27_dxtCharSpace; + field_28_dyaLinePitch = other.field_28_dyaLinePitch; + field_29_clm = other.field_29_clm; + field_30_unused2 = other.field_30_unused2; + field_31_dmOrientPage = other.field_31_dmOrientPage; + field_32_iHeadingPgn = other.field_32_iHeadingPgn; + field_33_pgnStart = other.field_33_pgnStart; + field_34_lnnMin = other.field_34_lnnMin; + field_35_wTextFlow = other.field_35_wTextFlow; + field_36_unused3 = other.field_36_unused3; + field_37_pgbProp = other.field_37_pgbProp; + field_38_unused4 = other.field_38_unused4; + field_39_xaPage = other.field_39_xaPage; + field_40_yaPage = other.field_40_yaPage; + field_41_xaPageNUp = other.field_41_xaPageNUp; + field_42_yaPageNUp = other.field_42_yaPageNUp; + field_43_dxaLeft = other.field_43_dxaLeft; + field_44_dxaRight = other.field_44_dxaRight; + field_45_dyaTop = other.field_45_dyaTop; + field_46_dyaBottom = other.field_46_dyaBottom; + field_47_dzaGutter = other.field_47_dzaGutter; + field_48_dyaHdrTop = other.field_48_dyaHdrTop; + field_49_dyaHdrBottom = other.field_49_dyaHdrBottom; + field_50_ccolM1 = other.field_50_ccolM1; + field_51_fEvenlySpaced = other.field_51_fEvenlySpaced; + field_52_unused5 = other.field_52_unused5; + field_53_dxaColumns = other.field_53_dxaColumns; + field_54_rgdxaColumn = (other.field_54_rgdxaColumn == null) ? null : other.field_54_rgdxaColumn.clone(); + field_55_dxaColumnWidth = other.field_55_dxaColumnWidth; + field_56_dmOrientFirst = other.field_56_dmOrientFirst; + field_57_fLayout = other.field_57_fLayout; + field_58_unused6 = other.field_58_unused6; + field_59_olstAnm = (other.field_59_olstAnm == null) ? null : other.field_59_olstAnm.clone(); + } + public String toString() { @@ -270,7 +330,7 @@ public abstract class SEPAbstractType /** * Break code. * - * @return One of + * @return One of * <li>{@link #BKC_NO_BREAK} * <li>{@link #BKC_NEW_COLUMN} * <li>{@link #BKC_NEW_PAGE} @@ -286,7 +346,7 @@ public abstract class SEPAbstractType * Break code. * * @param field_1_bkc - * One of + * One of * <li>{@link #BKC_NO_BREAK} * <li>{@link #BKC_NEW_COLUMN} * <li>{@link #BKC_NEW_PAGE} @@ -333,7 +393,7 @@ public abstract class SEPAbstractType /** * Page number format code. * - * @return One of + * @return One of * <li>{@link #NFCPGN_ARABIC} * <li>{@link #NFCPGN_ROMAN_UPPER_CASE} * <li>{@link #NFCPGN_ROMAN_LOWER_CASE} @@ -349,7 +409,7 @@ public abstract class SEPAbstractType * Page number format code. * * @param field_4_nfcPgn - * One of + * One of * <li>{@link #NFCPGN_ARABIC} * <li>{@link #NFCPGN_ROMAN_UPPER_CASE} * <li>{@link #NFCPGN_ROMAN_LOWER_CASE} @@ -780,7 +840,7 @@ public abstract class SEPAbstractType /** * Get the dmOrientPage field for the SEP record. * - * @return One of + * @return One of * <li>{@link #DMORIENTPAGE_LANDSCAPE} * <li>{@link #DMORIENTPAGE_PORTRAIT} */ @@ -793,7 +853,7 @@ public abstract class SEPAbstractType * Set the dmOrientPage field for the SEP record. * * @param field_31_dmOrientPage - * One of + * One of * <li>{@link #DMORIENTPAGE_LANDSCAPE} * <li>{@link #DMORIENTPAGE_PORTRAIT} */ @@ -1250,4 +1310,4 @@ public abstract class SEPAbstractType this.field_59_olstAnm = field_59_olstAnm; } -} // END OF CLASS +} Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SHD80AbstractType.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SHD80AbstractType.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SHD80AbstractType.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SHD80AbstractType.java Tue Dec 24 11:56:42 2019 @@ -24,32 +24,24 @@ import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; /** - * The Shd80 structure specifies the colors and pattern that are used for background - shading. As an exception to the constraints that are specified by Ico and Ipat, a Shd80 can - be set to Shd80Nil and specifies that no shading is applied. <p>Class and fields - descriptions are quoted from Word (.doc) Binary File Format by Microsoft Corporation - - * <p> - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/types/definitions. - * <p> - * This class is internal. It content or properties may change without notice - * due to changes in our knowledge of internal Microsoft Word binary structures. - - * @author Sergey Vladimirov; according to Word (.doc) Binary File Format by Microsoft Corporation. - + * The Shd80 structure specifies the colors and pattern that are used for background shading. + * As an exception to the constraints that are specified by Ico and Ipat, + * a Shd80 can be set to Shd80Nil and specifies that no shading is applied. */ +@SuppressWarnings("unused") @Internal -public abstract class SHD80AbstractType -{ +public abstract class SHD80AbstractType { + + private static final BitField icoFore = new BitField(0x001F); + private static final BitField icoBack = new BitField(0x03E0); + private static final BitField ipat = new BitField(0xFC00); protected short field_1_value; - /**/private static final BitField icoFore = new BitField(0x001F); - /**/private static final BitField icoBack = new BitField(0x03E0); - /**/private static final BitField ipat = new BitField(0xFC00); - protected SHD80AbstractType() - { + protected SHD80AbstractType() { } + + protected SHD80AbstractType(SHD80AbstractType other) { + field_1_value = other.field_1_value; } protected void fillFields( byte[] data, int offset ) @@ -189,4 +181,4 @@ public abstract class SHD80AbstractType return ( byte )ipat.getValue(field_1_value); } -} // END OF CLASS +} Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SHDAbstractType.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SHDAbstractType.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SHDAbstractType.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SHDAbstractType.java Tue Dec 24 11:56:42 2019 @@ -25,32 +25,24 @@ import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; /** - * The Shd structure specifies the colors and pattern that are used for background shading. <p>Class - and - fields descriptions are quoted from Word (.doc) Binary File Format by Microsoft Corporation - - * <p> - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/types/definitions. - * <p> - * This class is internal. It content or properties may change without notice - * due to changes in our knowledge of internal Microsoft Word binary structures. - - * @author Sergey Vladimirov; according to Word (.doc) Binary File Format by Microsoft Corporation. - + * The Shd structure specifies the colors and pattern that are used for background shading. */ @Internal -public abstract class SHDAbstractType -{ +public abstract class SHDAbstractType { protected Colorref field_1_cvFore; protected Colorref field_2_cvBack; protected int field_3_ipat; - protected SHDAbstractType() - { - this.field_1_cvFore = new Colorref(); - this.field_2_cvBack = new Colorref(); + protected SHDAbstractType() { + field_1_cvFore = new Colorref(); + field_2_cvBack = new Colorref(); + } + + protected SHDAbstractType(SHDAbstractType other) { + field_1_cvFore = (other.field_1_cvFore == null) ? null : other.field_1_cvFore.copy(); + field_2_cvBack = (other.field_2_cvBack == null) ? null : other.field_2_cvBack.copy(); + field_3_ipat = other.field_3_ipat; } protected void fillFields( byte[] data, int offset ) @@ -175,4 +167,4 @@ public abstract class SHDAbstractType this.field_3_ipat = field_3_ipat; } -} // END OF CLASS +} Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TAPAbstractType.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TAPAbstractType.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TAPAbstractType.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TAPAbstractType.java Tue Dec 24 11:56:42 2019 @@ -19,6 +19,7 @@ package org.apache.poi.hwpf.model.types; import java.util.Arrays; +import java.util.stream.Stream; import org.apache.poi.hwpf.usermodel.BorderCode; import org.apache.poi.hwpf.usermodel.ShadingDescriptor; @@ -28,21 +29,39 @@ import org.apache.poi.util.BitField; import org.apache.poi.util.Internal; /** - * Table Properties. Properties descriptions quoted from official 97-2007 binary file - format specification. - - * <p> - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/types/definitions. - * <p> - * This class is internal. It content or properties may change without notice - * due to changes in our knowledge of internal Microsoft Word binary structures. - - * @author S. Ryan Ackley + * Table Properties */ +@SuppressWarnings("unused") @Internal -public abstract class TAPAbstractType -{ +public abstract class TAPAbstractType { + private static final BitField fAutofit = new BitField(0x00000001); + private static final BitField fKeepFollow = new BitField(0x00000002); + private static final BitField ftsWidth = new BitField(0x0000001c); + private static final BitField ftsWidthIndent = new BitField(0x000000e0); + private static final BitField ftsWidthBefore = new BitField(0x00000700); + private static final BitField ftsWidthAfter = new BitField(0x00003800); + private static final BitField fNeverBeenAutofit = new BitField(0x00004000); + private static final BitField fInvalAutofit = new BitField(0x00008000); + private static final BitField widthAndFitsFlags_empty1 = new BitField(0x00070000); + private static final BitField fVert = new BitField(0x00080000); + private static final BitField pcVert = new BitField(0x00300000); + private static final BitField pcHorz = new BitField(0x00c00000); + private static final BitField widthAndFitsFlags_empty2 = new BitField(0xff000000); + + private static final BitField fFirstRow = new BitField(0x0001); + private static final BitField fLastRow = new BitField(0x0002); + private static final BitField fOutline = new BitField(0x0004); + private static final BitField fOrigWordTableRules = new BitField(0x0008); + private static final BitField fCellSpacing = new BitField(0x0010); + private static final BitField grpfTap_unused = new BitField(0xffe0); + + private static final BitField fWrapToWwd = new BitField(0x0001); + private static final BitField fNotPageView = new BitField(0x0002); + private static final BitField viewFlags_unused1 = new BitField(0x0004); + private static final BitField fWebView = new BitField(0x0008); + private static final BitField fAdjusted = new BitField(0x0010); + private static final BitField viewFlags_unused2 = new BitField(0xffe0); + protected short field_1_istd; protected short field_2_jc; @@ -57,19 +76,6 @@ public abstract class TAPAbstractType protected short field_11_wWidthBefore; protected short field_12_wWidthAfter; protected int field_13_widthAndFitsFlags; - /**/private static BitField fAutofit = new BitField(0x00000001); - /**/private static BitField fKeepFollow = new BitField(0x00000002); - /**/private static BitField ftsWidth = new BitField(0x0000001c); - /**/private static BitField ftsWidthIndent = new BitField(0x000000e0); - /**/private static BitField ftsWidthBefore = new BitField(0x00000700); - /**/private static BitField ftsWidthAfter = new BitField(0x00003800); - /**/private static BitField fNeverBeenAutofit = new BitField(0x00004000); - /**/private static BitField fInvalAutofit = new BitField(0x00008000); - /**/private static BitField widthAndFitsFlags_empty1 = new BitField(0x00070000); - /**/private static BitField fVert = new BitField(0x00080000); - /**/private static BitField pcVert = new BitField(0x00300000); - /**/private static BitField pcHorz = new BitField(0x00c00000); - /**/private static BitField widthAndFitsFlags_empty2 = new BitField(0xff000000); protected int field_14_dxaAbs; protected int field_15_dyaAbs; protected int field_16_dxaFromText; @@ -82,12 +88,6 @@ public abstract class TAPAbstractType protected byte field_23_fSpare; protected int field_24_grpfTap; protected int field_25_internalFlags; - /**/private static BitField fFirstRow = new BitField(0x0001); - /**/private static BitField fLastRow = new BitField(0x0002); - /**/private static BitField fOutline = new BitField(0x0004); - /**/private static BitField fOrigWordTableRules = new BitField(0x0008); - /**/private static BitField fCellSpacing = new BitField(0x0010); - /**/private static BitField grpfTap_unused = new BitField(0xffe0); protected short field_26_itcMac; protected int field_27_dxaAdjust; protected int field_28_dxaWebView; @@ -95,12 +95,6 @@ public abstract class TAPAbstractType protected int field_30_dxaColWidthWwd; protected short field_31_pctWwd; protected int field_32_viewFlags; - /**/private static BitField fWrapToWwd = new BitField(0x0001); - /**/private static BitField fNotPageView = new BitField(0x0002); - /**/private static BitField viewFlags_unused1 = new BitField(0x0004); - /**/private static BitField fWebView = new BitField(0x0008); - /**/private static BitField fAdjusted = new BitField(0x0010); - /**/private static BitField viewFlags_unused2 = new BitField(0xffe0); protected short[] field_33_rgdxaCenter; protected short[] field_34_rgdxaCenterPrint; protected ShadingDescriptor field_35_shdTable; @@ -151,8 +145,7 @@ public abstract class TAPAbstractType protected BorderCode field_80_rgbrcInsideDefault_0; protected BorderCode field_81_rgbrcInsideDefault_1; - protected TAPAbstractType() - { + protected TAPAbstractType() { this.field_8_tlp = new TableAutoformatLookSpecifier(); this.field_33_rgdxaCenter = new short[0]; this.field_34_rgdxaCenterPrint = new short[0]; @@ -169,6 +162,91 @@ public abstract class TAPAbstractType this.field_81_rgbrcInsideDefault_1 = new BorderCode(); } + protected TAPAbstractType(TAPAbstractType other) { + field_1_istd = other.field_1_istd; + field_2_jc = other.field_2_jc; + field_3_dxaGapHalf = other.field_3_dxaGapHalf; + field_4_dyaRowHeight = other.field_4_dyaRowHeight; + field_5_fCantSplit = other.field_5_fCantSplit; + field_6_fCantSplit90 = other.field_6_fCantSplit90; + field_7_fTableHeader = other.field_7_fTableHeader; + field_8_tlp = (other.field_8_tlp == null) ? null : other.field_8_tlp.copy(); + field_9_wWidth = other.field_9_wWidth; + field_10_wWidthIndent = other.field_10_wWidthIndent; + field_11_wWidthBefore = other.field_11_wWidthBefore; + field_12_wWidthAfter = other.field_12_wWidthAfter; + field_13_widthAndFitsFlags = other.field_13_widthAndFitsFlags; + field_14_dxaAbs = other.field_14_dxaAbs; + field_15_dyaAbs = other.field_15_dyaAbs; + field_16_dxaFromText = other.field_16_dxaFromText; + field_17_dyaFromText = other.field_17_dyaFromText; + field_18_dxaFromTextRight = other.field_18_dxaFromTextRight; + field_19_dyaFromTextBottom = other.field_19_dyaFromTextBottom; + field_20_fBiDi = other.field_20_fBiDi; + field_21_fRTL = other.field_21_fRTL; + field_22_fNoAllowOverlap = other.field_22_fNoAllowOverlap; + field_23_fSpare = other.field_23_fSpare; + field_24_grpfTap = other.field_24_grpfTap; + field_25_internalFlags = other.field_25_internalFlags; + field_26_itcMac = other.field_26_itcMac; + field_27_dxaAdjust = other.field_27_dxaAdjust; + field_28_dxaWebView = other.field_28_dxaWebView; + field_29_dxaRTEWrapWidth = other.field_29_dxaRTEWrapWidth; + field_30_dxaColWidthWwd = other.field_30_dxaColWidthWwd; + field_31_pctWwd = other.field_31_pctWwd; + field_32_viewFlags = other.field_32_viewFlags; + field_33_rgdxaCenter = (other.field_33_rgdxaCenter == null) ? null : other.field_33_rgdxaCenter.clone(); + field_34_rgdxaCenterPrint = (other.field_34_rgdxaCenterPrint == null) ? null : other.field_34_rgdxaCenterPrint.clone(); + field_35_shdTable = (other.field_35_shdTable == null) ? null : other.field_35_shdTable.copy(); + field_36_brcBottom = (other.field_36_brcBottom == null) ? null : other.field_36_brcBottom.copy(); + field_37_brcTop = (other.field_37_brcTop == null) ? null : other.field_37_brcTop.copy(); + field_38_brcLeft = (other.field_38_brcLeft == null) ? null : other.field_38_brcLeft.copy(); + field_39_brcRight = (other.field_39_brcRight == null) ? null : other.field_39_brcRight.copy(); + field_40_brcVertical = (other.field_40_brcVertical == null) ? null : other.field_40_brcVertical.copy(); + field_41_brcHorizontal = (other.field_41_brcHorizontal == null) ? null : other.field_41_brcHorizontal.copy(); + field_42_wCellPaddingDefaultTop = other.field_42_wCellPaddingDefaultTop; + field_43_wCellPaddingDefaultLeft = other.field_43_wCellPaddingDefaultLeft; + field_44_wCellPaddingDefaultBottom = other.field_44_wCellPaddingDefaultBottom; + field_45_wCellPaddingDefaultRight = other.field_45_wCellPaddingDefaultRight; + field_46_ftsCellPaddingDefaultTop = other.field_46_ftsCellPaddingDefaultTop; + field_47_ftsCellPaddingDefaultLeft = other.field_47_ftsCellPaddingDefaultLeft; + field_48_ftsCellPaddingDefaultBottom = other.field_48_ftsCellPaddingDefaultBottom; + field_49_ftsCellPaddingDefaultRight = other.field_49_ftsCellPaddingDefaultRight; + field_50_wCellSpacingDefaultTop = other.field_50_wCellSpacingDefaultTop; + field_51_wCellSpacingDefaultLeft = other.field_51_wCellSpacingDefaultLeft; + field_52_wCellSpacingDefaultBottom = other.field_52_wCellSpacingDefaultBottom; + field_53_wCellSpacingDefaultRight = other.field_53_wCellSpacingDefaultRight; + field_54_ftsCellSpacingDefaultTop = other.field_54_ftsCellSpacingDefaultTop; + field_55_ftsCellSpacingDefaultLeft = other.field_55_ftsCellSpacingDefaultLeft; + field_56_ftsCellSpacingDefaultBottom = other.field_56_ftsCellSpacingDefaultBottom; + field_57_ftsCellSpacingDefaultRight = other.field_57_ftsCellSpacingDefaultRight; + field_58_wCellPaddingOuterTop = other.field_58_wCellPaddingOuterTop; + field_59_wCellPaddingOuterLeft = other.field_59_wCellPaddingOuterLeft; + field_60_wCellPaddingOuterBottom = other.field_60_wCellPaddingOuterBottom; + field_61_wCellPaddingOuterRight = other.field_61_wCellPaddingOuterRight; + field_62_ftsCellPaddingOuterTop = other.field_62_ftsCellPaddingOuterTop; + field_63_ftsCellPaddingOuterLeft = other.field_63_ftsCellPaddingOuterLeft; + field_64_ftsCellPaddingOuterBottom = other.field_64_ftsCellPaddingOuterBottom; + field_65_ftsCellPaddingOuterRight = other.field_65_ftsCellPaddingOuterRight; + field_66_wCellSpacingOuterTop = other.field_66_wCellSpacingOuterTop; + field_67_wCellSpacingOuterLeft = other.field_67_wCellSpacingOuterLeft; + field_68_wCellSpacingOuterBottom = other.field_68_wCellSpacingOuterBottom; + field_69_wCellSpacingOuterRight = other.field_69_wCellSpacingOuterRight; + field_70_ftsCellSpacingOuterTop = other.field_70_ftsCellSpacingOuterTop; + field_71_ftsCellSpacingOuterLeft = other.field_71_ftsCellSpacingOuterLeft; + field_72_ftsCellSpacingOuterBottom = other.field_72_ftsCellSpacingOuterBottom; + field_73_ftsCellSpacingOuterRight = other.field_73_ftsCellSpacingOuterRight; + field_74_rgtc = (other.field_74_rgtc == null) ? null + : Stream.of(other.field_74_rgtc).map(TableCellDescriptor::copy).toArray(TableCellDescriptor[]::new); + field_75_rgshd = (other.field_75_rgshd == null) ? null + : Stream.of(other.field_75_rgshd).map(ShadingDescriptor::copy).toArray(ShadingDescriptor[]::new); + field_76_fPropRMark = other.field_76_fPropRMark; + field_77_fHasOldProps = other.field_77_fHasOldProps; + field_78_cHorzBands = other.field_78_cHorzBands; + field_79_cVertBands = other.field_79_cVertBands; + field_80_rgbrcInsideDefault_0 = (other.field_80_rgbrcInsideDefault_0 == null) ? null : other.field_80_rgbrcInsideDefault_0.copy(); + field_81_rgbrcInsideDefault_1 = (other.field_81_rgbrcInsideDefault_1 == null) ? null : other.field_81_rgbrcInsideDefault_1.copy(); + } public String toString() { Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TBDAbstractType.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TBDAbstractType.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TBDAbstractType.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TBDAbstractType.java Tue Dec 24 11:56:42 2019 @@ -22,33 +22,23 @@ import org.apache.poi.util.BitField; import org.apache.poi.util.Internal; /** - * The TBD is a substructure of the PAP. <p>Class and fields descriptions are quoted from - Microsoft Office Word 97-2007 Binary File Format - - * <p> - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/types/definitions. - * <p> - * This class is internal. It content or properties may change without notice - * due to changes in our knowledge of internal Microsoft Word binary structures. - - * @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary File Format - Specification [*.doc] - + * The TBD is a substructure of the PAP. */ @Internal -public abstract class TBDAbstractType -{ +public abstract class TBDAbstractType { + private static final BitField jc = new BitField(0x07); + private static final BitField tlc = new BitField(0x38); + private static final BitField reserved = new BitField(0xc0); protected byte field_1_value; - /**/private static BitField jc = new BitField(0x07); - /**/private static BitField tlc = new BitField(0x38); - /**/private static BitField reserved = new BitField(0xc0); - protected TBDAbstractType() - { + protected TBDAbstractType() { } + + protected TBDAbstractType(TBDAbstractType other) { + field_1_value = other.field_1_value; } + protected void fillFields( byte[] data, int offset ) { field_1_value = data[ 0x0 + offset ]; @@ -141,7 +131,7 @@ public abstract class TBDAbstractType /** * Sets the reserved field value. - * + * */ @Internal public void setReserved( byte value ) @@ -150,7 +140,7 @@ public abstract class TBDAbstractType } /** - * + * * @return the reserved field value. */ @Internal Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TCAbstractType.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TCAbstractType.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TCAbstractType.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TCAbstractType.java Tue Dec 24 11:56:42 2019 @@ -18,39 +18,30 @@ package org.apache.poi.hwpf.model.types; -import org.apache.poi.hwpf.usermodel.*; -import org.apache.poi.util.*; +import org.apache.poi.hwpf.usermodel.BorderCode; +import org.apache.poi.hwpf.usermodel.ShadingDescriptor; +import org.apache.poi.util.BitField; +import org.apache.poi.util.Internal; /** * Table Cell Descriptor. - * <p> - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/types/definitions. - * <p> - * This class is internal. It content or properties may change without notice - * due to changes in our knowledge of internal Microsoft Word binary structures. - - * @author S. Ryan Ackley. Field descriptions are quoted from Microsoft Office Word 97-2007 Binary - File Format (.doc) Specification - */ @Internal -public abstract class TCAbstractType -{ +public abstract class TCAbstractType { + private static final BitField fFirstMerged = new BitField(0x0001); + private static final BitField fMerged = new BitField(0x0002); + private static final BitField fVertical = new BitField(0x0004); + private static final BitField fBackward = new BitField(0x0008); + private static final BitField fRotateFont = new BitField(0x0010); + private static final BitField fVertMerge = new BitField(0x0020); + private static final BitField fVertRestart = new BitField(0x0040); + private static final BitField vertAlign = new BitField(0x0180); + private static final BitField ftsWidth = new BitField(0x0E00); + private static final BitField fFitText = new BitField(0x1000); + private static final BitField fNoWrap = new BitField(0x2000); + private static final BitField fUnused = new BitField(0xC000); protected short field_1_rgf; - /**/private static BitField fFirstMerged = new BitField(0x0001); - /**/private static BitField fMerged = new BitField(0x0002); - /**/private static BitField fVertical = new BitField(0x0004); - /**/private static BitField fBackward = new BitField(0x0008); - /**/private static BitField fRotateFont = new BitField(0x0010); - /**/private static BitField fVertMerge = new BitField(0x0020); - /**/private static BitField fVertRestart = new BitField(0x0040); - /**/private static BitField vertAlign = new BitField(0x0180); - /**/private static BitField ftsWidth = new BitField(0x0E00); - /**/private static BitField fFitText = new BitField(0x1000); - /**/private static BitField fNoWrap = new BitField(0x2000); - /**/private static BitField fUnused = new BitField(0xC000); protected short field_2_wWidth; protected ShadingDescriptor field_3_shd; protected short field_4_wCellPaddingLeft; @@ -74,8 +65,7 @@ public abstract class TCAbstractType protected BorderCode field_22_brcBottom; protected BorderCode field_23_brcRight; - protected TCAbstractType() - { + protected TCAbstractType() { this.field_3_shd = new ShadingDescriptor(); this.field_20_brcTop = new BorderCode(); this.field_21_brcLeft = new BorderCode(); @@ -83,6 +73,31 @@ public abstract class TCAbstractType this.field_23_brcRight = new BorderCode(); } + protected TCAbstractType(TCAbstractType other) { + field_1_rgf = other.field_1_rgf; + field_2_wWidth = other.field_2_wWidth; + field_3_shd = (other.field_3_shd == null) ? null : other.field_3_shd.copy(); + field_4_wCellPaddingLeft = other.field_4_wCellPaddingLeft; + field_5_wCellPaddingTop = other.field_5_wCellPaddingTop; + field_6_wCellPaddingBottom = other.field_6_wCellPaddingBottom; + field_7_wCellPaddingRight = other.field_7_wCellPaddingRight; + field_8_ftsCellPaddingLeft = other.field_8_ftsCellPaddingLeft; + field_9_ftsCellPaddingTop = other.field_9_ftsCellPaddingTop; + field_10_ftsCellPaddingBottom = other.field_10_ftsCellPaddingBottom; + field_11_ftsCellPaddingRight = other.field_11_ftsCellPaddingRight; + field_12_wCellSpacingLeft = other.field_12_wCellSpacingLeft; + field_13_wCellSpacingTop = other.field_13_wCellSpacingTop; + field_14_wCellSpacingBottom = other.field_14_wCellSpacingBottom; + field_15_wCellSpacingRight = other.field_15_wCellSpacingRight; + field_16_ftsCellSpacingLeft = other.field_16_ftsCellSpacingLeft; + field_17_ftsCellSpacingTop = other.field_17_ftsCellSpacingTop; + field_18_ftsCellSpacingBottom = other.field_18_ftsCellSpacingBottom; + field_19_ftsCellSpacingRight = other.field_19_ftsCellSpacingRight; + field_20_brcTop = (other.field_20_brcTop == null) ? null : other.field_20_brcTop.copy(); + field_21_brcLeft = (other.field_21_brcLeft == null) ? null : other.field_21_brcLeft.copy(); + field_22_brcBottom = (other.field_22_brcBottom == null) ? null : other.field_22_brcBottom.copy(); + field_23_brcRight = (other.field_23_brcRight == null) ? null : other.field_23_brcRight.copy(); + } public String toString() { Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TLPAbstractType.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TLPAbstractType.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TLPAbstractType.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TLPAbstractType.java Tue Dec 24 11:56:42 2019 @@ -23,22 +23,10 @@ import org.apache.poi.util.LittleEndian; /** * Table Autoformat Look sPecifier (TLP). - * <p> - * Class and fields descriptions are quoted from Microsoft Office Word 97-2007 - * Binary File Format - * - * NOTE: This source is automatically generated please do not modify this file. - * Either subclass or remove the record in src/records/definitions. - * - * @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary - * File Format Specification [*.doc] */ +@SuppressWarnings("unused") @Internal -public abstract class TLPAbstractType -{ - - protected short field_1_itl; - protected byte field_2_tlp_flags; +public abstract class TLPAbstractType { private static final BitField fBorders = new BitField( 0x0001 ); private static final BitField fShading = new BitField( 0x0002 ); private static final BitField fFont = new BitField( 0x0004 ); @@ -47,9 +35,14 @@ public abstract class TLPAbstractType private static final BitField fHdrRows = new BitField( 0x0020 ); private static final BitField fLastRow = new BitField( 0x0040 ); - public TLPAbstractType() - { + protected short field_1_itl; + protected byte field_2_tlp_flags; + + public TLPAbstractType() {} + public TLPAbstractType(TLPAbstractType other) { + field_1_itl = other.field_1_itl; + field_2_tlp_flags = other.field_2_tlp_flags; } protected void fillFields( byte[] data, int offset ) @@ -132,7 +125,7 @@ public abstract class TLPAbstractType /** * When == 1, use the border properties from the selected table look - * + * * @return the fBorders field value. */ public boolean isFBorders() @@ -154,7 +147,7 @@ public abstract class TLPAbstractType /** * When == 1, use the shading properties from the selected table look - * + * * @return the fShading field value. */ public boolean isFShading() @@ -175,7 +168,7 @@ public abstract class TLPAbstractType /** * When == 1, use the font from the selected table look - * + * * @return the fFont field value. */ public boolean isFFont() @@ -196,7 +189,7 @@ public abstract class TLPAbstractType /** * When == 1, use the color from the selected table look - * + * * @return the fColor field value. */ public boolean isFColor() @@ -218,7 +211,7 @@ public abstract class TLPAbstractType /** * When == 1, do best fit from the selected table look - * + * * @return the fBestFit field value. */ public boolean isFBestFit() @@ -241,7 +234,7 @@ public abstract class TLPAbstractType /** * When == 1, apply properties from the selected table look to the header * rows in the table - * + * * @return the fHdrRows field value. */ public boolean isFHdrRows() @@ -264,7 +257,7 @@ public abstract class TLPAbstractType /** * When == 1, apply properties from the selected table look to the last row * in the table - * + * * @return the fLastRow field value. */ public boolean isFLastRow() Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java Tue Dec 24 11:56:42 2019 @@ -51,15 +51,7 @@ public final class ParagraphSprmUncompre byte[] grpprl, int offset) { - ParagraphProperties newProperties = null; - try - { - newProperties = (ParagraphProperties) parent.clone(); - } - catch (CloneNotSupportedException cnse) - { - throw new RuntimeException("There is no way this exception should happen!!"); - } + ParagraphProperties newProperties = parent.copy(); SprmIterator sprmIt = new SprmIterator(grpprl, offset); while (sprmIt.hasNext()) @@ -338,8 +330,8 @@ public final class ParagraphSprmUncompre newPAP.setDttmPropRMark (new DateAndTime(varParam, offset + 3)); break; case 0x40: - // This condition commented out, as Word seems to set outline levels even for - // paragraph with other styles than Heading 1..9, even though specification + // This condition commented out, as Word seems to set outline levels even for + // paragraph with other styles than Heading 1..9, even though specification // does not say so. See bug 49820 for discussion. //if (newPAP.getIstd () < 1 && newPAP.getIstd () > 9) { @@ -347,7 +339,7 @@ public final class ParagraphSprmUncompre } break; case 0x41: - // sprmPFBiDi + // sprmPFBiDi newPAP.setFBiDi(sprm.getOperand() != 0); break; case 0x43: @@ -413,11 +405,11 @@ public final class ParagraphSprmUncompre newPAP.setDxaLeft1( sprm.getOperand() ); break; case 0x61: - // sprmPJc + // sprmPJc newPAP.setJustificationLogical((byte) sprm.getOperand()); break; case 0x67: - // sprmPRsid -- 0x6467 + // sprmPRsid -- 0x6467 newPAP.setRsid( sprm.getOperand() ); break; default: @@ -458,7 +450,7 @@ public final class ParagraphSprmUncompre tabPositions = new int[tabMap.size()]; tabDescriptors = new TabDescriptor[tabPositions.length]; - + List<Integer> list = new ArrayList<>(tabMap.keySet()); Collections.sort(list); Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmBuffer.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmBuffer.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmBuffer.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmBuffer.java Tue Dec 24 11:56:42 2019 @@ -19,12 +19,14 @@ package org.apache.poi.hwpf.sprm; import java.util.Arrays; +import org.apache.poi.common.Duplicatable; import org.apache.poi.util.IOUtils; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; +import org.apache.poi.util.Removal; @Internal -public final class SprmBuffer implements Cloneable { +public final class SprmBuffer implements Duplicatable { //arbitrarily selected; may need to increase private static final int MAX_RECORD_LENGTH = 100_000; @@ -35,6 +37,13 @@ public final class SprmBuffer implements private final int _sprmsStartOffset; + public SprmBuffer(SprmBuffer other) { + _buf = (other._buf == null) ? null : other._buf.clone(); + _istd = other._istd; + _offset = other._offset; + _sprmsStartOffset = other._sprmsStartOffset; + } + public SprmBuffer(byte[] buf, boolean istd, int sprmsStartOffset) { _offset = buf.length; _buf = buf; @@ -97,15 +106,17 @@ public final class SprmBuffer implements _offset += grpprl.length - offset; } + @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") public SprmBuffer clone() { - try { - SprmBuffer retVal = (SprmBuffer) super.clone(); - retVal._buf = new byte[_buf.length]; - System.arraycopy(_buf, 0, retVal._buf, 0, _buf.length); - return retVal; - } catch (CloneNotSupportedException e) { - throw new RuntimeException(e); - } + return copy(); + } + + @Override + public SprmBuffer copy() { + return new SprmBuffer(this); } private void ensureCapacity(int addition) { @@ -215,4 +226,6 @@ public final class SprmBuffer implements } return stringBuilder.toString(); } + + } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BookmarksImpl.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BookmarksImpl.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BookmarksImpl.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BookmarksImpl.java Tue Dec 24 11:56:42 2019 @@ -243,7 +243,7 @@ public class BookmarksImpl implements Bo indices[counter++] = entry.getKey().intValue(); List<GenericPropertyNode> updated = new ArrayList<>( entry.getValue()); - updated.sort(PropertyNode.EndComparator.instance); + updated.sort(PropertyNode.EndComparator); entry.setValue( updated ); } Arrays.sort( indices ); Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java Tue Dec 24 11:56:42 2019 @@ -17,31 +17,36 @@ package org.apache.poi.hwpf.usermodel; +import org.apache.poi.common.Duplicatable; import org.apache.poi.util.BitField; import org.apache.poi.util.BitFieldFactory; import org.apache.poi.util.LittleEndian; +import org.apache.poi.util.Removal; /** * Mapping class for BRC80 structure (Border Code for Word 97) - * - * <p>Comments are copied out from the binary format specification. */ -public final class BorderCode implements Cloneable { - - public static final int SIZE = 4; - - private short _info; +public final class BorderCode implements Duplicatable { + + public static final int SIZE = 4; + private static final BitField _dptLineWidth = BitFieldFactory.getInstance(0x00ff); private static final BitField _brcType = BitFieldFactory.getInstance(0xff00); - - private short _info2; + private static final BitField _ico = BitFieldFactory.getInstance(0x00ff); private static final BitField _dptSpace = BitFieldFactory.getInstance(0x1f00); private static final BitField _fShadow = BitFieldFactory.getInstance(0x2000); private static final BitField _fFrame = BitFieldFactory.getInstance(0x4000); - - public BorderCode() - { + + private short _info; + private short _info2; + + + public BorderCode() {} + + public BorderCode(BorderCode other) { + _info = other._info; + _info2 = other._info2; } public BorderCode(byte[] buf, int offset) @@ -81,20 +86,27 @@ public final class BorderCode implements assert false : "hashCode not designed"; return 42; // any arbitrary constant will do } - - public Object clone() - throws CloneNotSupportedException - { - return super.clone(); + + @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") + public BorderCode clone() { + return copy(); } - + + @Override + public BorderCode copy() { + return new BorderCode(this); + } + /** * Width of a single line in 1/8 pt, max of 32 pt. */ public int getLineWidth() { return _dptLineWidth.getShortValue(_info); } - + /** * @param lineWidth the width of the line to set */ @@ -136,11 +148,11 @@ public final class BorderCode implements public int getBorderType() { return _brcType.getShortValue(_info); } - + public void setBorderType(int borderType) { _info = _brcType.setShortValue(_info, (short)borderType); } - + /** * Color: * <ul> @@ -166,26 +178,26 @@ public final class BorderCode implements public short getColor() { return _ico.getShortValue(_info2); } - + public void setColor(short color) { _info2 = _ico.setShortValue(_info2, color); } - + /** * Width of space to maintain between border and text within border. - * + * * <p>Must be 0 when BRC is a substructure of TC. - * + * * <p>Stored in points. */ public int getSpace() { return _dptSpace.getShortValue(_info2); } - + public void setSpace(int space) { _info2 = (short)_dptSpace.setValue(_info2, space); } - + /** * When true, border is drawn with shadow * Must be false when BRC is a substructure of the TC. @@ -193,18 +205,18 @@ public final class BorderCode implements public boolean isShadow() { return _fShadow.getValue(_info2) != 0; } - + public void setShadow(boolean shadow) { _info2 = (short)_fShadow.setValue(_info2, shadow ? 1 : 0); } - + /** * Don't reverse the border. */ public boolean isFrame() { return _fFrame.getValue(_info2) != 0; } - + public void setFrame(boolean frame) { _info2 = (short)_fFrame.setValue(_info2, frame ? 1 : 0); } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java Tue Dec 24 11:56:42 2019 @@ -17,80 +17,81 @@ package org.apache.poi.hwpf.usermodel; +import org.apache.poi.common.Duplicatable; import org.apache.poi.hwpf.model.Colorref; import org.apache.poi.hwpf.model.types.CHPAbstractType; +import org.apache.poi.util.Removal; -/** - * @author Ryan Ackley - */ -public final class CharacterProperties - extends CHPAbstractType implements Cloneable -{ - public final static short SPRM_FRMARKDEL = (short)0x0800; - public final static short SPRM_FRMARK = 0x0801; - public final static short SPRM_FFLDVANISH = 0x0802; - public final static short SPRM_PICLOCATION = 0x6A03; - public final static short SPRM_IBSTRMARK = 0x4804; - public final static short SPRM_DTTMRMARK = 0x6805; - public final static short SPRM_FDATA = 0x0806; - public final static short SPRM_SYMBOL = 0x6A09; - public final static short SPRM_FOLE2 = 0x080A; - public final static short SPRM_HIGHLIGHT = 0x2A0C; - public final static short SPRM_OBJLOCATION = 0x680E; - public final static short SPRM_ISTD = 0x4A30; - public final static short SPRM_FBOLD = 0x0835; - public final static short SPRM_FITALIC = 0x0836; - public final static short SPRM_FSTRIKE = 0x0837; - public final static short SPRM_FOUTLINE = 0x0838; - public final static short SPRM_FSHADOW = 0x0839; - public final static short SPRM_FSMALLCAPS = 0x083A; - public final static short SPRM_FCAPS = 0x083B; - public final static short SPRM_FVANISH = 0x083C; - public final static short SPRM_KUL = 0x2A3E; - public final static short SPRM_DXASPACE = (short)0x8840; - public final static short SPRM_LID = 0x4A41; - public final static short SPRM_ICO = 0x2A42; - public final static short SPRM_HPS = 0x4A43; - public final static short SPRM_HPSPOS = 0x4845; - public final static short SPRM_ISS = 0x2A48; - public final static short SPRM_HPSKERN = 0x484B; - public final static short SPRM_YSRI = 0x484E; - public final static short SPRM_RGFTCASCII = 0x4A4F; - public final static short SPRM_RGFTCFAREAST = 0x4A50; - public final static short SPRM_RGFTCNOTFAREAST = 0x4A51; - public final static short SPRM_CHARSCALE = 0x4852; - public final static short SPRM_FDSTRIKE = 0x2A53; - public final static short SPRM_FIMPRINT = 0x0854; - public final static short SPRM_FSPEC = 0x0855; - public final static short SPRM_FOBJ = 0x0856; - public final static short SPRM_PROPRMARK = (short)0xCA57; - public final static short SPRM_FEMBOSS = 0x0858; - public final static short SPRM_SFXTEXT = 0x2859; +@SuppressWarnings("unused") +public final class CharacterProperties extends CHPAbstractType implements Duplicatable { + public static final short SPRM_FRMARKDEL = (short)0x0800; + public static final short SPRM_FRMARK = 0x0801; + public static final short SPRM_FFLDVANISH = 0x0802; + public static final short SPRM_PICLOCATION = 0x6A03; + public static final short SPRM_IBSTRMARK = 0x4804; + public static final short SPRM_DTTMRMARK = 0x6805; + public static final short SPRM_FDATA = 0x0806; + public static final short SPRM_SYMBOL = 0x6A09; + public static final short SPRM_FOLE2 = 0x080A; + public static final short SPRM_HIGHLIGHT = 0x2A0C; + public static final short SPRM_OBJLOCATION = 0x680E; + public static final short SPRM_ISTD = 0x4A30; + public static final short SPRM_FBOLD = 0x0835; + public static final short SPRM_FITALIC = 0x0836; + public static final short SPRM_FSTRIKE = 0x0837; + public static final short SPRM_FOUTLINE = 0x0838; + public static final short SPRM_FSHADOW = 0x0839; + public static final short SPRM_FSMALLCAPS = 0x083A; + public static final short SPRM_FCAPS = 0x083B; + public static final short SPRM_FVANISH = 0x083C; + public static final short SPRM_KUL = 0x2A3E; + public static final short SPRM_DXASPACE = (short)0x8840; + public static final short SPRM_LID = 0x4A41; + public static final short SPRM_ICO = 0x2A42; + public static final short SPRM_HPS = 0x4A43; + public static final short SPRM_HPSPOS = 0x4845; + public static final short SPRM_ISS = 0x2A48; + public static final short SPRM_HPSKERN = 0x484B; + public static final short SPRM_YSRI = 0x484E; + public static final short SPRM_RGFTCASCII = 0x4A4F; + public static final short SPRM_RGFTCFAREAST = 0x4A50; + public static final short SPRM_RGFTCNOTFAREAST = 0x4A51; + public static final short SPRM_CHARSCALE = 0x4852; + public static final short SPRM_FDSTRIKE = 0x2A53; + public static final short SPRM_FIMPRINT = 0x0854; + public static final short SPRM_FSPEC = 0x0855; + public static final short SPRM_FOBJ = 0x0856; + public static final short SPRM_PROPRMARK = (short)0xCA57; + public static final short SPRM_FEMBOSS = 0x0858; + public static final short SPRM_SFXTEXT = 0x2859; /* * Microsoft Office Word 97-2007 Binary File Format (.doc) Specification; * Page 60 of 210 */ - public final static short SPRM_DISPFLDRMARK = (short)0xCA62; - public final static short SPRM_IBSTRMARKDEL = 0x4863; - public final static short SPRM_DTTMRMARKDEL = 0x6864; - public final static short SPRM_BRC = 0x6865; - public final static short SPRM_SHD = 0x4866; - public final static short SPRM_IDSIRMARKDEL = 0x4867; - public final static short SPRM_CPG = 0x486B; - public final static short SPRM_NONFELID = 0x486D; - public final static short SPRM_FELID = 0x486E; - public final static short SPRM_IDCTHINT = 0x286F; + public static final short SPRM_DISPFLDRMARK = (short)0xCA62; + public static final short SPRM_IBSTRMARKDEL = 0x4863; + public static final short SPRM_DTTMRMARKDEL = 0x6864; + public static final short SPRM_BRC = 0x6865; + public static final short SPRM_SHD = 0x4866; + public static final short SPRM_IDSIRMARKDEL = 0x4867; + public static final short SPRM_CPG = 0x486B; + public static final short SPRM_NONFELID = 0x486D; + public static final short SPRM_FELID = 0x486E; + public static final short SPRM_IDCTHINT = 0x286F; /** * change chp.cv */ - public final static short SPRM_CCV = 0x6870; + public static final short SPRM_CCV = 0x6870; - public CharacterProperties() - { + public CharacterProperties() { setFUsePgsuSettings( true ); setXstDispFldRMark( new byte[36] ); } + public CharacterProperties(CharacterProperties other) { + super(other); + } + public boolean isMarkedDeleted() { return isFRMarkDel(); @@ -370,27 +371,16 @@ public final class CharacterProperties setCv( new Colorref( colour24 & 0xFFFFFF ) ); } - public CharacterProperties clone() - { - try - { - CharacterProperties cp = (CharacterProperties) super.clone(); - - cp.setCv( getCv().clone() ); - cp.setDttmRMark( (DateAndTime) getDttmRMark().clone() ); - cp.setDttmRMarkDel( (DateAndTime) getDttmRMarkDel().clone() ); - cp.setDttmPropRMark( (DateAndTime) getDttmPropRMark().clone() ); - cp.setDttmDispFldRMark( (DateAndTime) getDttmDispFldRMark().clone() ); - cp.setXstDispFldRMark( getXstDispFldRMark().clone() ); - cp.setShd( getShd().clone() ); - cp.setBrc( (BorderCode) getBrc().clone() ); + @Override + @SuppressWarnings({"squid:S2975", "MethodDoesntCallSuperMethod"}) + @Deprecated + @Removal(version = "5.0.0") + public CharacterProperties clone() { + return copy(); + } - return cp; - } - catch ( CloneNotSupportedException exc ) - { - throw new UnsupportedOperationException( - "Impossible CloneNotSupportedException occured", exc ); - } + @Override + public CharacterProperties copy() { + return new CharacterProperties(this); } } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java Tue Dec 24 11:56:42 2019 @@ -17,6 +17,7 @@ package org.apache.poi.hwpf.usermodel; +import org.apache.poi.common.Duplicatable; import org.apache.poi.hwpf.HWPFDocument; import org.apache.poi.hwpf.HWPFOldDocument; import org.apache.poi.hwpf.model.CHPX; @@ -25,63 +26,62 @@ import org.apache.poi.hwpf.model.Ffn; import org.apache.poi.hwpf.model.NilPICFAndBinData; import org.apache.poi.hwpf.model.StyleSheet; import org.apache.poi.hwpf.sprm.SprmBuffer; +import org.apache.poi.util.Removal; /** * This class represents a run of text that share common properties. */ -public final class CharacterRun extends Range - implements Cloneable, org.apache.poi.wp.usermodel.CharacterRun -{ - public final static short SPRM_FRMARKDEL = (short)0x0800; - public final static short SPRM_FRMARK = 0x0801; - public final static short SPRM_FFLDVANISH = 0x0802; - public final static short SPRM_PICLOCATION = 0x6A03; - public final static short SPRM_IBSTRMARK = 0x4804; - public final static short SPRM_DTTMRMARK = 0x6805; - public final static short SPRM_FDATA = 0x0806; - public final static short SPRM_SYMBOL = 0x6A09; - public final static short SPRM_FOLE2 = 0x080A; - public final static short SPRM_HIGHLIGHT = 0x2A0C; - public final static short SPRM_OBJLOCATION = 0x680E; - public final static short SPRM_ISTD = 0x4A30; - public final static short SPRM_FBOLD = 0x0835; - public final static short SPRM_FITALIC = 0x0836; - public final static short SPRM_FSTRIKE = 0x0837; - public final static short SPRM_FOUTLINE = 0x0838; - public final static short SPRM_FSHADOW = 0x0839; - public final static short SPRM_FSMALLCAPS = 0x083A; - public final static short SPRM_FCAPS = 0x083B; - public final static short SPRM_FVANISH = 0x083C; - public final static short SPRM_KUL = 0x2A3E; - public final static short SPRM_DXASPACE = (short)0x8840; - public final static short SPRM_LID = 0x4A41; - public final static short SPRM_ICO = 0x2A42; - public final static short SPRM_HPS = 0x4A43; - public final static short SPRM_HPSPOS = 0x4845; - public final static short SPRM_ISS = 0x2A48; - public final static short SPRM_HPSKERN = 0x484B; - public final static short SPRM_YSRI = 0x484E; - public final static short SPRM_RGFTCASCII = 0x4A4F; - public final static short SPRM_RGFTCFAREAST = 0x4A50; - public final static short SPRM_RGFTCNOTFAREAST = 0x4A51; - public final static short SPRM_CHARSCALE = 0x4852; - public final static short SPRM_FDSTRIKE = 0x2A53; - public final static short SPRM_FIMPRINT = 0x0854; - public final static short SPRM_FSPEC = 0x0855; - public final static short SPRM_FOBJ = 0x0856; - public final static short SPRM_PROPRMARK = (short)0xCA57; - public final static short SPRM_FEMBOSS = 0x0858; - public final static short SPRM_SFXTEXT = 0x2859; - public final static short SPRM_DISPFLDRMARK = (short)0xCA62; - public final static short SPRM_IBSTRMARKDEL = 0x4863; - public final static short SPRM_DTTMRMARKDEL = 0x6864; - public final static short SPRM_BRC = 0x6865; - public final static short SPRM_SHD = 0x4866; - public final static short SPRM_IDSIRMARKDEL = 0x4867; - public final static short SPRM_CPG = 0x486B; - public final static short SPRM_NONFELID = 0x486D; - public final static short SPRM_FELID = 0x486E; - public final static short SPRM_IDCTHINT = 0x286F; +public final class CharacterRun extends Range implements Duplicatable, org.apache.poi.wp.usermodel.CharacterRun { + public static final short SPRM_FRMARKDEL = (short)0x0800; + public static final short SPRM_FRMARK = 0x0801; + public static final short SPRM_FFLDVANISH = 0x0802; + public static final short SPRM_PICLOCATION = 0x6A03; + public static final short SPRM_IBSTRMARK = 0x4804; + public static final short SPRM_DTTMRMARK = 0x6805; + public static final short SPRM_FDATA = 0x0806; + public static final short SPRM_SYMBOL = 0x6A09; + public static final short SPRM_FOLE2 = 0x080A; + public static final short SPRM_HIGHLIGHT = 0x2A0C; + public static final short SPRM_OBJLOCATION = 0x680E; + public static final short SPRM_ISTD = 0x4A30; + public static final short SPRM_FBOLD = 0x0835; + public static final short SPRM_FITALIC = 0x0836; + public static final short SPRM_FSTRIKE = 0x0837; + public static final short SPRM_FOUTLINE = 0x0838; + public static final short SPRM_FSHADOW = 0x0839; + public static final short SPRM_FSMALLCAPS = 0x083A; + public static final short SPRM_FCAPS = 0x083B; + public static final short SPRM_FVANISH = 0x083C; + public static final short SPRM_KUL = 0x2A3E; + public static final short SPRM_DXASPACE = (short)0x8840; + public static final short SPRM_LID = 0x4A41; + public static final short SPRM_ICO = 0x2A42; + public static final short SPRM_HPS = 0x4A43; + public static final short SPRM_HPSPOS = 0x4845; + public static final short SPRM_ISS = 0x2A48; + public static final short SPRM_HPSKERN = 0x484B; + public static final short SPRM_YSRI = 0x484E; + public static final short SPRM_RGFTCASCII = 0x4A4F; + public static final short SPRM_RGFTCFAREAST = 0x4A50; + public static final short SPRM_RGFTCNOTFAREAST = 0x4A51; + public static final short SPRM_CHARSCALE = 0x4852; + public static final short SPRM_FDSTRIKE = 0x2A53; + public static final short SPRM_FIMPRINT = 0x0854; + public static final short SPRM_FSPEC = 0x0855; + public static final short SPRM_FOBJ = 0x0856; + public static final short SPRM_PROPRMARK = (short)0xCA57; + public static final short SPRM_FEMBOSS = 0x0858; + public static final short SPRM_SFXTEXT = 0x2859; + public static final short SPRM_DISPFLDRMARK = (short)0xCA62; + public static final short SPRM_IBSTRMARKDEL = 0x4863; + public static final short SPRM_DTTMRMARKDEL = 0x6864; + public static final short SPRM_BRC = 0x6865; + public static final short SPRM_SHD = 0x4866; + public static final short SPRM_IDSIRMARKDEL = 0x4867; + public static final short SPRM_CPG = 0x486B; + public static final short SPRM_NONFELID = 0x486D; + public static final short SPRM_FELID = 0x486E; + public static final short SPRM_IDCTHINT = 0x286F; protected short _istd; protected SprmBuffer _chpx; @@ -102,6 +102,13 @@ public final class CharacterRun extends _istd = istd; } + CharacterRun(CharacterRun other) { + super(other); + _istd = other._istd; + _chpx = (other._chpx == null) ? null : other._chpx.copy(); + _props = (other._props == null) ? null : other._props.copy(); + } + /** * Here for runtime type determination using a switch statement convenient. * @@ -551,23 +558,20 @@ public final class CharacterRun extends * Used to create a deep copy of this object. * * @return A deep copy. - * @throws CloneNotSupportedException never */ - public Object clone() - throws CloneNotSupportedException - { - CharacterRun cp = (CharacterRun)super.clone(); - cp._props.setDttmRMark((DateAndTime)_props.getDttmRMark().clone()); - cp._props.setDttmRMarkDel((DateAndTime)_props.getDttmRMarkDel().clone()); - cp._props.setDttmPropRMark((DateAndTime)_props.getDttmPropRMark().clone()); - cp._props.setDttmDispFldRMark((DateAndTime)_props.getDttmDispFldRMark(). - clone()); - cp._props.setXstDispFldRMark(_props.getXstDispFldRMark().clone()); - cp._props.setShd(_props.getShd().clone()); + @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") + public CharacterRun clone() { + return copy(); + } - return cp; + @Override + public CharacterRun copy() { + return new CharacterRun(this); } - + /** * Returns true, if the CharacterRun is a special character run containing a symbol, otherwise false. * @@ -582,7 +586,7 @@ public final class CharacterRun extends /** * Returns the symbol character, if this is a symbol character run. - * + * * @see #isSymbol() * @throws IllegalStateException If this is not a symbol character run: call {@link #isSymbol()} first. */ @@ -596,7 +600,7 @@ public final class CharacterRun extends /** * Returns the symbol font, if this is a symbol character run. Might return null, if the font index is not found in the font table. - * + * * @see #isSymbol() * @throws IllegalStateException If this is not a symbol character run: call {@link #isSymbol()} first. */ @@ -605,7 +609,7 @@ public final class CharacterRun extends if (isSymbol()) { if (_doc.getFontTable() == null) return null; - + // Fetch all font names Ffn[] fontNames = _doc.getFontTable().getFontNames(); @@ -617,7 +621,7 @@ public final class CharacterRun extends } else throw new IllegalStateException("Not a symbol CharacterRun"); } - + public BorderCode getBorder() { return _props.getBrc(); } @@ -625,7 +629,7 @@ public final class CharacterRun extends public int getLanguageCode() { return _props.getLidDefault(); } - + /** * <p>Returns the index of the base style which applies to * this Run. Details of the style can be looked up @@ -639,10 +643,10 @@ public final class CharacterRun extends public short getStyleIndex() { return _istd; } - + public String toString() { String text = text(); - return "CharacterRun of " + text.length() + " characters - " + text; + return "CharacterRun of " + text.length() + " characters - " + text; } public String[] getDropDownListValues() Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DateAndTime.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DateAndTime.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DateAndTime.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DateAndTime.java Tue Dec 24 11:56:42 2019 @@ -19,39 +19,40 @@ package org.apache.poi.hwpf.usermodel; import java.util.Calendar; +import org.apache.poi.common.Duplicatable; import org.apache.poi.util.BitField; import org.apache.poi.util.BitFieldFactory; import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LocaleUtil; +import org.apache.poi.util.Removal; /** * This class is used to represent a date and time in a Word document. - * - * @author Ryan Ackley */ -public final class DateAndTime - implements Cloneable -{ +public final class DateAndTime implements Duplicatable { public static final int SIZE = 4; - private short _info; private static final BitField _minutes = BitFieldFactory.getInstance(0x3f); private static final BitField _hours = BitFieldFactory.getInstance(0x7c0); private static final BitField _dom = BitFieldFactory.getInstance(0xf800); - private short _info2; private static final BitField _months = BitFieldFactory.getInstance(0xf); private static final BitField _years = BitFieldFactory.getInstance(0x1ff0); // private static final BitField _weekday = BitFieldFactory.getInstance(0xe000); - public DateAndTime() - { - } + private short _info; + private short _info2; + + public DateAndTime() {} + + public DateAndTime(DateAndTime other) { + _info = other._info; + _info2 = other._info2; + } + + public DateAndTime(byte[] buf, int offset) { + _info = LittleEndian.getShort(buf, offset); + _info2 = LittleEndian.getShort(buf, offset + LittleEndian.SHORT_SIZE); + } - public DateAndTime(byte[] buf, int offset) - { - _info = LittleEndian.getShort(buf, offset); - _info2 = LittleEndian.getShort(buf, offset + LittleEndian.SHORT_SIZE); - } - public Calendar getDate() { // TODO Discover if the timezone is stored somewhere else or not return LocaleUtil.getLocaleCalendar( @@ -83,12 +84,19 @@ public final class DateAndTime assert false : "hashCode not designed"; return 42; // any arbitrary constant will do } - - public Object clone() - throws CloneNotSupportedException - { - return super.clone(); - } + + @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") + public DateAndTime clone() { + return copy(); + } + + @Override + public DateAndTime copy() { + return new DateAndTime(this); + } public boolean isEmpty() { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org