]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Code to handle "no content" conditions.
authorJeremias Maerki <jeremias@apache.org>
Fri, 18 Mar 2005 13:21:39 +0000 (13:21 +0000)
committerJeremias Maerki <jeremias@apache.org>
Fri, 18 Mar 2005 13:21:39 +0000 (13:21 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_KnuthStylePageBreaking@198515 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java

index cc05436ecba61f60f16ff760820b2b9f9346d7a9..cb1aab7490aabcbe3b438e312a7719c92e7a8830 100644 (file)
@@ -424,21 +424,23 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
         MinOptMax range = new MinOptMax(relDims.ipd);
         BlockContainerBreaker breaker = new BlockContainerBreaker(this, range);
         breaker.doLayout(relDims.bpd);
-        boolean contentOverflows = (breaker.deferredAlg.getPageBreaks().size() > 1);
-        usedBPD = relDims.bpd - breaker.getDifferenceOfFirstPart(); 
-
-        Position bcPosition = new BlockContainerPosition(this, breaker);
+        boolean contentOverflows = breaker.isOverflow();
         LinkedList returnList = new LinkedList();
-        returnList.add(new KnuthBox(0, bcPosition, false));
+        if (!breaker.isEmpty()) {
+            usedBPD = relDims.bpd - breaker.getDifferenceOfFirstPart(); 
 
-        //TODO Maybe check for page overflow when autoHeight=true
-        if (!autoHeight & (contentOverflows/*usedBPD > relDims.bpd*/)) {
-            log.warn("Contents overflow block-container viewport: clipping");
-            if (fobj.getOverflow() == EN_HIDDEN) {
-                clip = true;
-            } else if (fobj.getOverflow() == EN_ERROR_IF_OVERFLOW) {
-                //TODO Throw layout exception
-                clip = true;
+            Position bcPosition = new BlockContainerPosition(this, breaker);
+            returnList.add(new KnuthBox(0, bcPosition, false));
+    
+            //TODO Maybe check for page overflow when autoHeight=true
+            if (!autoHeight & (contentOverflows/*usedBPD > relDims.bpd*/)) {
+                log.warn("Contents overflow block-container viewport: clipping");
+                if (fobj.getOverflow() == EN_HIDDEN) {
+                    clip = true;
+                } else if (fobj.getOverflow() == EN_ERROR_IF_OVERFLOW) {
+                    //TODO Throw layout exception
+                    clip = true;
+                }
             }
         }
 
@@ -481,6 +483,14 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
             return pbp.difference;
         }
         
+        public boolean isOverflow() {
+            if (isEmpty()) {
+                return false;
+            } else {
+                return (deferredAlg.getPageBreaks().size() > 1);
+            }
+        }
+        
         protected LayoutManager getTopLevelLM() {
             return bclm;
         }