ODFPY: odf.odf2xhtml.StyleToCSS Class Reference

ODFPY 1.2.0 |

All Classes Namespaces Files Functions Variables
Public Member Functions | Public Attributes | List of all members
odf.odf2xhtml.StyleToCSS Class Reference

The purpose of the StyleToCSS class is to contain the rules to convert ODF styles to CSS2. More...

## Public Member Functions
def | __init__
def | save_font
| It is possible that the HTML browser doesn't know how to show a particular font. More...
def | c_drawfillimage
| Fill a figure with an image. More...
def | c_fo
| XSL formatting attributes. More...
def | c_border_model
| Convert to CSS2 border model. More...
def | c_width
| Set width of box. More...
def | c_text_align
| Text align. More...
def | c_fn
| Generate the CSS font family A generic font can be found in two ways. More...
def | c_text_position
| Text position. More...
def | c_hp
def | c_page_width
| Set width of box HTML doesn't really have a page-width. More...
def | c_text_underline_style
| Set underline decoration HTML doesn't really have a page-width. More...
def | c_text_line_through_style
| Set underline decoration HTML doesn't really have a page-width. More...
def | c_page_height
| Set height of box. More...
def | convert_styles
| Rule is a tuple of (namespace, name). More...

## Public Attributes
| fontdict
| fillimages
| ruleconversions

## Detailed Description

The purpose of the StyleToCSS class is to contain the rules to convert ODF styles to CSS2.

Since it needs the generic fonts, it would probably make sense to also contain the Styles in a dict as well..

Definition at line 62 of file odf2xhtml.py.

## Constructor & Destructor Documentation

def odf.odf2xhtml.StyleToCSS.__init__ | ( |  | self | ) |

Definition at line 64 of file odf2xhtml.py.

## Member Function Documentation

def odf.odf2xhtml.StyleToCSS.c_border_model | ( |  | self,
|  |  | ruleset,
|  |  | sdict,
|  |  | rule,
|  |  | val
| ) |  |

Convert to CSS2 border model.

Definition at line 146 of file odf2xhtml.py.

def odf.odf2xhtml.StyleToCSS.c_drawfillimage | ( |  | self,
|  |  | ruleset,
|  |  | sdict,
|  |  | rule,
|  |  | val
| ) |  |

Fill a figure with an image.

Since CSS doesn't let you resize images this should really be implemented as an absolutely position with a width and a height

Definition at line 135 of file odf2xhtml.py.

def odf.odf2xhtml.StyleToCSS.c_fn | ( |  | self,
|  |  | ruleset,
|  |  | sdict,
|  |  | rule,
|  |  | fontstyle
| ) |  |

Generate the CSS font family A generic font can be found in two ways.

In a <style:font-face> element or as a font-family-generic attribute in text-properties.

Definition at line 169 of file odf2xhtml.py.

Here is the call graph for this function:

def odf.odf2xhtml.StyleToCSS.c_fo | ( |  | self,
|  |  | ruleset,
|  |  | sdict,
|  |  | rule,
|  |  | val
| ) |  |

XSL formatting attributes.

Definition at line 140 of file odf2xhtml.py.

def odf.odf2xhtml.StyleToCSS.c_hp | ( |  | self,
|  |  | ruleset,
|  |  | sdict,
|  |  | rule,
|  |  | hpos
| ) |  |

Definition at line 207 of file odf2xhtml.py.

Here is the caller graph for this function:

def odf.odf2xhtml.StyleToCSS.c_page_height | ( |  | self,
|  |  | ruleset,
|  |  | sdict,
|  |  | rule,
|  |  | val
| ) |  |

Set height of box.

Definition at line 274 of file odf2xhtml.py.

def odf.odf2xhtml.StyleToCSS.c_page_width | ( |  | self,
|  |  | ruleset,
|  |  | sdict,
|  |  | rule,
|  |  | val
| ) |  |

Set width of box HTML doesn't really have a page-width.

It is always 100% of the browser width

Definition at line 253 of file odf2xhtml.py.

def odf.odf2xhtml.StyleToCSS.c_text_align | ( |  | self,
|  |  | ruleset,
|  |  | sdict,
|  |  | rule,
|  |  | align
| ) |  |

Text align.

Definition at line 159 of file odf2xhtml.py.

def odf.odf2xhtml.StyleToCSS.c_text_line_through_style | ( |  | self,
|  |  | ruleset,
|  |  | sdict,
|  |  | rule,
|  |  | val
| ) |  |

Set underline decoration HTML doesn't really have a page-width.

It is always 100% of the browser width

Definition at line 268 of file odf2xhtml.py.

def odf.odf2xhtml.StyleToCSS.c_text_position | ( |  | self,
|  |  | ruleset,
|  |  | sdict,
|  |  | rule,
|  |  | tp
| ) |  |

Text position.

This is used e.g. to make superscript and subscript This attribute can have one or two values.

The first value must be present and specifies the vertical text position as a percentage that relates to the current font height or it takes one of the values sub or super. Negative percentages or the sub value place the text below the baseline. Positive percentages or the super value place the text above the baseline. If sub or super is specified, the application can choose an appropriate text position.

The second value is optional and specifies the font height as a percentage that relates to the current font-height. If this value is not specified, an appropriate font height is used. Although this value may change the font height that is displayed, it never changes the current font height that is used for additional calculations.

Definition at line 195 of file odf2xhtml.py.

def odf.odf2xhtml.StyleToCSS.c_text_underline_style | ( |  | self,
|  |  | ruleset,
|  |  | sdict,
|  |  | rule,
|  |  | val
| ) |  |

Set underline decoration HTML doesn't really have a page-width.

It is always 100% of the browser width

Definition at line 260 of file odf2xhtml.py.

def odf.odf2xhtml.StyleToCSS.c_width | ( |  | self,
|  |  | ruleset,
|  |  | sdict,
|  |  | rule,
|  |  | val
| ) |  |

Set width of box.

Definition at line 154 of file odf2xhtml.py.

def odf.odf2xhtml.StyleToCSS.convert_styles | ( |  | self,
|  |  | ruleset
| ) |  |

Rule is a tuple of (namespace, name).

If the namespace is '' then it is already CSS2

Definition at line 281 of file odf2xhtml.py.

Here is the call graph for this function:

def odf.odf2xhtml.StyleToCSS.save_font | ( |  | self,
|  |  | name,
|  |  | family,
|  |  | generic
| ) |  |

It is possible that the HTML browser doesn't know how to show a particular font.

Fortunately ODF provides generic fallbacks. Unfortunately they are not the same as CSS2. CSS2: serif, sans-serif, cursive, fantasy, monospace ODF: roman, swiss, modern, decorative, script, system This method put the font and fallback into a dictionary

Definition at line 120 of file odf2xhtml.py.

Here is the caller graph for this function:

## Member Data Documentation

odf.odf2xhtml.StyleToCSS.fillimages

Definition at line 69 of file odf2xhtml.py.

odf.odf2xhtml.StyleToCSS.fontdict

Definition at line 66 of file odf2xhtml.py.

odf.odf2xhtml.StyleToCSS.ruleconversions

Definition at line 71 of file odf2xhtml.py.

The documentation for this class was generated from the following file:

- odf/odf2xhtml.py