Browse Source

#64004 - Replace clone() with copy constructor - mainly HWPF classes

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1871938 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_4_1_2
Andreas Beeker 4 years ago
parent
commit
03fe2ded64
54 changed files with 1632 additions and 1194 deletions
  1. 18
    17
      src/scratchpad/src/org/apache/poi/hwpf/model/BookmarkFirstDescriptor.java
  2. 10
    6
      src/scratchpad/src/org/apache/poi/hwpf/model/BytePropertyNode.java
  3. 4
    4
      src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java
  4. 9
    2
      src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java
  5. 21
    13
      src/scratchpad/src/org/apache/poi/hwpf/model/Colorref.java
  6. 18
    17
      src/scratchpad/src/org/apache/poi/hwpf/model/FootnoteReferenceDescriptor.java
  7. 12
    5
      src/scratchpad/src/org/apache/poi/hwpf/model/GenericPropertyNode.java
  8. 19
    19
      src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java
  9. 3
    3
      src/scratchpad/src/org/apache/poi/hwpf/model/OldCHPBinTable.java
  10. 3
    3
      src/scratchpad/src/org/apache/poi/hwpf/model/OldSectionTable.java
  11. 10
    0
      src/scratchpad/src/org/apache/poi/hwpf/model/OldTextPiece.java
  12. 10
    12
      src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java
  13. 12
    4
      src/scratchpad/src/org/apache/poi/hwpf/model/PAPX.java
  14. 22
    13
      src/scratchpad/src/org/apache/poi/hwpf/model/ParagraphHeight.java
  15. 15
    1
      src/scratchpad/src/org/apache/poi/hwpf/model/PieceDescriptor.java
  16. 22
    11
      src/scratchpad/src/org/apache/poi/hwpf/model/PropertyModifier.java
  17. 23
    30
      src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java
  18. 14
    2
      src/scratchpad/src/org/apache/poi/hwpf/model/SEPX.java
  19. 17
    7
      src/scratchpad/src/org/apache/poi/hwpf/model/SectionDescriptor.java
  20. 1
    4
      src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java
  21. 10
    4
      src/scratchpad/src/org/apache/poi/hwpf/model/SinglentonTextPiece.java
  22. 11
    8
      src/scratchpad/src/org/apache/poi/hwpf/model/TabDescriptor.java
  23. 10
    2
      src/scratchpad/src/org/apache/poi/hwpf/model/TextPiece.java
  24. 12
    15
      src/scratchpad/src/org/apache/poi/hwpf/model/types/BKFAbstractType.java
  25. 190
    119
      src/scratchpad/src/org/apache/poi/hwpf/model/types/CHPAbstractType.java
  26. 5
    10
      src/scratchpad/src/org/apache/poi/hwpf/model/types/FRDAbstractType.java
  27. 15
    19
      src/scratchpad/src/org/apache/poi/hwpf/model/types/HRESIAbstractType.java
  28. 156
    76
      src/scratchpad/src/org/apache/poi/hwpf/model/types/PAPAbstractType.java
  29. 91
    31
      src/scratchpad/src/org/apache/poi/hwpf/model/types/SEPAbstractType.java
  30. 14
    22
      src/scratchpad/src/org/apache/poi/hwpf/model/types/SHD80AbstractType.java
  31. 12
    20
      src/scratchpad/src/org/apache/poi/hwpf/model/types/SHDAbstractType.java
  32. 118
    40
      src/scratchpad/src/org/apache/poi/hwpf/model/types/TAPAbstractType.java
  33. 12
    22
      src/scratchpad/src/org/apache/poi/hwpf/model/types/TBDAbstractType.java
  34. 43
    28
      src/scratchpad/src/org/apache/poi/hwpf/model/types/TCAbstractType.java
  35. 16
    23
      src/scratchpad/src/org/apache/poi/hwpf/model/types/TLPAbstractType.java
  36. 7
    15
      src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java
  37. 22
    9
      src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmBuffer.java
  38. 1
    1
      src/scratchpad/src/org/apache/poi/hwpf/usermodel/BookmarksImpl.java
  39. 42
    30
      src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java
  40. 72
    82
      src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java
  41. 78
    74
      src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java
  42. 30
    22
      src/scratchpad/src/org/apache/poi/hwpf/usermodel/DateAndTime.java
  43. 24
    16
      src/scratchpad/src/org/apache/poi/hwpf/usermodel/DropCapSpecifier.java
  44. 24
    16
      src/scratchpad/src/org/apache/poi/hwpf/usermodel/LineSpacingDescriptor.java
  45. 86
    77
      src/scratchpad/src/org/apache/poi/hwpf/usermodel/Paragraph.java
  46. 30
    28
      src/scratchpad/src/org/apache/poi/hwpf/usermodel/ParagraphProperties.java
  47. 48
    34
      src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java
  48. 31
    21
      src/scratchpad/src/org/apache/poi/hwpf/usermodel/Section.java
  49. 49
    38
      src/scratchpad/src/org/apache/poi/hwpf/usermodel/SectionProperties.java
  50. 19
    13
      src/scratchpad/src/org/apache/poi/hwpf/usermodel/ShadingDescriptor.java
  51. 21
    15
      src/scratchpad/src/org/apache/poi/hwpf/usermodel/ShadingDescriptor80.java
  52. 18
    19
      src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableAutoformatLookSpecifier.java
  53. 18
    15
      src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableCellDescriptor.java
  54. 34
    57
      src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableProperties.java

+ 18
- 17
src/scratchpad/src/org/apache/poi/hwpf/model/BookmarkFirstDescriptor.java View File

@@ -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

+ 10
- 6
src/scratchpad/src/org/apache/poi/hwpf/model/BytePropertyNode.java View File

@@ -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 )

+ 4
- 4
src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java View File

@@ -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

+ 9
- 2
src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java View File

@@ -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 BytePropertyNode<CHPX> {
return "CHPX from " + getStart() + " to " + getEnd() +
" (in bytes " + getStartBytes() + " to " + getEndBytes() + ")";
}

@Override
public CHPX copy() {
return new CHPX(this);
}
}

+ 21
- 13
src/scratchpad/src/org/apache/poi/hwpf/model/Colorref.java View File

@@ -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 Cloneable

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

+ 18
- 17
src/scratchpad/src/org/apache/poi/hwpf/model/FootnoteReferenceDescriptor.java View File

@@ -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

+ 12
- 5
src/scratchpad/src/org/apache/poi/hwpf/model/GenericPropertyNode.java View File

@@ -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);
}
}

+ 19
- 19
src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java View File

@@ -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

+ 3
- 3
src/scratchpad/src/org/apache/poi/hwpf/model/OldCHPBinTable.java View File

@@ -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 extends CHPBinTable
_textRuns.add( chpx );
}
}
_textRuns.sort(PropertyNode.StartComparator.instance);
_textRuns.sort(PropertyNode.StartComparator);
}
}

+ 3
- 3
src/scratchpad/src/org/apache/poi/hwpf/model/OldSectionTable.java View File

@@ -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 extends SectionTable

_sections.add( sepx );
}
_sections.sort(PropertyNode.StartComparator.instance);
_sections.sort(PropertyNode.StartComparator);
}
}

