Closed jferard closed 7 years ago
Every style may be in styles.xml > styles or in content.xml > automatic-styles. The meaning of the qualifier "automatic" is not obvious. I will use the term "hidden", which means "hidden to the end user in LO". Thus: every style may be hidden or not hidden. Steps:
boolean isHidden()
method in DataStyle
and StyleTag
interfaces;buildHidden()
for each builder;hidden
field in each object style (row style, cell style, table style, ...) and in data style;StylesContainer
if the styles are in the right container.If everything is fine, let StylesContainer
choose the container on the isHidden
value.
This method of OdsElements
does type-checking:
public void addObjectStyle(final ObjectStyle objectStyle) {
final String family = objectStyle.getFamily();
if ("table-cell".equals(family))
this.stylesContainer.addStyleToStylesCommonStyles(objectStyle);
else if ("text".equals(family))
this.stylesContainer.addStyleToStylesAutomaticStyles(objectStyle);
else
this.stylesContainer.addStyleToContentAutomaticStyles(objectStyle);
}
It will be replaced after refactoring by:
public void addObjectStyle(final ObjectStyle objectStyle) {
if (objectStyle.isHidden()) // text
this.stylesContainer.addStyleToStylesAutomaticStyles(objectStyle);
else // table cell and other
this.stylesContainer.addStyleToContentAutomaticStyles(objectStyle);
}
For
TableCellStyle
s andTextStyle
s, one should be able to decide whether they go in styles.xml or content.xml.Some ideas:
TableCellStyle
(in styles.xml > styles) andTableCellHiddenStyle
(in content.xml > automatic-styles).stylesContainer.addChildCellStyle
would be aTableCellHiddenStyle
.builder.buildHidden
, aTableCellHiddenStyle
.TextStyle
(in styles.xml > common-styles) andTextHiddenStyle
(in content.xml > automatic-styles).