Class Index | File Index

Classes


Class odf.Formatting


Defined in: Formatting.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Method Summary
Method Attributes Method Name and Description
<inner>  
buildStyleChain(node, collectedChains)
Builds up a style chain for a given node by climbing up all parent nodes and checking for style information
<inner>  
Takes a provided style chain and calculates the resulting inherited style, starting from the outer-most to the inner-most style
 
createDerivedStyleObject(parentStyleName, family, overrides)
Create a style object (JSON-equivalent) that is equivalent to inheriting from the parent style and family, and applying the specified overrides.
<inner>  
getAppliedStyles(nodes, calculatedStylesCache)
Returns an array of all unique styles in the given text nodes
 
getAppliedStylesForElement(node, calculatedStylesCache)
Returns a the applied style to the current node
 
Loop over the elements and place the attributes style:name and style:display-name in an array.
 
getContentSize(styleName, styleFamily)
Gets the width and height of content area in pixels.
<inner>  
 
Get the default tab-stop distance defined for this document See http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#property-style_tab-stop-distance
 
Get the name of the first common style in the parent style chain.
<inner>  
Returns a font face declarations map, where the key is the style:name and the value is the svg:font-family or null, if none set but a svg:font-face-uri
<inner>  
getInheritedStyleAttributes(styleNode, includeSystemDefault)
Returns a JSON representation of the style attributes of a given style element, also containing attributes inherited from it's ancestry - up to and including the document's default style for the family.
<inner>  
Find a master page definition with the specified name
<inner>  
getPageLayoutStyleElement(styleName, styleFamily)
Gets the associated page layout style node for the given style and family.
<inner>  
getStyleAttributes(styleNode)
Returns a JSON representation of the style attributes of a given style element
<inner>  
getStyleElement(styleName, family, styleElements)
Fetch style element associated with the requested name and family
<inner>  
Returns a JSON representation of the built-in default style attributes of a given style family.
 
hasParagraphStyle(styleName)
Returns if there is an automatic or common paragraph style with the given name.
<inner>  
Returns true if the supplied style node is a common style.
 
isStyleUsed(styleElement)
Returns if the given style is used anywhere in the document.
<inner>  
lengthInPx(length, defaultValue)
 
setOdfContainer(odfcontainer)
 
updateStyle(styleNode, properties)
Overrides the specific properties on the styleNode from the values in the supplied properties Object.
Class Detail
odf.Formatting()
Method Detail
<inner> {!Array.|undefined} buildStyleChain(node, collectedChains)
Builds up a style chain for a given node by climbing up all parent nodes and checking for style information
Parameters:
{!Node} node
{!Object.>=} collectedChains
Dictionary to add any new style chains to
Returns:
{!Array.|undefined}

<inner> {!odf.Formatting.AppliedStyle} calculateAppliedStyle(styleChain)
Takes a provided style chain and calculates the resulting inherited style, starting from the outer-most to the inner-most style
Parameters:
{!Array.} styleChain
Ordered list starting from inner-most style to outer-most style
Returns:
{!odf.Formatting.AppliedStyle}

{!odf.Formatting.StyleData} createDerivedStyleObject(parentStyleName, family, overrides)
Create a style object (JSON-equivalent) that is equivalent to inheriting from the parent style and family, and applying the specified overrides. This contains logic for simulating inheritance for automatic styles
Parameters:
{!string} parentStyleName
{!string} family
{!odf.Formatting.StyleData} overrides
Returns:
{!odf.Formatting.StyleData}

<inner> {!Array.} getAppliedStyles(nodes, calculatedStylesCache)
Returns an array of all unique styles in the given text nodes
Parameters:
{!Array.} nodes
{!Object.=} calculatedStylesCache
Short-lived cache of calculated styles. Useful if a function is looking up the style information for multiple nodes without updating any style definitions.
Returns:
{!Array.}

{!odf.Formatting.AppliedStyle|undefined} getAppliedStylesForElement(node, calculatedStylesCache)
Returns a the applied style to the current node
Parameters:
{!Node} node
{!Object.=} calculatedStylesCache
Short-lived cache of calculated styles. Useful if a function is looking up the style information for multiple nodes without updating any style definitions.
Returns:
{!odf.Formatting.AppliedStyle|undefined}

