*
* @return a map of text properties.
*/
private Map<OdfStyleProperty, String> getTextStylePropertiesDeep(OdfStylableElement element) {
String styleName = element.getStyleName();
OdfStyleBase styleElement = element.getAutomaticStyles().getStyle(styleName, element.getStyleFamily());
if (styleElement == null) {
styleElement = element.getDocumentStyle();
}
TreeMap<OdfStyleProperty, String> result = new TreeMap<OdfStyleProperty, String>();
while (styleElement != null) {
// check if it is the style:defaut-style
if ((styleElement.getPropertiesElement(OdfStylePropertiesSet.ParagraphProperties) == null)
&& (styleElement.getPropertiesElement(OdfStylePropertiesSet.TextProperties) == null)) {
styleElement = ((Document) ((OdfFileDom) styleElement.getOwnerDocument()).getDocument())
.getDocumentStyles().getDefaultStyle(styleElement.getFamily());
}
OdfStyleFamily family = OdfStyleFamily.Text;
if (family != null) {
for (OdfStyleProperty property : family.getProperties()) {
if (styleElement.hasProperty(property)) {
result.put(property, styleElement.getProperty(property));
}
}
}
styleElement = styleElement.getParentStyle();
}
return result;
}