be aware of PAP properties from lists, but don't forget that PAPX has priority over them

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1173841 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-09-21 20:42:04 +00:00
parent 766b2256cf
commit 52e5eb21e1
11 changed files with 557 additions and 240 deletions

View File

@ -23,6 +23,7 @@ import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -31,8 +32,6 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.poi.hwpf.model.StyleDescription;
import org.apache.poi.POIDocument; import org.apache.poi.POIDocument;
import org.apache.poi.hwpf.HWPFDocument; import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.HWPFDocumentCore; import org.apache.poi.hwpf.HWPFDocumentCore;
@ -42,9 +41,13 @@ import org.apache.poi.hwpf.model.CHPX;
import org.apache.poi.hwpf.model.FieldsDocumentPart; import org.apache.poi.hwpf.model.FieldsDocumentPart;
import org.apache.poi.hwpf.model.FileInformationBlock; import org.apache.poi.hwpf.model.FileInformationBlock;
import org.apache.poi.hwpf.model.GenericPropertyNode; import org.apache.poi.hwpf.model.GenericPropertyNode;
import org.apache.poi.hwpf.model.ListFormatOverride;
import org.apache.poi.hwpf.model.ListLevel;
import org.apache.poi.hwpf.model.ListTables;
import org.apache.poi.hwpf.model.PAPFormattedDiskPage; import org.apache.poi.hwpf.model.PAPFormattedDiskPage;
import org.apache.poi.hwpf.model.PAPX; import org.apache.poi.hwpf.model.PAPX;
import org.apache.poi.hwpf.model.PlexOfCps; import org.apache.poi.hwpf.model.PlexOfCps;
import org.apache.poi.hwpf.model.StyleDescription;
import org.apache.poi.hwpf.model.StyleSheet; import org.apache.poi.hwpf.model.StyleSheet;
import org.apache.poi.hwpf.model.TextPiece; import org.apache.poi.hwpf.model.TextPiece;
import org.apache.poi.hwpf.sprm.SprmIterator; import org.apache.poi.hwpf.sprm.SprmIterator;
@ -54,6 +57,7 @@ import org.apache.poi.hwpf.usermodel.Bookmarks;
import org.apache.poi.hwpf.usermodel.Field; import org.apache.poi.hwpf.usermodel.Field;
import org.apache.poi.hwpf.usermodel.OfficeDrawing; import org.apache.poi.hwpf.usermodel.OfficeDrawing;
import org.apache.poi.hwpf.usermodel.Paragraph; import org.apache.poi.hwpf.usermodel.Paragraph;
import org.apache.poi.hwpf.usermodel.ParagraphProperties;
import org.apache.poi.hwpf.usermodel.Picture; import org.apache.poi.hwpf.usermodel.Picture;
import org.apache.poi.hwpf.usermodel.Range; import org.apache.poi.hwpf.usermodel.Range;
import org.apache.poi.poifs.common.POIFSConstants; import org.apache.poi.poifs.common.POIFSConstants;
@ -560,11 +564,7 @@ public final class HWPFLister
{ {
SprmIterator sprmIt = new SprmIterator( SprmIterator sprmIt = new SprmIterator(
papx.getGrpprl(), 2 ); papx.getGrpprl(), 2 );
while ( sprmIt.hasNext() ) dumpSprms( sprmIt, "*** " );
{
SprmOperation sprm = sprmIt.next();
System.out.println( "*** " + sprm.toString() );
}
} }
} }
@ -578,31 +578,33 @@ public final class HWPFLister
if ( papx != null && withSprms ) if ( papx != null && withSprms )
{ {
SprmIterator sprmIt = new SprmIterator( papx.getGrpprl(), 2 ); SprmIterator sprmIt = new SprmIterator( papx.getGrpprl(), 2 );
while ( sprmIt.hasNext() ) dumpSprms( sprmIt, "*** " );
{
SprmOperation sprm = sprmIt.next();
System.out.println( "*** " + sprm.toString() );
}
} }
} }
} }
Method newParagraph = Paragraph.class.getDeclaredMethod(
"newParagraph", Range.class, PAPX.class );
newParagraph.setAccessible( true );
java.lang.reflect.Field _props = Paragraph.class
.getDeclaredField( "_props" );
_props.setAccessible( true );
for ( PAPX papx : _doc.getParagraphTable().getParagraphs() ) for ( PAPX papx : _doc.getParagraphTable().getParagraphs() )
{ {
System.out.println( papx ); System.out.println( papx );
if ( withProperties ) if ( withProperties )
System.out.println( papx.getParagraphProperties( _doc {
.getStyleSheet() ) ); Paragraph paragraph = (Paragraph) newParagraph.invoke( null,
_doc.getOverallRange(), papx );
System.out.println( _props.get( paragraph ) );
}
if ( true ) if ( true )
{ {
SprmIterator sprmIt = new SprmIterator( papx.getGrpprl(), 2 ); SprmIterator sprmIt = new SprmIterator( papx.getGrpprl(), 2 );
while ( sprmIt.hasNext() ) dumpSprms( sprmIt, "\t" );
{
SprmOperation sprm = sprmIt.next();
System.out.println( "\t" + sprm.toString() );
}
} }
} }
} }
@ -629,11 +631,7 @@ public final class HWPFLister
SprmIterator sprmIt = new SprmIterator( SprmIterator sprmIt = new SprmIterator(
papx.getGrpprl(), 2 ); papx.getGrpprl(), 2 );
while ( sprmIt.hasNext() ) dumpSprms( sprmIt, "** " );
{
SprmOperation sprm = sprmIt.next();
System.out.println( "** " + sprm.toString() );
}
} }
} }
if ( !hasAssotiatedPapx ) if ( !hasAssotiatedPapx )
@ -645,6 +643,15 @@ public final class HWPFLister
} }
} }
protected void dumpSprms( SprmIterator sprmIt, String linePrefix )
{
while ( sprmIt.hasNext() )
{
SprmOperation sprm = sprmIt.next();
System.out.println( linePrefix + sprm.toString() );
}
}
public void dumpParagraphsDom( boolean withText ) public void dumpParagraphsDom( boolean withText )
{ {
Range range = _doc.getOverallRange(); Range range = _doc.getOverallRange();
@ -682,6 +689,8 @@ public final class HWPFLister
return; return;
} }
HWPFDocument hwpfDocument = (HWPFDocument) _doc; HWPFDocument hwpfDocument = (HWPFDocument) _doc;
ListTables listTables = hwpfDocument.getListTables();
for ( int s = 0; s < hwpfDocument.getStyleSheet().numStyles(); s++ ) for ( int s = 0; s < hwpfDocument.getStyleSheet().numStyles(); s++ )
{ {
StyleDescription styleDescription = hwpfDocument.getStyleSheet() StyleDescription styleDescription = hwpfDocument.getStyleSheet()
@ -692,11 +701,47 @@ public final class HWPFLister
System.out.println( "=== Style #" + s + " '" System.out.println( "=== Style #" + s + " '"
+ styleDescription.getName() + "' ===" ); + styleDescription.getName() + "' ===" );
System.out.println( styleDescription ); System.out.println( styleDescription );
System.out.println( "PAP:" + styleDescription.getPAP() );
ParagraphProperties paragraph = styleDescription.getPAP();
System.out.println( "PAP: " + paragraph );
if ( paragraph != null )
{
dumpParagraphLevels( listTables, paragraph );
}
System.out.println( "CHP: " + styleDescription.getCHP() ); System.out.println( "CHP: " + styleDescription.getCHP() );
} }
} }
protected void dumpParagraphLevels( ListTables listTables,
ParagraphProperties paragraph )
{
if ( paragraph.getIlfo() != 0 )
{
final ListFormatOverride listFormatOverride = listTables
.getOverride( paragraph.getIlfo() );
System.out.println( "PAP's LFO: " + listFormatOverride );
final ListLevel listLevel = listTables.getLevel(
listFormatOverride.getLsid(), paragraph.getIlvl() );
System.out.println( "PAP's ListLevel: " + listLevel );
if ( listLevel.getGrpprlPapx() != null )
{
System.out.println( "PAP's ListLevel PAPX:" );
dumpSprms( new SprmIterator( listLevel.getGrpprlPapx(), 0 ),
"* " );
}
if ( listLevel.getGrpprlPapx() != null )
{
System.out.println( "PAP's ListLevel CHPX:" );
dumpSprms( new SprmIterator( listLevel.getGrpprlChpx(), 0 ),
"* " );
}
}
}
public void dumpTextPieces( boolean withText ) public void dumpTextPieces( boolean withText )
{ {
for ( TextPiece textPiece : _doc.getTextTable().getTextPieces() ) for ( TextPiece textPiece : _doc.getTextTable().getTextPieces() )

View File

@ -0,0 +1,85 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hwpf.model;
import org.apache.poi.util.Internal;
import org.apache.poi.hwpf.model.types.LFOAbstractType;
/**
* "The LFO structure specifies the LSTF element that corresponds to a list that
* contains a paragraph. An LFO can also specify formatting information that
* overrides the LSTF element to which it corresponds." -- [MS-DOC] -- v20110315
* Word (.doc) Binary File Format
*
* @author Sergey Vladimirov (vlsergey {at} gmail {dot} com)
*/
@Internal
class LFO extends LFOAbstractType
{
public LFO()
{
}
public LFO( byte[] std, int offset )
{
fillFields( std, offset );
}
@Override
public boolean equals( Object obj )
{
if ( this == obj )
return true;
if ( obj == null )
return false;
if ( getClass() != obj.getClass() )
return false;
LFO other = (LFO) obj;
if ( field_1_lsid != other.field_1_lsid )
return false;
if ( field_2_reserved1 != other.field_2_reserved1 )
return false;
if ( field_3_reserved2 != other.field_3_reserved2 )
return false;
if ( field_4_clfolvl != other.field_4_clfolvl )
return false;
if ( field_5_ibstFltAutoNum != other.field_5_ibstFltAutoNum )
return false;
if ( field_6_grfhic != other.field_6_grfhic )
return false;
if ( field_7_reserved3 != other.field_7_reserved3 )
return false;
return true;
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + field_1_lsid;
result = prime * result + field_2_reserved1;
result = prime * result + field_3_reserved2;
result = prime * result + field_4_clfolvl;
result = prime * result + field_5_ibstFltAutoNum;
result = prime * result + field_6_grfhic;
result = prime * result + field_7_reserved3;
return result;
}
}

View File

@ -17,24 +17,26 @@
package org.apache.poi.hwpf.model; package org.apache.poi.hwpf.model;
import org.apache.poi.hwpf.model.types.LFOAbstractType;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
@Internal @Internal
public final class ListFormatOverride extends LFOAbstractType public final class ListFormatOverride
{ {
private ListFormatOverrideLevel[] _levelOverrides; private ListFormatOverrideLevel[] _levelOverrides;
private LFO _lfo;
public ListFormatOverride( byte[] buf, int offset ) public ListFormatOverride( byte[] buf, int offset )
{ {
fillFields( buf, offset ); _lfo = new LFO( buf, offset );
_levelOverrides = new ListFormatOverrideLevel[_lfo.getClfolvl()];
_levelOverrides = new ListFormatOverrideLevel[getClfolvl()];
} }
public ListFormatOverride( int lsid ) public ListFormatOverride( int lsid )
{ {
setLsid( lsid ); _lfo = new LFO();
_lfo.setLsid( lsid );
_levelOverrides = new ListFormatOverrideLevel[0]; _levelOverrides = new ListFormatOverrideLevel[0];
} }
@ -43,6 +45,11 @@ public final class ListFormatOverride extends LFOAbstractType
return _levelOverrides; return _levelOverrides;
} }
public int getLsid()
{
return _lfo.getLsid();
}
public ListFormatOverrideLevel getOverrideLevel( int level ) public ListFormatOverrideLevel getOverrideLevel( int level )
{ {
@ -60,7 +67,12 @@ public final class ListFormatOverride extends LFOAbstractType
public int numOverrides() public int numOverrides()
{ {
return getClfolvl(); return _lfo.getClfolvl();
}
public void setLsid( int lsid )
{
_lfo.setLsid( lsid );
} }
public void setOverride( int index, ListFormatOverrideLevel lfolvl ) public void setOverride( int index, ListFormatOverrideLevel lfolvl )
@ -70,8 +82,6 @@ public final class ListFormatOverride extends LFOAbstractType
public byte[] toByteArray() public byte[] toByteArray()
{ {
byte[] bs = new byte[getSize()]; return _lfo.serialize();
serialize( bs, 0 );
return bs;
} }
} }

View File

@ -33,25 +33,9 @@ import org.apache.poi.util.LittleEndian;
@Internal @Internal
public final class ListLevel public final class ListLevel
{ {
// private int _iStartAt;
// private byte _nfc;
// private byte _info;
// /* */private static BitField _jc;
// /* */private static BitField _fLegal;
// /* */private static BitField _fNoRestart;
// /* */private static BitField _fPrev;
// /* */private static BitField _fPrevSpace;
// /* */private static BitField _fWord6;
// private byte[] _rgbxchNums;
// private byte _ixchFollow;
// private int _dxaSpace;
// private int _dxaIndent;
// private int _cbGrpprlChpx;
// private int _cbGrpprlPapx;
// private short _reserved;
private LVLF _lvlf;
private byte[] _grpprlPapx;
private byte[] _grpprlChpx; private byte[] _grpprlChpx;
private byte[] _grpprlPapx;
private LVLF _lvlf;
private char[] _numberText = null; private char[] _numberText = null;
public ListLevel( final byte[] buf, final int originalOffset ) public ListLevel( final byte[] buf, final int originalOffset )
@ -136,6 +120,16 @@ public final class ListLevel
return _lvlf.getJc(); return _lvlf.getJc();
} }
public byte[] getGrpprlChpx()
{
return _grpprlChpx;
}
public byte[] getGrpprlPapx()
{
return _grpprlPapx;
}
public byte[] getLevelProperties() public byte[] getLevelProperties()
{ {
return _grpprlPapx; return _grpprlPapx;
@ -245,4 +239,12 @@ public final class ListLevel
return buf; return buf;
} }
@Override
public String toString()
{
return "ListLevel: " + ( "\n" + _lvlf ).replaceAll( "\n", "\n " )
+ "\n"
+ ( "PAPX's grpprl: " + Arrays.toString( _grpprlPapx ) + "\n" )
+ ( "CHPX's grpprl: " + Arrays.toString( _grpprlChpx ) + "\n" );
}
} }

