- Timestamp:
- 05/08/08 14:35:29 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/docx4j/src/main/java/org/docx4j/openpackaging/packages/WordprocessingMLPackage.java
r357 r369 319 319 html(result, true); 320 320 } 321 321 322 public void html(javax.xml.transform.Result result, boolean fontFamilyStack) throws Exception { 323 324 // Prep parameters 325 HtmlSettings htmlSettings = new HtmlSettings(); 326 htmlSettings.setFontFamilyStack(fontFamilyStack); 327 328 html(result, htmlSettings); 329 } 322 330 323 331 /** Create an html version of the document. … … 327 335 * 328 336 * */ 329 public void html(javax.xml.transform.Result result, boolean fontFamilyStack) throws Exception {337 public void html(javax.xml.transform.Result result, HtmlSettings htmlSettings) throws Exception { 330 338 331 339 /* … … 352 360 353 361 // Prep parameters 354 Map<String, Object> transformParameters = new java.util.HashMap<String,Object>(); 355 // ..Ensure that the font names in the XHTML have been mapped to these matches 356 // possibly via an extension function in the XSLT 357 if (fontSubstituter==null) { 358 log.debug("Creating new Substituter."); 359 setFontSubstituter(new Substituter()); 360 } else { 361 log.debug("Using existing Substituter."); 362 } 363 transformParameters.put("substituterInstance", fontSubstituter); 364 transformParameters.put("fontFamilyStack", fontFamilyStack); 365 362 if (htmlSettings==null) { 363 htmlSettings = new HtmlSettings(); 364 // ..Ensure that the font names in the XHTML have been mapped to these matches 365 // possibly via an extension function in the XSLT 366 } 367 368 if (htmlSettings.getFontSubstituter()==null) { 369 if (fontSubstituter==null) { 370 log.debug("Creating new Substituter."); 371 setFontSubstituter(new Substituter()); 372 } else { 373 log.debug("Using existing Substituter."); 374 } 375 htmlSettings.setFontSubstituter(fontSubstituter); 376 } 366 377 367 378 // Now do the transformation 368 org.docx4j.XmlUtils.transform(doc, xslt, transformParameters, result);379 org.docx4j.XmlUtils.transform(doc, xslt, htmlSettings.getSettings(), result); 369 380 370 381 log.info("wordDocument transformed to xhtml .."); … … 637 648 638 649 } 650 651 public static class HtmlSettings { 652 653 Boolean fontFamilyStack = Boolean.FALSE; 654 public void setFontFamilyStack(boolean val) { 655 fontFamilyStack = new Boolean(val); 656 } 657 658 Boolean docxWiki = Boolean.FALSE; 659 public void setDocxWiki(boolean val) { 660 docxWiki = new Boolean(val); 661 } 662 663 Substituter fontSubstituter = null; 664 public void setFontSubstituter(Substituter fontSubstituter) { 665 this.fontSubstituter = fontSubstituter; 666 } 667 public Substituter getFontSubstituter() { 668 return fontSubstituter; 669 } 670 671 672 Map<String, Object> getSettings() { 673 Map<String, Object> settings = new java.util.HashMap<String, Object>(); 674 675 settings.put("fontFamilyStack", fontFamilyStack); 676 settings.put("docxWiki", docxWiki); 677 settings.put("substituterInstance", fontSubstituter); 678 679 return settings; 680 } 681 682 } 639 683 640 684 }
Note: See TracChangeset
for help on using the changeset viewer.
