Loading...
Searching...
No Matches
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

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

## Public Attributes

| fontdict
| fillimages
| ruleconversions
| c_drawfillimage
| c_fo
| c_page_width
| c_page_height
| c_text_align
| c_border_model
| c_width
| c_fn
| c_hp
| c_text_position
| c_text_line_through_style
| c_text_underline_style

## 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 61 of file odf2xhtml.py.

## Constructor & Destructor Documentation

## __init__()

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

Definition at line 63 of file odf2xhtml.py.

## Member Function Documentation

## c_border_model()

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

Convert to CSS2 border model.

Definition at line 141 of file odf2xhtml.py.

## c_drawfillimage()

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 132 of file odf2xhtml.py.

## c_fn()

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 161 of file odf2xhtml.py.

Here is the call graph for this function:

## c_fo()

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

XSL formatting attributes.

Definition at line 136 of file odf2xhtml.py.

## c_hp()

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

Definition at line 198 of file odf2xhtml.py.

Here is the caller graph for this function:

## c_page_height()

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

Set height of box.

Definition at line 261 of file odf2xhtml.py.

## c_page_width()

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 243 of file odf2xhtml.py.

## c_text_align()

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

Text align.

Definition at line 152 of file odf2xhtml.py.

## c_text_line_through_style()

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 256 of file odf2xhtml.py.

## c_text_position()

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 186 of file odf2xhtml.py.

## c_text_underline_style()

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 249 of file odf2xhtml.py.

## c_width()

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

Set width of box.

Definition at line 148 of file odf2xhtml.py.

## convert_styles()

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 267 of file odf2xhtml.py.

Here is the call graph for this function:

## save_font()

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 118 of file odf2xhtml.py.

Here is the caller graph for this function:

## Member Data Documentation

## c_border_model

odf.odf2xhtml.StyleToCSS.c_border_model

Definition at line 100 of file odf2xhtml.py.

## c_drawfillimage

odf.odf2xhtml.StyleToCSS.c_drawfillimage

Definition at line 71 of file odf2xhtml.py.

## c_fn

odf.odf2xhtml.StyleToCSS.c_fn

Definition at line 102 of file odf2xhtml.py.

## c_fo

odf.odf2xhtml.StyleToCSS.c_fo

Definition at line 72 of file odf2xhtml.py.

## c_hp

odf.odf2xhtml.StyleToCSS.c_hp

Definition at line 103 of file odf2xhtml.py.

## c_page_height

odf.odf2xhtml.StyleToCSS.c_page_height

Definition at line 97 of file odf2xhtml.py.

## c_page_width

odf.odf2xhtml.StyleToCSS.c_page_width

Definition at line 96 of file odf2xhtml.py.

## c_text_align

odf.odf2xhtml.StyleToCSS.c_text_align

Definition at line 98 of file odf2xhtml.py.

## c_text_line_through_style

odf.odf2xhtml.StyleToCSS.c_text_line_through_style

Definition at line 105 of file odf2xhtml.py.

## c_text_position

odf.odf2xhtml.StyleToCSS.c_text_position

Definition at line 104 of file odf2xhtml.py.

## c_text_underline_style

odf.odf2xhtml.StyleToCSS.c_text_underline_style

Definition at line 106 of file odf2xhtml.py.

## c_width

odf.odf2xhtml.StyleToCSS.c_width

Definition at line 101 of file odf2xhtml.py.

## fillimages

odf.odf2xhtml.StyleToCSS.fillimages

Definition at line 68 of file odf2xhtml.py.

## fontdict

odf.odf2xhtml.StyleToCSS.fontdict

Definition at line 65 of file odf2xhtml.py.

## ruleconversions

odf.odf2xhtml.StyleToCSS.ruleconversions

Definition at line 70 of file odf2xhtml.py.

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

- odf/odf2xhtml.py