if (LOG.isLoggable(INFO)) {
OdfDocument odfdoc = OdfDocument.loadDocument(ResourceUtilities.getAbsolutePath(TEST_FILE));
LOG.info("Parsed document.");
OdfElement e = (OdfElement) odfdoc.getContentDom().getDocumentElement();
NodeAction dumpStyles = new NodeAction() {
@Override
protected void apply(Node node, Object arg, int depth) {
String indent = new String();
for (int i = 0; i < depth; i++) {
indent += " ";
}
if (node.getNodeType() == Node.TEXT_NODE) {
LOG.log(INFO, "{0}{1}", new Object[]{indent, node.getNodeName()});
LOG.log(INFO, ": {0}\n", node.getNodeValue());
}
if (node instanceof OdfStylableElement) {
try {
//LOG.info(indent + "-style info...");
OdfStylableElement se = (OdfStylableElement) node;
OdfStyleBase as = se.getAutomaticStyle();
OdfStyle ds = se.getDocumentStyle();
if (as != null) {
LOG.log(INFO, "{0}-AutomaticStyle: {1}", new Object[]{indent, as});
}
if (ds != null) {
LOG.log(INFO, "{0}-OdfDocumentStyle: {1}", new Object[]{indent, ds});
}
} catch (Exception ex) {
LOG.log(Level.SEVERE, ex.getMessage(), ex);
}
}
}
};
dumpStyles.performAction(e, null);
}
}