refactor list format override structures (was marked with @Internal annotation)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1389039 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3c200abd02
commit
dc4fd539e0
@ -346,12 +346,13 @@ public final class HWPFDocument extends HWPFDocumentCore
|
||||
_ss = new StyleSheet(_tableStream, _fib.getFcStshf());
|
||||
_ft = new FontTable(_tableStream, _fib.getFcSttbfffn(), _fib.getLcbSttbfffn());
|
||||
|
||||
int listOffset = _fib.getFcPlcfLst();
|
||||
int lfoOffset = _fib.getFcPlfLfo();
|
||||
if (listOffset != 0 && _fib.getLcbPlcfLst() != 0)
|
||||
{
|
||||
_lt = new ListTables(_tableStream, _fib.getFcPlcfLst(), _fib.getFcPlfLfo());
|
||||
}
|
||||
int listOffset = _fib.getFcPlfLst();
|
||||
int lfoOffset = _fib.getFcPlfLfo();
|
||||
if ( listOffset != 0 && _fib.getLcbPlfLst() != 0 )
|
||||
{
|
||||
_lt = new ListTables( _tableStream, listOffset, _fib.getFcPlfLfo(),
|
||||
_fib.getLcbPlfLfo() );
|
||||
}
|
||||
|
||||
int sbtOffset = _fib.getFcSttbSavedBy();
|
||||
int sbtLength = _fib.getLcbSttbSavedBy();
|
||||
@ -830,9 +831,7 @@ public final class HWPFDocument extends HWPFDocumentCore
|
||||
* Microsoft Office Word 97-2007 Binary File Format (.doc)
|
||||
* Specification; Page 26 of 210
|
||||
*/
|
||||
_fib.setFcPlfLfo( tableStream.getOffset() );
|
||||
_lt.writeListOverridesTo( tableStream );
|
||||
_fib.setLcbPlfLfo( tableStream.getOffset() - tableOffset );
|
||||
_lt.writeListOverridesTo( _fib, tableStream );
|
||||
tableOffset = tableStream.getOffset();
|
||||
}
|
||||
|
||||
@ -1024,14 +1023,15 @@ public final class HWPFDocument extends HWPFDocumentCore
|
||||
return _tableStream;
|
||||
}
|
||||
|
||||
public int registerList(HWPFList list)
|
||||
{
|
||||
if (_lt == null)
|
||||
public int registerList( HWPFList list )
|
||||
{
|
||||
_lt = new ListTables();
|
||||
if ( _lt == null )
|
||||
{
|
||||
_lt = new ListTables();
|
||||
}
|
||||
return _lt.addList( list.getListData(), list.getLFO(),
|
||||
list.getLFOData() );
|
||||
}
|
||||
return _lt.addList(list.getListData(), list.getOverride());
|
||||
}
|
||||
|
||||
public void delete(int start, int length)
|
||||
{
|
||||
|
@ -159,9 +159,10 @@ public final class ParagraphSprmUncompressor
|
||||
case 0xa:
|
||||
newPAP.setIlvl ((byte) sprm.getOperand());
|
||||
break;
|
||||
case 0xb:
|
||||
newPAP.setIlfo (sprm.getOperand());
|
||||
break;
|
||||
case 0xb:
|
||||
/* sprmPIlfo -- 0x460B */
|
||||
newPAP.setIlfo( sprm.getOperandShortSigned() );
|
||||
break;
|
||||
case 0xc:
|
||||
newPAP.setFNoLnn (sprm.getOperand() != 0);
|
||||
break;
|
||||
|
@ -134,6 +134,15 @@ public final class SprmOperation
|
||||
}
|
||||
}
|
||||
|
||||
public short getOperandShortSigned()
|
||||
{
|
||||
if ( getSizeCode() != 2 && getSizeCode() != 4 && getSizeCode() != 5 )
|
||||
throw new UnsupportedOperationException(
|
||||
"Current SPRM doesn't have signed short operand: " + this );
|
||||
|
||||
return LittleEndian.getShort( _grpprl, _gOffset );
|
||||
}
|
||||
|
||||
public int getOperation()
|
||||
{
|
||||
return BITFIELD_OP.getValue( _value );
|
||||
|
@ -35,4 +35,11 @@ public class TestWordToTextConverter extends TestCase
|
||||
assertTrue( foundText
|
||||
.contains( "Soak the rice in water for three to four hours" ) );
|
||||
}
|
||||
|
||||
public void testBug53380_3() throws Exception
|
||||
{
|
||||
HWPFDocument doc = HWPFTestDataSamples
|
||||
.openSampleFile( "Bug53380_3.doc" );
|
||||
WordToTextConverter.getText( doc );
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user