diff options
author | Sergey Vladimirov <sergey@apache.org> | 2011-10-27 05:58:54 +0000 |
---|---|---|
committer | Sergey Vladimirov <sergey@apache.org> | 2011-10-27 05:58:54 +0000 |
commit | 06dc8ec50f1ffbc49051e078068ecb58a3458b4e (patch) | |
tree | 433cd94cd62b7eef2ec4a748b58fa4ed89aca27d /src | |
parent | 41a52a504db4743c46103cf900485355ada89d13 (diff) | |
download | poi-06dc8ec50f1ffbc49051e078068ecb58a3458b4e.tar.gz poi-06dc8ec50f1ffbc49051e078068ecb58a3458b4e.zip |
ability to extends documents facades
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1189612 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
5 files changed, 37 insertions, 16 deletions
diff --git a/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoConverter.java b/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoConverter.java index d0b8614d6a..3533757b65 100644 --- a/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoConverter.java +++ b/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoConverter.java @@ -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; diff --git a/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToHtmlConverter.java b/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToHtmlConverter.java index 448f874a28..b00866488c 100644 --- a/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToHtmlConverter.java +++ b/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToHtmlConverter.java @@ -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(); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java index c57d5d0a1c..f2bdcc97a4 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java @@ -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(); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java index 5cea888f2d..3092625e8c 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java @@ -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 ) { @@ -411,6 +406,16 @@ public class WordToHtmlConverter extends AbstractWordConverter } @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 ) { block.appendChild( htmlDocumentFacade.createLineBreak() ); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java index 0933f2854f..f77dc0286c 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java @@ -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() { |