Class odf.ListStyleToCss
Defined in: ListStylesToCss.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<inner> |
addListStyleRule(styleSheet, name, node)
In label-width-and-position mode of specifying list layout the margin and indent specified in
the paragraph style is additive to the layout specified in the list style.
|
<inner> |
addRule(styleSheet, name, node)
Adds a CSS rule for every ODF list style
|
<inner> |
applyContentBasedStyles(styleSheet, odfBody, listStyles)
Adds new CSS rules based on any properties in
the ODF list content if they affect the final style
|
applyListStyles(styleSheet, styleTree, odfBody)
Creates CSS styles from the given ODF list styles and applies them to the stylesheet
|
|
<inner> |
convertToPxValue(value)
Takes a value with a valid CSS unit and converts it to a CSS pixel value
|
<inner> |
escapeCSSString(value)
Return the supplied value with any backslashes escaped, and double-quotes escaped
|
<inner> |
getAllContentRules(listStyleNode)
Takes a text:list-style element and returns the generated CSS
content rules for each list level in the list style
|
<inner> |
getBulletRule(node)
Gets the CSS content for a bullet list
|
<inner> |
getContentRule(node)
Gets the CSS generated content rule for the list style
|
<inner> |
Gets the CSS content for a image bullet list
|
<inner> |
getNumberRule(node)
Gets the CSS content for a numbered list
|
<inner> |
isMatchingListStyle(list, matchingStyleName)
Determines whether the list element style-name matches the style-name we require
|
Method Detail
<inner>
{undefined}
addListStyleRule(styleSheet, name, node)
In label-width-and-position mode of specifying list layout the margin and indent specified in
the paragraph style is additive to the layout specified in the list style.
fo:margin-left text:space-before fo:text-indent +-----------+
+---------------->+------------------>+----------------->| label | LIST TEXT
+-----------+
+---------------->+------------------>+-------------------->LIST TEXT LIST TEXT LIST TEXT
text:min-label-width
To get this additive behaviour we calculate an offset from the left side of the page which is
the space-before + min-label-width. We then apply this offset to each text:list-item
element and apply the negative value of the offset to each text:list element. This allows the positioning
provided in the list style to apply relative to the paragraph style as we desired. Then on each
::before pseudo-element which holds the label we apply the negative value of the min-label-width to complete
the alignment from the left side of the page. We then apply the min-label-distance as padding to the right
of the ::before psuedo-element to complete the list label placement.
For the label-alignment mode the paragraph style overrides the list style but we specify offsets for
the text:list and text:list-item elements to keep the code consistent between the modes
Diagram and implementation based on: https://wiki.openoffice.org/wiki/Number_layout
- Parameters:
- {!CSSStyleSheet} styleSheet
- {!string} name
- {!Element} node
- Returns:
- {undefined}
<inner>
{undefined}
addRule(styleSheet, name, node)
Adds a CSS rule for every ODF list style
- Parameters:
- {!CSSStyleSheet} styleSheet
- {!string} name
- {!Element} node
- Returns:
- {undefined}
<inner>
{undefined}
applyContentBasedStyles(styleSheet, odfBody, listStyles)
Adds new CSS rules based on any properties in
the ODF list content if they affect the final style
- Parameters:
- {!CSSStyleSheet} styleSheet
- {!Element} odfBody
- {!Object.} listStyles
- Returns:
- {undefined}
{undefined}
applyListStyles(styleSheet, styleTree, odfBody)
Creates CSS styles from the given ODF list styles and applies them to the stylesheet
- Parameters:
- {!CSSStyleSheet} styleSheet
- {!odf.StyleTree.Tree} styleTree
- {!Element} odfBody
- Returns:
- {undefined}
<inner>
{!number}
convertToPxValue(value)
Takes a value with a valid CSS unit and converts it to a CSS pixel value
- Parameters:
- {!string} value
- Returns:
- {!number}
<inner>
{!string}
escapeCSSString(value)
Return the supplied value with any backslashes escaped, and double-quotes escaped
- Parameters:
- {!string} value
- Returns:
- {!string}
<inner>
{!Object.}
getAllContentRules(listStyleNode)
Takes a text:list-style element and returns the generated CSS
content rules for each list level in the list style
- Parameters:
- {!Element} listStyleNode
- Returns:
- {!Object.}
<inner>
{!string}
getBulletRule(node)
Gets the CSS content for a bullet list
- Parameters:
- {!Element} node
- Returns:
- {!string}
<inner>
{!string}
getContentRule(node)
Gets the CSS generated content rule for the list style
- Parameters:
- {!Element} node
- Returns:
- {!string}
<inner>
{!string}
getImageRule()
Gets the CSS content for a image bullet list
- Returns:
- {!string}
<inner>
{!string}
getNumberRule(node)
Gets the CSS content for a numbered list
- Parameters:
- {!Element} node
- Returns:
- {!string}
<inner>
{!boolean}
isMatchingListStyle(list, matchingStyleName)
Determines whether the list element style-name matches the style-name we require
- Parameters:
- {!Element|undefined} list
- {!string} matchingStyleName
- Returns:
- {!boolean}