//FIXME: are styles looked up by style-display-name?
No, because the
style-display-name[/m] is only present/set for common styles which you then e.g. also see in the LibreOffice GUI. But styles generated from direct formatting also need to be referenceable. So every style has got a [m]style-name[/m]. And common styles additionally have a [m]style-display-name which can be presented to the user.
E.g. see below the ODT element defining the paragraph style for preformatted text:
<style:style style:name="Preformatted_20_Text" style:display-name="Preformatted Text" style:family="paragraph" style:parent-style-name="Standard" style:class="html">
<style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.199cm" loext:contextual-spacing="false" style:join-border="false"/>
<style:text-properties style:font-name="Bitstream Vera Sans Mono" fo:font-family="'Bitstream Vera Sans Mono'" style:font-family-generic="modern" style:font-pitch="fixed" style:font-name-asian="Bitstream Vera Sans Mono" style:font-family-asian="'Bitstream Vera Sans Mono'" style:font-family-generic-asian="modern" style:font-pitch-asian="fixed" style:font-name-complex="Bitstream Vera Sans Mono" style:font-family-complex="'Bitstream Vera Sans Mono'" style:font-family-generic-complex="modern" style:font-pitch-complex="fixed"/>
</style:style>
And now see below the style for underlined text spans (direct formatting, not editable in the LibreOffice GUI - so NO
style:display-name attribute):
<style:style style:name="underline" style:family="text">
<style:text-properties style:text-underline-style="solid"
style:text-underline-width="auto" style:text-underline-color="font-color"/>
</style:style>
In
ODTDefaultStyles::getStyleName()[/m] you can see the mapping from known internal aliases to real ODT-XML style names defined in [m]styles.xml.
In your example you wrote:
if(!$renderer->styleExists('Command Line Interface')) { //FIXME: are styles looked up by style-display-name?
$style=array('style-display-name' => 'Command Line Interface',
'background-color' => '#feacdc' // some kind of pink
);
$renderer->createParagraphStyle( $style );
}
$options['p_style']='Command Line Interface';
....
generateCode....
This will not work as you only specified the
style-display-name[/m] but not the [m]style-name used for referencing a style. As it is not given, the ODT plugin will generate one dynamically. So you should change your code to:
if(!$renderer->styleExists('Command Line Interface')) { //FIXME: are styles looked up by style-display-name?
$style=array('style-name' => 'Command Line Interface',
'style-display-name' => 'Command Line Interface',
'background-color' => '#feacdc' // some kind of pink
);
$renderer->createParagraphStyle( $style );
}
$options['p_style']='Command Line Interface';
....
generateCode....