View File

@ -134,6 +134,8 @@ public final class PAPX extends BytePropertyNode<PAPX> {
return (SprmBuffer)_buf; return (SprmBuffer)_buf;
} }
@Deprecated
@Internal
public ParagraphProperties getParagraphProperties(StyleSheet ss) public ParagraphProperties getParagraphProperties(StyleSheet ss)
{ {
if(ss == null) { if(ss == null) {

View File

@ -20,8 +20,6 @@ package org.apache.poi.hwpf.model;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.Arrays; import java.util.Arrays;
import org.apache.poi.hwpf.sprm.SprmIterator;
import org.apache.poi.hwpf.usermodel.CharacterProperties; import org.apache.poi.hwpf.usermodel.CharacterProperties;
import org.apache.poi.hwpf.usermodel.ParagraphProperties; import org.apache.poi.hwpf.usermodel.ParagraphProperties;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
@ -51,7 +49,9 @@ public final class StyleDescription implements HDFType
UPX[] _upxs; UPX[] _upxs;
String _name; String _name;
@Deprecated
ParagraphProperties _pap; ParagraphProperties _pap;
@Deprecated
CharacterProperties _chp; CharacterProperties _chp;
public StyleDescription() public StyleDescription()
@ -173,18 +173,22 @@ public final class StyleDescription implements HDFType
return null; return null;
} }
} }
@Deprecated
public ParagraphProperties getPAP() public ParagraphProperties getPAP()
{ {
return _pap; return _pap;
} }
@Deprecated
public CharacterProperties getCHP() public CharacterProperties getCHP()
{ {
return _chp; return _chp;
} }
@Deprecated
void setPAP(ParagraphProperties pap) void setPAP(ParagraphProperties pap)
{ {
_pap = pap; _pap = pap;
} }
@Deprecated
void setCHP(CharacterProperties chp) void setCHP(CharacterProperties chp)
{ {
_chp = chp; _chp = chp;

View File

@ -47,10 +47,14 @@ public final class StyleSheet implements HDFType {
private static final int SEP_TYPE = 4; private static final int SEP_TYPE = 4;
private static final int TAP_TYPE = 5; private static final int TAP_TYPE = 5;
@Deprecated
private final static ParagraphProperties NIL_PAP = new ParagraphProperties(); private final static ParagraphProperties NIL_PAP = new ParagraphProperties();
@Deprecated
private final static CharacterProperties NIL_CHP = new CharacterProperties(); private final static CharacterProperties NIL_CHP = new CharacterProperties();
private final static byte[] NIL_CHPX = new byte[] {};
private final static byte[] NIL_PAPX = new byte[] {0, 0};
/** /**
* Size of the STSHI structure * Size of the STSHI structure
*/ */
@ -205,6 +209,7 @@ public final class StyleSheet implements HDFType {
* @param istd The index of the StyleDescription to create the * @param istd The index of the StyleDescription to create the
* ParagraphProperties from (and also place the finished PAP in) * ParagraphProperties from (and also place the finished PAP in)
*/ */
@Deprecated
private void createPap(int istd) private void createPap(int istd)
{ {
StyleDescription sd = _styleDescriptions[istd]; StyleDescription sd = _styleDescriptions[istd];
@ -248,6 +253,7 @@ public final class StyleSheet implements HDFType {
* @param istd The index of the StyleDescription to create the * @param istd The index of the StyleDescription to create the
* CharacterProperties object from. * CharacterProperties object from.
*/ */
@Deprecated
private void createChp(int istd) private void createChp(int istd)
{ {
StyleDescription sd = _styleDescriptions[istd]; StyleDescription sd = _styleDescriptions[istd];
@ -295,45 +301,104 @@ public final class StyleSheet implements HDFType {
/** /**
* Gets the StyleDescription at index x. * Gets the StyleDescription at index x.
* *
* @param x the index of the desired StyleDescription. * @param styleIndex
* the index of the desired StyleDescription.
*/ */
public StyleDescription getStyleDescription(int x) public StyleDescription getStyleDescription( int styleIndex )
{ {
return _styleDescriptions[x]; return _styleDescriptions[styleIndex];
} }
public CharacterProperties getCharacterStyle(int x) @Deprecated
public CharacterProperties getCharacterStyle( int styleIndex )
{ {
if (x == NIL_STYLE) if ( styleIndex == NIL_STYLE )
{ {
return NIL_CHP; return NIL_CHP;
} }
if (x>=_styleDescriptions.length) { if ( styleIndex >= _styleDescriptions.length )
{
return NIL_CHP; return NIL_CHP;
} }
return (_styleDescriptions[x] != null ? _styleDescriptions[x].getCHP() : NIL_CHP); return ( _styleDescriptions[styleIndex] != null ? _styleDescriptions[styleIndex]
.getCHP() : NIL_CHP );
} }
public ParagraphProperties getParagraphStyle(int x) @Deprecated
public ParagraphProperties getParagraphStyle( int styleIndex )
{
if ( styleIndex == NIL_STYLE )
{ {
if (x == NIL_STYLE) {
return NIL_PAP; return NIL_PAP;
} }
if (x >= _styleDescriptions.length) { if ( styleIndex >= _styleDescriptions.length )
{
return NIL_PAP; return NIL_PAP;
} }
if (_styleDescriptions[x]==null) { if ( _styleDescriptions[styleIndex] == null )
{
return NIL_PAP; return NIL_PAP;
} }
if (_styleDescriptions[x].getPAP()==null) { if ( _styleDescriptions[styleIndex].getPAP() == null )
{
return NIL_PAP; return NIL_PAP;
} }
return _styleDescriptions[x].getPAP(); return _styleDescriptions[styleIndex].getPAP();
}
public byte[] getCHPX( int styleIndex )
{
if ( styleIndex == NIL_STYLE )
{
return NIL_CHPX;
}
if ( styleIndex >= _styleDescriptions.length )
{
return NIL_CHPX;
}
if ( _styleDescriptions[styleIndex] == null )
{
return NIL_CHPX;
}
if ( _styleDescriptions[styleIndex].getCHPX() == null )
{
return NIL_CHPX;
}
return _styleDescriptions[styleIndex].getCHPX();
}
public byte[] getPAPX( int styleIndex )
{
if ( styleIndex == NIL_STYLE )
{
return NIL_PAPX;
}
if ( styleIndex >= _styleDescriptions.length )
{
return NIL_PAPX;
}
if ( _styleDescriptions[styleIndex] == null )
{
return NIL_PAPX;
}
if ( _styleDescriptions[styleIndex].getPAPX() == null )
{
return NIL_PAPX;
}
return _styleDescriptions[styleIndex].getPAPX();
} }
} }

View File

@ -21,16 +21,19 @@ import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
/** /**
* List Format Override (LFO). * List Format Override (LFO). <p>Class and fields descriptions are quoted from
Microsoft Office Word 97-2007 Binary File Format
* <p> * <p>
* Class and fields descriptions are quoted from Microsoft Office Word 97-2007 * NOTE: This source is automatically generated please do not modify this file. Either subclass or
* Binary File Format * remove the record in src/types/definitions.
* * <p>
* NOTE: This source is automatically generated please do not modify this file. * This class is internal. It content or properties may change without notice
* Either subclass or remove the record in src/types/definitions. * due to changes in our knowledge of internal Microsoft Word binary structures.
*
* @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary * @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary File Format
* File Format Specification [*.doc] Specification [*.doc]
*/ */
@Internal @Internal
public abstract class LFOAbstractType public abstract class LFOAbstractType
@ -42,16 +45,14 @@ public abstract class LFOAbstractType
protected byte field_4_clfolvl; protected byte field_4_clfolvl;
protected byte field_5_ibstFltAutoNum; protected byte field_5_ibstFltAutoNum;
protected byte field_6_grfhic; protected byte field_6_grfhic;
/**/private static BitField fHtmlChecked = new BitField( 0x01 ); /**/private static final BitField fHtmlChecked = new BitField(0x01);
/**/private static BitField fHtmlUnsupported = new BitField( 0x02 ); /**/private static final BitField fHtmlUnsupported = new BitField(0x02);
/**/private static BitField fHtmlListTextNotSharpDot = new BitField( 0x04 ); /**/private static final BitField fHtmlListTextNotSharpDot = new BitField(0x04);
/**/private static BitField fHtmlNotPeriod = new BitField( 0x08 ); /**/private static final BitField fHtmlNotPeriod = new BitField(0x08);
/**/private static BitField fHtmlFirstLineMismatch = new BitField( 0x10 ); /**/private static final BitField fHtmlFirstLineMismatch = new BitField(0x10);
/**/private static BitField fHtmlTabLeftIndentMismatch = new BitField( /**/private static final BitField fHtmlTabLeftIndentMismatch = new BitField(0x20);
0x20 ); /**/private static final BitField fHtmlHangingIndentBeneathNumber = new BitField(0x40);
/**/private static BitField fHtmlHangingIndentBeneathNumber = new BitField( /**/private static final BitField fHtmlBuiltInBullet = new BitField(0x80);
0x40 );
/**/private static BitField fHtmlBuiltInBullet = new BitField( 0x80 );
protected byte field_7_reserved3; protected byte field_7_reserved3;
protected LFOAbstractType() protected LFOAbstractType()
@ -80,6 +81,13 @@ public abstract class LFOAbstractType
data[ 0xf + offset ] = field_7_reserved3; data[ 0xf + offset ] = field_7_reserved3;
} }
public byte[] serialize()
{
final byte[] result = new byte[ getSize() ];
serialize( result, 0 );
return result;
}
/** /**
* Size of record * Size of record
*/ */
@ -104,22 +112,14 @@ public abstract class LFOAbstractType
builder.append(" (").append(getIbstFltAutoNum()).append(" )\n"); builder.append(" (").append(getIbstFltAutoNum()).append(" )\n");
builder.append(" .grfhic = "); builder.append(" .grfhic = ");
builder.append(" (").append(getGrfhic()).append(" )\n"); builder.append(" (").append(getGrfhic()).append(" )\n");
builder.append( " .fHtmlChecked = " ) builder.append(" .fHtmlChecked = ").append(isFHtmlChecked()).append('\n');
.append( isFHtmlChecked() ).append( '\n' ); builder.append(" .fHtmlUnsupported = ").append(isFHtmlUnsupported()).append('\n');
builder.append( " .fHtmlUnsupported = " ) builder.append(" .fHtmlListTextNotSharpDot = ").append(isFHtmlListTextNotSharpDot()).append('\n');
.append( isFHtmlUnsupported() ).append( '\n' ); builder.append(" .fHtmlNotPeriod = ").append(isFHtmlNotPeriod()).append('\n');
builder.append( " .fHtmlListTextNotSharpDot = " ) builder.append(" .fHtmlFirstLineMismatch = ").append(isFHtmlFirstLineMismatch()).append('\n');
.append( isFHtmlListTextNotSharpDot() ).append( '\n' ); builder.append(" .fHtmlTabLeftIndentMismatch = ").append(isFHtmlTabLeftIndentMismatch()).append('\n');
builder.append( " .fHtmlNotPeriod = " ) builder.append(" .fHtmlHangingIndentBeneathNumber = ").append(isFHtmlHangingIndentBeneathNumber()).append('\n');
.append( isFHtmlNotPeriod() ).append( '\n' ); builder.append(" .fHtmlBuiltInBullet = ").append(isFHtmlBuiltInBullet()).append('\n');
builder.append( " .fHtmlFirstLineMismatch = " )
.append( isFHtmlFirstLineMismatch() ).append( '\n' );
builder.append( " .fHtmlTabLeftIndentMismatch = " )
.append( isFHtmlTabLeftIndentMismatch() ).append( '\n' );
builder.append( " .fHtmlHangingIndentBeneathNumber = " )
.append( isFHtmlHangingIndentBeneathNumber() ).append( '\n' );
builder.append( " .fHtmlBuiltInBullet = " )
.append( isFHtmlBuiltInBullet() ).append( '\n' );
builder.append(" .reserved3 = "); builder.append(" .reserved3 = ");
builder.append(" (").append(getReserved3()).append(" )\n"); builder.append(" (").append(getReserved3()).append(" )\n");
@ -130,6 +130,7 @@ public abstract class LFOAbstractType
/** /**
* List ID of corresponding LSTF (see LSTF). * List ID of corresponding LSTF (see LSTF).
*/ */
@Internal
public int getLsid() public int getLsid()
{ {
return field_1_lsid; return field_1_lsid;
@ -138,6 +139,7 @@ public abstract class LFOAbstractType
/** /**
* List ID of corresponding LSTF (see LSTF). * List ID of corresponding LSTF (see LSTF).
*/ */
@Internal
public void setLsid( int field_1_lsid ) public void setLsid( int field_1_lsid )
{ {
this.field_1_lsid = field_1_lsid; this.field_1_lsid = field_1_lsid;
@ -146,6 +148,7 @@ public abstract class LFOAbstractType
/** /**
* Reserved. * Reserved.
*/ */
@Internal
public int getReserved1() public int getReserved1()
{ {
return field_2_reserved1; return field_2_reserved1;
@ -154,6 +157,7 @@ public abstract class LFOAbstractType
/** /**
* Reserved. * Reserved.
*/ */
@Internal
public void setReserved1( int field_2_reserved1 ) public void setReserved1( int field_2_reserved1 )
{ {
this.field_2_reserved1 = field_2_reserved1; this.field_2_reserved1 = field_2_reserved1;
@ -162,6 +166,7 @@ public abstract class LFOAbstractType
/** /**
* Reserved. * Reserved.
*/ */
@Internal
public int getReserved2() public int getReserved2()
{ {
return field_3_reserved2; return field_3_reserved2;
@ -170,6 +175,7 @@ public abstract class LFOAbstractType
/** /**
* Reserved. * Reserved.
*/ */
@Internal
public void setReserved2( int field_3_reserved2 ) public void setReserved2( int field_3_reserved2 )
{ {
this.field_3_reserved2 = field_3_reserved2; this.field_3_reserved2 = field_3_reserved2;
@ -178,6 +184,7 @@ public abstract class LFOAbstractType
/** /**
* Count of levels whose format is overridden (see LFOLVL). * Count of levels whose format is overridden (see LFOLVL).
*/ */
@Internal
public byte getClfolvl() public byte getClfolvl()
{ {
return field_4_clfolvl; return field_4_clfolvl;
@ -186,6 +193,7 @@ public abstract class LFOAbstractType
/** /**
* Count of levels whose format is overridden (see LFOLVL). * Count of levels whose format is overridden (see LFOLVL).
*/ */
@Internal
public void setClfolvl( byte field_4_clfolvl ) public void setClfolvl( byte field_4_clfolvl )
{ {
this.field_4_clfolvl = field_4_clfolvl; this.field_4_clfolvl = field_4_clfolvl;
@ -194,6 +202,7 @@ public abstract class LFOAbstractType
/** /**
* Used for AUTONUM field emulation. * Used for AUTONUM field emulation.
*/ */
@Internal
public byte getIbstFltAutoNum() public byte getIbstFltAutoNum()
{ {
return field_5_ibstFltAutoNum; return field_5_ibstFltAutoNum;
@ -202,6 +211,7 @@ public abstract class LFOAbstractType
/** /**
* Used for AUTONUM field emulation. * Used for AUTONUM field emulation.
*/ */
@Internal
public void setIbstFltAutoNum( byte field_5_ibstFltAutoNum ) public void setIbstFltAutoNum( byte field_5_ibstFltAutoNum )
{ {
this.field_5_ibstFltAutoNum = field_5_ibstFltAutoNum; this.field_5_ibstFltAutoNum = field_5_ibstFltAutoNum;
@ -210,6 +220,7 @@ public abstract class LFOAbstractType
/** /**
* HTML compatibility flags. * HTML compatibility flags.
*/ */
@Internal
public byte getGrfhic() public byte getGrfhic()
{ {
return field_6_grfhic; return field_6_grfhic;
@ -218,6 +229,7 @@ public abstract class LFOAbstractType
/** /**
* HTML compatibility flags. * HTML compatibility flags.
*/ */
@Internal
public void setGrfhic( byte field_6_grfhic ) public void setGrfhic( byte field_6_grfhic )
{ {
this.field_6_grfhic = field_6_grfhic; this.field_6_grfhic = field_6_grfhic;
@ -226,6 +238,7 @@ public abstract class LFOAbstractType
/** /**
* Reserved. * Reserved.
*/ */
@Internal
public byte getReserved3() public byte getReserved3()
{ {
return field_7_reserved3; return field_7_reserved3;
@ -234,14 +247,17 @@ public abstract class LFOAbstractType
/** /**
* Reserved. * Reserved.
*/ */
@Internal
public void setReserved3( byte field_7_reserved3 ) public void setReserved3( byte field_7_reserved3 )
{ {
this.field_7_reserved3 = field_7_reserved3; this.field_7_reserved3 = field_7_reserved3;
} }
/** /**
* Sets the fHtmlChecked field value. Checked * Sets the fHtmlChecked field value.
* Checked
*/ */
@Internal
public void setFHtmlChecked( boolean value ) public void setFHtmlChecked( boolean value )
{ {
field_6_grfhic = (byte)fHtmlChecked.setBoolean(field_6_grfhic, value); field_6_grfhic = (byte)fHtmlChecked.setBoolean(field_6_grfhic, value);
@ -249,146 +265,149 @@ public abstract class LFOAbstractType
/** /**
* Checked * Checked
*
* @return the fHtmlChecked field value. * @return the fHtmlChecked field value.
*/ */
@Internal
public boolean isFHtmlChecked() public boolean isFHtmlChecked()
{ {
return fHtmlChecked.isSet(field_6_grfhic); return fHtmlChecked.isSet(field_6_grfhic);
} }
/** /**
* Sets the fHtmlUnsupported field value. The numbering sequence or format * Sets the fHtmlUnsupported field value.
* is unsupported (includes tab & size) * The numbering sequence or format is unsupported (includes tab & size)
*/ */
@Internal
public void setFHtmlUnsupported( boolean value ) public void setFHtmlUnsupported( boolean value )
{ {
field_6_grfhic = (byte) fHtmlUnsupported.setBoolean( field_6_grfhic, field_6_grfhic = (byte)fHtmlUnsupported.setBoolean(field_6_grfhic, value);
value );
} }
/** /**
* The numbering sequence or format is unsupported (includes tab & size) * The numbering sequence or format is unsupported (includes tab & size)
*
* @return the fHtmlUnsupported field value. * @return the fHtmlUnsupported field value.
*/ */
@Internal
public boolean isFHtmlUnsupported() public boolean isFHtmlUnsupported()
{ {
return fHtmlUnsupported.isSet(field_6_grfhic); return fHtmlUnsupported.isSet(field_6_grfhic);
} }
/** /**
* Sets the fHtmlListTextNotSharpDot field value. The list text is not "#." * Sets the fHtmlListTextNotSharpDot field value.
* The list text is not "#."
*/ */
@Internal
public void setFHtmlListTextNotSharpDot( boolean value ) public void setFHtmlListTextNotSharpDot( boolean value )
{ {
field_6_grfhic = (byte) fHtmlListTextNotSharpDot.setBoolean( field_6_grfhic = (byte)fHtmlListTextNotSharpDot.setBoolean(field_6_grfhic, value);
field_6_grfhic, value );
} }
/** /**
* The list text is not "#." * The list text is not "#."
*
* @return the fHtmlListTextNotSharpDot field value. * @return the fHtmlListTextNotSharpDot field value.
*/ */
@Internal
public boolean isFHtmlListTextNotSharpDot() public boolean isFHtmlListTextNotSharpDot()
{ {
return fHtmlListTextNotSharpDot.isSet(field_6_grfhic); return fHtmlListTextNotSharpDot.isSet(field_6_grfhic);
} }
/** /**
* Sets the fHtmlNotPeriod field value. Something other than a period is * Sets the fHtmlNotPeriod field value.
* used * Something other than a period is used
*/ */
@Internal
public void setFHtmlNotPeriod( boolean value ) public void setFHtmlNotPeriod( boolean value )
{ {
field_6_grfhic = (byte) fHtmlNotPeriod.setBoolean( field_6_grfhic, field_6_grfhic = (byte)fHtmlNotPeriod.setBoolean(field_6_grfhic, value);
value );
} }
/** /**
* Something other than a period is used * Something other than a period is used
*
* @return the fHtmlNotPeriod field value. * @return the fHtmlNotPeriod field value.
*/ */
@Internal
public boolean isFHtmlNotPeriod() public boolean isFHtmlNotPeriod()
{ {
return fHtmlNotPeriod.isSet(field_6_grfhic); return fHtmlNotPeriod.isSet(field_6_grfhic);
} }
/** /**
* Sets the fHtmlFirstLineMismatch field value. First line indent mismatch * Sets the fHtmlFirstLineMismatch field value.
* First line indent mismatch
*/ */
@Internal
public void setFHtmlFirstLineMismatch( boolean value ) public void setFHtmlFirstLineMismatch( boolean value )
{ {
field_6_grfhic = (byte) fHtmlFirstLineMismatch.setBoolean( field_6_grfhic = (byte)fHtmlFirstLineMismatch.setBoolean(field_6_grfhic, value);
field_6_grfhic, value );
} }
/** /**
* First line indent mismatch * First line indent mismatch
*
* @return the fHtmlFirstLineMismatch field value. * @return the fHtmlFirstLineMismatch field value.
*/ */
@Internal
public boolean isFHtmlFirstLineMismatch() public boolean isFHtmlFirstLineMismatch()
{ {
return fHtmlFirstLineMismatch.isSet(field_6_grfhic); return fHtmlFirstLineMismatch.isSet(field_6_grfhic);
} }
/** /**
* Sets the fHtmlTabLeftIndentMismatch field value. The list tab and the * Sets the fHtmlTabLeftIndentMismatch field value.
* dxaLeft don't match (need table?) * The list tab and the dxaLeft don't match (need table?)
*/ */
@Internal
public void setFHtmlTabLeftIndentMismatch( boolean value ) public void setFHtmlTabLeftIndentMismatch( boolean value )
{ {
field_6_grfhic = (byte) fHtmlTabLeftIndentMismatch.setBoolean( field_6_grfhic = (byte)fHtmlTabLeftIndentMismatch.setBoolean(field_6_grfhic, value);
field_6_grfhic, value );
} }
/** /**
* The list tab and the dxaLeft don't match (need table?) * The list tab and the dxaLeft don't match (need table?)
*
* @return the fHtmlTabLeftIndentMismatch field value. * @return the fHtmlTabLeftIndentMismatch field value.
*/ */
@Internal
public boolean isFHtmlTabLeftIndentMismatch() public boolean isFHtmlTabLeftIndentMismatch()
{ {
return fHtmlTabLeftIndentMismatch.isSet(field_6_grfhic); return fHtmlTabLeftIndentMismatch.isSet(field_6_grfhic);
} }
/** /**
* Sets the fHtmlHangingIndentBeneathNumber field value. The hanging indent * Sets the fHtmlHangingIndentBeneathNumber field value.
* falls beneath the number (need plain text) * The hanging indent falls beneath the number (need plain text)
*/ */
@Internal
public void setFHtmlHangingIndentBeneathNumber( boolean value ) public void setFHtmlHangingIndentBeneathNumber( boolean value )
{ {
field_6_grfhic = (byte) fHtmlHangingIndentBeneathNumber.setBoolean( field_6_grfhic = (byte)fHtmlHangingIndentBeneathNumber.setBoolean(field_6_grfhic, value);
field_6_grfhic, value );
} }
/** /**
* The hanging indent falls beneath the number (need plain text) * The hanging indent falls beneath the number (need plain text)
*
* @return the fHtmlHangingIndentBeneathNumber field value. * @return the fHtmlHangingIndentBeneathNumber field value.
*/ */
@Internal
public boolean isFHtmlHangingIndentBeneathNumber() public boolean isFHtmlHangingIndentBeneathNumber()
{ {
return fHtmlHangingIndentBeneathNumber.isSet(field_6_grfhic); return fHtmlHangingIndentBeneathNumber.isSet(field_6_grfhic);
} }
/** /**
* Sets the fHtmlBuiltInBullet field value. A built-in HTML bullet * Sets the fHtmlBuiltInBullet field value.
* A built-in HTML bullet
*/ */
@Internal
public void setFHtmlBuiltInBullet( boolean value ) public void setFHtmlBuiltInBullet( boolean value )
{ {
field_6_grfhic = (byte) fHtmlBuiltInBullet.setBoolean( field_6_grfhic, field_6_grfhic = (byte)fHtmlBuiltInBullet.setBoolean(field_6_grfhic, value);
value );
} }
/** /**
* A built-in HTML bullet * A built-in HTML bullet
*
* @return the fHtmlBuiltInBullet field value. * @return the fHtmlBuiltInBullet field value.
*/ */
@Internal
public boolean isFHtmlBuiltInBullet() public boolean isFHtmlBuiltInBullet()
{ {
return fHtmlBuiltInBullet.isSet(field_6_grfhic); return fHtmlBuiltInBullet.isSet(field_6_grfhic);

View File

@ -22,6 +22,7 @@ import org.apache.poi.hwpf.model.ListFormatOverrideLevel;
import org.apache.poi.hwpf.model.ListLevel; import org.apache.poi.hwpf.model.ListLevel;
import org.apache.poi.hwpf.model.ListTables; import org.apache.poi.hwpf.model.ListTables;
import org.apache.poi.hwpf.model.PAPX; import org.apache.poi.hwpf.model.PAPX;
import org.apache.poi.util.Internal;
import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger; import org.apache.poi.util.POILogger;
@ -33,6 +34,27 @@ public final class ListEntry
ListLevel _level; ListLevel _level;
ListFormatOverrideLevel _overrideLevel; ListFormatOverrideLevel _overrideLevel;
@Internal
ListEntry( PAPX papx, ParagraphProperties properties, Range parent )
{
super( papx, properties, parent );
final ListTables tables = parent._doc.getListTables();
if ( tables != null && _props.getIlfo() < tables.getOverrideCount() )
{
ListFormatOverride override = tables.getOverride( _props.getIlfo() );
_overrideLevel = override.getOverrideLevel( _props.getIlvl() );
_level = tables.getLevel( override.getLsid(), _props.getIlvl() );
}
else
{
log.log( POILogger.WARN,
"No ListTables found for ListEntry - document probably partly corrupt, "
+ "and you may experience problems" );
}
}
@Deprecated
ListEntry(PAPX papx, Range parent, ListTables tables) ListEntry(PAPX papx, Range parent, ListTables tables)
{ {
super(papx, parent); super(papx, parent);
@ -46,6 +68,7 @@ public final class ListEntry
} }
} }
@Deprecated
public int type() public int type()
{ {
return TYPE_LISTENTRY; return TYPE_LISTENTRY;

View File

@ -17,9 +17,17 @@
package org.apache.poi.hwpf.usermodel; package org.apache.poi.hwpf.usermodel;
import org.apache.poi.hwpf.HWPFDocumentCore;
import org.apache.poi.hwpf.model.ListFormatOverride;
import org.apache.poi.hwpf.model.ListLevel;
import org.apache.poi.hwpf.model.ListTables;
import org.apache.poi.hwpf.model.PAPX; import org.apache.poi.hwpf.model.PAPX;
import org.apache.poi.hwpf.model.StyleSheet;
import org.apache.poi.hwpf.sprm.ParagraphSprmUncompressor;
import org.apache.poi.hwpf.sprm.SprmBuffer; import org.apache.poi.hwpf.sprm.SprmBuffer;
import org.apache.poi.hwpf.sprm.TableSprmCompressor; import org.apache.poi.hwpf.sprm.TableSprmCompressor;
import org.apache.poi.util.Internal;
public class Paragraph extends Range implements Cloneable { public class Paragraph extends Range implements Cloneable {
public final static short SPRM_JC = 0x2403; public final static short SPRM_JC = 0x2403;
@ -80,11 +88,55 @@ public class Paragraph extends Range implements Cloneable {
public final static short SPRM_USEPGSUSETTINGS = 0x2447; public final static short SPRM_USEPGSUSETTINGS = 0x2447;
public final static short SPRM_FADJUSTRIGHT = 0x2448; public final static short SPRM_FADJUSTRIGHT = 0x2448;
@Internal
static Paragraph newParagraph( Range parent, PAPX papx )
{
HWPFDocumentCore doc = parent._doc;
ListTables listTables = doc.getListTables();
StyleSheet styleSheet = doc.getStyleSheet();
ParagraphProperties properties = new ParagraphProperties();
properties.setIstd( papx.getIstd() );
if ( styleSheet != null )
{
int style = papx.getIstd();
byte[] grpprl = styleSheet.getPAPX( style );
properties = ParagraphSprmUncompressor.uncompressPAP( properties,
grpprl, 2 );
}
properties = ParagraphSprmUncompressor.uncompressPAP( properties,
papx.getGrpprl(), 2 );
if ( properties.getIlfo() != 0 && listTables != null )
{
final ListFormatOverride listFormatOverride = listTables
.getOverride( properties.getIlfo() );
final ListLevel listLevel = listTables.getLevel(
listFormatOverride.getLsid(), properties.getIlvl() );
if ( listLevel.getGrpprlPapx() != null )
{
properties = ParagraphSprmUncompressor.uncompressPAP(
properties, listLevel.getGrpprlPapx(), 0 );
// reapply PAPX properties
properties = ParagraphSprmUncompressor.uncompressPAP(
properties, papx.getGrpprl(), 2 );
}
}
if ( properties.getIlfo() > 0 )
return new ListEntry( papx, properties, parent );
return new Paragraph( papx, properties, parent );
}
protected short _istd; protected short _istd;
protected ParagraphProperties _props; protected ParagraphProperties _props;
protected SprmBuffer _papx; protected SprmBuffer _papx;
@Deprecated
protected Paragraph( int startIdxInclusive, int endIdxExclusive, protected Paragraph( int startIdxInclusive, int endIdxExclusive,
Table parent ) Table parent )
{ {
@ -97,27 +149,42 @@ public class Paragraph extends Range implements Cloneable {
_istd = papx.getIstd(); _istd = papx.getIstd();
} }
@Deprecated
protected Paragraph( PAPX papx, Range parent ) protected Paragraph( PAPX papx, Range parent )
{ {
super(Math.max(parent._start, papx.getStart()), Math.min(parent._end, papx.getEnd()), parent); super( Math.max( parent._start, papx.getStart() ), Math.min(
parent._end, papx.getEnd() ), parent );
_props = papx.getParagraphProperties( _doc.getStyleSheet() ); _props = papx.getParagraphProperties( _doc.getStyleSheet() );
_papx = papx.getSprmBuf(); _papx = papx.getSprmBuf();
_istd = papx.getIstd(); _istd = papx.getIstd();
} }
@Deprecated
protected Paragraph( PAPX papx, Range parent, int start ) protected Paragraph( PAPX papx, Range parent, int start )
{ {
super(Math.max(parent._start, start), Math.min(parent._end, papx.getEnd()), parent); super( Math.max( parent._start, start ), Math.min( parent._end,
papx.getEnd() ), parent );
_props = papx.getParagraphProperties( _doc.getStyleSheet() ); _props = papx.getParagraphProperties( _doc.getStyleSheet() );
_papx = papx.getSprmBuf(); _papx = papx.getSprmBuf();
_istd = papx.getIstd(); _istd = papx.getIstd();
} }
@Internal
Paragraph( PAPX papx, ParagraphProperties properties, Range parent )
{
super( Math.max( parent._start, papx.getStart() ), Math.min(
parent._end, papx.getEnd() ), parent );
_props = properties;
_papx = papx.getSprmBuf();
_istd = papx.getIstd();
}
public short getStyleIndex() public short getStyleIndex()
{ {
return _istd; return _istd;
} }
@Deprecated
public int type() public int type()
{ {
return TYPE_PARAGRAPH; return TYPE_PARAGRAPH;

View File

@ -60,12 +60,19 @@ public class Range { // TODO -instantiable superclass
private POILogger logger = POILogFactory.getLogger( Range.class ); private POILogger logger = POILogFactory.getLogger( Range.class );
@Deprecated
public static final int TYPE_PARAGRAPH = 0; public static final int TYPE_PARAGRAPH = 0;
@Deprecated
public static final int TYPE_CHARACTER = 1; public static final int TYPE_CHARACTER = 1;
@Deprecated
public static final int TYPE_SECTION = 2; public static final int TYPE_SECTION = 2;
@Deprecated
public static final int TYPE_TEXT = 3; public static final int TYPE_TEXT = 3;
@Deprecated
public static final int TYPE_LISTENTRY = 4; public static final int TYPE_LISTENTRY = 4;
@Deprecated
public static final int TYPE_TABLE = 5; public static final int TYPE_TABLE = 5;
@Deprecated
public static final int TYPE_UNDEFINED = 6; public static final int TYPE_UNDEFINED = 6;
/** Needed so inserts and deletes will ripple up through containing Ranges */ /** Needed so inserts and deletes will ripple up through containing Ranges */
@ -880,20 +887,7 @@ public class Range { // TODO -instantiable superclass
+ "; " + _parEnd + ")" ); + "; " + _parEnd + ")" );
PAPX papx = _paragraphs.get(index + _parStart); PAPX papx = _paragraphs.get(index + _parStart);
return Paragraph.newParagraph( this, papx );
ParagraphProperties props = papx.getParagraphProperties(_doc.getStyleSheet());
Paragraph pap = null;
if (props.getIlfo() > 0) {
pap = new ListEntry(papx, this, _doc.getListTables());
} else {
if (((index + _parStart)==0) && papx.getStart()>0) {
pap = new Paragraph(papx, this, 0);
} else {
pap = new Paragraph(papx, this);
}
}
return pap;
} }
/** /**
@ -902,6 +896,7 @@ public class Range { // TODO -instantiable superclass
* *
* @return A TYPE constant. * @return A TYPE constant.
*/ */
@Deprecated
public int type() { public int type() {
return TYPE_UNDEFINED; return TYPE_UNDEFINED;
} }
@ -930,8 +925,8 @@ public class Range { // TODO -instantiable superclass
if ( r._parStart != 0 ) if ( r._parStart != 0 )
{ {
Paragraph previous = new Paragraph( Paragraph previous = Paragraph.newParagraph( this,
_paragraphs.get( r._parStart - 1 ), this ); _paragraphs.get( r._parStart - 1 ) );
if ( previous.isInTable() && // if ( previous.isInTable() && //
previous.getTableLevel() == tableLevel // previous.getTableLevel() == tableLevel //
&& previous._sectionEnd >= r._sectionStart ) && previous._sectionEnd >= r._sectionStart )
@ -945,8 +940,8 @@ public class Range { // TODO -instantiable superclass
int limit = _paragraphs.size(); int limit = _paragraphs.size();
for ( ; tableEndInclusive < limit - 1; tableEndInclusive++ ) for ( ; tableEndInclusive < limit - 1; tableEndInclusive++ )
{ {
Paragraph next = new Paragraph( Paragraph next = Paragraph.newParagraph( overallRange,
_paragraphs.get( tableEndInclusive + 1 ), overallRange ); _paragraphs.get( tableEndInclusive + 1 ) );
if ( !next.isInTable() || next.getTableLevel() < tableLevel ) if ( !next.isInTable() || next.getTableLevel() < tableLevel )
break; break;
} }