incubator-odf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Svante Schubert <svante.schub...@gmail.com>
Subject Code Generation Improvement (earlier: Re: Changing default styles)
Date Thu, 17 Oct 2013 11:13:54 GMT
Before you complain the style handling is nasty, it is indeed improvable
and high on my list of desired change, although I have not yet find any
time (or financial sponsor) to do so.

To understand the desired change, let me explain the annoyance.

In ODF all hard styles are referenced styles as well. Those styles are
called automatic styles.
In contrary to the template styles, their name is arbitrary and may
change after loading/saving a document.
The end user does not want to deal with those automatic styles. It is
just a low level implementation detail of ODF. From the user perspective
there should be only style properties being added to the document content.
An idea to improve this situation is to have a map for the automatic
styles being created injected by code generation. In general, whenever
an XML element has multiple children of an element, which have an ID
such a map is being created on demand with the ID as key and element
reference as content (and code to maintain the map, e.g. update the map,
whenever elements are removed/added by DOM).
Note: In the case of automatic style the ID is not explicit in the XML
(RelaxNG), but the sum of style name and style family attribute. This
information would be given to the Code generation by configuration.

Another thing, that we might want to evaluate, I read that in JAXB in a
version update the number of files have been reduced. I would be curious
on performance/efficiency testing.

BTW the initial reason we were not using JAXB from the beginning was
that ODF has only RelaxNG and JAXB is only supporting W3C schema.

- Svante

Am 17.10.2013 12:48, schrieb Svante Schubert:
> Hello  Benson,
>
> Am 16.10.2013 16:26, schrieb Benson Margulies:
>> OK, but do you see my overall goal here, which is to change the default
>> styles? It's not at all obvious to me how to go about doing that now given
>> what you've written.
> There is a org.odftoolkit.odfdom.doc.StyleTest.java:
>
> 	OdfDocument doc = OdfTextDocument.newTextDocument();
>         OdfOfficeStyles styles = doc.getOrCreateDocumentStyles();
>         OdfDefaultStyle def = styles.getOrCreateDefaultStyle(OdfStyleFamily.Paragraph);
>         def.setProperty(StyleTextPropertiesElement.TextUnderlineColor, "#00FF00");
>
>
> or another way would be:
> 	
> 	OdfDocument doc = OdfTextDocument.newTextDocument();
>         OdfOfficeStyles styles = doc.getOrCreateDocumentStyles();
>         OdfDefaultStyle def = styles.getOrCreateDefaultStyle(OdfStyleFamily.Paragraph);
>         def.setProperty(StyleTextPropertiesElement.TextUnderlineColor, "#00FF00");
>
> (taken from org.odftoolkit.odfdom.doc.OdfDocument.java)
>
>
> Hope this may help you!
> Svante
> 	
>


Mime
View raw message