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) {
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();
--- /dev/null
+/*\r
+ * Copyright 2005 The Apache Software Foundation.\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+/* $Id$ */\r
+\r
+package org.apache.fop.layoutmgr;\r
+\r
+import org.apache.fop.area.inline.InlineArea;\r
+import org.apache.fop.fo.flow.Wrapper;\r
+\r
+/**\r
+ * This is the layout manager for the fo:wrapper formatting object.\r
+ */\r
+public class WrapperLayoutManager extends LeafNodeLayoutManager {\r
+ \r
+ private Wrapper fobj;\r
+\r
+ /**\r
+ * Creates a new LM for fo:wrapper.\r
+ * @param node the fo:wrapper\r
+ */\r
+ public WrapperLayoutManager(Wrapper node) {\r
+ super(node);\r
+ fobj = node;\r
+ }\r
+\r
+ /** @see org.apache.fop.layoutmgr.LeafNodeLayoutManager */\r
+ public InlineArea get(LayoutContext context) {\r
+ //Create a zero-width, zero-height dummy area so this node can \r
+ //participate in the ID handling. Otherwise, addId() wouldn't \r
+ //be called.\r
+ InlineArea area = new InlineArea();\r
+ return area;\r
+ }\r
+ \r
+ /** @see org.apache.fop.layoutmgr.LeafNodeLayoutManager#addId() */\r
+ protected void addId() {\r
+ getPSLM().addIDToPage(fobj.getId());\r
+ }\r
+ \r
+}\r