Author: kiwiwings Date: Tue Dec 24 11:56:42 2019 New Revision: 1871938 URL: http://svn.apache.org/viewvc?rev=1871938&view=rev Log: #64004 - Replace clone() with copy constructor - mainly HWPF classes
Modified: poi/site/src/documentation/content/xdocs/changes.xml poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarkFirstDescriptor.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/BytePropertyNode.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Colorref.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FootnoteReferenceDescriptor.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/GenericPropertyNode.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldCHPBinTable.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldSectionTable.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldTextPiece.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPX.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ParagraphHeight.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PieceDescriptor.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyModifier.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SEPX.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SectionDescriptor.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SinglentonTextPiece.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/TabDescriptor.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/TextPiece.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/BKFAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/CHPAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/FRDAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/HRESIAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/PAPAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SEPAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SHD80AbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/SHDAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TAPAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TBDAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TCAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/TLPAbstractType.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmBuffer.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BookmarksImpl.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DateAndTime.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DropCapSpecifier.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/LineSpacingDescriptor.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Paragraph.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ParagraphProperties.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Section.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/SectionProperties.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ShadingDescriptor.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ShadingDescriptor80.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableAutoformatLookSpecifier.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableCellDescriptor.java poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableProperties.java Modified: poi/site/src/documentation/content/xdocs/changes.xml URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/changes.xml?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/site/src/documentation/content/xdocs/changes.xml (original) +++ poi/site/src/documentation/content/xdocs/changes.xml Tue Dec 24 11:56:42 2019 @@ -95,6 +95,7 @@ <action dev="PD" type="fix" fixes-bug="63955" context="HMEF">HMEFContentsExtractor fails to extract content from winmail.dat</action> <action dev="PD" type="fix" fixes-bug="63927" context="POI_Overall">Inconsistent mapping of Norwegian locales for date formats</action> <action dev="PD" type="fix" fixes-bug="github-164" context="XSSF">Fix Bug in XSSFTable.setCellReferences when table is single cell</action> + <action dev="PD" type="fix" fixes-bug="64004" context="POI_Overall">Replace Cloneable / clone() with copy constructor</action> </actions> </release> Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarkFirstDescriptor.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarkFirstDescriptor.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarkFirstDescriptor.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarkFirstDescriptor.java Tue Dec 24 11:56:42 2019 @@ -18,33 +18,34 @@ package org.apache.poi.hwpf.model; import java.util.Objects; +import org.apache.poi.common.Duplicatable; import org.apache.poi.hwpf.model.types.BKFAbstractType; import org.apache.poi.util.Internal; +import org.apache.poi.util.Removal; @Internal -public final class BookmarkFirstDescriptor extends BKFAbstractType implements - Cloneable -{ - public BookmarkFirstDescriptor() - { +public final class BookmarkFirstDescriptor extends BKFAbstractType implements Duplicatable { + public BookmarkFirstDescriptor() { } + + public BookmarkFirstDescriptor(BookmarkFirstDescriptor other) { + super(other); } - public BookmarkFirstDescriptor( byte[] data, int offset ) - { + public BookmarkFirstDescriptor( byte[] data, int offset ) { fillFields( data, offset ); } @Override - protected BookmarkFirstDescriptor clone() - { - try - { - return (BookmarkFirstDescriptor) super.clone(); - } - catch ( CloneNotSupportedException e ) - { - throw new RuntimeException( e ); - } + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") + protected BookmarkFirstDescriptor clone() { + return copy(); + } + + @Override + public BookmarkFirstDescriptor copy() { + return new BookmarkFirstDescriptor(this); } @Override Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/BytePropertyNode.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/BytePropertyNode.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/BytePropertyNode.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/BytePropertyNode.java Tue Dec 24 11:56:42 2019 @@ -23,18 +23,22 @@ package org.apache.poi.hwpf.model; * still work despite that. * It handles the conversion as required between bytes * and characters. - * + * * @deprecated byte positions shall not be saved in memory */ @Deprecated -public abstract class BytePropertyNode<T extends BytePropertyNode<T>> extends - PropertyNode<T> -{ +public abstract class BytePropertyNode<T extends BytePropertyNode<T>> extends PropertyNode<T> { private final int startBytes; private final int endBytes; - public BytePropertyNode( int charStart, int charEnd, Object buf ) - { + protected BytePropertyNode( BytePropertyNode other ) { + super(other); + startBytes = other.startBytes; + endBytes = other.endBytes; + } + + + protected BytePropertyNode( int charStart, int charEnd, Object buf ) { super( charStart, charEnd, buf ); if ( charStart > charEnd ) Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java Tue Dec 24 11:56:42 2019 @@ -61,7 +61,7 @@ public class CHPBinTable /** * Constructor used to read a binTable in from a Word document. - * + * * @deprecated Use * {@link #CHPBinTable(byte[], byte[], int, int, CharIndexTranslator)} * instead @@ -81,7 +81,7 @@ public class CHPBinTable long start = System.currentTimeMillis(); /* * Page 35: - * + * * "Associated with each interval is a BTE. A BTE holds a four-byte PN * (page number) which identifies the FKP page in the file which * contains the formatting information for that interval. A CHPX FKP @@ -172,7 +172,7 @@ public class CHPBinTable } List<CHPX> oldChpxSortedByStartPos = new ArrayList<>(_textRuns); - oldChpxSortedByStartPos.sort(PropertyNode.StartComparator.instance); + oldChpxSortedByStartPos.sort(PropertyNode.StartComparator); logger.log( POILogger.DEBUG, "CHPX sorted by start position in ", Long.valueOf( System.currentTimeMillis() - start ), " ms" ); @@ -459,7 +459,7 @@ public class CHPBinTable /* * Page 35: - * + * * "Associated with each interval is a BTE. A BTE holds a four-byte PN * (page number) which identifies the FKP page in the file which * contains the formatting information for that interval. A CHPX FKP Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java Tue Dec 24 11:56:42 2019 @@ -28,13 +28,15 @@ import org.apache.poi.util.Internal; * Make sure you call getStart() / getEnd() when you want characters * (normal use), but getStartByte() / getEndByte() when you're * reading in / writing out! - * - * @author Ryan Ackley */ @Internal @SuppressWarnings("deprecation") public final class CHPX extends BytePropertyNode<CHPX> { + public CHPX(CHPX other) { + super(other); + } + CHPX(int charStart, int charEnd, SprmBuffer buf) { super(charStart, charEnd, buf); } @@ -62,4 +64,9 @@ public final class CHPX extends ByteProp return "CHPX from " + getStart() + " to " + getEnd() + " (in bytes " + getStartBytes() + " to " + getEndBytes() + ")"; } + + @Override + public CHPX copy() { + return new CHPX(this); + } } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Colorref.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Colorref.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Colorref.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Colorref.java Tue Dec 24 11:56:42 2019 @@ -16,17 +16,17 @@ ==================================================================== */ package org.apache.poi.hwpf.model; +import org.apache.poi.common.Duplicatable; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; +import org.apache.poi.util.Removal; /** * 24-bit color structure - * - * @author Sergey Vladimirov (vlsergey {at} gmail {dot} com) */ @Internal -public class Colorref implements Cloneable -{ +public class Colorref implements Duplicatable { + public static Colorref valueOfIco( int ico ) { @@ -71,25 +71,33 @@ public class Colorref implements Cloneab private int value; - public Colorref() - { + public Colorref() { this.value = -1; } - public Colorref( byte[] data, int offset ) - { + public Colorref(Colorref other) { + value = other.value; + } + + public Colorref( byte[] data, int offset ) { this.value = LittleEndian.getInt( data, offset ); } - public Colorref( int value ) - { + public Colorref( int value ) { this.value = value; } @Override - public Colorref clone() throws CloneNotSupportedException - { - return (Colorref)super.clone(); + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") + public Colorref clone() { + return copy(); + } + + @Override + public Colorref copy() { + return new Colorref(this); } @Override Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FootnoteReferenceDescriptor.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FootnoteReferenceDescriptor.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FootnoteReferenceDescriptor.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FootnoteReferenceDescriptor.java Tue Dec 24 11:56:42 2019 @@ -18,33 +18,34 @@ package org.apache.poi.hwpf.model; import java.util.Objects; +import org.apache.poi.common.Duplicatable; import org.apache.poi.hwpf.model.types.FRDAbstractType; import org.apache.poi.util.Internal; +import org.apache.poi.util.Removal; @Internal -public final class FootnoteReferenceDescriptor extends FRDAbstractType - implements Cloneable -{ - public FootnoteReferenceDescriptor() - { +public final class FootnoteReferenceDescriptor extends FRDAbstractType implements Duplicatable { + public FootnoteReferenceDescriptor() { } + + public FootnoteReferenceDescriptor(FootnoteReferenceDescriptor other) { + super(other); } - public FootnoteReferenceDescriptor( byte[] data, int offset ) - { + public FootnoteReferenceDescriptor( byte[] data, int offset ) { fillFields( data, offset ); } @Override - protected FootnoteReferenceDescriptor clone() - { - try - { - return (FootnoteReferenceDescriptor) super.clone(); - } - catch ( CloneNotSupportedException e ) - { - throw new RuntimeException( e ); - } + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") + protected FootnoteReferenceDescriptor clone() { + return copy(); + } + + @Override + public FootnoteReferenceDescriptor copy() { + return new FootnoteReferenceDescriptor(this); } @Override Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/GenericPropertyNode.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/GenericPropertyNode.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/GenericPropertyNode.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/GenericPropertyNode.java Tue Dec 24 11:56:42 2019 @@ -20,11 +20,13 @@ package org.apache.poi.hwpf.model; import org.apache.poi.util.Internal; @Internal -public final class GenericPropertyNode - extends PropertyNode<GenericPropertyNode> -{ - public GenericPropertyNode(int start, int end, byte[] buf) - { +public final class GenericPropertyNode extends PropertyNode<GenericPropertyNode> { + + public GenericPropertyNode(GenericPropertyNode other) { + super(other); + } + + public GenericPropertyNode(int start, int end, byte[] buf) { super(start, end, buf); } @@ -44,4 +46,9 @@ public final class GenericPropertyNode + ( getBytes() != null ? getBytes().length + " byte(s)" : "null" ); } + + @Override + public GenericPropertyNode copy() { + return new GenericPropertyNode(this); + } } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java Tue Dec 24 11:56:42 2019 @@ -19,41 +19,41 @@ package org.apache.poi.hwpf.model; import java.util.Objects; +import org.apache.poi.common.Duplicatable; import org.apache.poi.hwpf.model.types.HRESIAbstractType; import org.apache.poi.hwpf.usermodel.CharacterProperties; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; +import org.apache.poi.util.Removal; /** * Hyphenation. Substructure of the {@link CharacterProperties}. - * - * @author Sergey Vladimirov ( vlsergey {at} gmail {dot} com ) */ @Internal -public final class Hyphenation extends HRESIAbstractType implements Cloneable -{ - public Hyphenation() - { - super(); +public final class Hyphenation extends HRESIAbstractType implements Duplicatable { + public Hyphenation() {} + + public Hyphenation(Hyphenation other) { + super(other); } - public Hyphenation( short hres ) - { + public Hyphenation( short hres ) { byte[] data = new byte[2]; LittleEndian.putShort( data, 0, hres ); fillFields( data, 0 ); } - public Hyphenation clone() - { - try - { - return (Hyphenation) super.clone(); - } - catch ( CloneNotSupportedException e ) - { - throw new RuntimeException( e ); - } + @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") + public Hyphenation clone() { + return copy(); + } + + @Override + public Hyphenation copy() { + return new Hyphenation(this); } @Override Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldCHPBinTable.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldCHPBinTable.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldCHPBinTable.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldCHPBinTable.java Tue Dec 24 11:56:42 2019 @@ -22,11 +22,11 @@ import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; /** - * This class holds all of the character formatting + * This class holds all of the character formatting * properties from Old (Word 6 / Word 95) documents. * Unlike with Word 97+, it all gets held in the * same stream. - * In common with the rest of the old support, it + * In common with the rest of the old support, it * is read only */ @Internal @@ -63,6 +63,6 @@ public final class OldCHPBinTable extend _textRuns.add( chpx ); } } - _textRuns.sort(PropertyNode.StartComparator.instance); + _textRuns.sort(PropertyNode.StartComparator); } } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldSectionTable.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldSectionTable.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldSectionTable.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldSectionTable.java Tue Dec 24 11:56:42 2019 @@ -22,11 +22,11 @@ import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; /** - * This class holds all of the section formatting + * This class holds all of the section formatting * properties from Old (Word 6 / Word 95) documents. * Unlike with Word 97+, it all gets held in the * same stream. - * In common with the rest of the old support, it + * In common with the rest of the old support, it * is read only */ @Internal @@ -79,6 +79,6 @@ public final class OldSectionTable exten _sections.add( sepx ); } - _sections.sort(PropertyNode.StartComparator.instance); + _sections.sort(PropertyNode.StartComparator); } } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldTextPiece.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldTextPiece.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldTextPiece.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldTextPiece.java Tue Dec 24 11:56:42 2019 @@ -34,6 +34,12 @@ public class OldTextPiece extends TextPi private final byte[] rawBytes; + public OldTextPiece(OldTextPiece other) { + super(other); + rawBytes = (other.rawBytes == null) ? null : other.rawBytes.clone(); + } + + /** * @param start Beginning offset in main document stream, in characters. * @param end Ending offset in main document stream, in characters. @@ -115,4 +121,8 @@ public class OldTextPiece extends TextPi + getPieceDescriptor() + ")"; } + @Override + public OldTextPiece copy() { + return new OldTextPiece(this); + } } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java Tue Dec 24 11:56:42 2019 @@ -39,8 +39,6 @@ import org.apache.poi.util.POILogger; * This class represents the bin table of Word document but it also serves as a * holder for all of the paragraphs of document that have been loaded into * memory. - * - * @author Ryan Ackley */ @Internal public class PAPBinTable @@ -158,7 +156,7 @@ public class PAPBinTable } List<PAPX> oldPapxSortedByEndPos = new ArrayList<>(paragraphs); - oldPapxSortedByEndPos.sort(PropertyNode.EndComparator.instance); + oldPapxSortedByEndPos.sort(PropertyNode.EndComparator); logger.log( POILogger.DEBUG, "PAPX sorted by end position in ", Long.valueOf( System.currentTimeMillis() - start ), " ms" ); @@ -262,7 +260,7 @@ public class PAPBinTable continue; if ( sprmBuffer == null ) { - sprmBuffer = papx.getSprmBuf().clone(); + sprmBuffer = papx.getSprmBuf().copy(); } else { sprmBuffer.append( papx.getGrpprl(), 2 ); } @@ -299,7 +297,7 @@ public class PAPBinTable PAPX currentPap = _paragraphs.get(listIndex); if (currentPap != null && currentPap.getStart() < cpStart) { - SprmBuffer clonedBuf = currentPap.getSprmBuf().clone(); + SprmBuffer clonedBuf = currentPap.getSprmBuf().copy(); // Copy the properties of the one before to afterwards // Will go: @@ -389,7 +387,7 @@ public class PAPBinTable { PlexOfCps binTable = new PlexOfCps(4); - + // each FKP must start on a 512 byte page. int docOffset = wordDocumentStream.size(); int mod = docOffset % POIFSConstants.SMALLER_BIG_BLOCK_SIZE; @@ -398,21 +396,21 @@ public class PAPBinTable byte[] padding = new byte[POIFSConstants.SMALLER_BIG_BLOCK_SIZE - mod]; wordDocumentStream.write(padding); } - + // get the page number for the first fkp docOffset = wordDocumentStream.size(); int pageNum = docOffset/POIFSConstants.SMALLER_BIG_BLOCK_SIZE; - + // get the ending fc // int endingFc = _paragraphs.get(_paragraphs.size() - 1).getEnd(); // endingFc += fcMin; int endingFc = translator.getByteIndex( _paragraphs.get(_paragraphs.size() - 1 ).getEnd() ); - + ArrayList<PAPX> overflow = _paragraphs; do { PAPX startingProp = overflow.get(0); - + // int start = startingProp.getStart() + fcMin; int start = translator.getByteIndex( startingProp.getStart() ); @@ -429,11 +427,11 @@ public class PAPBinTable // end = overflow.get(0).getStart() + fcMin; end = translator.getByteIndex( overflow.get( 0 ).getStart() ); } - + byte[] intHolder = new byte[4]; LittleEndian.putInt(intHolder, 0, pageNum++); binTable.addProperty(new GenericPropertyNode(start, end, intHolder)); - + } while (overflow != null); tableStream.write(binTable.toByteArray()); Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPX.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPX.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPX.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPX.java Tue Dec 24 11:56:42 2019 @@ -31,8 +31,6 @@ import org.apache.poi.util.LittleEndian; * Make sure you call getStart() / getEnd() when you want characters * (normal use), but getStartByte() / getEndByte() when you're * reading in / writing out! - * - * @author Ryan Ackley */ @Internal @SuppressWarnings( "deprecation" ) @@ -40,6 +38,11 @@ public final class PAPX extends ByteProp private ParagraphHeight _phe; + public PAPX(PAPX other) { + super(other); + _phe = (other._phe == null) ? null : other._phe.copy(); + } + public PAPX( int charStart, int charEnd, byte[] papx, ParagraphHeight phe, byte[] dataStream ) { @@ -103,7 +106,7 @@ public final class PAPX extends ByteProp { if ( _buf == null ) return 0; - + byte[] buf = getGrpprl(); if (buf.length == 0) { @@ -129,7 +132,7 @@ public final class PAPX extends ByteProp // TODO Fix up for Word 6/95 return new ParagraphProperties(); } - + short istd = getIstd(); ParagraphProperties baseStyle = ss.getParagraphStyle(istd); return ParagraphSprmUncompressor.uncompressPAP(baseStyle, getGrpprl(), 2); @@ -156,4 +159,9 @@ public final class PAPX extends ByteProp return "PAPX from " + getStart() + " to " + getEnd() + " (in bytes " + getStartBytes() + " to " + getEndBytes() + ")"; } + + @Override + public PAPX copy() { + return new PAPX(this); + } } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ParagraphHeight.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ParagraphHeight.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ParagraphHeight.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ParagraphHeight.java Tue Dec 24 11:56:42 2019 @@ -20,25 +20,35 @@ package org.apache.poi.hwpf.model; import java.io.IOException; import java.io.OutputStream; +import org.apache.poi.common.Duplicatable; import org.apache.poi.util.BitField; import org.apache.poi.util.BitFieldFactory; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; @Internal -public final class ParagraphHeight -{ +public final class ParagraphHeight implements Duplicatable { + private static final BitField fSpare = BitFieldFactory.getInstance(0x0001); + private static final BitField fUnk = BitFieldFactory.getInstance(0x0002); + private static final BitField fDiffLines = BitFieldFactory.getInstance(0x0004); + private static final BitField clMac = BitFieldFactory.getInstance(0xff00); + + private short infoField; - private BitField fSpare = BitFieldFactory.getInstance(0x0001); - private BitField fUnk = BitFieldFactory.getInstance(0x0002); - private BitField fDiffLines = BitFieldFactory.getInstance(0x0004); - private BitField clMac = BitFieldFactory.getInstance(0xff00); private short reserved; private int dxaCol; private int dymLineOrHeight; - public ParagraphHeight(byte[] buf, int offset) - { + public ParagraphHeight() {} + + public ParagraphHeight(ParagraphHeight other) { + infoField = other.infoField; + reserved = other.reserved; + dxaCol = other.dxaCol; + dymLineOrHeight = other.dymLineOrHeight; + } + + public ParagraphHeight(byte[] buf, int offset) { infoField = LittleEndian.getShort(buf, offset); offset += LittleEndian.SHORT_SIZE; reserved = LittleEndian.getShort(buf, offset); @@ -48,11 +58,6 @@ public final class ParagraphHeight dymLineOrHeight = LittleEndian.getInt(buf, offset); } - public ParagraphHeight() - { - - } - public void write(OutputStream out) throws IOException { @@ -89,4 +94,8 @@ public final class ParagraphHeight return 42; // any arbitrary constant will do } + @Override + public ParagraphHeight copy() { + return new ParagraphHeight(this); + } } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PieceDescriptor.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PieceDescriptor.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PieceDescriptor.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PieceDescriptor.java Tue Dec 24 11:56:42 2019 @@ -20,18 +20,27 @@ package org.apache.poi.hwpf.model; import java.nio.charset.Charset; import java.util.Objects; +import org.apache.poi.common.Duplicatable; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; import org.apache.poi.util.StringUtil; @Internal -public final class PieceDescriptor { +public final class PieceDescriptor implements Duplicatable { private final short descriptor; int fc; // used from the outside?!? private final PropertyModifier prm; private final boolean unicode; private final Charset charset; + public PieceDescriptor(PieceDescriptor other) { + descriptor = other.descriptor; + fc = other.fc; + prm = (other.prm == null) ? null : other.prm.copy(); + unicode = other.unicode; + charset = other.charset; + } + public PieceDescriptor(byte[] buf, int offset) { this(buf, offset, null); } @@ -155,4 +164,9 @@ public final class PieceDescriptor { + (isUnicode() ? "unicode" : "non-unicode") + "; prm: " + getPrm() + ")"; } + + @Override + public PieceDescriptor copy() { + return new PieceDescriptor(this); + } } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyModifier.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyModifier.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyModifier.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyModifier.java Tue Dec 24 11:56:42 2019 @@ -18,43 +18,54 @@ package org.apache.poi.hwpf.model; import java.util.Objects; +import org.apache.poi.common.Duplicatable; import org.apache.poi.util.BitField; import org.apache.poi.util.Internal; +import org.apache.poi.util.Removal; @Internal -public final class PropertyModifier implements Cloneable -{ +public final class PropertyModifier implements Duplicatable { /** * <li>"Set to 0 for variant 1" <li>"Set to 1 for variant 2" */ - private static BitField _fComplex = new BitField( 0x0001 ); + private static final BitField _fComplex = new BitField( 0x0001 ); /** * "Index to a grpprl stored in CLX portion of file" */ - private static BitField _figrpprl = new BitField( 0xfffe ); + private static final BitField _figrpprl = new BitField( 0xfffe ); /** * "Index to entry into rgsprmPrm" */ - private static BitField _fisprm = new BitField( 0x00fe ); + private static final BitField _fisprm = new BitField( 0x00fe ); /** * "sprm's operand" */ - private static BitField _fval = new BitField( 0xff00 ); + private static final BitField _fval = new BitField( 0xff00 ); private short value; - public PropertyModifier( short value ) - { + public PropertyModifier( short value ) { this.value = value; } + public PropertyModifier( PropertyModifier other ) { + value = other.value; + } + + @Override + @SuppressWarnings("squid:S2975") + @Deprecated + @Removal(version = "5.0.0") + protected PropertyModifier clone() { + return copy(); + } + @Override - protected PropertyModifier clone() throws CloneNotSupportedException - { - return new PropertyModifier( value ); + public PropertyModifier copy() { + return new PropertyModifier(this); } @Override Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java Tue Dec 24 11:56:42 2019 @@ -21,9 +21,11 @@ import java.util.Arrays; import java.util.Comparator; import java.util.Objects; +import org.apache.poi.common.Duplicatable; import org.apache.poi.util.Internal; import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; +import org.apache.poi.util.Removal; /** * Represents a lightweight node in the Trees used to store content @@ -31,35 +33,17 @@ import org.apache.poi.util.POILogger; * This only ever works in characters. For the few odd cases when * the start and end aren't in characters (eg PAPX and CHPX), use * {@link BytePropertyNode} between you and this. - * - * @author Ryan Ackley */ @Internal -public abstract class PropertyNode<T extends PropertyNode<T>> implements Comparable<T>, Cloneable { +public abstract class PropertyNode<T extends PropertyNode<T>> implements Comparable<T>, Duplicatable { - public static final class EndComparator implements - Comparator<PropertyNode<?>> { - public static final EndComparator instance = new EndComparator(); - - public int compare(PropertyNode<?> o1, PropertyNode<?> o2) { - int thisVal = o1.getEnd(); - int anotherVal = o2.getEnd(); - return (Integer.compare(thisVal, anotherVal)); - } - } + public static final Comparator<PropertyNode<?>> EndComparator = Comparator.comparingInt(PropertyNode::getEnd); + + public static final Comparator<PropertyNode<?>> StartComparator = Comparator.comparingInt(PropertyNode::getStart); + + private static final POILogger _logger = POILogFactory.getLogger(PropertyNode.class); - public static final class StartComparator implements - Comparator<PropertyNode<?>> { - public static final StartComparator instance = new StartComparator(); - - public int compare(PropertyNode<?> o1, PropertyNode<?> o2) { - int thisVal = o1.getStart(); - int anotherVal = o2.getStart(); - return (Integer.compare(thisVal, anotherVal)); - } - } - private final static POILogger _logger = POILogFactory.getLogger(PropertyNode.class); protected Object _buf; /** * The start, in characters @@ -70,6 +54,13 @@ public abstract class PropertyNode<T ext */ private int _cpEnd; + protected PropertyNode(PropertyNode<T> other) { + // TODO: clone _buf? + _buf = other._buf; + _cpStart = other._cpStart; + _cpEnd = other._cpEnd; + } + /** * @param fcStart The start of the text for this property, in characters. @@ -118,9 +109,6 @@ public abstract class PropertyNode<T ext /** * Adjust for a deletion that can span multiple PropertyNodes. - * - * @param start - * @param length */ public void adjustForDelete(int start, int length) { int end = start + length; @@ -164,16 +152,21 @@ public abstract class PropertyNode<T ext return false; } - @SuppressWarnings("unchecked") - public T clone() throws CloneNotSupportedException { - return (T) super.clone(); + @Override + @Deprecated + @Removal(version = "5.0.0") + @SuppressWarnings({"unchecked","squid:S2975"}) + public T clone() { + return (T) copy(); } + @Override + public abstract PropertyNode<?> copy(); + /** * Used for sorting in collections. */ public int compareTo(T o) { - int cpEnd = o.getEnd(); - return Integer.compare(_cpEnd, cpEnd); + return Integer.compare(_cpEnd, o.getEnd()); } } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SEPX.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SEPX.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SEPX.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SEPX.java Tue Dec 24 11:56:42 2019 @@ -24,13 +24,20 @@ import org.apache.poi.hwpf.usermodel.Sec import org.apache.poi.util.Internal; @Internal -public final class SEPX extends PropertyNode<SEPX> -{ +public final class SEPX extends PropertyNode<SEPX> { SectionProperties sectionProperties; SectionDescriptor _sed; + public SEPX( SEPX other ) { + super(other); + + sectionProperties = (other.sectionProperties == null) ? null : other.sectionProperties.copy(); + _sed = (other._sed == null) ? null : other._sed.copy(); + } + + public SEPX( SectionDescriptor sed, int start, int end, byte[] grpprl ) { super( start, end, new SprmBuffer( grpprl, 0 ) ); @@ -86,4 +93,9 @@ public final class SEPX extends Property { return "SEPX from " + getStart() + " to " + getEnd(); } + + @Override + public SEPX copy() { + return new SEPX(this); + } } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SectionDescriptor.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SectionDescriptor.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SectionDescriptor.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SectionDescriptor.java Tue Dec 24 11:56:42 2019 @@ -17,17 +17,17 @@ package org.apache.poi.hwpf.model; +import org.apache.poi.common.Duplicatable; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; /** * Section Descriptor (SED) - * + * * See page 186 for details. */ @Internal -public final class SectionDescriptor -{ +public final class SectionDescriptor implements Duplicatable { /** * "Used internally by Word" @@ -40,7 +40,7 @@ public final class SectionDescriptor * to the standard SEP (see SEP definition)." */ private int fcSepx; - + /** * "Used internally by Word" */ @@ -52,8 +52,13 @@ public final class SectionDescriptor */ private int fcMpr; - public SectionDescriptor() - { + public SectionDescriptor() {} + + public SectionDescriptor(SectionDescriptor other) { + fn = other.fn; + fcSepx = other.fcSepx; + fnMpr = other.fnMpr; + fcMpr = other.fcMpr; } public SectionDescriptor(byte[] buf, int offset) @@ -90,7 +95,7 @@ public final class SectionDescriptor assert false : "hashCode not designed"; return 42; // any arbitrary constant will do } - + public byte[] toByteArray() { int offset = 0; @@ -113,4 +118,9 @@ public final class SectionDescriptor return "[SED] (fn: " + fn + "; fcSepx: " + fcSepx + "; fnMpr: " + fnMpr + "; fcMpr: " + fcMpr + ")"; } + + @Override + public SectionDescriptor copy() { + return new SectionDescriptor(this); + } } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java Tue Dec 24 11:56:42 2019 @@ -29,9 +29,6 @@ import org.apache.poi.util.LittleEndian; import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; -/** - * @author Ryan Ackley - */ @Internal public class SectionTable { @@ -117,7 +114,7 @@ public class SectionTable } } - _sections.sort(PropertyNode.StartComparator.instance); + _sections.sort(PropertyNode.StartComparator); } public void adjustForInsert(int listIndex, int length) Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SinglentonTextPiece.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SinglentonTextPiece.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SinglentonTextPiece.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SinglentonTextPiece.java Tue Dec 24 11:56:42 2019 @@ -20,11 +20,12 @@ import org.apache.poi.util.Internal; import org.apache.poi.util.StringUtil; @Internal -public class SinglentonTextPiece extends TextPiece -{ +public class SinglentonTextPiece extends TextPiece { + public SinglentonTextPiece(SinglentonTextPiece other) { + super(other); + } - public SinglentonTextPiece( StringBuilder buffer ) - { + public SinglentonTextPiece( StringBuilder buffer ) { super( 0, buffer.length(), StringUtil.getToUnicodeLE(buffer.toString()), new PieceDescriptor( new byte[8], 0 ) ); } @@ -62,4 +63,9 @@ public class SinglentonTextPiece extends { return "SinglentonTextPiece (" + characterLength() + " chars)"; } + + @Override + public SinglentonTextPiece copy() { + return new SinglentonTextPiece(this); + } } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/TabDescriptor.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/TabDescriptor.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/TabDescriptor.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/TabDescriptor.java Tue Dec 24 11:56:42 2019 @@ -16,23 +16,22 @@ ==================================================================== */ package org.apache.poi.hwpf.model; +import org.apache.poi.common.Duplicatable; import org.apache.poi.hwpf.model.types.TBDAbstractType; import org.apache.poi.hwpf.usermodel.ParagraphProperties; /** * Tab descriptor. Part of {@link ParagraphProperties}. - * - * @author vlsergey */ -public class TabDescriptor extends TBDAbstractType -{ +public class TabDescriptor extends TBDAbstractType implements Duplicatable { - public TabDescriptor() - { + public TabDescriptor() {} + + public TabDescriptor(TabDescriptor other) { + super(other); } - public TabDescriptor( byte[] bytes, int offset ) - { + public TabDescriptor( byte[] bytes, int offset ) { fillFields( bytes, offset ); } @@ -43,4 +42,8 @@ public class TabDescriptor extends TBDAb return buf; } + @Override + public TabDescriptor copy() { + return new TabDescriptor(this); + } } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/TextPiece.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/TextPiece.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/TextPiece.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/TextPiece.java Tue Dec 24 11:56:42 2019 @@ -29,8 +29,6 @@ import org.apache.poi.util.StringUtil; * Works in the character domain, not the byte domain, so you * need to have turned byte references into character * references before getting here. - * - * @author Ryan Ackley */ @Internal public class TextPiece extends PropertyNode<TextPiece> { @@ -38,6 +36,12 @@ public class TextPiece extends PropertyN private PieceDescriptor _pd; + public TextPiece(TextPiece other) { + super(other); + _usesUnicode = other._usesUnicode; + _pd = (other._pd == null) ? null : other._pd.copy(); + } + /** * @param start Beginning offset in main document stream, in characters. * @param end Ending offset in main document stream, in characters. @@ -212,4 +216,8 @@ public class TextPiece extends PropertyN + getPieceDescriptor() + ")"; } + @Override + public TextPiece copy() { + return new TextPiece(this); + } } Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/BKFAbstractType.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/BKFAbstractType.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/BKFAbstractType.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/BKFAbstractType.java Tue Dec 24 11:56:42 2019 @@ -26,26 +26,23 @@ import org.apache.poi.util.LittleEndian; * <p> * Class and fields descriptions are quoted from Microsoft Office Word 97-2007 * Binary File Format (.doc) Specification - * - * NOTE: This source is automatically generated please do not modify this file. - * Either subclass or remove the record in src/types/definitions. - * - * @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary - * File Format (.doc) Specification */ @Internal -public abstract class BKFAbstractType -{ +public abstract class BKFAbstractType { + + private static final BitField itcFirst = new BitField( 0x007F ); + private static final BitField fPub = new BitField( 0x0080 ); + private static final BitField itcLim = new BitField( 0x7F00 ); + private static final BitField fCol = new BitField( 0x8000 ); protected short field_1_ibkl; protected short field_2_bkf_flags; - /**/private static BitField itcFirst = new BitField( 0x007F ); - /**/private static BitField fPub = new BitField( 0x0080 ); - /**/private static BitField itcLim = new BitField( 0x7F00 ); - /**/private static BitField fCol = new BitField( 0x8000 ); - protected BKFAbstractType() - { + protected BKFAbstractType() {} + + protected BKFAbstractType(BKFAbstractType other) { + field_1_ibkl = other.field_1_ibkl; + field_2_bkf_flags = other.field_2_bkf_flags; } protected void fillFields( byte[] data, int offset ) @@ -189,4 +186,4 @@ public abstract class BKFAbstractType return fCol.isSet(field_2_bkf_flags); } -} // END OF CLASS +} \ No newline at end of file Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/CHPAbstractType.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/CHPAbstractType.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/CHPAbstractType.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/CHPAbstractType.java Tue Dec 24 11:56:42 2019 @@ -30,53 +30,111 @@ import org.apache.poi.util.Internal; /** * Character 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 CHPAbstractType -{ +public abstract class CHPAbstractType { + + private static final BitField fBold = new BitField(0x00000001); + private static final BitField fItalic = new BitField(0x00000002); + private static final BitField fRMarkDel = new BitField(0x00000004); + private static final BitField fOutline = new BitField(0x00000008); + private static final BitField fFldVanish = new BitField(0x00000010); + private static final BitField fSmallCaps = new BitField(0x00000020); + private static final BitField fCaps = new BitField(0x00000040); + private static final BitField fVanish = new BitField(0x00000080); + private static final BitField fRMark = new BitField(0x00000100); + private static final BitField fSpec = new BitField(0x00000200); + private static final BitField fStrike = new BitField(0x00000400); + private static final BitField fObj = new BitField(0x00000800); + private static final BitField fShadow = new BitField(0x00001000); + private static final BitField fLowerCase = new BitField(0x00002000); + private static final BitField fData = new BitField(0x00004000); + private static final BitField fOle2 = new BitField(0x00008000); + private static final BitField fEmboss = new BitField(0x00010000); + private static final BitField fImprint = new BitField(0x00020000); + private static final BitField fDStrike = new BitField(0x00040000); + private static final BitField fUsePgsuSettings = new BitField(0x00080000); + private static final BitField fBoldBi = new BitField(0x00100000); + private static final BitField fComplexScripts = new BitField(0x00100000); + private static final BitField fItalicBi = new BitField(0x00200000); + private static final BitField fBiDi = new BitField(0x00400000); + private static final BitField fIcoBi = new BitField(0x00800000); + private static final BitField fNonGlyph = new BitField(0x01000000); + private static final BitField fBoldOther = new BitField(0x02000000); + private static final BitField fItalicOther = new BitField(0x04000000); + private static final BitField fNoProof = new BitField(0x08000000); + private static final BitField fWebHidden = new BitField(0x10000000); + private static final BitField fFitText = new BitField(0x20000000); + private static final BitField fCalc = new BitField(0x40000000); + private static final BitField fFmtLineProp = new BitField(0x80000000); + + protected static final byte SFXTTEXT_NO = 0; + protected static final byte SFXTTEXT_LAS_VEGAS_LIGHTS = 1; + protected static final byte SFXTTEXT_BACKGROUND_BLINK = 2; + protected static final byte SFXTTEXT_SPARKLE_TEXT = 3; + protected static final byte SFXTTEXT_MARCHING_ANTS = 4; + protected static final byte SFXTTEXT_MARCHING_RED_ANTS = 5; + protected static final byte SFXTTEXT_SHIMMER = 6; + + protected static final byte KCD_NON = 0; + protected static final byte KCD_DOT = 1; + protected static final byte KCD_COMMA = 2; + protected static final byte KCD_CIRCLE = 3; + protected static final byte KCD_UNDER_DOT = 4; + + protected static final byte KUL_NONE = 0; + protected static final byte KUL_SINGLE = 1; + protected static final byte KUL_BY_WORD = 2; + protected static final byte KUL_DOUBLE = 3; + protected static final byte KUL_DOTTED = 4; + protected static final byte KUL_HIDDEN = 5; + protected static final byte KUL_THICK = 6; + protected static final byte KUL_DASH = 7; + protected static final byte KUL_DOT = 8; + protected static final byte KUL_DOT_DASH = 9; + protected static final byte KUL_DOT_DOT_DASH = 10; + protected static final byte KUL_WAVE = 11; + protected static final byte KUL_DOTTED_HEAVY = 20; + protected static final byte KUL_DASHED_HEAVY = 23; + protected static final byte KUL_DOT_DASH_HEAVY = 25; + protected static final byte KUL_DOT_DOT_DASH_HEAVY = 26; + protected static final byte KUL_WAVE_HEAVY = 27; + protected static final byte KUL_DASH_LONG = 39; + protected static final byte KUL_WAVE_DOUBLE = 43; + protected static final byte KUL_DASH_LONG_HEAVY = 55; + + protected static final byte ISS_NONE = 0; + protected static final byte ISS_SUPERSCRIPTED = 1; + protected static final byte ISS_SUBSCRIPTED = 2; + + private static final BitField itypFELayout = new BitField(0x00ff); + private static final BitField fTNY = new BitField(0x0100); + private static final BitField fWarichu = new BitField(0x0200); + private static final BitField fKumimoji = new BitField(0x0400); + private static final BitField fRuby = new BitField(0x0800); + private static final BitField fLSFitText = new BitField(0x1000); + private static final BitField spare = new BitField(0xe000); + + private static final BitField iWarichuBracket = new BitField(0x07); + private static final BitField fWarichuNoOpenBracket = new BitField(0x08); + private static final BitField fTNYCompress = new BitField(0x10); + private static final BitField fTNYFetchTxm = new BitField(0x20); + private static final BitField fCellFitText = new BitField(0x40); + private static final BitField unused = new BitField(0x80); + + private static final BitField icoHighlight = new BitField(0x001f); + private static final BitField fHighlight = new BitField(0x0020); + + private static final BitField fChsDiff = new BitField(0x0001); + private static final BitField fMacChs = new BitField(0x0020); + + protected static final byte LBRCRJ_NONE = 0; + protected static final byte LBRCRJ_LEFT = 1; + protected static final byte LBRCRJ_RIGHT = 2; + protected static final byte LBRCRJ_BOTH = 3; protected int field_1_grpfChp; - /**/private static final BitField fBold = new BitField(0x00000001); - /**/private static final BitField fItalic = new BitField(0x00000002); - /**/private static final BitField fRMarkDel = new BitField(0x00000004); - /**/private static final BitField fOutline = new BitField(0x00000008); - /**/private static final BitField fFldVanish = new BitField(0x00000010); - /**/private static final BitField fSmallCaps = new BitField(0x00000020); - /**/private static final BitField fCaps = new BitField(0x00000040); - /**/private static final BitField fVanish = new BitField(0x00000080); - /**/private static final BitField fRMark = new BitField(0x00000100); - /**/private static final BitField fSpec = new BitField(0x00000200); - /**/private static final BitField fStrike = new BitField(0x00000400); - /**/private static final BitField fObj = new BitField(0x00000800); - /**/private static final BitField fShadow = new BitField(0x00001000); - /**/private static final BitField fLowerCase = new BitField(0x00002000); - /**/private static final BitField fData = new BitField(0x00004000); - /**/private static final BitField fOle2 = new BitField(0x00008000); - /**/private static final BitField fEmboss = new BitField(0x00010000); - /**/private static final BitField fImprint = new BitField(0x00020000); - /**/private static final BitField fDStrike = new BitField(0x00040000); - /**/private static final BitField fUsePgsuSettings = new BitField(0x00080000); - /**/private static final BitField fBoldBi = new BitField(0x00100000); - /**/private static final BitField fComplexScripts = new BitField(0x00100000); - /**/private static final BitField fItalicBi = new BitField(0x00200000); - /**/private static final BitField fBiDi = new BitField(0x00400000); - /**/private static final BitField fIcoBi = new BitField(0x00800000); - /**/private static final BitField fNonGlyph = new BitField(0x01000000); - /**/private static final BitField fBoldOther = new BitField(0x02000000); - /**/private static final BitField fItalicOther = new BitField(0x04000000); - /**/private static final BitField fNoProof = new BitField(0x08000000); - /**/private static final BitField fWebHidden = new BitField(0x10000000); - /**/private static final BitField fFitText = new BitField(0x20000000); - /**/private static final BitField fCalc = new BitField(0x40000000); - /**/private static final BitField fFmtLineProp = new BitField(0x80000000); protected int field_2_hps; protected int field_3_ftcAscii; protected int field_4_ftcFE; @@ -89,40 +147,12 @@ public abstract class CHPAbstractType protected int field_11_lidDefault; protected int field_12_lidFE; protected byte field_13_kcd; - /**/protected final static byte KCD_NON = 0; - /**/protected final static byte KCD_DOT = 1; - /**/protected final static byte KCD_COMMA = 2; - /**/protected final static byte KCD_CIRCLE = 3; - /**/protected final static byte KCD_UNDER_DOT = 4; protected boolean field_14_fUndetermine; protected byte field_15_iss; - /**/protected final static byte ISS_NONE = 0; - /**/protected final static byte ISS_SUPERSCRIPTED = 1; - /**/protected final static byte ISS_SUBSCRIPTED = 2; protected boolean field_16_fSpecSymbol; protected byte field_17_idct; protected byte field_18_idctHint; protected byte field_19_kul; - /**/protected final static byte KUL_NONE = 0; - /**/protected final static byte KUL_SINGLE = 1; - /**/protected final static byte KUL_BY_WORD = 2; - /**/protected final static byte KUL_DOUBLE = 3; - /**/protected final static byte KUL_DOTTED = 4; - /**/protected final static byte KUL_HIDDEN = 5; - /**/protected final static byte KUL_THICK = 6; - /**/protected final static byte KUL_DASH = 7; - /**/protected final static byte KUL_DOT = 8; - /**/protected final static byte KUL_DOT_DASH = 9; - /**/protected final static byte KUL_DOT_DOT_DASH = 10; - /**/protected final static byte KUL_WAVE = 11; - /**/protected final static byte KUL_DOTTED_HEAVY = 20; - /**/protected final static byte KUL_DASHED_HEAVY = 23; - /**/protected final static byte KUL_DOT_DASH_HEAVY = 25; - /**/protected final static byte KUL_DOT_DOT_DASH_HEAVY = 26; - /**/protected final static byte KUL_WAVE_HEAVY = 27; - /**/protected final static byte KUL_DASH_LONG = 39; - /**/protected final static byte KUL_WAVE_DOUBLE = 43; - /**/protected final static byte KUL_DASH_LONG_HEAVY = 55; protected Hyphenation field_20_hresi; protected int field_21_hpsKern; protected short field_22_hpsPos; @@ -130,30 +160,10 @@ public abstract class CHPAbstractType protected BorderCode field_24_brc; protected int field_25_ibstRMark; protected byte field_26_sfxtText; - /**/protected final static byte SFXTTEXT_NO = 0; - /**/protected final static byte SFXTTEXT_LAS_VEGAS_LIGHTS = 1; - /**/protected final static byte SFXTTEXT_BACKGROUND_BLINK = 2; - /**/protected final static byte SFXTTEXT_SPARKLE_TEXT = 3; - /**/protected final static byte SFXTTEXT_MARCHING_ANTS = 4; - /**/protected final static byte SFXTTEXT_MARCHING_RED_ANTS = 5; - /**/protected final static byte SFXTTEXT_SHIMMER = 6; protected boolean field_27_fDblBdr; protected boolean field_28_fBorderWS; protected short field_29_ufel; - /**/private static final BitField itypFELayout = new BitField(0x00ff); - /**/private static final BitField fTNY = new BitField(0x0100); - /**/private static final BitField fWarichu = new BitField(0x0200); - /**/private static final BitField fKumimoji = new BitField(0x0400); - /**/private static final BitField fRuby = new BitField(0x0800); - /**/private static final BitField fLSFitText = new BitField(0x1000); - /**/private static final BitField spare = new BitField(0xe000); protected byte field_30_copt; - /**/private static final BitField iWarichuBracket = new BitField(0x07); - /**/private static final BitField fWarichuNoOpenBracket = new BitField(0x08); - /**/private static final BitField fTNYCompress = new BitField(0x10); - /**/private static final BitField fTNYFetchTxm = new BitField(0x20); - /**/private static final BitField fCellFitText = new BitField(0x40); - /**/private static final BitField unused = new BitField(0x80); protected int field_31_hpsAsci; protected int field_32_hpsFE; protected int field_33_hpsBi; @@ -172,11 +182,7 @@ public abstract class CHPAbstractType protected int field_46_idslReasonDel; protected int field_47_cpg; protected short field_48_Highlight; - /**/private static final BitField icoHighlight = new BitField(0x001f); - /**/private static final BitField fHighlight = new BitField(0x0020); protected short field_49_CharsetFlags; - /**/private static final BitField fChsDiff = new BitField(0x0001); - /**/private static final BitField fMacChs = new BitField(0x0020); protected short field_50_chse; protected boolean field_51_fPropRMark; protected int field_52_ibstPropRMark; @@ -192,36 +198,101 @@ public abstract class CHPAbstractType protected byte[] field_62_xstDispFldRMark; protected int field_63_fcObjp; protected byte field_64_lbrCRJ; - /**/protected final static byte LBRCRJ_NONE = 0; - /**/protected final static byte LBRCRJ_LEFT = 1; - /**/protected final static byte LBRCRJ_RIGHT = 2; - /**/protected final static byte LBRCRJ_BOTH = 3; protected boolean field_65_fSpecVanish; protected boolean field_66_fHasOldProps; protected boolean field_67_fSdtVanish; protected int field_68_wCharScale; - protected CHPAbstractType() - { - this.field_2_hps = 20; - this.field_8_cv = new Colorref(); - this.field_11_lidDefault = 0x0400; - this.field_12_lidFE = 0x0400; - this.field_20_hresi = new Hyphenation(); - this.field_23_shd = new ShadingDescriptor(); - this.field_24_brc = new BorderCode(); - this.field_36_fcPic = -1; - this.field_40_hresiOld = new Hyphenation(); - this.field_42_dttmRMark = new DateAndTime(); - this.field_43_dttmRMarkDel = new DateAndTime(); - this.field_44_istd = 10; - this.field_53_dttmPropRMark = new DateAndTime(); - this.field_58_dttmConflict = new DateAndTime(); - this.field_61_dttmDispFldRMark = new DateAndTime(); - this.field_62_xstDispFldRMark = new byte[32]; - this.field_68_wCharScale = 100; + protected CHPAbstractType() { + field_2_hps = 20; + field_8_cv = new Colorref(); + field_11_lidDefault = 0x0400; + field_12_lidFE = 0x0400; + field_20_hresi = new Hyphenation(); + field_23_shd = new ShadingDescriptor(); + field_24_brc = new BorderCode(); + field_36_fcPic = -1; + field_40_hresiOld = new Hyphenation(); + field_42_dttmRMark = new DateAndTime(); + field_43_dttmRMarkDel = new DateAndTime(); + field_44_istd = 10; + field_53_dttmPropRMark = new DateAndTime(); + field_58_dttmConflict = new DateAndTime(); + field_61_dttmDispFldRMark = new DateAndTime(); + field_62_xstDispFldRMark = new byte[32]; + field_68_wCharScale = 100; } + protected CHPAbstractType(CHPAbstractType other) { + field_1_grpfChp = other.field_1_grpfChp; + field_2_hps = other.field_2_hps; + field_3_ftcAscii = other.field_3_ftcAscii; + field_4_ftcFE = other.field_4_ftcFE; + field_5_ftcOther = other.field_5_ftcOther; + field_6_ftcBi = other.field_6_ftcBi; + field_7_dxaSpace = other.field_7_dxaSpace; + field_8_cv = (other.field_8_cv == null) ? null : other.field_8_cv.copy(); + field_9_ico = other.field_9_ico; + field_10_pctCharWidth = other.field_10_pctCharWidth; + field_11_lidDefault = other.field_11_lidDefault; + field_12_lidFE = other.field_12_lidFE; + field_13_kcd = other.field_13_kcd; + field_14_fUndetermine = other.field_14_fUndetermine; + field_15_iss = other.field_15_iss; + field_16_fSpecSymbol = other.field_16_fSpecSymbol; + field_17_idct = other.field_17_idct; + field_18_idctHint = other.field_18_idctHint; + field_19_kul = other.field_19_kul; + field_20_hresi = (other.field_20_hresi == null) ? null : other.field_20_hresi.copy(); + field_21_hpsKern = other.field_21_hpsKern; + field_22_hpsPos = other.field_22_hpsPos; + field_23_shd = (other.field_23_shd == null) ? null : other.field_23_shd.copy(); + field_24_brc = (other.field_24_brc == null) ? null : other.field_24_brc.copy(); + field_25_ibstRMark = other.field_25_ibstRMark; + field_26_sfxtText = other.field_26_sfxtText; + field_27_fDblBdr = other.field_27_fDblBdr; + field_28_fBorderWS = other.field_28_fBorderWS; + field_29_ufel = other.field_29_ufel; + field_30_copt = other.field_30_copt; + field_31_hpsAsci = other.field_31_hpsAsci; + field_32_hpsFE = other.field_32_hpsFE; + field_33_hpsBi = other.field_33_hpsBi; + field_34_ftcSym = other.field_34_ftcSym; + field_35_xchSym = other.field_35_xchSym; + field_36_fcPic = other.field_36_fcPic; + field_37_fcObj = other.field_37_fcObj; + field_38_lTagObj = other.field_38_lTagObj; + field_39_fcData = other.field_39_fcData; + field_40_hresiOld = (other.field_40_hresiOld == null) ? null : other.field_40_hresiOld.copy(); + field_41_ibstRMarkDel = other.field_41_ibstRMarkDel; + field_42_dttmRMark = (other.field_42_dttmRMark == null) ? null : other.field_42_dttmRMark.copy(); + field_43_dttmRMarkDel = (other.field_43_dttmRMarkDel == null) ? null : other.field_43_dttmRMarkDel.copy(); + field_44_istd = other.field_44_istd; + field_45_idslRMReason = other.field_45_idslRMReason; + field_46_idslReasonDel = other.field_46_idslReasonDel; + field_47_cpg = other.field_47_cpg; + field_48_Highlight = other.field_48_Highlight; + field_49_CharsetFlags = other.field_49_CharsetFlags; + field_50_chse = other.field_50_chse; + field_51_fPropRMark = other.field_51_fPropRMark; + field_52_ibstPropRMark = other.field_52_ibstPropRMark; + field_53_dttmPropRMark = (other.field_53_dttmPropRMark == null) ? null : other.field_53_dttmPropRMark.copy(); + field_54_fConflictOrig = other.field_54_fConflictOrig; + field_55_fConflictOtherDel = other.field_55_fConflictOtherDel; + field_56_wConflict = other.field_56_wConflict; + field_57_IbstConflict = other.field_57_IbstConflict; + field_58_dttmConflict = (other.field_58_dttmConflict == null) ? null : other.field_58_dttmConflict.copy(); + field_59_fDispFldRMark = other.field_59_fDispFldRMark; + field_60_ibstDispFldRMark = other.field_60_ibstDispFldRMark; + field_61_dttmDispFldRMark = (other.field_61_dttmDispFldRMark == null) ? null : other.field_61_dttmDispFldRMark.copy(); + field_62_xstDispFldRMark = (other.field_62_xstDispFldRMark == null) ? null : other.field_62_xstDispFldRMark.clone(); + field_63_fcObjp = other.field_63_fcObjp; + field_64_lbrCRJ = other.field_64_lbrCRJ; + field_65_fSpecVanish = other.field_65_fSpecVanish; + field_66_fHasOldProps = other.field_66_fHasOldProps; + field_67_fSdtVanish = other.field_67_fSdtVanish; + field_68_wCharScale = other.field_68_wCharScale; + } @Override public boolean equals( Object obj ) Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/FRDAbstractType.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/FRDAbstractType.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/FRDAbstractType.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/FRDAbstractType.java Tue Dec 24 11:56:42 2019 @@ -24,21 +24,16 @@ import org.apache.poi.util.LittleEndian; * <p> * Class and fields descriptions are quoted from Microsoft Office Word 97-2007 * Binary File Format (.doc) Specification - * - * NOTE: This source is automatically generated please do not modify this file. - * Either subclass or remove the record in src/types/definitions. - * - * @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary - * File Format (.doc) Specification */ @Internal -public abstract class FRDAbstractType -{ +public abstract class FRDAbstractType { protected short field_1_nAuto; - protected FRDAbstractType() - { + protected FRDAbstractType() {} + + protected FRDAbstractType(FRDAbstractType other) { + field_1_nAuto = other.field_1_nAuto; } protected void fillFields( byte[] data, int offset ) Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/HRESIAbstractType.java URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/HRESIAbstractType.java?rev=1871938&r1=1871937&r2=1871938&view=diff ============================================================================== --- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/HRESIAbstractType.java (original) +++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/types/HRESIAbstractType.java Tue Dec 24 11:56:42 2019 @@ -24,29 +24,25 @@ import org.apache.poi.util.Internal; * <p> * Class and fields descriptions are quoted from Microsoft Office Word 97-2007 * Binary File Format (.doc) Specification - * - * NOTE: This source is automatically generated please do not modify this file. - * Either subclass or remove the record in src/types/definitions. - * - * @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary - * File Format (.doc) Specification */ @Internal -public abstract class HRESIAbstractType -{ +public abstract class HRESIAbstractType { + public static final byte HRES_NO = 0; + public static final byte HRES_NORMAL = 1; + public static final byte HRES_ADD_LETTER_BEFORE = 2; + public static final byte HRES_CHANGE_LETTER_BEFORE = 3; + public static final byte HRES_DELETE_LETTER_BEFORE = 4; + public static final byte HRES_CHANGE_LETTER_AFTER = 5; + public static final byte HRES_DELETE_BEFORE_CHANGE_BEFORE = 6; protected byte field_1_hres; - /**/public final static byte HRES_NO = 0; - /**/public final static byte HRES_NORMAL = 1; - /**/public final static byte HRES_ADD_LETTER_BEFORE = 2; - /**/public final static byte HRES_CHANGE_LETTER_BEFORE = 3; - /**/public final static byte HRES_DELETE_LETTER_BEFORE = 4; - /**/public final static byte HRES_CHANGE_LETTER_AFTER = 5; - /**/public final static byte HRES_DELETE_BEFORE_CHANGE_BEFORE = 6; protected byte field_2_chHres; - protected HRESIAbstractType() - { + protected HRESIAbstractType() {} + + protected HRESIAbstractType(HRESIAbstractType other) { + field_1_hres = other.field_1_hres; + field_2_chHres = other.field_2_chHres; } protected void fillFields( byte[] data, int offset ) @@ -85,7 +81,7 @@ public abstract class HRESIAbstractType /** * Hyphenation rule. * - * @return One of + * @return One of * <li>{@link #HRES_NO} * <li>{@link #HRES_NORMAL} * <li>{@link #HRES_ADD_LETTER_BEFORE} @@ -103,7 +99,7 @@ public abstract class HRESIAbstractType * Hyphenation rule. * * @param field_1_hres - * One of + * One of * <li>{@link #HRES_NO} * <li>{@link #HRES_NORMAL} * <li>{@link #HRES_ADD_LETTER_BEFORE} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org