From 68516ec9507b6fe4b46778dd5c752fef291c5479 Mon Sep 17 00:00:00 2001 From: Luis Bernardo Date: Mon, 17 Nov 2014 15:59:43 +0000 Subject: [PATCH] skip float if inside a table and emit warning git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_BasicSideFloats@1640175 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/fo/flow/Float.java | 16 ++++++++++++++++ .../fop/layoutmgr/inline/FloatLayoutManager.java | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/java/org/apache/fop/fo/flow/Float.java b/src/java/org/apache/fop/fo/flow/Float.java index 449c12bce..a10d9c74d 100644 --- a/src/java/org/apache/fop/fo/flow/Float.java +++ b/src/java/org/apache/fop/fo/flow/Float.java @@ -20,6 +20,7 @@ package org.apache.fop.fo.flow; // XML +import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.apache.fop.apps.FOPException; @@ -38,6 +39,7 @@ public class Float extends FObj { private int clear; // End of property values private boolean inWhiteSpace; + private boolean disabled; /** * Base constructor @@ -99,4 +101,18 @@ public class Float extends FObj { public boolean getInWhiteSpace() { return inWhiteSpace; } + + public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList pList) + throws FOPException { + if (findAncestor(FO_TABLE) > 0) { + disabled = true; + getFOValidationEventProducer().unimplementedFeature(this, "fo:table", getName(), getLocator()); + } else { + super.processNode(elementName, locator, attlist, pList); + } + } + + public boolean isDisabled() { + return disabled; + } } diff --git a/src/java/org/apache/fop/layoutmgr/inline/FloatLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/FloatLayoutManager.java index 2185ddb47..4bb481dcd 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/FloatLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/FloatLayoutManager.java @@ -53,7 +53,7 @@ public class FloatLayoutManager extends InlineStackingLayoutManager { public LinkedList getNextKnuthElements(LayoutContext context, int alignment) { - if (!floatContentAreaAdded) { + if (!floatContentAreaAdded && !floatContent.isDisabled()) { floatContentLM = new FloatContentLayoutManager(floatContent); floatContentLM.setParent(this); floatContentLM.initialize(); -- 2.39.5