+ 10
- 0
src/scratchpad/src/org/apache/poi/hwpf/model/OldTextPiece.java View File

@@ -34,6 +34,12 @@ public class OldTextPiece extends TextPiece {

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 TextPiece {
+ getPieceDescriptor() + ")";
}

@Override
public OldTextPiece copy() {
return new OldTextPiece(this);
}
}

+ 10
- 12
src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java View File

@@ -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());

+ 12
- 4
src/scratchpad/src/org/apache/poi/hwpf/model/PAPX.java View File

@@ -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 BytePropertyNode<PAPX> {

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 BytePropertyNode<PAPX> {
{
if ( _buf == null )
return 0;
byte[] buf = getGrpprl();
if (buf.length == 0)
{
@@ -129,7 +132,7 @@ public final class PAPX extends BytePropertyNode<PAPX> {
// 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 BytePropertyNode<PAPX> {
return "PAPX from " + getStart() + " to " + getEnd() + " (in bytes "
+ getStartBytes() + " to " + getEndBytes() + ")";
}

@Override
public PAPX copy() {
return new PAPX(this);
}
}

+ 22
- 13
src/scratchpad/src/org/apache/poi/hwpf/model/ParagraphHeight.java View File

@@ -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);
}
}

+ 15
- 1
src/scratchpad/src/org/apache/poi/hwpf/model/PieceDescriptor.java View File

@@ -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);
}
}

+ 22
- 11
src/scratchpad/src/org/apache/poi/hwpf/model/PropertyModifier.java View File

