diff --git a/src/main/java/writer2latex/xhtml/content/TextParser.java b/src/main/java/writer2latex/xhtml/content/TextParser.java index 44737a4..7db71e8 100644 --- a/src/main/java/writer2latex/xhtml/content/TextParser.java +++ b/src/main/java/writer2latex/xhtml/content/TextParser.java @@ -1646,6 +1646,7 @@ public class TextParser extends Parser { StyleInfo info = new StyleInfo(); StyleWithProperties style = ofr.getParStyle(styleName); getParSP().readStyle(styleName,info); + getParSP().readParentStyle(styleName,info); Element para = converter.createElement(info.sTagName); node.appendChild(para); @@ -1680,7 +1681,7 @@ public class TextParser extends Parser { protected Element createInline(Element node, String sStyleName) { StyleInfo info = new StyleInfo(); getTextSP().readStyle(sStyleName,info); - + getTextSP().readParentStyle(sStyleName,info); Element newNode = node; if (info.hasAttributes() || !"span".equals(info.sTagName)) { // We (probably) need to create a new element diff --git a/src/main/java/writer2latex/xhtml/style/StyleWithPropertiesParser.java b/src/main/java/writer2latex/xhtml/style/StyleWithPropertiesParser.java index 05ae5a7..135c481 100644 --- a/src/main/java/writer2latex/xhtml/style/StyleWithPropertiesParser.java +++ b/src/main/java/writer2latex/xhtml/style/StyleWithPropertiesParser.java @@ -96,13 +96,35 @@ public abstract class StyleWithPropertiesParser extends StyleParser { info.sClass = getClassNamePrefix() + styleNames.getName(displayName); } } - if (info.sClass != null && !info.sClass.equals(sStyleName)) { - StyleWithProperties classStyle = (StyleWithProperties) getStyles().getStyle(info.sClass); - if (classStyle != null && inlineCSS) { - applyProperties(classStyle, info.props, true); - } + } + + public void readParentStyle(String styleName, StyleInfo info) { + if (!inlineCSS || styleName == null) { + return; } - + if (info.sClass != null && !info.sClass.equals(styleName)) { + StyleWithProperties classStyle = (StyleWithProperties) getStyles().getStyle(info.sClass); + if (classStyle != null) { + applyProperties(classStyle, info.props, true); + String parentName = classStyle.getParentName(); + if (parentName != null && !parentName.equals(styleName)) { + readParentStyle(classStyle.getParentName(), info); + } + } + } + StyleWithProperties style = (StyleWithProperties) getStyles().getStyle(styleName); + if (style == null) { + return; + } + String displayName = style.getDisplayName(); + String exportName = styleNames.getName(displayName); + if (exportName != null && !exportName.trim().equals("null")) { + applyProperties(style, info.props, true); + } + String parentName = style.getParentName(); + if (parentName != null && !parentName.equals(styleName)) { + readParentStyle(style.getParentName(), info); + } } /** Convert style information for used styles