Difference between revisions of "Calc/Implementation/Calc styles export"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Basic concept of Styles)
(Basic concept of Styles)
Line 19: Line 19:
 
<style:default-style> <number:number-style>,  <style:style> etc.  
 
<style:default-style> <number:number-style>,  <style:style> etc.  
 
ScXMLImportWrapper::ExportToComponent() is called with different parameters to export each file inside ods, such as styles.xml, content.xml.
 
ScXMLImportWrapper::ExportToComponent() is called with different parameters to export each file inside ods, such as styles.xml, content.xml.
 +
 +
==Styles export  sequence diagrams overview==
 +
 
 +
<style:font-face> elements export is mainly in following sequence,
 +
[[File:styles_fontf_export.jpg]]
 +
<style: default style> elements is exported generally as following sequece,
 +
[[File:styles_def_expt.jpg]]
 +
Automatic styles export is mainly as below,
 +
[[File:styles_auto_expt.jpg]]
  
 
==Styles export  sequence diagrams overview==
 
==Styles export  sequence diagrams overview==

Revision as of 11:06, 8 August 2012


Basic concept of Styles

In the OpenDocument format, formatting properties, which influences the visual representation of objects, are stored in styles. Using styles to store formatting properties has advantages such as, format information is separated from document content, and styles enable consistent formatting and changing of formatting for objects subject to styles. Following picture is a sample of OpenDocument styles.xml file. This file is the main file for styles storage.

Styles.xml .jpg

As styles.xml shows, both <style:default-style> and <style:style> in <office:styles> have a “style:name” attribute. In fact, styles and font face declarations are referenced by their style:name attribute[1]. A referenced style or font face declaration should be defined in the same file as the reference, or in styles.xml. Styles built in the stylist (can be used by click menu "Format"--"Styles and formatting") or ones that you create there, will have names like “Heading 1” or Custom Citation. Automatic styles <office:automatic-styles> will have names consisting of style-family abbreviation followed by a number; a style name such as T1 is the first automatic style for style:family="text"; P3 would be the third style for paragraphs, ta2 would be the second style for a table, ro4 would be the fourth style for a table row, etc(please refer content.xml for OpenDocument). The other attribute of interest is the optional parent-style-name, which you will find in styles that have been derived from other styles. <style:font-face> element represents a font face declaration which documents the properties of a font used in a document. OpenDocument font face declarations may have an unique name. This name can be used inside styles (as an attribute of <style:text-properties> element) as value of the style:font-name attribute to select a font face declaration. <style:style> element represents styles,and <style:default-style> element represents default styles. A default style specifies default formatting properties for a style family. These defaults are used if a formatting property is neither specified by an automatic nor a common style. Default styles exist for all style families that are represented by the <style:style> element specified by the style:family attribute. An OpenDocument document should contain the default styles of the style families for which are used in common or automatic styles in the document.<office:master-styles> <style:master-page> defines page styles which is in stylist.

File:Styles font face.xml .jpg

Attributes for elements defined by OpenDocument are divided between those used by structural elements[2] versus those used by <style:*-properties> elements. Attributes have default values defined by reference[2] standard, and when any element appears in a document instance without such an attribute, consumers should behave as if the attribute is present with the defined default value. <style:*-properties> elements is commonly used to aggregate attributes of one type for specific style. Formatting definitions are expressed as attributes on the <style:*-properties> elements or as child elements of these elements. From code perspective, these <office:styles> , <office:automatic-styles> etc elements in styles.xml is written by SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ), when export ods, eClass is XML_SPREADSHEET. For example, ImplExportStyles() inside SvXMLExport::exportDoc() is for writing <office:styles> elements, _ExportFontDecls(); is for <office:font-face-decls>, and ImplExportAutoStyles() is for <office:automatic-styles>. Inside ImplExportStyles() , ScXMLExport::_ExportStyles will call exportDefaultStyle(), exportDataStyles(), exportStyleFamily() etc, in turn to export <style:default-style> <number:number-style>, <style:style> etc. ScXMLImportWrapper::ExportToComponent() is called with different parameters to export each file inside ods, such as styles.xml, content.xml.

Styles export sequence diagrams overview

<style:font-face> elements export is mainly in following sequence, File:Styles fontf export.jpg <style: default style> elements is exported generally as following sequece, File:Styles def expt.jpg Automatic styles export is mainly as below, File:Styles auto expt.jpg

Styles export sequence diagrams overview

<style:font-face> elements export is mainly in following sequence, File:Styles font fexport.xml .jpg <style: default style> elements is exported generally as following sequece, File:Styles def exp.xml .jpg Automatic styles export is mainly as below, File:Styles auto exp.xml .jpg

Personal tools