Package org.docx4j.model
Class PropertyResolver
java.lang.Object
org.docx4j.model.PropertyResolver
- Direct Known Subclasses:
ImmutablePropertyResolver
This class works out the actual set of properties (paragraph or run)
which apply, following the order specified in ECMA-376.
From ECMA-376 > Part3 > 2 Introduction to WordprocessingML > 2.8 Styles > 2.8.10 Style Application
at http://www.documentinteropinitiative.org/implnotes/ecma-376/P3-2.8.10.aspx
(See also Part 4, 2.7.2 which is the normative bit...)
With the various flavors of styles available, multiple style types can be
applied to the same content within a file, which means that properties must
be applied in a specific deterministic order. As with inheritance, the
resulting formatting properties set by one type can be unchanged, removed,
or altered by following types.
The following table illustrates the order of application of these defaults,
and which properties are impacted by each:
This process can be described as follows:
First, the document defaults are applied to all runs and paragraphs in
the document.
Next, the table style properties are applied to each table in the document,
following the conditional formatting inclusions and exclusions specified
per table.
Next, numbered item and paragraph properties are applied to each paragraph
formatted with a numbering style.
Next, paragraph and run properties are
applied to each paragraph as defined by the paragraph style.
Next, run properties are applied to each run with a specific character style
applied.
Finally, we apply direct formatting (paragraph or run properties not from
styles).
-----------
Things which are unclear:
- the role of w:link on a paragraph style (eg Heading1 links to "Heading1char"),
experimentation in Word 2007 suggests the w:link is not used at all
- indeed, "Heading1char" is not used at all?
-----------
docx4all does not use this; its org.docx4all.swing.text.StyleSheet
uses MutableAttributeSet's resolve function to climb the style hierarchy.
This is most relevant to XSLFO, which unlike CSS, doesn't have a concept of
style. HTML NG2 uses CSS inheritance, and so doesn't need it.
- Author:
- jharrop
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanactivateStyle(String styleId) booleanprotected voidprotected voidprotected voidgetEffectivePPr(String styleId) Follow the resolution rules to return the paragraph properties which actually apply, given this paragraph style Note 1: the properties are not the definition of any style name returned.getEffectivePPr(PPr expressPPr) Follow the resolution rules to return the paragraph properties which actually apply, given this pPr element (on a w:p).getEffectiveRPr(String styleId) apply the rPr in the stack of styles, including documentDefaultRPrgetEffectiveRPr(String styleId, boolean applyDocDefaultsRFonts, boolean applyDocDefaultsSz, boolean applyDocDefaultsLang) apply the rPr in the stack of styles, optionally including documentDefaultRPrgetEffectiveRPr(RPr expressRPr, PPr pPr) getEffectiveRPrUsingPStyleRPr(RPr expressRPr, RPr rPrFromPStyle) Return effective rPr, as follows: Starting with the rPr from the pStyle, apply character style (if any) specified on the run, then any other direct (ad-hoc) run formatting.getEffectiveTableStyle(TblPr tblPr) intgetLvlFromHeadingStyle(String style) booleanhasDirectRPrFormatting(RPr rPrToApply)
-
Constructor Details
-
PropertyResolver
- Throws:
Docx4JException
-
-
Method Details
-
getDocumentDefaultRPr
-
getDocumentDefaultPPr
-
getEffectiveTableStyle
-
getEffectivePPr
Follow the resolution rules to return the paragraph properties which actually apply, given this pPr element (on a w:p). Note 1: the properties are not the definition of any style name returned. Note 2: run properties are not resolved or returned by this method. What is returned is a live object. If you want to change it, you should clone it first!- Parameters:
expressPPr-- Returns:
-
getEffectivePPr
Follow the resolution rules to return the paragraph properties which actually apply, given this paragraph style Note 1: the properties are not the definition of any style name returned. Note 2: run properties are not resolved or returned by this method. What is returned is a live object. If you want to change it, you should clone it first!- Parameters:
expressPPr-- Returns:
-
getEffectiveRPr
- Parameters:
expressRPr-pPr- -- Returns:
-
getEffectiveRPrUsingPStyleRPr
Return effective rPr, as follows: Starting with the rPr from the pStyle, apply character style (if any) specified on the run, then any other direct (ad-hoc) run formatting.- Parameters:
expressRPr-rPrFromPStyle- should be rPr from the paragraph style (as opposed to rPr in the direct pPr, which is only relevant to the paragraph mark)- Returns:
-
getEffectiveRPr
apply the rPr in the stack of styles, including documentDefaultRPr- Parameters:
styleId-- Returns:
-
getEffectiveRPr
public RPr getEffectiveRPr(String styleId, boolean applyDocDefaultsRFonts, boolean applyDocDefaultsSz, boolean applyDocDefaultsLang) apply the rPr in the stack of styles, optionally including documentDefaultRPr- Parameters:
styleId-- Returns:
- Since:
- 8.2.4
-
applyPPr
-
hasDirectRPrFormatting
-
applyRPr
-
applyRPr
-
getLvlFromHeadingStyle
-
activateStyle
-
activateStyle
-
getStyle
-