From 5fac6eaf12691399074e5674de75d6d45e2a6584 Mon Sep 17 00:00:00 2001 From: Peter Hancock Date: Thu, 29 Sep 2011 10:18:53 +0000 Subject: [PATCH] Fix FO tree hierarchy: BasicLink shouldn't inherit from Inline git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1177251 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/fop/fo/flow/BasicLink.java | 39 ++++++++++++++++++- .../layoutmgr/inline/InlineLayoutManager.java | 10 ++++- src/java/org/apache/fop/pdf/PDFFactory.java | 1 - 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/src/java/org/apache/fop/fo/flow/BasicLink.java b/src/java/org/apache/fop/fo/flow/BasicLink.java index ee3171188..c3a735db6 100644 --- a/src/java/org/apache/fop/fo/flow/BasicLink.java +++ b/src/java/org/apache/fop/fo/flow/BasicLink.java @@ -22,9 +22,11 @@ package org.apache.fop.fo.flow; import org.xml.sax.Locator; import org.apache.fop.apps.FOPException; +import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.ValidationException; +import org.apache.fop.fo.properties.StructurePointerPropertySet; /** * Class modelling the @@ -34,9 +36,14 @@ import org.apache.fop.fo.ValidationException; * and whether that link is external (uses a URI) or internal (an id * reference). */ -public class BasicLink extends Inline { +public class BasicLink extends InlineLevel implements StructurePointerPropertySet { // The value of properties relevant for fo:basic-link. + private Length alignmentAdjust; + private int alignmentBaseline; + private Length baselineShift; + private int dominantBaseline; + private String ptr; // private ToBeImplementedProperty destinationPlacementOffset; private String externalDestination; // private ToBeImplementedProperty indicateDestination; @@ -65,6 +72,11 @@ public class BasicLink extends Inline { /** {@inheritDoc} */ public void bind(PropertyList pList) throws FOPException { super.bind(pList); + alignmentAdjust = pList.get(PR_ALIGNMENT_ADJUST).getLength(); + alignmentBaseline = pList.get(PR_ALIGNMENT_BASELINE).getEnum(); + baselineShift = pList.get(PR_BASELINE_SHIFT).getLength(); + dominantBaseline = pList.get(PR_DOMINANT_BASELINE).getEnum(); + ptr = pList.get(PR_X_PTR).getString(); // used for accessibility // destinationPlacementOffset = pList.get(PR_DESTINATION_PLACEMENT_OFFSET); externalDestination = pList.get(PR_EXTERNAL_DESTINATION).getString(); // indicateDestination = pList.get(PR_INDICATE_DESTINATION); @@ -111,6 +123,31 @@ public class BasicLink extends Inline { } } + /** @return the "alignment-adjust" property */ + public Length getAlignmentAdjust() { + return alignmentAdjust; + } + + /** @return the "alignment-baseline" property */ + public int getAlignmentBaseline() { + return alignmentBaseline; + } + + /** @return the "baseline-shift" property */ + public Length getBaselineShift() { + return baselineShift; + } + + /** @return the "dominant-baseline" property */ + public int getDominantBaseline() { + return dominantBaseline; + } + + /** {@inheritDoc} */ + public String getPtr() { + return ptr; + } + /** * Get the value of the internal-destination property. * diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java index 14ce7474a..e1899646d 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java @@ -32,6 +32,7 @@ import org.apache.fop.area.inline.InlineArea; import org.apache.fop.area.inline.InlineBlockParent; import org.apache.fop.area.inline.InlineParent; import org.apache.fop.datatypes.Length; +import org.apache.fop.fo.flow.BasicLink; import org.apache.fop.fo.flow.Inline; import org.apache.fop.fo.flow.InlineLevel; import org.apache.fop.fo.flow.Leader; @@ -136,6 +137,11 @@ public class InlineLayoutManager extends InlineStackingLayoutManager { alignmentBaseline = ((Leader)fobj).getAlignmentBaseline(); baselineShift = ((Leader)fobj).getBaselineShift(); dominantBaseline = ((Leader)fobj).getDominantBaseline(); + } else if (fobj instanceof BasicLink) { + alignmentAdjust = ((BasicLink)fobj).getAlignmentAdjust(); + alignmentBaseline = ((BasicLink)fobj).getAlignmentBaseline(); + baselineShift = ((BasicLink)fobj).getBaselineShift(); + dominantBaseline = ((BasicLink)fobj).getDominantBaseline(); } if (borderProps != null) { padding = borderProps.getPadding(CommonBorderPaddingBackground.BEFORE, false, this); @@ -209,8 +215,8 @@ public class InlineLayoutManager extends InlineStackingLayoutManager { } else { area = new InlineBlockParent(); } - if (fobj instanceof Inline) { - TraitSetter.setProducerID(area, getInlineFO().getId()); + if (fobj instanceof Inline || fobj instanceof BasicLink) { + TraitSetter.setProducerID(area, fobj.getId()); } return area; } diff --git a/src/java/org/apache/fop/pdf/PDFFactory.java b/src/java/org/apache/fop/pdf/PDFFactory.java index 64941be94..a981dae88 100644 --- a/src/java/org/apache/fop/pdf/PDFFactory.java +++ b/src/java/org/apache/fop/pdf/PDFFactory.java @@ -64,7 +64,6 @@ import org.apache.fop.fonts.truetype.FontFileReader; import org.apache.fop.fonts.truetype.TTFSubSetFile; import org.apache.fop.fonts.type1.PFBData; import org.apache.fop.fonts.type1.PFBParser; -import org.apache.xmlgraphics.xmp.Metadata; /** * This class provides method to create and register PDF objects. -- 2.39.5