diff options
author | Jeremias Maerki <jeremias@apache.org> | 2005-08-03 18:37:31 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2005-08-03 18:37:31 +0000 |
commit | 148c27f0366d25d3106dcd31f807226099cf23fb (patch) | |
tree | a79823966cf085955c3836ca02c106f6639d78a6 /src | |
parent | e97e57ffea013777827acfd7e458fc8e8d4c8ec2 (diff) | |
download | xmlgraphics-fop-148c27f0366d25d3106dcd31f807226099cf23fb.tar.gz xmlgraphics-fop-148c27f0366d25d3106dcd31f807226099cf23fb.zip |
Proper handling of the color property on page-number and page-number-citatition.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@227245 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
4 files changed, 47 insertions, 39 deletions
diff --git a/src/java/org/apache/fop/fo/flow/PageNumber.java b/src/java/org/apache/fop/fo/flow/PageNumber.java index 14c3bd437..e3afb7ab4 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumber.java +++ b/src/java/org/apache/fop/fo/flow/PageNumber.java @@ -21,7 +21,9 @@ package org.apache.fop.fo.flow; import org.xml.sax.Locator; import org.apache.fop.apps.FOPException; +import org.apache.fop.datatypes.ColorType; import org.apache.fop.datatypes.Length; +import org.apache.fop.fo.Constants; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyList; @@ -68,6 +70,9 @@ public class PageNumber extends FObj { private int wrapOption; // End of property values + // Properties which are not explicitely listed but are still applicable + private ColorType color; + /** * @param parent FONode that is the parent of this object */ @@ -103,6 +108,9 @@ public class PageNumber extends FObj { visibility = pList.get(PR_VISIBILITY).getEnum(); wordSpacing = pList.get(PR_WORD_SPACING).getSpace(); wrapOption = pList.get(PR_WRAP_OPTION).getEnum(); + + // implicit properties + color = pList.get(Constants.PR_COLOR).getColorType(); } /** @@ -129,23 +137,22 @@ public class PageNumber extends FObj { invalidChildError(loc, nsURI, localName); } - /** - * Return the Common Font Properties. - */ + /** @return the Common Font Properties. */ public CommonFont getCommonFont() { return commonFont; } - /** - * Return the Common Border, Padding, and Background Properties. - */ + /** @return the "color" property. */ + public ColorType getColor() { + return color; + } + + /** @return the Common Border, Padding, and Background Properties. */ public CommonBorderPaddingBackground getCommonBorderPaddingBackground() { return commonBorderPaddingBackground; } - /** - * @return the "id" property. - */ + /** @return the "id" property. */ public String getId() { return id; } @@ -155,16 +162,12 @@ public class PageNumber extends FObj { return textDecoration; } - /** - * @see org.apache.fop.fo.FONode#getName() - */ + /** @see org.apache.fop.fo.FONode#getName() */ public String getName() { return "fo:page-number"; } - /** - * @see org.apache.fop.fo.FObj#getNameId() - */ + /** @see org.apache.fop.fo.FObj#getNameId() */ public int getNameId() { return FO_PAGE_NUMBER; } diff --git a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java index 178d5fdee..775479b43 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java +++ b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java @@ -21,7 +21,9 @@ package org.apache.fop.fo.flow; import org.xml.sax.Locator; import org.apache.fop.apps.FOPException; +import org.apache.fop.datatypes.ColorType; import org.apache.fop.datatypes.Length; +import org.apache.fop.fo.Constants; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyList; @@ -72,6 +74,9 @@ public class PageNumberCitation extends FObj { private int wrapOption; // End of property values + // Properties which are not explicitely listed but are still applicable + private ColorType color; + /** * @param parent FONode that is the parent of this object */ @@ -108,6 +113,9 @@ public class PageNumberCitation extends FObj { visibility = pList.get(PR_VISIBILITY).getEnum(); wordSpacing = pList.get(PR_WORD_SPACING).getSpace(); wrapOption = pList.get(PR_WRAP_OPTION).getEnum(); + + // implicit properties + color = pList.get(Constants.PR_COLOR).getColorType(); } /** @@ -129,42 +137,37 @@ public class PageNumberCitation extends FObj { invalidChildError(loc, nsURI, localName); } - /** - * Return the Common Font Properties. - */ + /** @return the Common Font Properties. */ public CommonFont getCommonFont() { return commonFont; } + /** @return the "color" property. */ + public ColorType getColor() { + return color; + } + /** @return the "text-decoration" property. */ public CommonTextDecoration getTextDecoration() { return textDecoration; } - /** - * Return the "id" property. - */ + /** @return the "id" property. */ public String getId() { return id; } - /** - * Return the "ref-id" property. - */ + /** @return the "ref-id" property. */ public String getRefId() { return refId; } - /** - * @see org.apache.fop.fo.FObj#getName() - */ + /** @see org.apache.fop.fo.FObj#getName() */ public String getName() { return "fo:page-number-citation"; } - /** - * @see org.apache.fop.fo.FObj#getNameId() - */ + /** @see org.apache.fop.fo.FObj#getNameId() */ public int getNameId() { return FO_PAGE_NUMBER_CITATION; } diff --git a/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java index 0957cf36f..bd075f45d 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java @@ -105,6 +105,7 @@ public class PageNumberCitationLayoutManager extends LeafNodeLayoutManager { inline.setOffset(font.getAscender()); inline.addTrait(Trait.FONT_NAME, font.getFontName()); inline.addTrait(Trait.FONT_SIZE, new Integer(font.getFontSize())); + inline.addTrait(Trait.COLOR, fobj.getColor()); TraitSetter.addTextDecoration(inline, fobj.getTextDecoration()); return inline; diff --git a/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java index dd58e992d..17c40aece 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java @@ -48,23 +48,24 @@ public class PageNumberLayoutManager extends LeafNodeLayoutManager { public InlineArea get(LayoutContext context) { // get page string from parent, build area - TextArea inline = new TextArea(); + TextArea text = new TextArea(); String str = getCurrentPV().getPageNumberString(); int width = 0; for (int count = 0; count < str.length(); count++) { width += font.getCharWidth(str.charAt(count)); } - inline.setTextArea(str); - inline.setIPD(width); - inline.setBPD(font.getAscender() - font.getDescender()); - inline.setOffset(font.getAscender()); - inline.addTrait(Trait.FONT_NAME, font.getFontName()); - inline.addTrait(Trait.FONT_SIZE, + text.setTextArea(str); + text.setIPD(width); + text.setBPD(font.getAscender() - font.getDescender()); + text.setOffset(font.getAscender()); + text.addTrait(Trait.FONT_NAME, font.getFontName()); + text.addTrait(Trait.FONT_SIZE, new Integer(font.getFontSize())); + text.addTrait(Trait.COLOR, fobj.getColor()); - TraitSetter.addTextDecoration(inline, fobj.getTextDecoration()); + TraitSetter.addTextDecoration(text, fobj.getTextDecoration()); - return inline; + return text; } |