mirror of https://github.com/apache/poi.git
Sonar fixes - "static" base class members should not be accessed via derived types
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1876159 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
074d68fedf
commit
d842136464
|
@ -175,7 +175,7 @@ public final class HSSFClientAnchor extends HSSFAnchor implements ClientAnchor {
|
||||||
*/
|
*/
|
||||||
public void setRow1(int row1) {
|
public void setRow1(int row1) {
|
||||||
checkRange(row1, 0, MAX_ROW, "row1");
|
checkRange(row1, 0, MAX_ROW, "row1");
|
||||||
_escherClientAnchor.setRow1(Integer.valueOf(row1).shortValue());
|
_escherClientAnchor.setRow1((short)row1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -190,7 +190,7 @@ public final class HSSFClientAnchor extends HSSFAnchor implements ClientAnchor {
|
||||||
*/
|
*/
|
||||||
public void setRow2(int row2) {
|
public void setRow2(int row2) {
|
||||||
checkRange(row2, 0, MAX_ROW, "row2");
|
checkRange(row2, 0, MAX_ROW, "row2");
|
||||||
_escherClientAnchor.setRow2(Integer.valueOf(row2).shortValue());
|
_escherClientAnchor.setRow2((short)row2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -311,7 +311,7 @@ public final class HSSFClientAnchor extends HSSFAnchor implements ClientAnchor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDx1(int dx1) {
|
public void setDx1(int dx1) {
|
||||||
_escherClientAnchor.setDx1(Integer.valueOf(dx1).shortValue());
|
_escherClientAnchor.setDx1((short)dx1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -321,7 +321,7 @@ public final class HSSFClientAnchor extends HSSFAnchor implements ClientAnchor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDy1(int dy1) {
|
public void setDy1(int dy1) {
|
||||||
_escherClientAnchor.setDy1(Integer.valueOf(dy1).shortValue());
|
_escherClientAnchor.setDy1((short)dy1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -331,7 +331,7 @@ public final class HSSFClientAnchor extends HSSFAnchor implements ClientAnchor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDy2(int dy2) {
|
public void setDy2(int dy2) {
|
||||||
_escherClientAnchor.setDy2(Integer.valueOf(dy2).shortValue());
|
_escherClientAnchor.setDy2((short)dy2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -341,6 +341,6 @@ public final class HSSFClientAnchor extends HSSFAnchor implements ClientAnchor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDx2(int dx2) {
|
public void setDx2(int dx2) {
|
||||||
_escherClientAnchor.setDx2(Integer.valueOf(dx2).shortValue());
|
_escherClientAnchor.setDx2((short)dx2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,9 +77,8 @@ public class AbstractWordUtils
|
||||||
{
|
{
|
||||||
TableCell tableCell = tableRow.getCell( c );
|
TableCell tableCell = tableRow.getCell( c );
|
||||||
|
|
||||||
edges.add( Integer.valueOf( tableCell.getLeftEdge() ) );
|
edges.add(tableCell.getLeftEdge());
|
||||||
edges.add( Integer.valueOf( tableCell.getLeftEdge()
|
edges.add(tableCell.getLeftEdge() + tableCell.getWidth());
|
||||||
+ tableCell.getWidth() ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +86,7 @@ public class AbstractWordUtils
|
||||||
int[] result = new int[sorted.length];
|
int[] result = new int[sorted.length];
|
||||||
for ( int i = 0; i < sorted.length; i++ )
|
for ( int i = 0; i < sorted.length; i++ )
|
||||||
{
|
{
|
||||||
result[i] = sorted[i].intValue();
|
result[i] = sorted[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -165,20 +164,7 @@ public class AbstractWordUtils
|
||||||
|
|
||||||
switch ( borderCode.getBorderType() )
|
switch ( borderCode.getBorderType() )
|
||||||
{
|
{
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
return "solid";
|
|
||||||
case 3:
|
case 3:
|
||||||
return "double";
|
|
||||||
case 5:
|
|
||||||
return "solid";
|
|
||||||
case 6:
|
|
||||||
return "dotted";
|
|
||||||
case 7:
|
|
||||||
case 8:
|
|
||||||
return "dashed";
|
|
||||||
case 9:
|
|
||||||
return "dotted";
|
|
||||||
case 10:
|
case 10:
|
||||||
case 11:
|
case 11:
|
||||||
case 12:
|
case 12:
|
||||||
|
@ -189,19 +175,24 @@ public class AbstractWordUtils
|
||||||
case 17:
|
case 17:
|
||||||
case 18:
|
case 18:
|
||||||
case 19:
|
case 19:
|
||||||
return "double";
|
|
||||||
case 20:
|
|
||||||
return "solid";
|
|
||||||
case 21:
|
case 21:
|
||||||
return "double";
|
return "double";
|
||||||
|
case 6:
|
||||||
|
case 9:
|
||||||
|
return "dotted";
|
||||||
|
case 7:
|
||||||
|
case 8:
|
||||||
case 22:
|
case 22:
|
||||||
return "dashed";
|
|
||||||
case 23:
|
case 23:
|
||||||
return "dashed";
|
return "dashed";
|
||||||
case 24:
|
case 24:
|
||||||
return "ridge";
|
return "ridge";
|
||||||
case 25:
|
case 25:
|
||||||
return "grooved";
|
return "grooved";
|
||||||
|
case 5:
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
case 20:
|
||||||
default:
|
default:
|
||||||
return "solid";
|
return "solid";
|
||||||
}
|
}
|
||||||
|
@ -213,12 +204,7 @@ public class AbstractWordUtils
|
||||||
int pt = lineWidth / 8;
|
int pt = lineWidth / 8;
|
||||||
int pte = lineWidth - pt * 8;
|
int pte = lineWidth - pt * 8;
|
||||||
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
return pt + "." + 1000 / 8 * pte + "pt";
|
||||||
stringBuilder.append( pt );
|
|
||||||
stringBuilder.append( "." );
|
|
||||||
stringBuilder.append( 1000 / 8 * pte );
|
|
||||||
stringBuilder.append( "pt" );
|
|
||||||
return stringBuilder.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class NumberingState
|
public static class NumberingState
|
||||||
|
@ -294,10 +280,7 @@ public class AbstractWordUtils
|
||||||
|
|
||||||
public static String getColor( int ico )
|
public static String getColor( int ico )
|
||||||
{
|
{
|
||||||
switch ( ico )
|
switch ( ico ) {
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
return "black";
|
|
||||||
case 2:
|
case 2:
|
||||||
return "blue";
|
return "blue";
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -328,6 +311,7 @@ public class AbstractWordUtils
|
||||||
return "darkgray";
|
return "darkgray";
|
||||||
case 16:
|
case 16:
|
||||||
return "lightgray";
|
return "lightgray";
|
||||||
|
case 1:
|
||||||
default:
|
default:
|
||||||
return "black";
|
return "black";
|
||||||
}
|
}
|
||||||
|
@ -335,7 +319,7 @@ public class AbstractWordUtils
|
||||||
|
|
||||||
public static String getOpacity( int argbValue )
|
public static String getOpacity( int argbValue )
|
||||||
{
|
{
|
||||||
int opacity = (int) ( ( argbValue & 0xFF000000l ) >>> 24 );
|
int opacity = (int) ( ( argbValue & 0xFF000000L) >>> 24 );
|
||||||
if ( opacity == 0 || opacity == 0xFF )
|
if ( opacity == 0 || opacity == 0xFF )
|
||||||
return ".0";
|
return ".0";
|
||||||
|
|
||||||
|
@ -403,24 +387,20 @@ public class AbstractWordUtils
|
||||||
switch ( js )
|
switch ( js )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
case 7:
|
||||||
return "start";
|
return "start";
|
||||||
case 1:
|
case 1:
|
||||||
|
case 5:
|
||||||
return "center";
|
return "center";
|
||||||
case 2:
|
case 2:
|
||||||
|
case 8:
|
||||||
return "end";
|
return "end";
|
||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
return "justify";
|
|
||||||
case 5:
|
|
||||||
return "center";
|
|
||||||
case 6:
|
|
||||||
return "left";
|
|
||||||
case 7:
|
|
||||||
return "start";
|
|
||||||
case 8:
|
|
||||||
return "end";
|
|
||||||
case 9:
|
case 9:
|
||||||
return "justify";
|
return "justify";
|
||||||
|
case 6:
|
||||||
|
return "left";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -438,8 +418,7 @@ public class AbstractWordUtils
|
||||||
case 2057:
|
case 2057:
|
||||||
return "en-uk";
|
return "en-uk";
|
||||||
default:
|
default:
|
||||||
logger.log( POILogger.WARN, "Uknown or unmapped language code: ",
|
logger.log( POILogger.WARN, "Uknown or unmapped language code: ", languageCode);
|
||||||
Integer.valueOf( languageCode ) );
|
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,8 +88,7 @@ public class HtmlDocumentFacade
|
||||||
{
|
{
|
||||||
String exising = element.getAttribute( "class" );
|
String exising = element.getAttribute( "class" );
|
||||||
String addition = getOrCreateCssClass( classNamePrefix, style );
|
String addition = getOrCreateCssClass( classNamePrefix, style );
|
||||||
String newClassValue = WordToHtmlUtils.isEmpty( exising ) ? addition
|
String newClassValue = AbstractWordUtils.isEmpty( exising ) ? addition : ( exising + " " + addition );
|
||||||
: ( exising + " " + addition );
|
|
||||||
element.setAttribute( "class", newClassValue );
|
element.setAttribute( "class", newClassValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +271,7 @@ public class HtmlDocumentFacade
|
||||||
|
|
||||||
public void setTitle( String titleText )
|
public void setTitle( String titleText )
|
||||||
{
|
{
|
||||||
if ( WordToHtmlUtils.isEmpty( titleText ) && this.title != null )
|
if ( AbstractWordUtils.isEmpty( titleText ) && this.title != null )
|
||||||
{
|
{
|
||||||
this.head.removeChild( this.title );
|
this.head.removeChild( this.title );
|
||||||
this.title = null;
|
this.title = null;
|
||||||
|
|
|
@ -159,7 +159,7 @@ public class TextDocumentFacade
|
||||||
|
|
||||||
public void setTitle( String titleText )
|
public void setTitle( String titleText )
|
||||||
{
|
{
|
||||||
if ( WordToHtmlUtils.isEmpty( titleText ) && this.title != null )
|
if ( AbstractWordUtils.isEmpty( titleText ) && this.title != null )
|
||||||
{
|
{
|
||||||
this.head.removeChild( this.title );
|
this.head.removeChild( this.title );
|
||||||
this.title = null;
|
this.title = null;
|
||||||
|
|
|
@ -16,6 +16,11 @@
|
||||||
==================================================================== */
|
==================================================================== */
|
||||||
package org.apache.poi.hwpf.converter;
|
package org.apache.poi.hwpf.converter;
|
||||||
|
|
||||||
|
import static org.apache.poi.hwpf.converter.AbstractWordUtils.TWIPS_PER_INCH;
|
||||||
|
import static org.apache.poi.hwpf.converter.AbstractWordUtils.isNotEmpty;
|
||||||
|
import static org.apache.poi.hwpf.converter.AbstractWordUtils.loadDoc;
|
||||||
|
import static org.apache.poi.hwpf.converter.WordToFoUtils.*;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
|
@ -92,7 +97,7 @@ public class WordToFoConverter extends AbstractWordConverter
|
||||||
static Document process( File docFile ) throws Exception
|
static Document process( File docFile ) throws Exception
|
||||||
{
|
{
|
||||||
final DocumentBuilder docBuild = XMLHelper.newDocumentBuilder();
|
final DocumentBuilder docBuild = XMLHelper.newDocumentBuilder();
|
||||||
try (final HWPFDocumentCore hwpfDocument = WordToFoUtils.loadDoc( docFile )) {
|
try (final HWPFDocumentCore hwpfDocument = loadDoc( docFile )) {
|
||||||
WordToFoConverter wordToFoConverter = new WordToFoConverter(docBuild.newDocument());
|
WordToFoConverter wordToFoConverter = new WordToFoConverter(docBuild.newDocument());
|
||||||
wordToFoConverter.processDocument(hwpfDocument);
|
wordToFoConverter.processDocument(hwpfDocument);
|
||||||
return wordToFoConverter.getDocument();
|
return wordToFoConverter.getDocument();
|
||||||
|
@ -136,18 +141,13 @@ public class WordToFoConverter extends AbstractWordConverter
|
||||||
return inline;
|
return inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String createPageMaster( Section section, String type,
|
protected String createPageMaster( Section section, String type, int sectionIndex ) {
|
||||||
int sectionIndex )
|
float height = section.getPageHeight() / TWIPS_PER_INCH;
|
||||||
{
|
float width = section.getPageWidth() / TWIPS_PER_INCH;
|
||||||
float height = section.getPageHeight() / WordToFoUtils.TWIPS_PER_INCH;
|
float leftMargin = section.getMarginLeft() / TWIPS_PER_INCH;
|
||||||
float width = section.getPageWidth() / WordToFoUtils.TWIPS_PER_INCH;
|
float rightMargin = section.getMarginRight() / TWIPS_PER_INCH;
|
||||||
float leftMargin = section.getMarginLeft()
|
float topMargin = section.getMarginTop() / TWIPS_PER_INCH;
|
||||||
/ WordToFoUtils.TWIPS_PER_INCH;
|
float bottomMargin = section.getMarginBottom() / TWIPS_PER_INCH;
|
||||||
float rightMargin = section.getMarginRight()
|
|
||||||
/ WordToFoUtils.TWIPS_PER_INCH;
|
|
||||||
float topMargin = section.getMarginTop() / WordToFoUtils.TWIPS_PER_INCH;
|
|
||||||
float bottomMargin = section.getMarginBottom()
|
|
||||||
/ WordToFoUtils.TWIPS_PER_INCH;
|
|
||||||
|
|
||||||
// add these to the header
|
// add these to the header
|
||||||
String pageMasterName = type + "-page" + sectionIndex;
|
String pageMasterName = type + "-page" + sectionIndex;
|
||||||
|
@ -177,8 +177,7 @@ public class WordToFoConverter extends AbstractWordConverter
|
||||||
"" + ( section.getNumColumns() ) );
|
"" + ( section.getNumColumns() ) );
|
||||||
if ( section.isColumnsEvenlySpaced() )
|
if ( section.isColumnsEvenlySpaced() )
|
||||||
{
|
{
|
||||||
float distance = section.getDistanceBetweenColumns()
|
float distance = section.getDistanceBetweenColumns() / TWIPS_PER_INCH;
|
||||||
/ WordToFoUtils.TWIPS_PER_INCH;
|
|
||||||
regionBody.setAttribute( "column-gap", distance + "in" );
|
regionBody.setAttribute( "column-gap", distance + "in" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -208,15 +207,15 @@ public class WordToFoConverter extends AbstractWordConverter
|
||||||
|
|
||||||
Triplet triplet = getCharacterRunTriplet( characterRun );
|
Triplet triplet = getCharacterRunTriplet( characterRun );
|
||||||
|
|
||||||
if ( WordToFoUtils.isNotEmpty( triplet.fontName ) )
|
if ( isNotEmpty( triplet.fontName ) )
|
||||||
WordToFoUtils.setFontFamily( inline, triplet.fontName );
|
setFontFamily( inline, triplet.fontName );
|
||||||
WordToFoUtils.setBold( inline, triplet.bold );
|
setBold( inline, triplet.bold );
|
||||||
WordToFoUtils.setItalic( inline, triplet.italic );
|
setItalic( inline, triplet.italic );
|
||||||
WordToFoUtils.setFontSize( inline, characterRun.getFontSize() / 2 );
|
setFontSize( inline, characterRun.getFontSize() / 2 );
|
||||||
WordToFoUtils.setCharactersProperties( characterRun, inline );
|
setCharactersProperties( characterRun, inline );
|
||||||
|
|
||||||
if ( isOutputCharactersLanguage() )
|
if ( isOutputCharactersLanguage() )
|
||||||
WordToFoUtils.setLanguage( characterRun, inline );
|
setLanguage( characterRun, inline );
|
||||||
|
|
||||||
block.appendChild( inline );
|
block.appendChild( inline );
|
||||||
|
|
||||||
|
@ -254,16 +253,16 @@ public class WordToFoConverter extends AbstractWordConverter
|
||||||
protected void processDocumentInformation(
|
protected void processDocumentInformation(
|
||||||
SummaryInformation summaryInformation )
|
SummaryInformation summaryInformation )
|
||||||
{
|
{
|
||||||
if ( WordToHtmlUtils.isNotEmpty( summaryInformation.getTitle() ) )
|
if ( isNotEmpty( summaryInformation.getTitle() ) )
|
||||||
foDocumentFacade.setTitle( summaryInformation.getTitle() );
|
foDocumentFacade.setTitle( summaryInformation.getTitle() );
|
||||||
|
|
||||||
if ( WordToHtmlUtils.isNotEmpty( summaryInformation.getAuthor() ) )
|
if ( isNotEmpty( summaryInformation.getAuthor() ) )
|
||||||
foDocumentFacade.setCreator( summaryInformation.getAuthor() );
|
foDocumentFacade.setCreator( summaryInformation.getAuthor() );
|
||||||
|
|
||||||
if ( WordToHtmlUtils.isNotEmpty( summaryInformation.getKeywords() ) )
|
if ( isNotEmpty( summaryInformation.getKeywords() ) )
|
||||||
foDocumentFacade.setKeywords( summaryInformation.getKeywords() );
|
foDocumentFacade.setKeywords( summaryInformation.getKeywords() );
|
||||||
|
|
||||||
if ( WordToHtmlUtils.isNotEmpty( summaryInformation.getComments() ) )
|
if ( isNotEmpty( summaryInformation.getComments() ) )
|
||||||
foDocumentFacade.setDescription( summaryInformation.getComments() );
|
foDocumentFacade.setDescription( summaryInformation.getComments() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,7 +301,7 @@ public class WordToFoConverter extends AbstractWordConverter
|
||||||
processCharacters( wordDocument, Integer.MIN_VALUE, endnoteTextRange,
|
processCharacters( wordDocument, Integer.MIN_VALUE, endnoteTextRange,
|
||||||
endnote );
|
endnote );
|
||||||
|
|
||||||
WordToFoUtils.compactInlines( endnote );
|
compactInlines( endnote );
|
||||||
this.endnotes.add( endnote );
|
this.endnotes.add( endnote );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +338,7 @@ public class WordToFoConverter extends AbstractWordConverter
|
||||||
processCharacters( wordDocument, Integer.MIN_VALUE, footnoteTextRange,
|
processCharacters( wordDocument, Integer.MIN_VALUE, footnoteTextRange,
|
||||||
footnoteBlock );
|
footnoteBlock );
|
||||||
|
|
||||||
WordToFoUtils.compactInlines( footnoteBlock );
|
compactInlines( footnoteBlock );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void processHyperlink( HWPFDocumentCore wordDocument,
|
protected void processHyperlink( HWPFDocumentCore wordDocument,
|
||||||
|
@ -360,7 +359,7 @@ public class WordToFoConverter extends AbstractWordConverter
|
||||||
{
|
{
|
||||||
final Element externalGraphic = foDocumentFacade
|
final Element externalGraphic = foDocumentFacade
|
||||||
.createExternalGraphic( url );
|
.createExternalGraphic( url );
|
||||||
WordToFoUtils.setPictureProperties( picture, externalGraphic );
|
setPictureProperties( picture, externalGraphic );
|
||||||
currentBlock.appendChild( externalGraphic );
|
currentBlock.appendChild( externalGraphic );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,7 +425,7 @@ public class WordToFoConverter extends AbstractWordConverter
|
||||||
final Element block = foDocumentFacade.createBlock();
|
final Element block = foDocumentFacade.createBlock();
|
||||||
parentFopElement.appendChild( block );
|
parentFopElement.appendChild( block );
|
||||||
|
|
||||||
WordToFoUtils.setParagraphProperties( paragraph, block );
|
setParagraphProperties( paragraph, block );
|
||||||
|
|
||||||
final int charRuns = paragraph.numCharacterRuns();
|
final int charRuns = paragraph.numCharacterRuns();
|
||||||
|
|
||||||
|
@ -437,7 +436,7 @@ public class WordToFoConverter extends AbstractWordConverter
|
||||||
|
|
||||||
boolean haveAnyText = false;
|
boolean haveAnyText = false;
|
||||||
|
|
||||||
if ( WordToFoUtils.isNotEmpty( bulletText ) )
|
if ( isNotEmpty( bulletText ) )
|
||||||
{
|
{
|
||||||
Element inline = foDocumentFacade.createInline();
|
Element inline = foDocumentFacade.createInline();
|
||||||
block.appendChild( inline );
|
block.appendChild( inline );
|
||||||
|
@ -457,7 +456,7 @@ public class WordToFoConverter extends AbstractWordConverter
|
||||||
block.appendChild( leader );
|
block.appendChild( leader );
|
||||||
}
|
}
|
||||||
|
|
||||||
WordToFoUtils.compactInlines( block );
|
compactInlines( block );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void processSection( HWPFDocumentCore wordDocument,
|
protected void processSection( HWPFDocumentCore wordDocument,
|
||||||
|
@ -485,8 +484,7 @@ public class WordToFoConverter extends AbstractWordConverter
|
||||||
Element tableHeader = foDocumentFacade.createTableHeader();
|
Element tableHeader = foDocumentFacade.createTableHeader();
|
||||||
Element tableBody = foDocumentFacade.createTableBody();
|
Element tableBody = foDocumentFacade.createTableBody();
|
||||||
|
|
||||||
final int[] tableCellEdges = WordToHtmlUtils
|
final int[] tableCellEdges = buildTableCellEdgesArray( table );
|
||||||
.buildTableCellEdgesArray( table );
|
|
||||||
final int tableRows = table.numRows();
|
final int tableRows = table.numRows();
|
||||||
|
|
||||||
int maxColumns = Integer.MIN_VALUE;
|
int maxColumns = Integer.MIN_VALUE;
|
||||||
|
@ -500,7 +498,7 @@ public class WordToFoConverter extends AbstractWordConverter
|
||||||
TableRow tableRow = table.getRow( r );
|
TableRow tableRow = table.getRow( r );
|
||||||
|
|
||||||
Element tableRowElement = foDocumentFacade.createTableRow();
|
Element tableRowElement = foDocumentFacade.createTableRow();
|
||||||
WordToFoUtils.setTableRowProperties( tableRow, tableRowElement );
|
setTableRowProperties( tableRow, tableRowElement );
|
||||||
|
|
||||||
// index of current element in tableCellEdges[]
|
// index of current element in tableCellEdges[]
|
||||||
int currentEdgeIndex = 0;
|
int currentEdgeIndex = 0;
|
||||||
|
@ -518,7 +516,7 @@ public class WordToFoConverter extends AbstractWordConverter
|
||||||
}
|
}
|
||||||
|
|
||||||
Element tableCellElement = foDocumentFacade.createTableCell();
|
Element tableCellElement = foDocumentFacade.createTableCell();
|
||||||
WordToFoUtils.setTableCellProperties( tableRow, tableCell,
|
setTableCellProperties( tableRow, tableCell,
|
||||||
tableCellElement, r == 0, r == tableRows - 1, c == 0,
|
tableCellElement, r == 0, r == tableRows - 1, c == 0,
|
||||||
c == rowCells - 1 );
|
c == rowCells - 1 );
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.io.InputStream;
|
||||||
|
|
||||||
import org.apache.poi.extractor.POIOLE2TextExtractor;
|
import org.apache.poi.extractor.POIOLE2TextExtractor;
|
||||||
import org.apache.poi.hwpf.HWPFDocument;
|
import org.apache.poi.hwpf.HWPFDocument;
|
||||||
|
import org.apache.poi.hwpf.HWPFDocumentCore;
|
||||||
import org.apache.poi.hwpf.converter.WordToTextConverter;
|
import org.apache.poi.hwpf.converter.WordToTextConverter;
|
||||||
import org.apache.poi.hwpf.usermodel.HeaderStories;
|
import org.apache.poi.hwpf.usermodel.HeaderStories;
|
||||||
import org.apache.poi.hwpf.usermodel.Paragraph;
|
import org.apache.poi.hwpf.usermodel.Paragraph;
|
||||||
|
@ -48,7 +49,7 @@ public final class WordExtractor extends POIOLE2TextExtractor {
|
||||||
* InputStream containing the word file
|
* InputStream containing the word file
|
||||||
*/
|
*/
|
||||||
public WordExtractor( InputStream is ) throws IOException {
|
public WordExtractor( InputStream is ) throws IOException {
|
||||||
this( HWPFDocument.verifyAndBuildPOIFS( is ) );
|
this(HWPFDocumentCore.verifyAndBuildPOIFS(is ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.poi.hwpf.model.types.BKFAbstractType;
|
||||||
import org.apache.poi.util.Internal;
|
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;
|
||||||
|
@ -124,9 +125,9 @@ public class BookmarksTables
|
||||||
int firstDescriptorsStart = fib.getFcPlcfbkf();
|
int firstDescriptorsStart = fib.getFcPlcfbkf();
|
||||||
int firstDescriptorsLength = fib.getLcbPlcfbkf();
|
int firstDescriptorsLength = fib.getLcbPlcfbkf();
|
||||||
if ( firstDescriptorsStart != 0 && firstDescriptorsLength != 0 )
|
if ( firstDescriptorsStart != 0 && firstDescriptorsLength != 0 )
|
||||||
descriptorsFirst = new PlexOfCps( tableStream,
|
descriptorsFirst = new PlexOfCps(tableStream,
|
||||||
firstDescriptorsStart, firstDescriptorsLength,
|
firstDescriptorsStart, firstDescriptorsLength,
|
||||||
BookmarkFirstDescriptor.getSize() );
|
BKFAbstractType.getSize() );
|
||||||
|
|
||||||
int limDescriptorsStart = fib.getFcPlcfbkl();
|
int limDescriptorsStart = fib.getFcPlcfbkl();
|
||||||
int limDescriptorsLength = fib.getLcbPlcfbkl();
|
int limDescriptorsLength = fib.getLcbPlcfbkl();
|
||||||
|
|
|
@ -16,6 +16,11 @@
|
||||||
==================================================================== */
|
==================================================================== */
|
||||||
package org.apache.poi.hwpf.model;
|
package org.apache.poi.hwpf.model;
|
||||||
|
|
||||||
|
import static org.apache.poi.hwpf.model.types.FFDataBaseAbstractType.ITYPE_CHCK;
|
||||||
|
import static org.apache.poi.hwpf.model.types.FFDataBaseAbstractType.ITYPE_DROP;
|
||||||
|
import static org.apache.poi.hwpf.model.types.FFDataBaseAbstractType.ITYPE_TEXT;
|
||||||
|
|
||||||
|
import org.apache.poi.hwpf.model.types.FFDataBaseAbstractType;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
import org.apache.poi.util.LittleEndianConsts;
|
import org.apache.poi.util.LittleEndianConsts;
|
||||||
|
@ -95,12 +100,12 @@ public class FFData
|
||||||
int offset = startOffset;
|
int offset = startOffset;
|
||||||
|
|
||||||
this._base = new FFDataBase( std, offset );
|
this._base = new FFDataBase( std, offset );
|
||||||
offset += FFDataBase.getSize();
|
offset += FFDataBaseAbstractType.getSize();
|
||||||
|
|
||||||
this._xstzName = new Xstz( std, offset );
|
this._xstzName = new Xstz( std, offset );
|
||||||
offset += this._xstzName.getSize();
|
offset += this._xstzName.getSize();
|
||||||
|
|
||||||
if ( _base.getIType() == FFDataBase.ITYPE_TEXT )
|
if ( _base.getIType() == ITYPE_TEXT )
|
||||||
{
|
{
|
||||||
_xstzTextDef = new Xstz( std, offset );
|
_xstzTextDef = new Xstz( std, offset );
|
||||||
offset += this._xstzTextDef.getSize();
|
offset += this._xstzTextDef.getSize();
|
||||||
|
@ -110,11 +115,10 @@ public class FFData
|
||||||
this._xstzTextDef = null;
|
this._xstzTextDef = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( _base.getIType() == FFDataBase.ITYPE_CHCK
|
if ( _base.getIType() == ITYPE_CHCK
|
||||||
|| _base.getIType() == FFDataBase.ITYPE_DROP )
|
|| _base.getIType() == ITYPE_DROP )
|
||||||
{
|
{
|
||||||
this._wDef = Integer
|
this._wDef = LittleEndian.getUShort(std, offset);
|
||||||
.valueOf( LittleEndian.getUShort( std, offset ) );
|
|
||||||
offset += LittleEndianConsts.SHORT_SIZE;
|
offset += LittleEndianConsts.SHORT_SIZE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -137,10 +141,8 @@ public class FFData
|
||||||
_xstzExitMcr = new Xstz( std, offset );
|
_xstzExitMcr = new Xstz( std, offset );
|
||||||
offset += this._xstzExitMcr.getSize();
|
offset += this._xstzExitMcr.getSize();
|
||||||
|
|
||||||
if ( _base.getIType() == FFDataBase.ITYPE_DROP )
|
if ( _base.getIType() == ITYPE_DROP ) {
|
||||||
{
|
|
||||||
_hsttbDropList = new Sttb( std, offset );
|
_hsttbDropList = new Sttb( std, offset );
|
||||||
offset += _hsttbDropList.getSize();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +151,7 @@ public class FFData
|
||||||
*/
|
*/
|
||||||
public int getDefaultDropDownItemIndex()
|
public int getDefaultDropDownItemIndex()
|
||||||
{
|
{
|
||||||
return _wDef.intValue();
|
return _wDef;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getDropList()
|
public String[] getDropList()
|
||||||
|
@ -159,17 +161,17 @@ public class FFData
|
||||||
|
|
||||||
public int getSize()
|
public int getSize()
|
||||||
{
|
{
|
||||||
int size = FFDataBase.getSize();
|
int size = FFDataBaseAbstractType.getSize();
|
||||||
|
|
||||||
size += _xstzName.getSize();
|
size += _xstzName.getSize();
|
||||||
|
|
||||||
if ( _base.getIType() == FFDataBase.ITYPE_TEXT )
|
if ( _base.getIType() == ITYPE_TEXT )
|
||||||
{
|
{
|
||||||
size += _xstzTextDef.getSize();
|
size += _xstzTextDef.getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( _base.getIType() == FFDataBase.ITYPE_CHCK
|
if ( _base.getIType() == ITYPE_CHCK
|
||||||
|| _base.getIType() == FFDataBase.ITYPE_DROP )
|
|| _base.getIType() == ITYPE_DROP )
|
||||||
{
|
{
|
||||||
size += LittleEndianConsts.SHORT_SIZE;
|
size += LittleEndianConsts.SHORT_SIZE;
|
||||||
}
|
}
|
||||||
|
@ -180,7 +182,7 @@ public class FFData
|
||||||
size += _xstzEntryMcr.getSize();
|
size += _xstzEntryMcr.getSize();
|
||||||
size += _xstzExitMcr.getSize();
|
size += _xstzExitMcr.getSize();
|
||||||
|
|
||||||
if ( _base.getIType() == FFDataBase.ITYPE_DROP )
|
if ( _base.getIType() == ITYPE_DROP )
|
||||||
{
|
{
|
||||||
size += _hsttbDropList.getSize();
|
size += _hsttbDropList.getSize();
|
||||||
}
|
}
|
||||||
|
@ -199,17 +201,17 @@ public class FFData
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
_base.serialize( buffer, offset );
|
_base.serialize( buffer, offset );
|
||||||
offset += FFDataBase.getSize();
|
offset += FFDataBaseAbstractType.getSize();
|
||||||
|
|
||||||
offset += _xstzName.serialize( buffer, offset );
|
offset += _xstzName.serialize( buffer, offset );
|
||||||
|
|
||||||
if ( _base.getIType() == FFDataBase.ITYPE_TEXT )
|
if ( _base.getIType() == ITYPE_TEXT )
|
||||||
{
|
{
|
||||||
offset += _xstzTextDef.serialize( buffer, offset );
|
offset += _xstzTextDef.serialize( buffer, offset );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( _base.getIType() == FFDataBase.ITYPE_CHCK
|
if ( _base.getIType() == ITYPE_CHCK
|
||||||
|| _base.getIType() == FFDataBase.ITYPE_DROP )
|
|| _base.getIType() == ITYPE_DROP )
|
||||||
{
|
{
|
||||||
LittleEndian.putUShort( buffer, offset, _wDef );
|
LittleEndian.putUShort( buffer, offset, _wDef );
|
||||||
offset += LittleEndianConsts.SHORT_SIZE;
|
offset += LittleEndianConsts.SHORT_SIZE;
|
||||||
|
@ -221,9 +223,8 @@ public class FFData
|
||||||
offset += _xstzEntryMcr.serialize( buffer, offset );
|
offset += _xstzEntryMcr.serialize( buffer, offset );
|
||||||
offset += _xstzExitMcr.serialize( buffer, offset );
|
offset += _xstzExitMcr.serialize( buffer, offset );
|
||||||
|
|
||||||
if ( _base.getIType() == FFDataBase.ITYPE_DROP )
|
if ( _base.getIType() == ITYPE_DROP ) {
|
||||||
{
|
_hsttbDropList.serialize( buffer, offset );
|
||||||
offset += _hsttbDropList.serialize( buffer, offset );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
|
|
|
@ -22,12 +22,11 @@ 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.types.FSPAAbstractType;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class holds all the FSPA (File Shape Address) structures.
|
* This class holds all the FSPA (File Shape Address) structures.
|
||||||
*
|
|
||||||
* @author Squeeself
|
|
||||||
*/
|
*/
|
||||||
@Internal
|
@Internal
|
||||||
public final class FSPATable
|
public final class FSPATable
|
||||||
|
@ -41,12 +40,11 @@ public final class FSPATable
|
||||||
int offset = fib.getFSPAPlcfOffset( part );
|
int offset = fib.getFSPAPlcfOffset( part );
|
||||||
int length = fib.getFSPAPlcfLength( part );
|
int length = fib.getFSPAPlcfLength( part );
|
||||||
|
|
||||||
PlexOfCps plex = new PlexOfCps( tableStream, offset, length,
|
PlexOfCps plex = new PlexOfCps(tableStream, offset, length, FSPAAbstractType.getSize() );
|
||||||
FSPA.getSize() );
|
|
||||||
for ( int i = 0; i < plex.length(); i++ )
|
for ( int i = 0; i < plex.length(); i++ )
|
||||||
{
|
{
|
||||||
GenericPropertyNode property = plex.getProperty( i );
|
GenericPropertyNode property = plex.getProperty( i );
|
||||||
_byStart.put( Integer.valueOf( property.getStart() ), property );
|
_byStart.put(property.getStart(), property );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,13 +61,13 @@ public final class FSPATable
|
||||||
for ( int i = 0; i < plex.length(); i++ )
|
for ( int i = 0; i < plex.length(); i++ )
|
||||||
{
|
{
|
||||||
GenericPropertyNode property = plex.getProperty( i );
|
GenericPropertyNode property = plex.getProperty( i );
|
||||||
_byStart.put( Integer.valueOf( property.getStart() ), property );
|
_byStart.put(property.getStart(), property );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public FSPA getFspaFromCp( int cp )
|
public FSPA getFspaFromCp( int cp )
|
||||||
{
|
{
|
||||||
GenericPropertyNode propertyNode = _byStart.get( Integer.valueOf( cp ) );
|
GenericPropertyNode propertyNode = _byStart.get(cp);
|
||||||
if ( propertyNode == null )
|
if ( propertyNode == null )
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -96,7 +94,7 @@ public final class FSPATable
|
||||||
buf.append( " " ).append(i).append( " => \t" );
|
buf.append( " " ).append(i).append( " => \t" );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
FSPA fspa = getFspaFromCp( i.intValue() );
|
FSPA fspa = getFspaFromCp(i);
|
||||||
buf.append(fspa);
|
buf.append(fspa);
|
||||||
} catch ( Exception exc ) {
|
} catch ( Exception exc ) {
|
||||||
buf.append( exc.getMessage() );
|
buf.append( exc.getMessage() );
|
||||||
|
|
|
@ -24,6 +24,8 @@ import java.lang.reflect.Modifier;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import org.apache.poi.hwpf.model.types.FibBaseAbstractType;
|
||||||
|
import org.apache.poi.hwpf.model.types.FibRgW97AbstractType;
|
||||||
import org.apache.poi.util.IOUtils;
|
import org.apache.poi.util.IOUtils;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
|
@ -69,20 +71,18 @@ public final class FileInformationBlock
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
_fibBase = new FibBase( mainDocument, offset );
|
_fibBase = new FibBase( mainDocument, offset );
|
||||||
offset = FibBase.getSize();
|
offset = FibBaseAbstractType.getSize();
|
||||||
assert offset == 32;
|
assert offset == 32;
|
||||||
|
|
||||||
_csw = LittleEndian.getUShort( mainDocument, offset );
|
_csw = LittleEndian.getUShort( mainDocument, offset );
|
||||||
offset += LittleEndianConsts.SHORT_SIZE;
|
offset += LittleEndianConsts.SHORT_SIZE;
|
||||||
assert offset == 34;
|
|
||||||
|
|
||||||
_fibRgW = new FibRgW97( mainDocument, offset );
|
_fibRgW = new FibRgW97( mainDocument, offset );
|
||||||
offset += FibRgW97.getSize();
|
offset += FibRgW97AbstractType.getSize();
|
||||||
assert offset == 62;
|
assert offset == 62;
|
||||||
|
|
||||||
_cslw = LittleEndian.getUShort( mainDocument, offset );
|
_cslw = LittleEndian.getUShort( mainDocument, offset );
|
||||||
offset += LittleEndianConsts.SHORT_SIZE;
|
offset += LittleEndianConsts.SHORT_SIZE;
|
||||||
assert offset == 64;
|
|
||||||
|
|
||||||
if ( _fibBase.getNFib() < 105 )
|
if ( _fibBase.getNFib() < 105 )
|
||||||
{
|
{
|
||||||
|
@ -1079,13 +1079,13 @@ public final class FileInformationBlock
|
||||||
_cbRgFcLcb = _fieldHandler.getFieldsCount();
|
_cbRgFcLcb = _fieldHandler.getFieldsCount();
|
||||||
|
|
||||||
_fibBase.serialize( mainStream, 0 );
|
_fibBase.serialize( mainStream, 0 );
|
||||||
int offset = FibBase.getSize();
|
int offset = FibBaseAbstractType.getSize();
|
||||||
|
|
||||||
LittleEndian.putUShort( mainStream, offset, _csw );
|
LittleEndian.putUShort( mainStream, offset, _csw );
|
||||||
offset += LittleEndianConsts.SHORT_SIZE;
|
offset += LittleEndianConsts.SHORT_SIZE;
|
||||||
|
|
||||||
_fibRgW.serialize( mainStream, offset );
|
_fibRgW.serialize( mainStream, offset );
|
||||||
offset += FibRgW97.getSize();
|
offset += FibRgW97AbstractType.getSize();
|
||||||
|
|
||||||
LittleEndian.putUShort( mainStream, offset, _cslw );
|
LittleEndian.putUShort( mainStream, offset, _cslw );
|
||||||
offset += LittleEndianConsts.SHORT_SIZE;
|
offset += LittleEndianConsts.SHORT_SIZE;
|
||||||
|
@ -1114,7 +1114,7 @@ public final class FileInformationBlock
|
||||||
|
|
||||||
public int getSize()
|
public int getSize()
|
||||||
{
|
{
|
||||||
return FibBase.getSize() + LittleEndianConsts.SHORT_SIZE + FibRgW97.getSize()
|
return FibBaseAbstractType.getSize() + LittleEndianConsts.SHORT_SIZE + FibRgW97AbstractType.getSize()
|
||||||
+ LittleEndianConsts.SHORT_SIZE + FibRgLw97.getSize()
|
+ LittleEndianConsts.SHORT_SIZE + FibRgLw97.getSize()
|
||||||
+ LittleEndianConsts.SHORT_SIZE + _fieldHandler.sizeInBytes();
|
+ LittleEndianConsts.SHORT_SIZE + _fieldHandler.sizeInBytes();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.poi.hwpf.model;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import org.apache.poi.hwpf.model.types.LFOLVLBaseAbstractType;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,7 +37,7 @@ public final class ListFormatOverrideLevel
|
||||||
public ListFormatOverrideLevel( byte[] buf, int offset )
|
public ListFormatOverrideLevel( byte[] buf, int offset )
|
||||||
{
|
{
|
||||||
_base = new LFOLVLBase( buf, offset );
|
_base = new LFOLVLBase( buf, offset );
|
||||||
offset += LFOLVLBase.getSize();
|
offset += LFOLVLBaseAbstractType.getSize();
|
||||||
|
|
||||||
if ( _base.isFFormatting() )
|
if ( _base.isFFormatting() )
|
||||||
{
|
{
|
||||||
|
@ -78,7 +79,7 @@ public final class ListFormatOverrideLevel
|
||||||
|
|
||||||
public int getSizeInBytes()
|
public int getSizeInBytes()
|
||||||
{
|
{
|
||||||
return _lvl == null ? LFOLVLBase.getSize() : LFOLVLBase.getSize()
|
return _lvl == null ? LFOLVLBaseAbstractType.getSize() : LFOLVLBaseAbstractType.getSize()
|
||||||
+ _lvl.getSizeInBytes();
|
+ _lvl.getSizeInBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +104,7 @@ public final class ListFormatOverrideLevel
|
||||||
|
|
||||||
byte[] buf = new byte[getSizeInBytes()];
|
byte[] buf = new byte[getSizeInBytes()];
|
||||||
_base.serialize( buf, offset );
|
_base.serialize( buf, offset );
|
||||||
offset += LFOLVLBase.getSize();
|
offset += LFOLVLBaseAbstractType.getSize();
|
||||||
|
|
||||||
if ( _lvl != null )
|
if ( _lvl != null )
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.poi.hwpf.model;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import org.apache.poi.hwpf.model.types.LVLFAbstractType;
|
||||||
import org.apache.poi.util.IOUtils;
|
import org.apache.poi.util.IOUtils;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
import org.apache.poi.util.POILogFactory;
|
import org.apache.poi.util.POILogFactory;
|
||||||
|
@ -162,7 +163,7 @@ public final class ListLevel
|
||||||
|
|
||||||
public int getSizeInBytes()
|
public int getSizeInBytes()
|
||||||
{
|
{
|
||||||
return LVLF.getSize() + _lvlf.getCbGrpprlChpx()
|
return LVLFAbstractType.getSize() + _lvlf.getCbGrpprlChpx()
|
||||||
+ _lvlf.getCbGrpprlPapx() + _xst.getSize();
|
+ _lvlf.getCbGrpprlPapx() + _xst.getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +220,7 @@ public final class ListLevel
|
||||||
int offset = startOffset;
|
int offset = startOffset;
|
||||||
|
|
||||||
_lvlf = new LVLF( data, offset );
|
_lvlf = new LVLF( data, offset );
|
||||||
offset += LVLF.getSize();
|
offset += LVLFAbstractType.getSize();
|
||||||
|
|
||||||
//short -- no need to safely allocate
|
//short -- no need to safely allocate
|
||||||
_grpprlPapx = new byte[_lvlf.getCbGrpprlPapx()];
|
_grpprlPapx = new byte[_lvlf.getCbGrpprlPapx()];
|
||||||
|
@ -292,7 +293,7 @@ public final class ListLevel
|
||||||
_lvlf.setCbGrpprlChpx( (short) _grpprlChpx.length );
|
_lvlf.setCbGrpprlChpx( (short) _grpprlChpx.length );
|
||||||
_lvlf.setCbGrpprlPapx( (short) _grpprlPapx.length );
|
_lvlf.setCbGrpprlPapx( (short) _grpprlPapx.length );
|
||||||
_lvlf.serialize( buf, offset );
|
_lvlf.serialize( buf, offset );
|
||||||
offset += LVLF.getSize();
|
offset += LVLFAbstractType.getSize();
|
||||||
|
|
||||||
System.arraycopy( _grpprlPapx, 0, buf, offset, _grpprlPapx.length );
|
System.arraycopy( _grpprlPapx, 0, buf, offset, _grpprlPapx.length );
|
||||||
offset += _grpprlPapx.length;
|
offset += _grpprlPapx.length;
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import org.apache.poi.hwpf.model.types.LSTFAbstractType;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
import org.apache.poi.util.LittleEndianConsts;
|
import org.apache.poi.util.LittleEndianConsts;
|
||||||
|
@ -58,13 +59,13 @@ public final class ListTables
|
||||||
|
|
||||||
int cLst = LittleEndian.getShort( tableStream, offset );
|
int cLst = LittleEndian.getShort( tableStream, offset );
|
||||||
offset += LittleEndianConsts.SHORT_SIZE;
|
offset += LittleEndianConsts.SHORT_SIZE;
|
||||||
int levelOffset = offset + ( cLst * LSTF.getSize() );
|
int levelOffset = offset + ( cLst * LSTFAbstractType.getSize() );
|
||||||
|
|
||||||
for ( int x = 0; x < cLst; x++ )
|
for ( int x = 0; x < cLst; x++ )
|
||||||
{
|
{
|
||||||
ListData lst = new ListData( tableStream, offset );
|
ListData lst = new ListData( tableStream, offset );
|
||||||
_listMap.put( Integer.valueOf( lst.getLsid() ), lst );
|
_listMap.put(lst.getLsid(), lst );
|
||||||
offset += LSTF.getSize();
|
offset += LSTFAbstractType.getSize();
|
||||||
|
|
||||||
int num = lst.numLevels();
|
int num = lst.numLevels();
|
||||||
for ( int y = 0; y < num; y++ )
|
for ( int y = 0; y < num; y++ )
|
||||||
|
@ -96,9 +97,8 @@ public final class ListTables
|
||||||
for(ListData lst : _listMap.values()) {
|
for(ListData lst : _listMap.values()) {
|
||||||
tableStream.write(lst.toByteArray());
|
tableStream.write(lst.toByteArray());
|
||||||
ListLevel[] lvls = lst.getLevels();
|
ListLevel[] lvls = lst.getLevels();
|
||||||
for (int y = 0; y < lvls.length; y++)
|
for (ListLevel lvl : lvls) {
|
||||||
{
|
levelBuf.write(lvl.toByteArray());
|
||||||
levelBuf.write(lvls[y].toByteArray());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,13 +135,11 @@ public final class ListTables
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the ListLevel for a given lsid and level
|
* Get the ListLevel for a given lsid and level
|
||||||
* @param lsid
|
|
||||||
* @param level
|
|
||||||
* @return ListLevel if found, or <code>null</code> if ListData can't be found or if level is > that available
|
* @return ListLevel if found, or <code>null</code> if ListData can't be found or if level is > that available
|
||||||
*/
|
*/
|
||||||
public ListLevel getLevel(int lsid, int level)
|
public ListLevel getLevel(int lsid, int level)
|
||||||
{
|
{
|
||||||
ListData lst = _listMap.get(Integer.valueOf(lsid));
|
ListData lst = _listMap.get(lsid);
|
||||||
if (lst == null) {
|
if (lst == null) {
|
||||||
if (log.check(POILogger.WARN)) {
|
if (log.check(POILogger.WARN)) {
|
||||||
log.log(POILogger.WARN, "ListData for " +
|
log.log(POILogger.WARN, "ListData for " +
|
||||||
|
@ -160,7 +158,7 @@ public final class ListTables
|
||||||
|
|
||||||
public ListData getListData(int lsid)
|
public ListData getListData(int lsid)
|
||||||
{
|
{
|
||||||
return _listMap.get(Integer.valueOf(lsid));
|
return _listMap.get(lsid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -180,25 +178,18 @@ public final class ListTables
|
||||||
ListTables other = (ListTables) obj;
|
ListTables other = (ListTables) obj;
|
||||||
if ( !_listMap.equals( other._listMap ) )
|
if ( !_listMap.equals( other._listMap ) )
|
||||||
return false;
|
return false;
|
||||||
if ( _plfLfo == null )
|
return Objects.equals(_plfLfo, other._plfLfo);
|
||||||
{
|
|
||||||
if ( other._plfLfo != null )
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if ( !_plfLfo.equals( other._plfLfo ) )
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int addList( ListData lst, LFO lfo, LFOData lfoData )
|
public int addList( ListData lst, LFO lfo, LFOData lfoData )
|
||||||
{
|
{
|
||||||
int lsid = lst.getLsid();
|
int lsid = lst.getLsid();
|
||||||
while ( _listMap.get( Integer.valueOf( lsid ) ) != null )
|
while (_listMap.containsKey(lsid))
|
||||||
{
|
{
|
||||||
lsid = lst.resetListID();
|
lsid = lst.resetListID();
|
||||||
lfo.setLsid( lsid );
|
lfo.setLsid( lsid );
|
||||||
}
|
}
|
||||||
_listMap.put( Integer.valueOf( lsid ), lst );
|
_listMap.put(lsid, lst );
|
||||||
|
|
||||||
if ( lfo == null && lfoData != null )
|
if ( lfo == null && lfoData != null )
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.poi.hwpf.model;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.apache.poi.hwpf.model.types.FRDAbstractType;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,8 +30,7 @@ import org.apache.poi.util.Internal;
|
||||||
@Internal
|
@Internal
|
||||||
public class NotesTables
|
public class NotesTables
|
||||||
{
|
{
|
||||||
private PlexOfCps descriptors = new PlexOfCps(
|
private PlexOfCps descriptors = new PlexOfCps(FRDAbstractType.getSize() );
|
||||||
FootnoteReferenceDescriptor.getSize() );
|
|
||||||
|
|
||||||
private final NoteType noteType;
|
private final NoteType noteType;
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ public class NotesTables
|
||||||
|
|
||||||
if ( referencesStart != 0 && referencesLength != 0 )
|
if ( referencesStart != 0 && referencesLength != 0 )
|
||||||
this.descriptors = new PlexOfCps( tableStream, referencesStart,
|
this.descriptors = new PlexOfCps( tableStream, referencesStart,
|
||||||
referencesLength, FootnoteReferenceDescriptor.getSize() );
|
referencesLength, FRDAbstractType.getSize() );
|
||||||
|
|
||||||
int textPositionsStart = fib.getNotesTextPositionsOffset( noteType );
|
int textPositionsStart = fib.getNotesTextPositionsOffset( noteType );
|
||||||
int textPositionsLength = fib.getNotesTextPositionsSize( noteType );
|
int textPositionsLength = fib.getNotesTextPositionsSize( noteType );
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.util.List;
|
||||||
import org.apache.poi.ddf.DefaultEscherRecordFactory;
|
import org.apache.poi.ddf.DefaultEscherRecordFactory;
|
||||||
import org.apache.poi.ddf.EscherContainerRecord;
|
import org.apache.poi.ddf.EscherContainerRecord;
|
||||||
import org.apache.poi.ddf.EscherRecord;
|
import org.apache.poi.ddf.EscherRecord;
|
||||||
|
import org.apache.poi.hwpf.model.types.PICFAbstractType;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
|
|
||||||
|
@ -47,7 +48,7 @@ public class PICFAndOfficeArtData
|
||||||
int offset = startOffset;
|
int offset = startOffset;
|
||||||
|
|
||||||
_picf = new PICF( dataStream, offset );
|
_picf = new PICF( dataStream, offset );
|
||||||
offset += PICF.getSize();
|
offset += PICFAbstractType.getSize();
|
||||||
|
|
||||||
if ( _picf.getMm() == 0x0066 )
|
if ( _picf.getMm() == 0x0066 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
|
import org.apache.poi.hwpf.model.types.LFOAbstractType;
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
import org.apache.poi.util.LittleEndianConsts;
|
import org.apache.poi.util.LittleEndianConsts;
|
||||||
import org.apache.poi.util.POILogFactory;
|
import org.apache.poi.util.POILogFactory;
|
||||||
|
@ -87,7 +88,7 @@ public class PlfLfo
|
||||||
for ( int x = 0; x < _lfoMac; x++ )
|
for ( int x = 0; x < _lfoMac; x++ )
|
||||||
{
|
{
|
||||||
LFO lfo = new LFO( tableStream, offset );
|
LFO lfo = new LFO( tableStream, offset );
|
||||||
offset += LFO.getSize();
|
offset += LFOAbstractType.getSize();
|
||||||
_rgLfo[x] = lfo;
|
_rgLfo[x] = lfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,12 +206,12 @@ public class PlfLfo
|
||||||
|
|
||||||
LittleEndian.putUInt( _lfoMac, outputStream );
|
LittleEndian.putUInt( _lfoMac, outputStream );
|
||||||
|
|
||||||
byte[] bs = new byte[LFO.getSize() * _lfoMac];
|
byte[] bs = new byte[LFOAbstractType.getSize() * _lfoMac];
|
||||||
for ( int i = 0; i < _lfoMac; i++ )
|
for ( int i = 0; i < _lfoMac; i++ )
|
||||||
{
|
{
|
||||||
_rgLfo[i].serialize( bs, i * LFO.getSize() );
|
_rgLfo[i].serialize( bs, i * LFOAbstractType.getSize() );
|
||||||
}
|
}
|
||||||
outputStream.write( bs, 0, LFO.getSize() * _lfoMac );
|
outputStream.write( bs, 0, LFOAbstractType.getSize() * _lfoMac );
|
||||||
|
|
||||||
for ( int i = 0; i < _lfoMac; i++ )
|
for ( int i = 0; i < _lfoMac; i++ )
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,9 @@
|
||||||
package org.apache.poi.hwpf.model;
|
package org.apache.poi.hwpf.model;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import org.apache.poi.hwpf.model.types.StdfBaseAbstractType;
|
||||||
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.IOUtils;
|
import org.apache.poi.util.IOUtils;
|
||||||
|
@ -72,13 +74,11 @@ public final class StyleDescription {
|
||||||
} else if (baseLength == 0x000A) {
|
} else if (baseLength == 0x000A) {
|
||||||
readStdfPost2000 = false;
|
readStdfPost2000 = false;
|
||||||
} else {
|
} else {
|
||||||
logger.log(POILogger.WARN,
|
logger.log(POILogger.WARN, "Style definition has non-standard size of ", baseLength);
|
||||||
"Style definition has non-standard size of ",
|
|
||||||
Integer.valueOf(baseLength));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_stdfBase = new StdfBase(std, offset);
|
_stdfBase = new StdfBase(std, offset);
|
||||||
offset += StdfBase.getSize();
|
offset += StdfBaseAbstractType.getSize();
|
||||||
|
|
||||||
if (readStdfPost2000) {
|
if (readStdfPost2000) {
|
||||||
_stdfPost2000 = new StdfPost2000(std, offset);
|
_stdfPost2000 = new StdfPost2000(std, offset);
|
||||||
|
@ -146,12 +146,7 @@ public final class StyleDescription {
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getPAPX() {
|
public byte[] getPAPX() {
|
||||||
switch (_stdfBase.getStk()) {
|
return _stdfBase.getStk() == PARAGRAPH_STYLE ? _upxs[0].getUPX() : null;
|
||||||
case PARAGRAPH_STYLE:
|
|
||||||
return _upxs[0].getUPX();
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -201,18 +196,18 @@ public final class StyleDescription {
|
||||||
char[] letters = _name.toCharArray();
|
char[] letters = _name.toCharArray();
|
||||||
LittleEndian.putShort(buf, _baseLength, (short) letters.length);
|
LittleEndian.putShort(buf, _baseLength, (short) letters.length);
|
||||||
offset += LittleEndianConsts.SHORT_SIZE;
|
offset += LittleEndianConsts.SHORT_SIZE;
|
||||||
for (int x = 0; x < letters.length; x++) {
|
for (char letter : letters) {
|
||||||
LittleEndian.putShort(buf, offset, (short) letters[x]);
|
LittleEndian.putShort(buf, offset, (short) letter);
|
||||||
offset += LittleEndianConsts.SHORT_SIZE;
|
offset += LittleEndianConsts.SHORT_SIZE;
|
||||||
}
|
}
|
||||||
// get past the null delimiter for the name.
|
// get past the null delimiter for the name.
|
||||||
offset += LittleEndianConsts.SHORT_SIZE;
|
offset += LittleEndianConsts.SHORT_SIZE;
|
||||||
|
|
||||||
for (int x = 0; x < _upxs.length; x++) {
|
for (UPX upx : _upxs) {
|
||||||
short upxSize = (short) _upxs[x].size();
|
short upxSize = (short) upx.size();
|
||||||
LittleEndian.putShort(buf, offset, upxSize);
|
LittleEndian.putShort(buf, offset, upxSize);
|
||||||
offset += LittleEndianConsts.SHORT_SIZE;
|
offset += LittleEndianConsts.SHORT_SIZE;
|
||||||
System.arraycopy(_upxs[x].getUPX(), 0, buf, offset, upxSize);
|
System.arraycopy(upx.getUPX(), 0, buf, offset, upxSize);
|
||||||
offset += upxSize + (upxSize % 2);
|
offset += upxSize + (upxSize % 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,24 +223,16 @@ public final class StyleDescription {
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj)
|
if (this == obj)
|
||||||
return true;
|
return true;
|
||||||
if (obj == null)
|
if (!(obj instanceof StyleDescription))
|
||||||
return false;
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
return false;
|
return false;
|
||||||
StyleDescription other = (StyleDescription) obj;
|
StyleDescription other = (StyleDescription) obj;
|
||||||
if (_name == null) {
|
if (!Objects.equals(_name, other._name)) {
|
||||||
if (other._name != null)
|
|
||||||
return false;
|
return false;
|
||||||
} else if (!_name.equals(other._name))
|
}
|
||||||
|
if (!Objects.equals(_stdfBase, other._stdfBase)) {
|
||||||
return false;
|
return false;
|
||||||
if (_stdfBase == null) {
|
}
|
||||||
if (other._stdfBase != null)
|
return Arrays.equals(_upxs, other._upxs);
|
||||||
return false;
|
|
||||||
} else if (!_stdfBase.equals(other._stdfBase))
|
|
||||||
return false;
|
|
||||||
if (!Arrays.equals(_upxs, other._upxs))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -89,7 +89,6 @@ public final class StyleSheet {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_stshif = new Stshif(tableStream, offset);
|
_stshif = new Stshif(tableStream, offset);
|
||||||
offset += Stshif.getSize();
|
|
||||||
|
|
||||||
// shall we discard cbLSD and mpstilsd?
|
// shall we discard cbLSD and mpstilsd?
|
||||||
|
|
||||||
|
@ -144,9 +143,9 @@ public final class StyleSheet {
|
||||||
out.write(buf);
|
out.write(buf);
|
||||||
|
|
||||||
byte[] sizeHolder = new byte[2];
|
byte[] sizeHolder = new byte[2];
|
||||||
for (int x = 0; x < _styleDescriptions.length; x++) {
|
for (StyleDescription styleDescription : _styleDescriptions) {
|
||||||
if (_styleDescriptions[x] != null) {
|
if (styleDescription != null) {
|
||||||
byte[] std = _styleDescriptions[x].toByteArray();
|
byte[] std = styleDescription.toByteArray();
|
||||||
|
|
||||||
// adjust the size so it is always on a word boundary
|
// adjust the size so it is always on a word boundary
|
||||||
LittleEndian.putShort(sizeHolder, 0, (short) ((std.length) + (std.length % 2)));
|
LittleEndian.putShort(sizeHolder, 0, (short) ((std.length) + (std.length % 2)));
|
||||||
|
@ -179,7 +178,7 @@ public final class StyleSheet {
|
||||||
StyleDescription tsd = this._styleDescriptions[i];
|
StyleDescription tsd = this._styleDescriptions[i];
|
||||||
StyleDescription osd = ss._styleDescriptions[i];
|
StyleDescription osd = ss._styleDescriptions[i];
|
||||||
if (tsd == null && osd == null) continue;
|
if (tsd == null && osd == null) continue;
|
||||||
if (tsd == null || osd == null || !osd.equals(tsd)) return false;
|
if (osd == null || !osd.equals(tsd)) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.poi.hwpf.model.TabDescriptor;
|
import org.apache.poi.hwpf.model.TabDescriptor;
|
||||||
|
import org.apache.poi.hwpf.model.types.TBDAbstractType;
|
||||||
import org.apache.poi.hwpf.usermodel.BorderCode;
|
import org.apache.poi.hwpf.usermodel.BorderCode;
|
||||||
import org.apache.poi.hwpf.usermodel.DateAndTime;
|
import org.apache.poi.hwpf.usermodel.DateAndTime;
|
||||||
import org.apache.poi.hwpf.usermodel.DropCapSpecifier;
|
import org.apache.poi.hwpf.usermodel.DropCapSpecifier;
|
||||||
|
@ -155,7 +156,7 @@ public final class ParagraphSprmUncompressor
|
||||||
newPAP.setFNoLnn (sprm.getOperand() != 0);
|
newPAP.setFNoLnn (sprm.getOperand() != 0);
|
||||||
break;
|
break;
|
||||||
case 0xd:
|
case 0xd:
|
||||||
/**handle tabs . variable parameter. seperate processing needed*/
|
// handle tabs . variable parameter. seperate processing needed
|
||||||
handleTabs(newPAP, sprm);
|
handleTabs(newPAP, sprm);
|
||||||
break;
|
break;
|
||||||
case 0xe:
|
case 0xe:
|
||||||
|
@ -204,7 +205,7 @@ public final class ParagraphSprmUncompressor
|
||||||
break;
|
break;
|
||||||
case 0x1b:
|
case 0x1b:
|
||||||
byte param = (byte)sprm.getOperand();
|
byte param = (byte)sprm.getOperand();
|
||||||
/** @todo handle paragraph postioning*/
|
// TODO: handle paragraph postioning
|
||||||
byte pcVert = (byte) ((param & 0x0c) >> 2);
|
byte pcVert = (byte) ((param & 0x0c) >> 2);
|
||||||
byte pcHorz = (byte) (param & 0x03);
|
byte pcHorz = (byte) (param & 0x03);
|
||||||
if (pcVert != 3)
|
if (pcVert != 3)
|
||||||
|
@ -430,12 +431,12 @@ public final class ParagraphSprmUncompressor
|
||||||
Map<Integer, TabDescriptor> tabMap = new HashMap<>();
|
Map<Integer, TabDescriptor> tabMap = new HashMap<>();
|
||||||
for (int x = 0; x < tabPositions.length; x++)
|
for (int x = 0; x < tabPositions.length; x++)
|
||||||
{
|
{
|
||||||
tabMap.put(Integer.valueOf(tabPositions[x]), tabDescriptors[x]);
|
tabMap.put(tabPositions[x], tabDescriptors[x]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int x = 0; x < delSize; x++)
|
for (int x = 0; x < delSize; x++)
|
||||||
{
|
{
|
||||||
tabMap.remove(Integer.valueOf(LittleEndian.getShort(grpprl, offset)));
|
tabMap.remove((int) LittleEndian.getShort(grpprl, offset));
|
||||||
offset += LittleEndianConsts.SHORT_SIZE;
|
offset += LittleEndianConsts.SHORT_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,8 +444,8 @@ public final class ParagraphSprmUncompressor
|
||||||
int start = offset;
|
int start = offset;
|
||||||
for (int x = 0; x < addSize; x++)
|
for (int x = 0; x < addSize; x++)
|
||||||
{
|
{
|
||||||
Integer key = Integer.valueOf(LittleEndian.getShort(grpprl, offset));
|
Integer key = (int) LittleEndian.getShort(grpprl, offset);
|
||||||
TabDescriptor val = new TabDescriptor( grpprl, start + ((TabDescriptor.getSize() * addSize) + x) );
|
TabDescriptor val = new TabDescriptor( grpprl, start + ((TBDAbstractType.getSize() * addSize) + x) );
|
||||||
tabMap.put(key, val);
|
tabMap.put(key, val);
|
||||||
offset += LittleEndianConsts.SHORT_SIZE;
|
offset += LittleEndianConsts.SHORT_SIZE;
|
||||||
}
|
}
|
||||||
|
@ -458,7 +459,7 @@ public final class ParagraphSprmUncompressor
|
||||||
for (int x = 0; x < tabPositions.length; x++)
|
for (int x = 0; x < tabPositions.length; x++)
|
||||||
{
|
{
|
||||||
Integer key = list.get(x);
|
Integer key = list.get(x);
|
||||||
tabPositions[x] = key.intValue();
|
tabPositions[x] = key;
|
||||||
if (tabMap.containsKey( key ))
|
if (tabMap.containsKey( key ))
|
||||||
tabDescriptors[x] = tabMap.get(key);
|
tabDescriptors[x] = tabMap.get(key);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue