public static Boolean publishAsynch() { if (publishAsynch==null) { publishAsynch = Docx4jProperties.getProperty("docx4j.events.Docx4jEvent.PublishAsync", false); } return publishAsynch; }
private static boolean shouldUseHighlightInRPr() { if (useHIghlightInRPr==null) { useHIghlightInRPr = Docx4jProperties.getProperty("docx4j.model.properties.PropertyFactory.createPropertyFromCssName.background-color.useHighlightInRPr", false); } return useHIghlightInRPr; }
@Override public String parseFieldArgument(String fieldArgument) { this.fieldArgument = fieldArgument; tSwitchSeparator = Docx4jProperties.getProperty(DOCX4J_FIELDS_TOC_SWITCH_T_SEPARATOR, COMMA); return EMPTY; }
public void fatalError(TransformerException exception) throws TransformerException { if (Docx4jProperties.getProperty("docx4j.openpackaging.exceptions.LogBeforeThrow", true)) { log.error(exception.getMessage(), exception); } // This is an error which the processor cannot recover from; // e.g. a malformed stylesheet or input document // (or a cancelled request) // so I must throw this exception here. throw exception; }
@Override public void beforeMarshal(Object source) { if (Docx4jProperties.getProperty("docx4j.jaxb.marshal.suppressVersionComment", false)==false) { try { if (source instanceof org.docx4j.wml.Body) { xsw.writeComment(Version.getPoweredBy(isNewPkg)); } } catch(XMLStreamException e) { log.error(e.getMessage(), e); } } }
private static NativeDigitsSetting getNativeDigitsSetting() { if (nativeDigitsSetting==null) { nativeDigitsSetting = NativeDigitsSetting.valueOf( Docx4jProperties.getProperty("docx4j.MicrosoftWindows.Region.Format.Numbers.NativeDigits", "National")); } return nativeDigitsSetting; }
private static MicrosoftWordNumeralOption getMicrosoftWordNumeralOption() { if (microsoftWordNumeralOption==null) { microsoftWordNumeralOption = MicrosoftWordNumeralOption.valueOf( Docx4jProperties.getProperty("docx4j.MicrosoftWord.Numeral", "Arabic")); } return microsoftWordNumeralOption; }
private Quantifier getQuantifier() { if (defaultQuantifier!=null) return defaultQuantifier; String q = Docx4jProperties.getProperty("docx4j.model.datastorage.RemovalHandler.Quantifier", "ALL"); if (q.equals("ALL")) { defaultQuantifier = Quantifier.ALL; } else if (q.equals("ALL_BUT_PLACEHOLDERS")) { defaultQuantifier = Quantifier.ALL_BUT_PLACEHOLDERS; } else if (q.equals("ALL_BUT_PLACEHOLDERS_CONTENT")) { defaultQuantifier = Quantifier.ALL_BUT_PLACEHOLDERS_CONTENT; } else if (q.equals("DEFAULT")) { defaultQuantifier = Quantifier.DEFAULT; } else if (q.equals("NAMED")) { defaultQuantifier = Quantifier.NAMED; } else { log.warn("Unknown Quantifier property value: " + q); defaultQuantifier = Quantifier.ALL; } return defaultQuantifier; }
private static java.io.InputStream getResourceViaProperty(String propName, String defaultPath) throws java.io.IOException { String resourcePath= Docx4jProperties.getProperty(propName, defaultPath); log.debug(propName + " resolved to " + resourcePath); InputStream resourceIS = null; try { resourceIS = ResourceUtils.getResource(resourcePath); } catch (IOException ioe) { log.warn(resourcePath + ": " + ioe.getMessage()); } if (resourceIS==null) { log.warn("Property " + propName + " resolved to missing resource " + resourcePath + "; using " + defaultPath); return ResourceUtils.getResource(defaultPath); } else { return resourceIS; } }
/** * Create an empty presentation. * * @return * @throws InvalidFormatException */ public static PresentationMLPackage createPackage() throws InvalidFormatException { String slideSize= Docx4jProperties.getProperties().getProperty("pptx4j.PageSize", "A4"); log.info("Using paper size: " + slideSize); boolean landscape= Docx4jProperties.getProperty("pptx4j.PageOrientationLandscape", true); log.info("Landscape orientation: " + landscape); return createPackage( SlideSizesWellKnown.valueOf(slideSize), landscape); }
if (Docx4jProperties.getProperty("docx4j.jaxb.marshal.suppressVersionComment", false)==true) { commentWritten = true; // fiction super.write(b, off, len);
/** * Get this resource from the location specified in docx4j.properties; * if none is specified, fallback to the default specified * * @param propName * @param defaultPath * @return * @throws java.io.IOException * @since 3.2.0 */ public static java.io.InputStream getResourceViaProperty(String propName, String defaultPath) throws java.io.IOException { String resourcePath= Docx4jProperties.getProperty(propName, defaultPath); log.debug(propName + " resolved to " + resourcePath); InputStream resourceIS = null; try { resourceIS = getResource(resourcePath); } catch (IOException ioe) { log.warn(resourcePath + ": " + ioe.getMessage()); } if (resourceIS==null) { log.warn("Property " + propName + " resolved to missing resource " + resourcePath + "; using " + defaultPath); return getResource(defaultPath); } else { return resourceIS; } }
if (Docx4jProperties.getProperty("docx4j.jaxb.marshal.canonicalize", false)) {
/** Marshal to a W3C document, for object * missing an @XmlRootElement annotation. */ public static org.w3c.dom.Document marshaltoW3CDomDocument(Object o, JAXBContext jc, String uri, String local, Class declaredType) { // TODO - refactor this. try { Marshaller marshaller = jc.createMarshaller(); NamespacePrefixMapperUtils.setProperty(marshaller, NamespacePrefixMapperUtils.getPrefixMapper()); String ignorables = setMcIgnorable(((McIgnorableNamespaceDeclarator)NamespacePrefixMapperUtils.getPrefixMapper()), o); org.w3c.dom.Document doc = XmlUtils.getNewDocumentBuilder().newDocument(); // See http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html marshaller.marshal( new JAXBElement(new QName(uri,local), declaredType, o ), doc); if (Docx4jProperties.getProperty("docx4j.jaxb.marshal.canonicalize", false)) { byte[] bytes = trimNamespaces(doc, ignorables); DocumentBuilder builder = XmlUtils.getDocumentBuilderFactory().newDocumentBuilder(); return builder.parse(new ByteArrayInputStream(bytes)); } else { return doc; } } catch (Exception e) { throw new RuntimeException(e); } }
m.marshal(o, os); if (Docx4jProperties.getProperty("docx4j.jaxb.marshal.canonicalize", false)) {
marshaller.marshal(o, doc); if (Docx4jProperties.getProperty("docx4j.jaxb.marshal.canonicalize", false)) {
if (Docx4jProperties.getProperty(PROPERTY_HTML_OUTPUT_TYPE, true)){ log.info("Outputting well-formed XHTML.."); defaultTemplatesResource = XHTML_TEMPLATE_RESOURCE;
boolean remediate = Docx4jProperties.getProperty("docx4j.toc.BookmarksIntegrity.remediate", false);
if ( Docx4jProperties.getProperty("docx4j.model.datastorage.BindingHandler.Implementation", "BindingTraverserXSLT") .equals("BindingTraverserNonXSLT") ) {
String URL = Docx4jProperties.getProperty("com.plutext.converter.URL", "http://localhost:9016/v1/00000000-0000-0000-0000-000000000000/convert");