*/
private void openStyled(Element element, Writer out) throws IOException {
// If the block/inline element had associated style information
Styles styles = element.getStyles();
VDXMLStyleProperties style = STYLE_FACTORY.getVDXMLStyle(styles);
if (style != null) {
// Then we will may need to write out some styling markup.
// First, calculate if the style has any properties that are not
// already in effect from the parent.
VDXMLStyleProperties current = (VDXMLStyleProperties)
summaryStyles.peek();
VDXMLStyleProperties canonical = style.removeDuplicate(current);
// If there were some non-duplicate values
if (!canonical.isEmpty()) {
// Then we definitely need to write out some styling markup.
// Before we do, see if we can use the synthetic reverse video
// property instead of the more verbose explicit background
// and foreground color changes.
// If the colours we are to use are reversed from the current
if (current.isReverseVideo(canonical)) {
// Then set the synthetic reverse video property to
// be the inverse of the parent value.
VDXMLBinaryValue currentReverseVideo = (VDXMLBinaryValue)
current.getReverseVideo().getValue();
canonical.setReverseVideo(
new VDXMLReverseVideoStyleProperty(
currentReverseVideo.inverse()));
}
// Save away the styles we are using for the end call so child
// elements can use these values to re-establish non-boolean
// styles which they changed.
canonicalStyles.push(canonical);
// Update the summary state properties so child elements can
// figure out what styles are in effect at the moment.
VDXMLStyleProperties summary = current.merge(canonical);
summaryStyles.push(summary);
// Write out the styles as the start of a range (for booleans)
writeStyle(VDXMLStyleRange.START, canonical, out);