diff options
author | Jeremias Maerki <jeremias@apache.org> | 2005-07-15 17:52:39 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2005-07-15 17:52:39 +0000 |
commit | b17fd7370cb6e6abe05d515f75f422741bf1a461 (patch) | |
tree | 761dfd5f083fac77f51adebed5104e88ed23429d /src/java/org/apache | |
parent | ca87a2126be73769a808cc98b283d1e1f8c0208c (diff) | |
download | xmlgraphics-fop-b17fd7370cb6e6abe05d515f75f422741bf1a461.tar.gz xmlgraphics-fop-b17fd7370cb6e6abe05d515f75f422741bf1a461.zip |
Bugzilla #35749:
IDs on fo:wrapper didn't register on the pages because fo:wrapper didn't have an LM that does that job for it.
The new LM for wrapper creates a dummy area so addId() can be triggered. No area is actually sent to the area tree. The WrapperLM is simply inserted before its children.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@219226 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
3 files changed, 62 insertions, 3 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java b/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java index abc54efb3..74c4d160b 100644 --- a/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java +++ b/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java @@ -332,6 +332,9 @@ public class LayoutManagerMapping implements LayoutManagerMaker { public class WrapperLayoutManagerMaker extends Maker { public void make(FONode node, List lms) { + //We insert the wrapper LM before it's children so an ID + //on the node can be registered on a page. + lms.add(new WrapperLayoutManager((Wrapper)node)); Iterator baseIter; baseIter = node.getChildNodes(); if (baseIter == null) { diff --git a/src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java b/src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java index 04c9e3136..e0fc04dcc 100644 --- a/src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java @@ -169,9 +169,11 @@ public abstract class LeafNodeLayoutManager extends AbstractLayoutManager addId(); InlineArea area = getEffectiveArea(); - offsetArea(area, context); - widthAdjustArea(area, context); - parentLM.addChildArea(area); + if (area.getAllocIPD() > 0 || area.getAllocBPD() > 0) { + offsetArea(area, context); + widthAdjustArea(area, context); + parentLM.addChildArea(area); + } while (posIter.hasNext()) { posIter.next(); diff --git a/src/java/org/apache/fop/layoutmgr/WrapperLayoutManager.java b/src/java/org/apache/fop/layoutmgr/WrapperLayoutManager.java new file mode 100644 index 000000000..e7341b817 --- /dev/null +++ b/src/java/org/apache/fop/layoutmgr/WrapperLayoutManager.java @@ -0,0 +1,54 @@ +/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.layoutmgr;
+
+import org.apache.fop.area.inline.InlineArea;
+import org.apache.fop.fo.flow.Wrapper;
+
+/**
+ * This is the layout manager for the fo:wrapper formatting object.
+ */
+public class WrapperLayoutManager extends LeafNodeLayoutManager {
+
+ private Wrapper fobj;
+
+ /**
+ * Creates a new LM for fo:wrapper.
+ * @param node the fo:wrapper
+ */
+ public WrapperLayoutManager(Wrapper node) {
+ super(node);
+ fobj = node;
+ }
+
+ /** @see org.apache.fop.layoutmgr.LeafNodeLayoutManager */
+ public InlineArea get(LayoutContext context) {
+ //Create a zero-width, zero-height dummy area so this node can
+ //participate in the ID handling. Otherwise, addId() wouldn't
+ //be called.
+ InlineArea area = new InlineArea();
+ return area;
+ }
+
+ /** @see org.apache.fop.layoutmgr.LeafNodeLayoutManager#addId() */
+ protected void addId() {
+ getPSLM().addIDToPage(fobj.getId());
+ }
+
+}
|