ability to extends documents facades

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1189612 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-10-27 05:58:54 +00:00
parent f99c017a81
commit c235706423
5 changed files with 37 additions and 16 deletions

View File

@ -137,6 +137,11 @@ public class ExcelToFoConverter extends AbstractExcelConverter
this.foDocumentFacade = new FoDocumentFacade( document );
}
public ExcelToFoConverter( FoDocumentFacade foDocumentFacade )
{
this.foDocumentFacade = foDocumentFacade;
}
protected String createPageMaster( float tableWidthIn, String pageMasterName )
{
final float paperHeightIn;

View File

@ -133,8 +133,6 @@ public class ExcelToHtmlConverter extends AbstractExcelConverter
private String cssClassPrefixTable = "t";
private final String cssClassTable;
private Map<Short, String> excelStyleToClass = new LinkedHashMap<Short, String>();
private final HtmlDocumentFacade htmlDocumentFacade;
@ -144,9 +142,11 @@ public class ExcelToHtmlConverter extends AbstractExcelConverter
public ExcelToHtmlConverter( Document doc )
{
htmlDocumentFacade = new HtmlDocumentFacade( doc );
cssClassTable = htmlDocumentFacade.getOrCreateCssClass(
cssClassPrefixTable,
"border-collapse:collapse;border-spacing:0;" );
}
public ExcelToHtmlConverter( HtmlDocumentFacade htmlDocumentFacade )
{
this.htmlDocumentFacade = htmlDocumentFacade;
}
protected String buildStyle( HSSFWorkbook workbook, HSSFCellStyle cellStyle )
@ -643,7 +643,8 @@ public class ExcelToHtmlConverter extends AbstractExcelConverter
return;
Element table = htmlDocumentFacade.createTable();
table.setAttribute( "class", cssClassTable );
htmlDocumentFacade.addStyleClass( table, cssClassPrefixTable,
"border-collapse:collapse;border-spacing:0;" );
Element tableBody = htmlDocumentFacade.createTableBody();

View File

@ -138,6 +138,11 @@ public class WordToFoConverter extends AbstractWordConverter
this.foDocumentFacade = new FoDocumentFacade( document );
}
public WordToFoConverter( FoDocumentFacade foDocumentFacade )
{
this.foDocumentFacade = foDocumentFacade;
}
protected Element createNoteInline( String noteIndexText )
{
Element inline = foDocumentFacade.createInline();

View File

@ -180,6 +180,11 @@ public class WordToHtmlConverter extends AbstractWordConverter
this.htmlDocumentFacade = new HtmlDocumentFacade( document );
}
public WordToHtmlConverter( HtmlDocumentFacade htmlDocumentFacade )
{
this.htmlDocumentFacade = htmlDocumentFacade;
}
@Override
protected void afterProcess()
{
@ -313,16 +318,6 @@ public class WordToHtmlConverter extends AbstractWordConverter
basicLink );
}
@Override
protected void processImageWithoutPicturesManager( Element currentBlock,
boolean inlined, Picture picture )
{
// no default implementation -- skip
currentBlock.appendChild( htmlDocumentFacade.document
.createComment( "Image link to '"
+ picture.suggestFullFileName() + "' can be here" ) );
}
protected void processImage( Element currentBlock, boolean inlined,
Picture picture, String imageSourcePath )
{
@ -410,6 +405,16 @@ public class WordToHtmlConverter extends AbstractWordConverter
currentBlock.appendChild( root );
}
@Override
protected void processImageWithoutPicturesManager( Element currentBlock,
boolean inlined, Picture picture )
{
// no default implementation -- skip
currentBlock.appendChild( htmlDocumentFacade.document
.createComment( "Image link to '"
+ picture.suggestFullFileName() + "' can be here" ) );
}
@Override
protected void processLineBreak( Element block, CharacterRun characterRun )
{

View File

@ -170,6 +170,11 @@ public class WordToTextConverter extends AbstractWordConverter
this.textDocumentFacade = new TextDocumentFacade( document );
}
public WordToTextConverter( TextDocumentFacade textDocumentFacade )
{
this.textDocumentFacade = textDocumentFacade;
}
@Override
protected void afterProcess()
{