@@ -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
protected PropertyModifier clone() throws CloneNotSupportedException
{
return new PropertyModifier( value );
@SuppressWarnings("squid:S2975")
@Deprecated
@Removal(version = "5.0.0")
protected PropertyModifier clone() {
return copy();
}

@Override
public PropertyModifier copy() {
return new PropertyModifier(this);
}

@Override

+ 23
- 30
src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java View File

@@ -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 static final Comparator<PropertyNode<?>> EndComparator = Comparator.comparingInt(PropertyNode::getEnd);

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<?>> StartComparator = Comparator.comparingInt(PropertyNode::getStart);

public static final class StartComparator implements
Comparator<PropertyNode<?>> {
public static final StartComparator instance = new StartComparator();
private static final POILogger _logger = POILogFactory.getLogger(PropertyNode.class);

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 extends PropertyNode<T>> implements Compara
*/
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 extends PropertyNode<T>> implements Compara

/**
* 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 extends PropertyNode<T>> implements Compara
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());
}
}

+ 14
- 2
src/scratchpad/src/org/apache/poi/hwpf/model/SEPX.java View File

@@ -24,13 +24,20 @@ import org.apache.poi.hwpf.usermodel.SectionProperties;
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 PropertyNode<SEPX>
{
return "SEPX from " + getStart() + " to " + getEnd();
}

@Override
public SEPX copy() {
return new SEPX(this);
}
}

+ 17
- 7
src/scratchpad/src/org/apache/poi/hwpf/model/SectionDescriptor.java View File

@@ -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);
}
}

+ 1
- 4
src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java View File

@@ -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)

+ 10
- 4
src/scratchpad/src/org/apache/poi/hwpf/model/SinglentonTextPiece.java View File

@@ -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 TextPiece
{
return "SinglentonTextPiece (" + characterLength() + " chars)";
}

@Override
public SinglentonTextPiece copy() {
return new SinglentonTextPiece(this);
}
}

+ 11
- 8
src/scratchpad/src/org/apache/poi/hwpf/model/TabDescriptor.java View File

@@ -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 TBDAbstractType
return buf;
}

@Override
public TabDescriptor copy() {
return new TabDescriptor(this);
}
}

+ 10
- 2
src/scratchpad/src/org/apache/poi/hwpf/model/TextPiece.java View File

@@ -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 PropertyNode<TextPiece> {

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 PropertyNode<TextPiece> {
+ getPieceDescriptor() + ")";
}

@Override
public TextPiece copy() {
return new TextPiece(this);
}
}

+ 12
- 15
src/scratchpad/src/org/apache/poi/hwpf/model/types/BKFAbstractType.java View File

@@ -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
}

+ 190
- 119
src/scratchpad/src/org/apache/poi/hwpf/model/types/CHPAbstractType.java View File

@@ -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,37 +198,102 @@ 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 )
{

+ 5
- 10
src/scratchpad/src/org/apache/poi/hwpf/model/types/FRDAbstractType.java View File

@@ -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 )

+ 15
- 19
src/scratchpad/src/org/apache/poi/hwpf/model/types/HRESIAbstractType.java View File

@@ -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}

+ 156
- 76
src/scratchpad/src/org/apache/poi/hwpf/model/types/PAPAbstractType.java View File

@@ -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

+ 91
- 31
src/scratchpad/src/org/apache/poi/hwpf/model/types/SEPAbstractType.java View File

@@ -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
}

+ 14
- 22
src/scratchpad/src/org/apache/poi/hwpf/model/types/SHD80AbstractType.java View File

@@ -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
}

+ 12
- 20
src/scratchpad/src/org/apache/poi/hwpf/model/types/SHDAbstractType.java View File

@@ -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
}

+ 118
- 40
src/scratchpad/src/org/apache/poi/hwpf/model/types/TAPAbstractType.java View File

@@ -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()
{

+ 12
- 22
src/scratchpad/src/org/apache/poi/hwpf/model/types/TBDAbstractType.java View File

@@ -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

+ 43
- 28
src/scratchpad/src/org/apache/poi/hwpf/model/types/TCAbstractType.java View File

@@ -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()
{

+ 16
- 23
src/scratchpad/src/org/apache/poi/hwpf/model/types/TLPAbstractType.java View File

@@ -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()

+ 7
- 15
src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java View File

@@ -51,15 +51,7 @@ public final class ParagraphSprmUncompressor
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 ParagraphSprmUncompressor
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 ParagraphSprmUncompressor
}
break;
case 0x41:
// sprmPFBiDi
// sprmPFBiDi
newPAP.setFBiDi(sprm.getOperand() != 0);
break;
case 0x43:
@@ -413,11 +405,11 @@ public final class ParagraphSprmUncompressor
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 ParagraphSprmUncompressor

tabPositions = new int[tabMap.size()];
tabDescriptors = new TabDescriptor[tabPositions.length];
List<Integer> list = new ArrayList<>(tabMap.keySet());
Collections.sort(list);


+ 22
- 9
src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmBuffer.java View File

@@ -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 Cloneable {

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 Cloneable {
_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 Cloneable {
}
return stringBuilder.toString();
}


}

+ 1
- 1
src/scratchpad/src/org/apache/poi/hwpf/usermodel/BookmarksImpl.java View File

@@ -243,7 +243,7 @@ public class BookmarksImpl implements Bookmarks
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 );

+ 42
- 30
src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java View File

@@ -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 Cloneable {
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 Cloneable {
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 Cloneable {
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 Cloneable {
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);
}

+ 72
- 82
src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java View File

@@ -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;

/**
* @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;
import org.apache.poi.util.Removal;

@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() );

return cp;
}
catch ( CloneNotSupportedException exc )
{
throw new UnsupportedOperationException(
"Impossible CloneNotSupportedException occured", exc );
}
@Override
@SuppressWarnings({"squid:S2975", "MethodDoesntCallSuperMethod"})
@Deprecated
@Removal(version = "5.0.0")
public CharacterProperties clone() {
return copy();
}

@Override
public CharacterProperties copy() {
return new CharacterProperties(this);
}
}

+ 78
- 74
src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java View File

@@ -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 Range
_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 Range
* 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 Range

/**
* 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 Range

/**
* 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 Range
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 Range
} else
throw new IllegalStateException("Not a symbol CharacterRun");
}
public BorderCode getBorder() {
return _props.getBrc();
}
@@ -625,7 +629,7 @@ public final class CharacterRun extends Range
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 Range
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()

+ 30
- 22
src/scratchpad/src/org/apache/poi/hwpf/usermodel/DateAndTime.java View File

@@ -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()
{

+ 24
- 16
src/scratchpad/src/org/apache/poi/hwpf/usermodel/DropCapSpecifier.java View File

@@ -17,42 +17,50 @@

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;

/**
* This data structure is used by a paragraph to determine how it should drop
* its first letter. I think its the visual effect that will show a giant first
* letter to a paragraph. I've seen this used in the first paragraph of a book
*
* @author Ryan Ackley
*/
public final class DropCapSpecifier implements Cloneable
{
public final class DropCapSpecifier implements Duplicatable {
private static final BitField _lines = BitFieldFactory.getInstance( 0xf8 );
private static final BitField _type = BitFieldFactory.getInstance( 0x07 );

private short _fdct;
private static BitField _lines = BitFieldFactory.getInstance( 0xf8 );
private static BitField _type = BitFieldFactory.getInstance( 0x07 );

public DropCapSpecifier()
{
this._fdct = 0;
public DropCapSpecifier() {
_fdct = 0;
}

public DropCapSpecifier( byte[] buf, int offset )
{
public DropCapSpecifier(DropCapSpecifier other) {
_fdct = other._fdct;
}

public DropCapSpecifier( byte[] buf, int offset ) {
this( LittleEndian.getShort( buf, offset ) );
}

public DropCapSpecifier( short fdct )
{
public DropCapSpecifier( short fdct ) {
this._fdct = fdct;
}

@Override
public DropCapSpecifier clone()
{
return new DropCapSpecifier( _fdct );
@SuppressWarnings("squid:S2975")
@Deprecated
@Removal(version = "5.0.0")
public DropCapSpecifier clone() {
return copy();
}

@Override
public DropCapSpecifier copy() {
return new DropCapSpecifier(this);
}

@Override

+ 24
- 16
src/scratchpad/src/org/apache/poi/hwpf/usermodel/LineSpacingDescriptor.java View File

@@ -17,36 +17,44 @@

package org.apache.poi.hwpf.usermodel;

import org.apache.poi.common.Duplicatable;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.Removal;

/**
* This class is used to determine line spacing for a paragraph.
*
* @author Ryan Ackley
*/
public final class LineSpacingDescriptor
implements Cloneable
{
public final class LineSpacingDescriptor implements Duplicatable {
short _dyaLine;
short _fMultiLinespace;

public LineSpacingDescriptor()
{
//see page 181
public LineSpacingDescriptor() {
_dyaLine = 240;
_fMultiLinespace = 1;
}

public LineSpacingDescriptor(byte[] buf, int offset)
{
public LineSpacingDescriptor(LineSpacingDescriptor other) {
_dyaLine = other._dyaLine;
_fMultiLinespace = other._fMultiLinespace;
}


public LineSpacingDescriptor(byte[] buf, int offset) {
_dyaLine = LittleEndian.getShort(buf, offset);
_fMultiLinespace = LittleEndian.getShort(buf, offset + LittleEndian.SHORT_SIZE);
}

public Object clone()
throws CloneNotSupportedException
{
return super.clone();
@Override
@SuppressWarnings("squid:S2975")
@Deprecated
@Removal(version = "5.0.0")
public LineSpacingDescriptor clone() {
return copy();
}

@Override
public LineSpacingDescriptor copy() {
return new LineSpacingDescriptor(this);
}

public void setMultiLinespace(short fMultiLinespace)
@@ -71,7 +79,7 @@ public final class LineSpacingDescriptor
{
_dyaLine = dyaLine;
}
@Override
public boolean equals(Object o)
{
@@ -86,7 +94,7 @@ public final class LineSpacingDescriptor
assert false : "hashCode not designed";
return 42; // any arbitrary constant will do
}
public boolean isEmpty()
{
return _dyaLine == 0 && _fMultiLinespace == 0;

+ 86
- 77
src/scratchpad/src/org/apache/poi/hwpf/usermodel/Paragraph.java View File

@@ -19,6 +19,7 @@ package org.apache.poi.hwpf.usermodel;

import java.util.NoSuchElementException;

import org.apache.poi.common.Duplicatable;
import org.apache.poi.hwpf.HWPFDocumentCore;
import org.apache.poi.hwpf.model.LFO;
import org.apache.poi.hwpf.model.ListLevel;
@@ -31,67 +32,68 @@ import org.apache.poi.hwpf.sprm.TableSprmCompressor;
import org.apache.poi.util.Internal;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;

public class Paragraph extends Range implements Cloneable {
private final static POILogger log = POILogFactory.getLogger( Paragraph.class );

public final static short SPRM_JC = 0x2403;
public final static short SPRM_FSIDEBYSIDE = 0x2404;
public final static short SPRM_FKEEP = 0x2405;
public final static short SPRM_FKEEPFOLLOW = 0x2406;
public final static short SPRM_FPAGEBREAKBEFORE = 0x2407;
public final static short SPRM_BRCL = 0x2408;
public final static short SPRM_BRCP = 0x2409;
public final static short SPRM_ILVL = 0x260A;
public final static short SPRM_ILFO = 0x460B;
public final static short SPRM_FNOLINENUMB = 0x240C;
public final static short SPRM_CHGTABSPAPX = (short)0xC60D;
public final static short SPRM_DXARIGHT = (short)0x840E;
public final static short SPRM_DXALEFT = (short)0x840F;
public final static short SPRM_DXALEFT1 = (short)0x8411;
public final static short SPRM_DYALINE = 0x6412;
public final static short SPRM_DYABEFORE = (short)0xA413;
public final static short SPRM_DYAAFTER = (short)0xA414;
public final static short SPRM_CHGTABS = (short)0xC615;
public final static short SPRM_FINTABLE = 0x2416;
public final static short SPRM_FTTP = 0x2417;
public final static short SPRM_DXAABS = (short)0x8418;
public final static short SPRM_DYAABS = (short)0x8419;
public final static short SPRM_DXAWIDTH = (short)0x841A;
public final static short SPRM_PC = 0x261B;
public final static short SPRM_WR = 0x2423;
public final static short SPRM_BRCTOP = 0x6424;
public final static short SPRM_BRCLEFT = 0x6425;
public final static short SPRM_BRCBOTTOM = 0x6426;
public final static short SPRM_BRCRIGHT = 0x6427;
public final static short SPRM_BRCBAR = 0x6629;
public final static short SPRM_FNOAUTOHYPH = 0x242A;
public final static short SPRM_WHEIGHTABS = 0x442B;
public final static short SPRM_DCS = 0x442C;
public final static short SPRM_SHD80 = 0x442D;
public final static short SPRM_SHD = (short)0xC64D;
public final static short SPRM_DYAFROMTEXT = (short)0x842E;
public final static short SPRM_DXAFROMTEXT = (short)0x842F;
public final static short SPRM_FLOCKED = 0x2430;
public final static short SPRM_FWIDOWCONTROL = 0x2431;
public final static short SPRM_RULER = (short)0xC632;
public final static short SPRM_FKINSOKU = 0x2433;
public final static short SPRM_FWORDWRAP = 0x2434;
public final static short SPRM_FOVERFLOWPUNCT = 0x2435;
public final static short SPRM_FTOPLINEPUNCT = 0x2436;
public final static short SPRM_AUTOSPACEDE = 0x2437;
public final static short SPRM_AUTOSPACEDN = 0x2438;
public final static short SPRM_WALIGNFONT = 0x4439;
public final static short SPRM_FRAMETEXTFLOW = 0x443A;
public final static short SPRM_ANLD = (short)0xC63E;
public final static short SPRM_PROPRMARK = (short)0xC63F;
public final static short SPRM_OUTLVL = 0x2640;
public final static short SPRM_FBIDI = 0x2441;
public final static short SPRM_FNUMRMLNS = 0x2443;
public final static short SPRM_CRLF = 0x2444;
public final static short SPRM_NUMRM = (short)0xC645;
public final static short SPRM_USEPGSUSETTINGS = 0x2447;
public final static short SPRM_FADJUSTRIGHT = 0x2448;
import org.apache.poi.util.Removal;

public class Paragraph extends Range implements Duplicatable {
private static final POILogger log = POILogFactory.getLogger( Paragraph.class );

public static final short SPRM_JC = 0x2403;
public static final short SPRM_FSIDEBYSIDE = 0x2404;
public static final short SPRM_FKEEP = 0x2405;
public static final short SPRM_FKEEPFOLLOW = 0x2406;
public static final short SPRM_FPAGEBREAKBEFORE = 0x2407;
public static final short SPRM_BRCL = 0x2408;
public static final short SPRM_BRCP = 0x2409;
public static final short SPRM_ILVL = 0x260A;
public static final short SPRM_ILFO = 0x460B;
public static final short SPRM_FNOLINENUMB = 0x240C;
public static final short SPRM_CHGTABSPAPX = (short)0xC60D;
public static final short SPRM_DXARIGHT = (short)0x840E;
public static final short SPRM_DXALEFT = (short)0x840F;
public static final short SPRM_DXALEFT1 = (short)0x8411;
public static final short SPRM_DYALINE = 0x6412;
public static final short SPRM_DYABEFORE = (short)0xA413;
public static final short SPRM_DYAAFTER = (short)0xA414;
public static final short SPRM_CHGTABS = (short)0xC615;
public static final short SPRM_FINTABLE = 0x2416;
public static final short SPRM_FTTP = 0x2417;
public static final short SPRM_DXAABS = (short)0x8418;
public static final short SPRM_DYAABS = (short)0x8419;
public static final short SPRM_DXAWIDTH = (short)0x841A;
public static final short SPRM_PC = 0x261B;
public static final short SPRM_WR = 0x2423;
public static final short SPRM_BRCTOP = 0x6424;
public static final short SPRM_BRCLEFT = 0x6425;
public static final short SPRM_BRCBOTTOM = 0x6426;
public static final short SPRM_BRCRIGHT = 0x6427;
public static final short SPRM_BRCBAR = 0x6629;
public static final short SPRM_FNOAUTOHYPH = 0x242A;
public static final short SPRM_WHEIGHTABS = 0x442B;
public static final short SPRM_DCS = 0x442C;
public static final short SPRM_SHD80 = 0x442D;
public static final short SPRM_SHD = (short)0xC64D;
public static final short SPRM_DYAFROMTEXT = (short)0x842E;
public static final short SPRM_DXAFROMTEXT = (short)0x842F;
public static final short SPRM_FLOCKED = 0x2430;
public static final short SPRM_FWIDOWCONTROL = 0x2431;
public static final short SPRM_RULER = (short)0xC632;
public static final short SPRM_FKINSOKU = 0x2433;
public static final short SPRM_FWORDWRAP = 0x2434;
public static final short SPRM_FOVERFLOWPUNCT = 0x2435;
public static final short SPRM_FTOPLINEPUNCT = 0x2436;
public static final short SPRM_AUTOSPACEDE = 0x2437;
public static final short SPRM_AUTOSPACEDN = 0x2438;
public static final short SPRM_WALIGNFONT = 0x4439;
public static final short SPRM_FRAMETEXTFLOW = 0x443A;
public static final short SPRM_ANLD = (short)0xC63E;
public static final short SPRM_PROPRMARK = (short)0xC63F;
public static final short SPRM_OUTLVL = 0x2640;
public static final short SPRM_FBIDI = 0x2441;
public static final short SPRM_FNUMRMLNS = 0x2443;
public static final short SPRM_CRLF = 0x2444;
public static final short SPRM_NUMRM = (short)0xC645;
public static final short SPRM_USEPGSUSETTINGS = 0x2447;
public static final short SPRM_FADJUSTRIGHT = 0x2448;

@Internal
public static Paragraph newParagraph( Range parent, PAPX papx )
@@ -169,11 +171,18 @@ public class Paragraph extends Range implements Cloneable {
_istd = papx.getIstd();
}

Paragraph(Paragraph other) {
super(other);
_istd = other._istd;
_props = (other._props == null) ? null : other._props.copy();
_papx = (other._papx == null) ? null : other._papx.copy();
}

/**
* Returns the index of the style which applies to this
* Paragraph. Details of the style can be looked up
* from the {@link StyleSheet}, via
* {@link StyleSheet#getStyleDescription(int)}
* {@link StyleSheet#getStyleDescription(int)}
*/
public short getStyleIndex()
{
@@ -540,7 +549,7 @@ public class Paragraph extends Range implements Cloneable {
/**
* Returns number of tabs stops defined for paragraph. Must be >= 0 and <=
* 64.
*
*
* @return number of tabs stops defined for paragraph. Must be >= 0 and <=
* 64
*/
@@ -551,7 +560,7 @@ public class Paragraph extends Range implements Cloneable {

/**
* Returns array of positions of itbdMac tab stops
*
*
* @return array of positions of itbdMac tab stops
*/
public int[] getTabStopsPositions()
@@ -576,24 +585,24 @@ public class Paragraph extends Range implements Cloneable {

/**
* Clone the ParagraphProperties object associated with this
* Paragraph, so that you can apply the same properties to
* Paragraph, so that you can apply the same properties to
* another Paragraph.
*/
public ParagraphProperties cloneProperties() {
try {
return (ParagraphProperties)_props.clone();
} catch (Exception e) {
throw new RuntimeException(e);
}
return _props.copy();
}

public Object clone() throws CloneNotSupportedException
{
Paragraph p = (Paragraph)super.clone();
p._props = (ParagraphProperties)_props.clone();
//p._baseStyle = _baseStyle;
p._papx = new SprmBuffer(0);
return p;
@Override
@SuppressWarnings("squid:S2975")
@Deprecated
@Removal(version = "5.0.0")
public Paragraph clone() {
return copy();
}

@Override
public Paragraph copy() {
return new Paragraph(this);
}

private short getFrameTextFlow()

+ 30
- 28
src/scratchpad/src/org/apache/poi/hwpf/usermodel/ParagraphProperties.java View File

@@ -17,35 +17,36 @@

package org.apache.poi.hwpf.usermodel;

import org.apache.poi.common.Duplicatable;
import org.apache.poi.hwpf.model.types.PAPAbstractType;
import org.apache.poi.util.Removal;

public final class ParagraphProperties extends PAPAbstractType implements
Cloneable
{
@SuppressWarnings("unused")
public final class ParagraphProperties extends PAPAbstractType implements Duplicatable {

private boolean jcLogical;

public ParagraphProperties()
{
setAnld( new byte[84] );
setPhe( new byte[12] );
public ParagraphProperties() {
setAnld(new byte[84]);
setPhe(new byte[12]);
}

public Object clone() throws CloneNotSupportedException
{
ParagraphProperties pp = (ParagraphProperties) super.clone();
pp.setAnld( getAnld().clone() );
pp.setBrcTop( (BorderCode) getBrcTop().clone() );
pp.setBrcLeft( (BorderCode) getBrcLeft().clone() );
pp.setBrcBottom( (BorderCode) getBrcBottom().clone() );
pp.setBrcRight( (BorderCode) getBrcRight().clone() );
pp.setBrcBetween( (BorderCode) getBrcBetween().clone() );
pp.setBrcBar( (BorderCode) getBrcBar().clone() );
pp.setDcs( getDcs().clone() );
pp.setLspd( (LineSpacingDescriptor) getLspd().clone() );
pp.setShd( getShd().clone() );
pp.setPhe( getPhe().clone() );
return pp;
public ParagraphProperties(ParagraphProperties other) {
super(other);
jcLogical = other.jcLogical;
}

@Override
@SuppressWarnings({"squid:S2975", "MethodDoesntCallSuperMethod"})
@Deprecated
@Removal(version = "5.0.0")
public ParagraphProperties clone() {
return copy();
}

@Override
public ParagraphProperties copy() {
return new ParagraphProperties(this);
}

public BorderCode getBarBorder()
@@ -92,12 +93,12 @@ public final class ParagraphProperties extends PAPAbstractType implements

switch ( getJc() )
{
case 0:
return 2;
case 2:
return 0;
default:
return getJc();
case 0:
return 2;
case 2:
return 0;
default:
return getJc();
}
}

@@ -332,3 +333,4 @@ public final class ParagraphProperties extends PAPAbstractType implements
}

}


+ 48
- 34
src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java View File

@@ -17,6 +17,8 @@

package org.apache.poi.hwpf.usermodel;

import static java.util.stream.Collectors.toList;

import java.util.List;

import org.apache.poi.hwpf.HWPFDocument;
@@ -47,49 +49,47 @@ import org.apache.poi.util.POILogger;
* Ranges are only valid if there hasn't been an insert in a prior Range since
* the Range's creation. Once an element (text, paragraph, etc.) has been
* inserted into a Range, subsequent Ranges become unstable.
*
* @author Ryan Ackley
*/
public class Range { // TODO -instantiable superclass
public class Range {

private static final POILogger logger = POILogFactory.getLogger( Range.class );

private POILogger logger = POILogFactory.getLogger( Range.class );
/**
* @deprecated POI 3.8 beta 5
*/
@Deprecated
public static final int TYPE_PARAGRAPH = 0;
/**
* @deprecated POI 3.8 beta 5
*/
@Deprecated
public static final int TYPE_CHARACTER = 1;
/**
* @deprecated POI 3.8 beta 5
*/
@Deprecated
public static final int TYPE_SECTION = 2;
/**
* @deprecated POI 3.8 beta 5
*/
@Deprecated
public static final int TYPE_TEXT = 3;
/**
* @deprecated POI 3.8 beta 5
*/
@Deprecated
public static final int TYPE_LISTENTRY = 4;
/**
* @deprecated POI 3.8 beta 5
*/
@Deprecated
public static final int TYPE_TABLE = 5;
/**
* @deprecated POI 3.8 beta 5
*/
@@ -145,18 +145,15 @@ public class Range { // TODO -instantiable superclass
protected int _charEnd;

protected StringBuilder _text;
/**
* Used to construct a Range from a document. This is generally used to
* create a Range that spans the whole document, or at least one whole part
* of the document (eg main text, header, comment)
*
* @param start
* Starting character offset of the range.
* @param end
* Ending character offset of the range.
* @param doc
* The HWPFDocument the range is based on.
* @param start Starting character offset of the range.
* @param end Ending character offset of the range.
* @param doc The HWPFDocument the range is based on.
*/
public Range(int start, int end, HWPFDocumentCore doc) {
_start = start;
@@ -174,12 +171,9 @@ public class Range { // TODO -instantiable superclass
/**
* Used to create Ranges that are children of other Ranges.
*
* @param start
* Starting character offset of the range.
* @param end
* Ending character offset of the range.
* @param parent
* The parent this range belongs to.
* @param start Starting character offset of the range.
* @param end Ending character offset of the range.
* @param parent The parent this range belongs to.
*/
protected Range(int start, int end, Range parent) {
_start = start;
@@ -195,6 +189,26 @@ public class Range { // TODO -instantiable superclass
sanityCheck();
}

protected Range(Range other) {
_parent = other._parent;
_start = other._start;
_end = other._end;
_doc = other._doc;
_sectionRangeFound = other._sectionRangeFound;
_sections = (other._sections == null) ? null : other._sections.stream().map(SEPX::copy).collect(toList());
_sectionStart = other._sectionStart;
_sectionEnd = other._sectionEnd;
_parRangeFound = other._parRangeFound;
_paragraphs = (other._paragraphs == null) ? null : other._paragraphs.stream().map(PAPX::copy).collect(toList());
_parStart = other._parStart;
_parEnd = other._parEnd;
_charRangeFound = other._charRangeFound;
_characters = (other._characters == null) ? null : other._characters.stream().map(CHPX::copy).collect(toList());
_charStart = other._charStart;
_charEnd = other._charEnd;
_text = (other._text == null) ? null : new StringBuilder(other._text);
}


/**
* Ensures that the start and end were were given are actually valid, to
@@ -305,7 +319,7 @@ public class Range { // TODO -instantiable superclass

/**
* Inserts text into the front of this range.
*
*
* @param text
* The text to insert
* @return The character run that text was inserted into.
@@ -335,7 +349,7 @@ public class Range { // TODO -instantiable superclass

/**
* Inserts text onto the end of this range
*
*
* @param text
* The text to insert
* @return The character run the text was inserted into.
@@ -569,7 +583,7 @@ public class Range { // TODO -instantiable superclass

/**
* Inserts a simple table into the beginning of this range.
*
*
* @param columns
* The number of columns
* @param rows
@@ -582,7 +596,7 @@ public class Range { // TODO -instantiable superclass
parProps.setItap( 1 );

final int oldEnd = this._end;
for ( int x = 0; x < rows; x++ )
{
Paragraph cell = this.insertBefore( parProps, StyleSheet.NIL_STYLE );
@@ -602,11 +616,11 @@ public class Range { // TODO -instantiable superclass

return new Table( _start, _start + diff, this, 1 );
}
/**
* Replace range text with new one, adding it to the range and deleting
* original text from document
*
*
* @param newText
* The text to be replaced with
* @param addAfter
@@ -941,7 +955,7 @@ public class Range { // TODO -instantiable superclass

/**
* Used to find the list indexes of a particular property.
*
*
* @param rpl
* A list of property nodes.
* @param start
@@ -988,7 +1002,7 @@ public class Range { // TODO -instantiable superclass
*/
private int[] findRange(List<? extends PropertyNode<?>> rpl, int min, int start, int end) {
int x = min;
if ( rpl.size() == min )
return new int[] { min, min };

@@ -1043,9 +1057,9 @@ public class Range { // TODO -instantiable superclass
/**
* Adjust the value of the various FIB character count fields, eg
* <code>FIB.CCPText</code> after an insert or a delete...
*
*
* Works on all CCP fields from this range onwards
*
*
* @param adjustment
* The (signed) value that should be added to the FIB CCP fields
*/

+ 31
- 21
src/scratchpad/src/org/apache/poi/hwpf/usermodel/Section.java View File

@@ -17,17 +17,21 @@

package org.apache.poi.hwpf.usermodel;

import org.apache.poi.common.Duplicatable;
import org.apache.poi.hwpf.HWPFOldDocument;
import org.apache.poi.hwpf.model.SEPX;
import org.apache.poi.util.Removal;

public final class Section extends Range
{
private SectionProperties _props;
public final class Section extends Range implements Duplicatable {
private final SectionProperties _props;

public Section( SEPX sepx, Range parent )
{
super( Math.max( parent._start, sepx.getStart() ), Math.min(
parent._end, sepx.getEnd() ), parent );
public Section(Section other) {
super(other);
_props = other._props.copy();
}

public Section( SEPX sepx, Range parent ) {
super( Math.max( parent._start, sepx.getStart() ), Math.min(parent._end, sepx.getEnd() ), parent );

// XXX: temporary workaround for old Word95 document
if ( parent.getDocument() instanceof HWPFOldDocument )
@@ -36,11 +40,17 @@ public final class Section extends Range
_props = sepx.getSectionProperties();
}

public Object clone() throws CloneNotSupportedException
{
Section s = (Section) super.clone();
s._props = (SectionProperties) _props.clone();
return s;
@Override
@SuppressWarnings({"squid:S2975", "MethodDoesntCallSuperMethod"})
@Deprecated
@Removal(version = "5.0.0")
public Section clone() {
return copy();
}

@Override
public Section copy() {
return new Section(this);
}

/**
@@ -99,7 +109,7 @@ public final class Section extends Range
* Set the height of the bottom margin in twips. In the AbstractWordUtils class, a constant
* is defined that indicates how many twips there are per inch and it can be used in setting
* the margins width a little like this;
*
*
* section.setMarginBottom( (int) 1.5 * AbstractWordUtils.TWIPS_PER_INCH );
*
* @param marginWidth A primitive int whose value will indciate how high the margin should
@@ -114,7 +124,7 @@ public final class Section extends Range
* Set the width of the left hand margin in twips. In the AbstractWordUtils class, a constant
* is defined that indicates how many twips there are per inch and it can be used in setting
* the margins width a little like this;
*
*
* section.setMarginLeft( (int) 1.5 * AbstractWordUtils.TWIPS_PER_INCH );
*
* @param marginWidth A primitive int whose value will indciate how high the margin should
@@ -129,7 +139,7 @@ public final class Section extends Range
* Set the width of the right hand margin in twips. In the AbstractWordUtils class, a constant
* is defined that indicates how many twips there are per inch and it can be used in setting
* the margins width a little like this;
*
*
* section.setMarginRight( (int) 1.5 * AbstractWordUtils.TWIPS_PER_INCH );
*
* @param marginWidth A primitive int whose value will indciate how high the margin should
@@ -144,7 +154,7 @@ public final class Section extends Range
* Set the height of the top margin in twips. In the AbstractWordUtils class, a constant
* is defined that indicates how many twips there are per inch and it can be used in setting
* the margins width a little like this;
*
*
* section.setMarginTop( (int) 1.5 * AbstractWordUtils.TWIPS_PER_INCH );
*
* @param marginWidth A primitive int whose value will indciate how high the margin should
@@ -181,7 +191,7 @@ public final class Section extends Range
public int getFootnoteNumberingOffset() {
return _props.getNFtn();
}
/**
* Get the numbering format of embedded footnotes
*
@@ -192,7 +202,7 @@ public final class Section extends Range
public int getFootnoteNumberingFormat() {
return _props.getNfcFtnRef();
}
/**
* Get the endnote restart qualifier
*
@@ -203,18 +213,18 @@ public final class Section extends Range
* </dl>
*
* @return an Rnc, as decribed above, specifying when and where endnote numbering restarts
*/
*/
public short getEndnoteRestartQualifier() {
return _props.getRncEdn();
}
/**
* @return an offset to be added to endnote numbers
*/
public int getEndnoteNumberingOffset() {
return _props.getNEdn();
}
/**
* Get the numbering format of embedded endnotes
*

+ 49
- 38
src/scratchpad/src/org/apache/poi/hwpf/usermodel/SectionProperties.java View File

@@ -17,20 +17,22 @@

package org.apache.poi.hwpf.usermodel;

import org.apache.poi.common.Duplicatable;
import org.apache.poi.hwpf.model.types.SEPAbstractType;
import org.apache.poi.util.Removal;

public final class SectionProperties extends SEPAbstractType implements Cloneable
{
public final class SectionProperties extends SEPAbstractType implements Duplicatable {
private short field_60_rncftn;
private short field_61_rncedn;
private int field_62_nftn;
// initialize with default value; msonfcArabic
@SuppressWarnings("RedundantFieldInitialization")
private int field_63_nfcftnref = 0x00; // initialize with default value; msonfcArabic
private int field_63_nfcftnref = 0x00;
private int field_64_nedn;
private int field_65_nfcednref = 0x02; // initialize with default value; msonfcLCRoman
// initialize with default value; msonfcLCRoman
private int field_65_nfcednref = 0x02;

public SectionProperties()
{
public SectionProperties() {
field_20_brcTop = new BorderCode();
field_21_brcLeft = new BorderCode();
field_22_brcBottom = new BorderCode();
@@ -38,29 +40,38 @@ public final class SectionProperties extends SEPAbstractType implements Cloneabl
field_26_dttmPropRMark = new DateAndTime();
}

public SectionProperties(SectionProperties other) {
super(other);
field_60_rncftn = other.field_60_rncftn;
field_61_rncedn = other.field_61_rncedn;
field_62_nftn = other.field_62_nftn;
field_63_nfcftnref = other.field_63_nfcftnref;
field_64_nedn = other.field_64_nedn;
field_65_nfcednref = other.field_65_nfcednref;
}

@Override
@SuppressWarnings("squid:S2975")
@Deprecated
@Removal(version = "5.0.0")
public SectionProperties clone() {
return copy();
}

@Override
public Object clone() throws CloneNotSupportedException
{
SectionProperties copy = (SectionProperties) super.clone();
copy.field_20_brcTop = (BorderCode) field_20_brcTop.clone();
copy.field_21_brcLeft = (BorderCode) field_21_brcLeft.clone();
copy.field_22_brcBottom = (BorderCode) field_22_brcBottom.clone();
copy.field_23_brcRight = (BorderCode) field_23_brcRight.clone();
copy.field_26_dttmPropRMark = (DateAndTime) field_26_dttmPropRMark
.clone();

return copy;
}
public SectionProperties copy() {
return new SectionProperties(this);
}

/**
* sprmSRncFtn, [MS-DOC], 20140721, 2.6.4
*
*
* @param field_60_rncftn unsigned 8-bit integer specifying the footnote numbering restart condition
*/
public void setRncFtn(final short field_60_rncftn) {
this.field_60_rncftn = field_60_rncftn;
}

/**
* @see #setRncFtn(short)
* @return an Rnc value specifying when and where footnote numbering restarts
@@ -68,16 +79,16 @@ public final class SectionProperties extends SEPAbstractType implements Cloneabl
public short getRncFtn() {
return this.field_60_rncftn;
}
/**
* sprmSRncEdn, [MS-DOC], 20140721, 2.6.4
*
*
* @param field_61_rncedn unsigned 8-bit integer specifying the endnote numbering restart condition
*/
public void setRncEdn(final short field_61_rncedn) {
this.field_61_rncedn = field_61_rncedn;
}
/**
* @see #setRncEdn(short)
* @return an Rnc value specifying when and where endnote numbering restarts
@@ -85,16 +96,16 @@ public final class SectionProperties extends SEPAbstractType implements Cloneabl
public short getRncEdn() {
return this.field_61_rncedn;
}
/**
* sprmSNftn, [MS-DOC], v20140721, 2.6.4
*
*
* @param field_62_nftn a number specifying the offset to add to footnote numbers
*/
public void setNFtn(final int field_62_nftn) {
this.field_62_nftn = field_62_nftn;
}
/**
* @see #setNFtn(int)
* @return a 16-bit integer specifying the offset to add to footnote numbering
@@ -102,34 +113,34 @@ public final class SectionProperties extends SEPAbstractType implements Cloneabl
public int getNFtn() {
return this.field_62_nftn;
}
/**
* sprmSNfcFtnRef, [MS-DOC], v20140721
*
*
* @param field_63_nfcftnref an Nfc specifying the numbering format for footnotes
*/
public void setNfcFtnRef(final int field_63_nfcftnref) {
this.field_63_nfcftnref = field_63_nfcftnref;
}
/**
*
*
* @see #setNfcFtnRef(int)
* @return a 16-bit integer with an Nfc specifying the numbering format for footnotes
*/
public int getNfcFtnRef() {
return this.field_63_nfcftnref;
}
/**
* sprmSNEdn, [MS-DOC], v20140721, 2.6.4
*
*
* @param field_64_nedn a number specifying the offset to add to footnote numbers
*/
public void setNEdn(final int field_64_nedn) {
this.field_64_nedn = field_64_nedn;
}
/**
* @see #setNEdn(int)
* @return a 16-bit integer specifying the offset to add to endnote numbering
@@ -137,18 +148,18 @@ public final class SectionProperties extends SEPAbstractType implements Cloneabl
public int getNEdn() {
return this.field_64_nedn;
}
/**
* sprmSNfcEdnRef, [MS-DOC], v20140721
*
*
* @param field_65_nfcednref an Nfc specifying the numbering format for endnotes
*/
public void setNfcEdnRef(final int field_65_nfcednref) {
this.field_65_nfcednref = field_65_nfcednref;
}
/**
*
*
* @see #setNfcEdnRef(int)
* @return a 16-bit integer with an Nfc specifying the numbering format for endnotes
*/

+ 19
- 13
src/scratchpad/src/org/apache/poi/hwpf/usermodel/ShadingDescriptor.java View File

@@ -17,30 +17,36 @@

package org.apache.poi.hwpf.usermodel;

import org.apache.poi.common.Duplicatable;
import org.apache.poi.hwpf.model.types.SHDAbstractType;
import org.apache.poi.util.Removal;

/**
* The SHD is a substructure of the CHP, PAP, and TC for Word 2000.
*
* @author vlsergey
*/
public final class ShadingDescriptor extends SHDAbstractType implements
Cloneable
{
public final class ShadingDescriptor extends SHDAbstractType implements Duplicatable {

public ShadingDescriptor()
{
public ShadingDescriptor() {}

public ShadingDescriptor(ShadingDescriptor other) {
super(other);
}

public ShadingDescriptor( byte[] buf, int offset )
{
super();
public ShadingDescriptor( byte[] buf, int offset ) {
fillFields( buf, offset );
}

public ShadingDescriptor clone() throws CloneNotSupportedException
{
return (ShadingDescriptor) super.clone();
@Override
@SuppressWarnings("squid:S2975")
@Deprecated
@Removal(version = "5.0.0")
public ShadingDescriptor clone() {
return copy();
}

@Override
public ShadingDescriptor copy() {
return new ShadingDescriptor(this);
}

public boolean isEmpty()

+ 21
- 15
src/scratchpad/src/org/apache/poi/hwpf/usermodel/ShadingDescriptor80.java View File

@@ -17,36 +17,42 @@

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.SHD80AbstractType;
import org.apache.poi.util.Removal;

/**
* The SHD80 is a substructure of the CHP and PAP, and TC for Word 97.
*/
public final class ShadingDescriptor80 extends SHD80AbstractType implements
Cloneable
{
@SuppressWarnings("unused")
public final class ShadingDescriptor80 extends SHD80AbstractType implements Duplicatable {

public ShadingDescriptor80()
{
public ShadingDescriptor80() {}

public ShadingDescriptor80(ShadingDescriptor80 other) {
super(other);
}

public ShadingDescriptor80( byte[] buf, int offset )
{
super();
public ShadingDescriptor80( byte[] buf, int offset ) {
fillFields( buf, offset );
}

public ShadingDescriptor80( short value )
{
super();
public ShadingDescriptor80( short value ) {
field_1_value = value;
}

public ShadingDescriptor80 clone() throws CloneNotSupportedException
{
return (ShadingDescriptor80) super.clone();
@Override
@SuppressWarnings({"squid:S2975", "MethodDoesntCallSuperMethod"})
@Deprecated
@Removal(version = "5.0.0")
public ShadingDescriptor80 clone() {
return copy();
}

@Override
public ShadingDescriptor80 copy() {
return new ShadingDescriptor80(this);
}

public boolean isEmpty()

+ 18
- 19
src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableAutoformatLookSpecifier.java View File

@@ -18,35 +18,34 @@ package org.apache.poi.hwpf.usermodel;

import java.util.Objects;

import org.apache.poi.common.Duplicatable;
import org.apache.poi.hwpf.model.types.TLPAbstractType;
import org.apache.poi.util.Removal;

public class TableAutoformatLookSpecifier extends TLPAbstractType implements
Cloneable
{
public class TableAutoformatLookSpecifier extends TLPAbstractType implements Duplicatable {
public static final int SIZE = 4;

public TableAutoformatLookSpecifier()
{
super();
public TableAutoformatLookSpecifier() {}

public TableAutoformatLookSpecifier(TableAutoformatLookSpecifier other) {
super(other);
}

public TableAutoformatLookSpecifier( byte[] data, int offset )
{
super();
public TableAutoformatLookSpecifier( byte[] data, int offset ) {
fillFields( data, offset );
}

@Override
public TableAutoformatLookSpecifier clone()
{
try
{
return (TableAutoformatLookSpecifier) super.clone();
}
catch ( CloneNotSupportedException e )
{
throw new Error( e.getMessage(), e );
}
@SuppressWarnings({"squid:S2975", "MethodDoesntCallSuperMethod"})
@Deprecated
@Removal(version = "5.0.0")
public TableAutoformatLookSpecifier clone() {
return copy();
}
@Override
public TableAutoformatLookSpecifier copy() {
return new TableAutoformatLookSpecifier(this);
}

@Override

+ 18
- 15
src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableCellDescriptor.java View File

@@ -17,16 +17,18 @@

package org.apache.poi.hwpf.usermodel;

import org.apache.poi.common.Duplicatable;
import org.apache.poi.hwpf.model.types.TCAbstractType;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.Removal;

public final class TableCellDescriptor extends TCAbstractType implements
Cloneable
{
public final class TableCellDescriptor extends TCAbstractType implements Duplicatable {
public static final int SIZE = 20;

public TableCellDescriptor()
{
public TableCellDescriptor() {}

public TableCellDescriptor(TableCellDescriptor other) {
super(other);
}

protected void fillFields(byte[] data, int offset)
@@ -49,16 +51,17 @@ public final class TableCellDescriptor extends TCAbstractType implements
getBrcRight().serialize(data, 0x10 + offset);
}

public Object clone()
throws CloneNotSupportedException
{
TableCellDescriptor tc = (TableCellDescriptor)super.clone();
tc.setShd( getShd().clone() );
tc.setBrcTop((BorderCode)getBrcTop().clone());
tc.setBrcLeft((BorderCode)getBrcLeft().clone());
tc.setBrcBottom((BorderCode)getBrcBottom().clone());
tc.setBrcRight((BorderCode)getBrcRight().clone());
return tc;
@Override
@SuppressWarnings({"squid:S2975", "MethodDoesntCallSuperMethod"})
@Deprecated
@Removal(version = "5.0.0")
public TableCellDescriptor clone() {
return copy();
}

@Override
public TableCellDescriptor copy() {
return new TableCellDescriptor(this);
}

public static TableCellDescriptor convertBytesToTC(byte[] buf, int offset)

+ 34
- 57
src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableProperties.java View File

@@ -17,33 +17,34 @@

package org.apache.poi.hwpf.usermodel;

import org.apache.poi.common.Duplicatable;
import org.apache.poi.hwpf.model.types.TAPAbstractType;

public final class TableProperties extends TAPAbstractType implements Cloneable
{

public TableProperties()
{
setTlp( new TableAutoformatLookSpecifier() );
setShdTable( new ShadingDescriptor() );
setBrcBottom( new BorderCode() );
setBrcHorizontal( new BorderCode() );
setBrcLeft( new BorderCode() );
setBrcRight( new BorderCode() );
setBrcTop( new BorderCode() );
setBrcVertical( new BorderCode() );
setRgbrcInsideDefault_0( new BorderCode() );
setRgbrcInsideDefault_1( new BorderCode() );
setRgdxaCenter( new short[0] );
setRgdxaCenterPrint( new short[0] );
setRgshd( new ShadingDescriptor[0] );
setRgtc( new TableCellDescriptor[0] );
import org.apache.poi.util.Removal;

public final class TableProperties extends TAPAbstractType implements Duplicatable {

public TableProperties() {
setTlp(new TableAutoformatLookSpecifier());
setShdTable(new ShadingDescriptor());
setBrcBottom(new BorderCode());
setBrcHorizontal(new BorderCode());
setBrcLeft(new BorderCode());
setBrcRight(new BorderCode());
setBrcTop(new BorderCode());
setBrcVertical(new BorderCode());
setRgbrcInsideDefault_0(new BorderCode());
setRgbrcInsideDefault_1(new BorderCode());
setRgdxaCenter(new short[0]);
setRgdxaCenterPrint(new short[0]);
setRgshd(new ShadingDescriptor[0]);
setRgtc(new TableCellDescriptor[0]);
}

public TableProperties( short columns )
{
this();
public TableProperties(TableProperties other) {
super(other);
}

public TableProperties( short columns ) {
setItcMac( columns );
setRgshd( new ShadingDescriptor[columns] );

@@ -63,40 +64,16 @@ public final class TableProperties extends TAPAbstractType implements Cloneable
setRgdxaCenterPrint( new short[columns] );
}

public Object clone() throws CloneNotSupportedException
{
TableProperties tap = (TableProperties) super.clone();

tap.setTlp( getTlp().clone() );
tap.setRgshd( new ShadingDescriptor[getRgshd().length] );
for ( int x = 0; x < getRgshd().length; x++ )
{
tap.getRgshd()[x] = getRgshd()[x].clone();
}

tap.setBrcBottom( (BorderCode) getBrcBottom().clone() );
tap.setBrcHorizontal( (BorderCode) getBrcHorizontal().clone() );
tap.setBrcLeft( (BorderCode) getBrcLeft().clone() );
tap.setBrcRight( (BorderCode) getBrcRight().clone() );
tap.setBrcTop( (BorderCode) getBrcTop().clone() );
tap.setBrcVertical( (BorderCode) getBrcVertical().clone() );

tap.setShdTable( getShdTable().clone() );

tap.setRgbrcInsideDefault_0( (BorderCode) getRgbrcInsideDefault_0()
.clone() );
tap.setRgbrcInsideDefault_1( (BorderCode) getRgbrcInsideDefault_1()
.clone() );

tap.setRgdxaCenter( getRgdxaCenter().clone() );
tap.setRgdxaCenterPrint( getRgdxaCenterPrint().clone() );

tap.setRgtc( new TableCellDescriptor[getRgtc().length] );
for ( int x = 0; x < getRgtc().length; x++ )
{
tap.getRgtc()[x] = (TableCellDescriptor) getRgtc()[x].clone();
}
return tap;
@Override
@SuppressWarnings({"squid:S2975", "MethodDoesntCallSuperMethod"})
@Deprecated
@Removal(version = "5.0.0")
public TableProperties clone() {
return copy();
}

@Override
public TableProperties copy() {
return new TableProperties(this);
}
}

Loading…
Cancel
Save