{!Array} getAvailableParagraphStyles()
Loop over the elements and place the attributes style:name and style:display-name in an array.
Returns:
{!Array}

{!{width: number|height: number}} getContentSize(styleName, styleFamily)
Gets the width and height of content area in pixels.
Parameters:
{string} styleName
{string} styleFamily
Returns:
{!{width: number|height: number}} Available content size in pixels

<inner> {?Element} getDefaultStyleElement(family)
Parameters:
{!string} family
Returns:
{?Element}

{?{value: !number|unit: !string}} getDefaultTabStopDistance()
Get the default tab-stop distance defined for this document See http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#property-style_tab-stop-distance
Returns:
{?{value: !number|unit: !string}}

{?string} getFirstCommonParentStyleNameOrSelf(styleName)
Get the name of the first common style in the parent style chain. If none is found, null is returned and you should assume the Default style.
Parameters:
{!string} styleName
Returns:
{?string}

<inner> {!Object.} getFontMap()
Returns a font face declarations map, where the key is the style:name and the value is the svg:font-family or null, if none set but a svg:font-face-uri
Returns:
{!Object.}

<inner> {!odf.Formatting.StyleData} getInheritedStyleAttributes(styleNode, includeSystemDefault)
Returns a JSON representation of the style attributes of a given style element, also containing attributes inherited from it's ancestry - up to and including the document's default style for the family.
Parameters:
{!Element} styleNode
{!boolean=} includeSystemDefault
True by default. Specify false to suppress inclusion of system defaults
Returns:
{!odf.Formatting.StyleData}

<inner> {?Element} getMasterPageElement(pageName)
Find a master page definition with the specified name
Parameters:
{!string} pageName
Returns:
{?Element}

<inner> {?Element} getPageLayoutStyleElement(styleName, styleFamily)
Gets the associated page layout style node for the given style and family.
Parameters:
{!string} styleName
{!string} styleFamily
either 'paragraph' or 'table'
Returns:
{?Element}

<inner> {!odf.Formatting.StyleData} getStyleAttributes(styleNode)
Returns a JSON representation of the style attributes of a given style element
Parameters:
{!Element} styleNode
Returns:
{!odf.Formatting.StyleData}

<inner> {?Element} getStyleElement(styleName, family, styleElements)
Fetch style element associated with the requested name and family
Parameters:
{!string} styleName
{!string} family
{!Array.=} styleElements
Specific style trees to search. If unspecified will search both automatic and user-created styles
Returns:
{?Element}

<inner> {!odf.Formatting.StyleData} getSystemDefaultStyleAttributes(styleFamily)
Returns a JSON representation of the built-in default style attributes of a given style family. Creates a deep copy, so the result can be modified by the callee. If there are no such attributes, null is returned.
Parameters:
{string} styleFamily
Returns:
{!odf.Formatting.StyleData}

{!boolean} hasParagraphStyle(styleName)
Returns if there is an automatic or common paragraph style with the given name.
Parameters:
{!string} styleName
Returns:
{!boolean}

<inner> {!boolean} isCommonStyleElement(styleNode)
Returns true if the supplied style node is a common style. From the OpenDocument spec: "Common and automatic styles behave differently in OpenDocument editing consumers. Common styles are presented to the user as a named set of formatting properties. The formatting properties of an automatic style are presented to a user as properties of the object to which the style is applied." http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#element-office_automatic-styles
Parameters:
{!Node} styleNode
Returns:
{!boolean}

{!boolean} isStyleUsed(styleElement)
Returns if the given style is used anywhere in the document.
Parameters:
{!Element} styleElement
Returns:
{!boolean}

<inner> {!number|undefined} lengthInPx(length, defaultValue)
Parameters:
{?string|undefined} length
{string=} defaultValue
Returns:
{!number|undefined}

{undefined} setOdfContainer(odfcontainer)
Parameters:
{!odf.OdfContainer} odfcontainer
Returns:
{undefined}

updateStyle(styleNode, properties)
Overrides the specific properties on the styleNode from the values in the supplied properties Object. If a newStylePrefix is supplied, this method will automatically generate a unique name for the style node
Parameters:
{!Element} styleNode
{!odf.Formatting.StyleData} properties
Prefix to put in front of new auto styles

Documentation generated by JsDoc Toolkit 2.4.0 on Thu Aug 06 2015 04:10:41 GMT+0200 (MESZ)