xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From phanc...@apache.org
Subject svn commit: r1343285 [14/24] - in /xmlgraphics/fop/branches/Temp_URI_Unification: ./ conf/ examples/embedding/ examples/embedding/java/embedding/ examples/embedding/java/embedding/tools/ lib/ src/codegen/java/org/apache/fop/tools/ src/codegen/unicode/j...
Date Mon, 28 May 2012 15:31:36 GMT
Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/image/loader/batik/PreloaderWMF.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/image/loader/batik/PreloaderWMF.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/image/loader/batik/PreloaderWMF.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/image/loader/batik/PreloaderWMF.java Mon May 28 15:30:46 2012
@@ -25,13 +25,14 @@ import java.io.InputStream;
 
 import javax.xml.transform.Source;
 
-import org.apache.batik.transcoder.wmf.WMFConstants;
-import org.apache.batik.transcoder.wmf.tosvg.WMFRecordStore;
 import org.apache.commons.io.EndianUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import org.apache.batik.transcoder.wmf.WMFConstants;
+import org.apache.batik.transcoder.wmf.tosvg.WMFRecordStore;
+
 import org.apache.xmlgraphics.image.loader.ImageContext;
 import org.apache.xmlgraphics.image.loader.ImageInfo;
 import org.apache.xmlgraphics.image.loader.ImageSize;

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java Mon May 28 15:30:46 2012
@@ -420,7 +420,7 @@ public abstract class AbstractBreaker {
                 alg.setConstantLineWidth(flowBPD);
                 int optimalPageCount = alg.findBreakingPoints(effectiveList, 1, true,
                         BreakingAlgorithm.ALL_BREAKS);
-                if (alg.getIPDdifference() != 0) {
+                if ( Math.abs ( alg.getIPDdifference() ) > 1 ) {
                     addAreas(alg, optimalPageCount, blockList, effectiveList);
                     // *** redo Phase 1 ***
                     log.trace("IPD changes after page " + optimalPageCount);
@@ -752,7 +752,7 @@ public abstract class AbstractBreaker {
         Position positionAtBreak = elementAtBreak.getPosition();
         if (!(positionAtBreak instanceof SpaceResolver.SpaceHandlingBreakPosition)) {
             throw new UnsupportedOperationException(
-                    "Don't know how to restart at position" + positionAtBreak);
+                    "Don't know how to restart at position " + positionAtBreak);
         }
         /* Retrieve the original position wrapped into this space position */
         positionAtBreak = positionAtBreak.getPosition();

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java Mon May 28 15:30:46 2012
@@ -27,6 +27,8 @@ import java.util.Map;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import org.apache.xmlgraphics.util.QName;
+
 import org.apache.fop.area.Area;
 import org.apache.fop.area.AreaTreeObject;
 import org.apache.fop.area.PageViewport;
@@ -35,13 +37,11 @@ import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.flow.Marker;
 import org.apache.fop.fo.flow.RetrieveMarker;
-import org.apache.xmlgraphics.util.QName;
 
 /**
  * The base class for most LayoutManagers.
  */
-public abstract class AbstractLayoutManager extends AbstractBaseLayoutManager
-        implements Constants {
+public abstract class AbstractLayoutManager extends AbstractBaseLayoutManager implements Constants {
 
     /** logging instance */
     private static Log log = LogFactory.getLog(AbstractLayoutManager.class);
@@ -221,8 +221,8 @@ public abstract class AbstractLayoutMana
                         (RetrieveMarker) foNode);
                 }
                 if (foNode != null) {
-                    getPSLM().getLayoutManagerMaker().
-                        makeLayoutManagers(foNode, newLMs);
+                    getPSLM().getLayoutManagerMaker()
+                        .makeLayoutManagers(foNode, newLMs);
                 }
             }
         }
@@ -448,7 +448,7 @@ public abstract class AbstractLayoutMana
     /** {@inheritDoc} */
     @Override
     public String toString() {
-        return (super.toString() + (fobj != null ? "[fobj=" + fobj.toString() + "]" : ""));
+        return (super.toString() + (fobj != null ? "{fobj = " + fobj.toString() + "}" : ""));
     }
 
     /** {@inheritDoc} */

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java Mon May 28 15:30:46 2012
@@ -49,7 +49,7 @@ public final class AreaAdditionUtil {
         if (bslm != null) {
             bslm.addId();
         }
-        
+
         // "unwrap" the NonLeafPositions stored in parentIter
         // and put them in a new list;
         LinkedList<Position> positionList = new LinkedList<Position>();

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java Mon May 28 15:30:46 2012
@@ -22,7 +22,6 @@ package org.apache.fop.layoutmgr;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import org.apache.fop.fo.Constants;
 import org.apache.fop.traits.MinOptMax;
 
 /**

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Mon May 28 15:30:46 2012
@@ -44,8 +44,8 @@ import org.apache.fop.traits.SpaceVal;
 /**
  * LayoutManager for a block-container FO.
  */
-public class BlockContainerLayoutManager extends BlockStackingLayoutManager
-                implements ConditionalElementListener {
+public class BlockContainerLayoutManager extends BlockStackingLayoutManager implements
+        ConditionalElementListener, BreakOpportunity {
 
     /**
      * logging instance
@@ -86,6 +86,7 @@ public class BlockContainerLayoutManager
     private MinOptMax effSpaceBefore;
     private MinOptMax effSpaceAfter;
 
+    private int horizontalOverflow;
     private double contentRectOffsetX = 0;
     private double contentRectOffsetY = 0;
 
@@ -349,7 +350,12 @@ public class BlockContainerLayoutManager
         contentRectOffsetX = 0;
         contentRectOffsetY = 0;
 
-        contentRectOffsetX += fo.getCommonMarginBlock().startIndent.getValue(this);
+        int level = fo.getBidiLevel();
+        if ( ( level < 0 ) || ( ( level & 1 ) == 0 ) ) {
+            contentRectOffsetX += fo.getCommonMarginBlock().startIndent.getValue(this);
+        } else {
+            contentRectOffsetX += fo.getCommonMarginBlock().endIndent.getValue(this);
+        }
         contentRectOffsetY += fo.getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
         contentRectOffsetY += fo.getCommonBorderPaddingBackground().getPaddingBefore(false, this);
 
@@ -396,7 +402,7 @@ public class BlockContainerLayoutManager
             BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
                     getBlockContainerFO().getUserAgent().getEventBroadcaster());
             boolean canRecover = (getBlockContainerFO().getOverflow() != EN_ERROR_IF_OVERFLOW);
-            eventProducer.viewportOverflow(this, getBlockContainerFO().getName(),
+            eventProducer.viewportBPDOverflow(this, getBlockContainerFO().getName(),
                     breaker.getOverflowAmount(), needClip(), canRecover,
                     getBlockContainerFO().getLocator());
         }
@@ -418,7 +424,8 @@ public class BlockContainerLayoutManager
 
         boolean bpDirectionChanges = blockProgressionDirectionChanges();
         Point offset = getAbsOffset();
-        int allocBPD, allocIPD;
+        int allocBPD;
+        int allocIPD;
         if (height.getEnum() == EN_AUTO
                 || (!height.isAbsolute() && getAncestorBlockAreaBPD() <= 0)) {
             //auto height when height="auto" or "if that dimension is not specified explicitly
@@ -547,10 +554,18 @@ public class BlockContainerLayoutManager
                 BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
                         getBlockContainerFO().getUserAgent().getEventBroadcaster());
                 boolean canRecover = (getBlockContainerFO().getOverflow() != EN_ERROR_IF_OVERFLOW);
-                eventProducer.viewportOverflow(this, getBlockContainerFO().getName(),
+                eventProducer.viewportBPDOverflow(this, getBlockContainerFO().getName(),
                         breaker.getOverflowAmount(), needClip(), canRecover,
                         getBlockContainerFO().getLocator());
             }
+            // this handles the IPD (horizontal) overflow
+            if (this.horizontalOverflow > 0) {
+                BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider
+                        .get(getBlockContainerFO().getUserAgent().getEventBroadcaster());
+                boolean canRecover = (getBlockContainerFO().getOverflow() != EN_ERROR_IF_OVERFLOW);
+                eventProducer.viewportIPDOverflow(this, getBlockContainerFO().getName(),
+                        this.horizontalOverflow, needClip(), canRecover, getBlockContainerFO().getLocator());
+            }
         }
 
         setFinished(true);
@@ -834,10 +849,13 @@ public class BlockContainerLayoutManager
         if (referenceArea == null) {
             boolean switchedProgressionDirection = blockProgressionDirectionChanges();
             boolean allowBPDUpdate = autoHeight && !switchedProgressionDirection;
+            int level = getBlockContainerFO().getBidiLevel();
 
             viewportBlockArea = new BlockViewport(allowBPDUpdate);
             viewportBlockArea.addTrait(Trait.IS_VIEWPORT_AREA, Boolean.TRUE);
-
+            if ( level >= 0 ) {
+                viewportBlockArea.setBidiLevel ( level );
+            }
             viewportBlockArea.setIPD(getContentAreaIPD());
             if (allowBPDUpdate) {
                 viewportBlockArea.setBPD(0);
@@ -872,6 +890,9 @@ public class BlockContainerLayoutManager
 
             referenceArea = new Block();
             referenceArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
+            if ( level >= 0 ) {
+                referenceArea.setBidiLevel ( level );
+            }
             TraitSetter.setProducerID(referenceArea, getBlockContainerFO().getId());
 
             if (abProps.absolutePosition == EN_ABSOLUTE) {
@@ -1015,6 +1036,18 @@ public class BlockContainerLayoutManager
         }
     }
 
+    /** {@inheritDoc} */
+    public boolean handleOverflow(int milliPoints) {
+        if (milliPoints > this.horizontalOverflow) {
+            this.horizontalOverflow = milliPoints;
+        }
+        return true;
+    }
+
+    public int getBreakBefore() {
+        return BreakOpportunityHelper.getBreakBefore(this);
+    }
+
 }
 
 

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Mon May 28 15:30:46 2012
@@ -43,8 +43,8 @@ import org.apache.fop.traits.SpaceVal;
 /**
  * LayoutManager for a block FO.
  */
-public class BlockLayoutManager extends BlockStackingLayoutManager
-            implements ConditionalElementListener {
+public class BlockLayoutManager extends BlockStackingLayoutManager implements ConditionalElementListener,
+        BreakOpportunity {
 
     /** logging instance */
     private static Log log = LogFactory.getLog(BlockLayoutManager.class);
@@ -359,6 +359,8 @@ public class BlockLayoutManager extends 
 
             curBlockArea.setIPD(super.getContentAreaIPD());
 
+            curBlockArea.setBidiLevel ( getBlockFO().getBidiLevel() );
+
             TraitSetter.addBreaks(curBlockArea,
                     getBlockFO().getBreakBefore(), getBlockFO().getBreakAfter());
 
@@ -502,5 +504,8 @@ public class BlockLayoutManager extends 
         return true;
     }
 
-}
+    public int getBreakBefore() {
+        return BreakOpportunityHelper.getBreakBefore(this);
+    }
 
+}

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java Mon May 28 15:30:46 2012
@@ -89,19 +89,30 @@ public interface BlockLevelEventProducer
     void overconstrainedAdjustEndIndent(Object source, String elementName, int amount, Locator loc);
 
     /**
-     * Contents overflow a viewport.
+     * Contents IPD overflow a viewport.
      * @param source the event source
      * @param elementName the formatting object
      * @param amount the amount by which the contents overflow (in mpt)
      * @param clip true if the content will be clipped
      * @param canRecover indicates whether FOP can recover from this problem and continue working
      * @param loc the location of the error or null
-     * @throws LayoutException the layout error provoked by the method call
-     * @event.severity FATAL
+     * @event.severity ERROR
      */
-    void viewportOverflow(Object source, String elementName,
-            int amount, boolean clip, boolean canRecover,
-            Locator loc) throws LayoutException;
+    void viewportIPDOverflow(Object source, String elementName, int amount, boolean clip,
+            boolean canRecover, Locator loc);
+
+    /**
+     * Contents BPD overflow a viewport.
+     * @param source the event source
+     * @param elementName the formatting object
+     * @param amount the amount by which the contents overflow (in mpt)
+     * @param clip true if the content will be clipped
+     * @param canRecover indicates whether FOP can recover from this problem and continue working
+     * @param loc the location of the error or null
+     * @event.severity ERROR
+     */
+    void viewportBPDOverflow(Object source, String elementName, int amount, boolean clip,
+            boolean canRecover, Locator loc);
 
     /**
      * Contents overflow a region viewport.

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.xml?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.xml (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.xml Mon May 28 15:30:46 2012
@@ -22,7 +22,8 @@
   <message key="tableFixedAutoWidthNotSupported">table-layout="fixed" and width="auto", but auto-layout not supported =&gt; assuming width="100%".{{locator}}</message>
   <message key="objectTooWide">The extent in inline-progression-direction (width) of a {elementName} is bigger than the available space ({effIPD}mpt &gt; {maxIPD}mpt).{{locator}}</message>
   <message key="overconstrainedAdjustEndIndent">An {elementName} {{locator}} is wider than the available room in inline-progression-dimension. Adjusting end-indent based on overconstrained geometry rules (XSL 1.1, ch. 5.3.4)</message>
-  <message key="viewportOverflow">Content overflows the viewport of an {elementName} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}}</message>
+  <message key="viewportIPDOverflow">Content overflows the viewport of an {elementName} in inline-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}}</message>
+  <message key="viewportBPDOverflow">Content overflows the viewport of an {elementName} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}}</message>
   <message key="regionOverflow">Content overflows the viewport of the {elementName} on page {page} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}}</message>
   <message key="flowNotMappingToRegionBody">Flow "{flowName}" does not map to the region-body in page-master "{masterName}". FOP presently does not support this.{{locator}}</message>
   <message key="pageSequenceMasterExhausted">Subsequences exhausted in page-sequence-master "{pageSequenceMasterName}", {canRecover,if,using previous subsequence,cannot recover}.{{locator}}</message>

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java Mon May 28 15:30:46 2012
@@ -38,7 +38,6 @@ import org.apache.fop.fo.properties.Keep
 import org.apache.fop.fo.properties.SpaceProperty;
 import org.apache.fop.layoutmgr.inline.InlineLayoutManager;
 import org.apache.fop.traits.MinOptMax;
-import org.apache.fop.util.BreakUtil;
 import org.apache.fop.util.ListUtil;
 
 /**
@@ -1036,7 +1035,7 @@ public abstract class BlockStackingLayou
      * @return true if an element has been added due to a break-before.
      */
     protected boolean addKnuthElementsForBreakBefore(List returnList, LayoutContext context) {
-        int breakBefore = getBreakBefore();
+        int breakBefore = BreakOpportunityHelper.getBreakBefore(this);
         if (breakBefore == EN_PAGE
                 || breakBefore == EN_COLUMN
                 || breakBefore == EN_EVEN_PAGE
@@ -1051,27 +1050,6 @@ public abstract class BlockStackingLayou
     }
 
     /**
-     * Returns the break-before value of the current formatting object.
-     * @return the break-before value (Constants.EN_*)
-     */
-    private int getBreakBefore() {
-        int breakBefore = EN_AUTO;
-        if (fobj instanceof BreakPropertySet) {
-            breakBefore = ((BreakPropertySet)fobj).getBreakBefore();
-        }
-        if (true /* uncomment to only partially merge: && breakBefore != EN_AUTO*/) {
-            LayoutManager lm = getChildLM();
-            //It is assumed this is only called when the first LM is active.
-            if (lm instanceof BlockStackingLayoutManager) {
-                BlockStackingLayoutManager bslm = (BlockStackingLayoutManager)lm;
-                breakBefore = BreakUtil.compareBreakClasses(
-                        breakBefore, bslm.getBreakBefore());
-            }
-        }
-        return breakBefore;
-    }
-
-    /**
      * Creates Knuth elements for break-after and adds them to the return list.
      * @param returnList return list to add the additional elements to
      * @param context the layout context
@@ -1249,5 +1227,16 @@ public abstract class BlockStackingLayou
         // TODO startIndent, endIndent
     }
 
+    /**
+     * Whether this LM can handle horizontal overflow error messages (only a BlockContainerLayoutManager can).
+     * @param milliPoints horizontal overflow
+     * @return true if handled by a BlockContainerLayoutManager
+     */
+    public boolean handleOverflow(int milliPoints) {
+        if (getParent() instanceof BlockStackingLayoutManager) {
+            return ((BlockStackingLayoutManager) getParent()).handleOverflow(milliPoints);
+        }
+        return false;
+    }
 }
 

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BreakElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BreakElement.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BreakElement.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BreakElement.java Mon May 28 15:30:46 2012
@@ -21,8 +21,6 @@ package org.apache.fop.layoutmgr;
 
 import java.util.List;
 
-import org.apache.fop.fo.Constants;
-
 /**
  * This class represents an unresolved break possibility.
  */

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java Mon May 28 15:30:46 2012
@@ -640,7 +640,7 @@ public abstract class BreakingAlgorithm 
                 this.par.add(0, KnuthPenalty.DUMMY_ZERO_PENALTY);
             }
         }
-        
+
         // content would overflow, insert empty line/page and try again
         return createNode(
                 lastTooLong.previous.position, lastTooLong.previous.line + 1, 1,

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java Mon May 28 15:30:46 2012
@@ -51,6 +51,7 @@ import org.apache.fop.datatypes.URISpeci
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.extensions.ExternalDocument;
 import org.apache.fop.layoutmgr.inline.ImageLayout;
+import org.apache.fop.traits.WritingMode;
 
 /**
  * LayoutManager for an external-document extension element.  This class is instantiated by
@@ -184,12 +185,12 @@ public class ExternalDocumentLayoutManag
         TraitSetter.setProducerID(imageArea, fobj.getId());
         transferForeignAttributes(imageArea);
 
-        InlineViewport vp = new InlineViewport(imageArea);
+        InlineViewport vp = new InlineViewport(imageArea, fobj.getBidiLevel());
         TraitSetter.setProducerID(vp, fobj.getId());
         vp.setIPD(imageSize.width);
         vp.setBPD(imageSize.height);
         vp.setContentPosition(imageLayout.getPlacement());
-        vp.setOffset(0);
+        vp.setBlockProgressionOffset(0);
 
         //Link them all together...
         lineArea.addInlineArea(vp);
@@ -230,8 +231,9 @@ public class ExternalDocumentLayoutManag
             referenceRect = new Rectangle(0, 0, imageSize.height, imageSize.width);
         }
         FODimension reldims = new FODimension(0, 0);
+        // [TBD] BIDI ALERT
         CTM pageCTM = CTM.getCTMandRelDims(pageSeq.getReferenceOrientation(),
-            Constants.EN_LR_TB, referenceRect, reldims);
+                                           WritingMode.LR_TB, referenceRect, reldims);
 
         Page page = new Page(referenceRect, pageNumber, pageNumberString, isBlank);
 

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java Mon May 28 15:30:46 2012
@@ -215,7 +215,7 @@ public class FlowLayoutManager extends B
     protected List<ListElement> getNextChildElements(LayoutManager childLM, LayoutContext context,
             LayoutContext childLC, int alignment, Stack<LayoutManager> lmStack,
             Position restartPosition, LayoutManager restartLM) {
-        
+
         List<ListElement> childElements;
         if (lmStack == null) {
             childElements = childLM.getNextKnuthElements(childLC, alignment);

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java Mon May 28 15:30:46 2012
@@ -70,7 +70,8 @@ public class InlineKnuthSequence extends
             return false;
         }
         // does the first element of the first paragraph add to an existing word?
-        ListElement lastOldElement, firstNewElement;
+        ListElement lastOldElement;
+        ListElement firstNewElement;
         lastOldElement = getLast();
         firstNewElement = sequence.getElement(0);
         if (firstNewElement.isBox() && !((KnuthElement) firstNewElement).isAuxiliary()

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java Mon May 28 15:30:46 2012
@@ -19,8 +19,6 @@
 
 package org.apache.fop.layoutmgr;
 
-import org.apache.fop.fo.Constants;
-
 /**
  * An instance of this class represents information about a feasible
  * breaking point; it does not represent any piece of content.

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/KnuthSequence.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/KnuthSequence.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/KnuthSequence.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/KnuthSequence.java Mon May 28 15:30:46 2012
@@ -19,12 +19,12 @@
 
 package org.apache.fop.layoutmgr;
 
-import org.apache.fop.util.ListUtil;
-
 import java.util.ArrayList;
 import java.util.List;
 import java.util.ListIterator;
 
+import org.apache.fop.util.ListUtil;
+
 /**
  * Represents a list of {@link KnuthElement Knuth elements}.
  */

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/LayoutContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/LayoutContext.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/LayoutContext.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/LayoutContext.java Mon May 28 15:30:46 2012
@@ -26,6 +26,7 @@ import org.apache.fop.fo.Constants;
 import org.apache.fop.layoutmgr.inline.AlignmentContext;
 import org.apache.fop.layoutmgr.inline.HyphContext;
 import org.apache.fop.traits.MinOptMax;
+import org.apache.fop.traits.WritingMode;
 
 
 /**
@@ -92,7 +93,7 @@ public class LayoutContext {
     //overlap with refIPD. Need to investigate how best to refactor that.
 
     /** the writing mode established by the nearest ancestor reference area */
-    private int writingMode = Constants.EN_LR_TB;
+    private WritingMode writingMode = WritingMode.LR_TB;
 
     /** Current pending space-after or space-end from preceding area */
     private SpaceSpecifier trailingSpace;
@@ -564,7 +565,7 @@ public class LayoutContext {
      * Get the writing mode of the relevant reference area.
      * @return the applicable writing mode
      */
-    public int getWritingMode() {
+    public WritingMode getWritingMode() {
         return writingMode;
     }
 
@@ -572,7 +573,7 @@ public class LayoutContext {
      * Set the writing mode.
      * @param writingMode the writing mode
      */
-    public void setWritingMode(int writingMode) {
+    public void setWritingMode(WritingMode writingMode) {
         this.writingMode = writingMode;
     }
 

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/LayoutException.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/LayoutException.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/LayoutException.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/LayoutException.java Mon May 28 15:30:46 2012
@@ -22,8 +22,8 @@ package org.apache.fop.layoutmgr;
 import java.util.Locale;
 
 import org.apache.fop.events.Event;
-import org.apache.fop.events.EventFormatter;
 import org.apache.fop.events.EventExceptionManager.ExceptionFactory;
+import org.apache.fop.events.EventFormatter;
 
 /**
  * Exception thrown by FOP if an unrecoverable layout error occurs. An example: An area overflows

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java Mon May 28 15:30:46 2012
@@ -20,6 +20,9 @@
 package org.apache.fop.layoutmgr;
 
 import java.util.List;
+
+import org.apache.fop.area.AreaTreeHandler;
+import org.apache.fop.area.Block;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.extensions.ExternalDocument;
 import org.apache.fop.fo.pagination.Flow;
@@ -28,8 +31,6 @@ import org.apache.fop.fo.pagination.Side
 import org.apache.fop.fo.pagination.StaticContent;
 import org.apache.fop.fo.pagination.Title;
 import org.apache.fop.layoutmgr.inline.ContentLayoutManager;
-import org.apache.fop.area.AreaTreeHandler;
-import org.apache.fop.area.Block;
 
 /**
  * The interface for all LayoutManager makers

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java Mon May 28 15:30:46 2012
@@ -67,6 +67,7 @@ import org.apache.fop.fo.pagination.Side
 import org.apache.fop.fo.pagination.StaticContent;
 import org.apache.fop.fo.pagination.Title;
 import org.apache.fop.layoutmgr.inline.BasicLinkLayoutManager;
+import org.apache.fop.layoutmgr.inline.BidiLayoutManager;
 import org.apache.fop.layoutmgr.inline.CharacterLayoutManager;
 import org.apache.fop.layoutmgr.inline.ContentLayoutManager;
 import org.apache.fop.layoutmgr.inline.ExternalGraphicLayoutManager;
@@ -246,28 +247,9 @@ public class LayoutManagerMapping implem
     public static class BidiOverrideLayoutManagerMaker extends Maker {
         /** {@inheritDoc} */
         public void make(FONode node, List lms) {
-            /* [GA] remove broken code
-            if (false) {
-                // this is broken; it does nothing
-                // it should make something like an InlineStackingLM
-                super.make(node, lms);
-            } else {
-                ArrayList childList = new ArrayList();
-                // this is broken; it does nothing
-                // it should make something like an InlineStackingLM
-                super.make(node, childList);
-                for (int count = childList.size() - 1; count >= 0; count--) {
-                    LayoutManager lm = (LayoutManager) childList.get(count);
-                    if (lm instanceof InlineLevelLayoutManager) {
-                        LayoutManager blm = new BidiLayoutManager
-                            ((BidiOverride) node, (InlineLayoutManager) lm);
-                        lms.add(blm);
-                    } else {
-                        lms.add(lm);
-                    }
-                }
+            if ( node instanceof BidiOverride ) {
+                lms.add(new BidiLayoutManager((BidiOverride) node));
             }
-            */
         }
     }
 

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java Mon May 28 15:30:46 2012
@@ -20,7 +20,6 @@
 package org.apache.fop.layoutmgr;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.ListIterator;

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/PageProvider.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/PageProvider.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/PageProvider.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/PageProvider.java Mon May 28 15:30:46 2012
@@ -330,11 +330,11 @@ public class PageProvider implements Con
         boolean isFirstPage = (startPageOfPageSequence == index);
         SimplePageMaster spm = pageSeq.getNextSimplePageMaster(
                 index, isFirstPage, isLastPage, isBlank);
-
         Page page = new Page(spm, index, pageNumberString, isBlank, spanAll);
         //Set unique key obtained from the AreaTreeHandler
         page.getPageViewport().setKey(areaTreeHandler.generatePageViewportKey());
         page.getPageViewport().setForeignAttributes(spm.getForeignAttributes());
+        page.getPageViewport().setWritingModeTraits(pageSeq);
         cachedPages.add(page);
         return page;
     }

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java Mon May 28 15:30:46 2012
@@ -25,6 +25,7 @@ import org.apache.commons.logging.LogFac
 import org.apache.fop.area.AreaTreeHandler;
 import org.apache.fop.area.AreaTreeModel;
 import org.apache.fop.area.LineArea;
+import org.apache.fop.complexscripts.bidi.BidiResolver;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.pagination.PageSequence;
 import org.apache.fop.fo.pagination.PageSequenceMaster;
@@ -78,12 +79,16 @@ public class PageSequenceLayoutManager e
     public void activateLayout() {
         initialize();
 
-        LineArea title = null;
+        // perform step 5.8 of refinement process (Unicode BIDI Processing)
+        if ( areaTreeHandler.isComplexScriptFeaturesEnabled() ) {
+            BidiResolver.resolveInlineDirectionality(getPageSequence());
+        }
 
+        LineArea title = null;
         if (getPageSequence().getTitleFO() != null) {
             try {
-                ContentLayoutManager clm = getLayoutManagerMaker().
-                    makeContentLayoutManager(this, getPageSequence().getTitleFO());
+                ContentLayoutManager clm = getLayoutManagerMaker()
+                    .makeContentLayoutManager(this, getPageSequence().getTitleFO());
                 title = (LineArea) clm.getParentArea(null);
             } catch (IllegalStateException e) {
                 // empty title; do nothing
@@ -143,12 +148,18 @@ public class PageSequenceLayoutManager e
 
     @Override
     protected Page makeNewPage(boolean isBlank) {
-        Page newPage;
+        Page newPage = super.makeNewPage(isBlank);
 
-        do {
-            newPage = super.makeNewPage(isBlank);
-        } while (!getPageSequence().getMainFlow().getFlowName()
-                .equals(newPage.getSimplePageMaster().getRegion(FO_REGION_BODY).getRegionName()));
+        // Empty pages (pages that have been generated from a SPM that has an un-mapped flow name)
+        // cannot layout areas from the main flow.  Blank pages can be created from empty pages.
+
+        if (!isBlank) {
+            while (!getPageSequence().getMainFlow().getFlowName()
+                    .equals(newPage.getSimplePageMaster()
+                            .getRegion(FO_REGION_BODY).getRegionName())) {
+                newPage = super.makeNewPage(isBlank);
+            }
+        }
 
         return newPage;
     }

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/SpaceSpecifier.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/SpaceSpecifier.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/SpaceSpecifier.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/SpaceSpecifier.java Mon May 28 15:30:46 2012
@@ -19,10 +19,11 @@
 
 package org.apache.fop.layoutmgr;
 
-import org.apache.fop.traits.SpaceVal;
 import java.util.ArrayList;
 import java.util.List;
+
 import org.apache.fop.traits.MinOptMax;
+import org.apache.fop.traits.SpaceVal;
 
 /**
  * Accumulate a sequence of space-specifiers (XSL space type) on

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/TopLevelLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/TopLevelLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/TopLevelLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/TopLevelLayoutManager.java Mon May 28 15:30:46 2012
@@ -47,4 +47,4 @@ public interface TopLevelLayoutManager {
      */
     void finishPageSequence();
 
-}
\ No newline at end of file
+}

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/UnresolvedListElementWithLength.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/UnresolvedListElementWithLength.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/UnresolvedListElementWithLength.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/UnresolvedListElementWithLength.java Mon May 28 15:30:46 2012
@@ -21,6 +21,7 @@ package org.apache.fop.layoutmgr;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.apache.fop.traits.MinOptMax;
 
 /**

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java Mon May 28 15:30:46 2012
@@ -59,6 +59,7 @@ public abstract class AbstractGraphicsLa
         Dimension intrinsicSize = new Dimension(
                 fobj.getIntrinsicWidth(),
                 fobj.getIntrinsicHeight());
+        int bidiLevel = fobj.getBidiLevel();
 
         //TODO Investigate if the line-height property has to be taken into the calculation
         //somehow. There was some code here that hints in this direction but it was disabled.
@@ -67,6 +68,7 @@ public abstract class AbstractGraphicsLa
         Rectangle placement = imageLayout.getPlacement();
 
         CommonBorderPaddingBackground borderProps = fobj.getCommonBorderPaddingBackground();
+        setCommonBorderPaddingBackground(borderProps);
 
         //Determine extra BPD from borders and padding
         int beforeBPD = borderProps.getPadding(CommonBorderPaddingBackground.BEFORE, false, this);
@@ -75,30 +77,35 @@ public abstract class AbstractGraphicsLa
         placement.y += beforeBPD;
 
         //Determine extra IPD from borders and padding
-        int startIPD = borderProps.getPadding(CommonBorderPaddingBackground.START, false, this);
-        startIPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.START, false);
-
-        placement.x += startIPD;
+        if ( ( bidiLevel == -1 ) || ( ( bidiLevel & 1 ) == 0 ) ) {
+            int startIPD = borderProps.getPadding(CommonBorderPaddingBackground.START, false, this);
+            startIPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.START, false);
+            placement.x += startIPD;
+        } else {
+            int endIPD = borderProps.getPadding(CommonBorderPaddingBackground.END, false, this);
+            endIPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.END, false);
+            placement.x += endIPD;
+        }
 
         Area viewportArea = getChildArea();
         TraitSetter.setProducerID(viewportArea, fobj.getId());
         transferForeignAttributes(viewportArea);
 
-        InlineViewport vp = new InlineViewport(viewportArea);
+        InlineViewport vp = new InlineViewport(viewportArea, bidiLevel);
         TraitSetter.addStructureTreeElement(vp, fobj.getStructureTreeElement());
         TraitSetter.setProducerID(vp, fobj.getId());
         vp.setIPD(imageLayout.getViewportSize().width);
         vp.setBPD(imageLayout.getViewportSize().height);
         vp.setContentPosition(placement);
         vp.setClip(imageLayout.isClipped());
-        vp.setOffset(0);
+        vp.setBlockProgressionOffset(0);
 
         // Common Border, Padding, and Background Properties
-        TraitSetter.addBorders(vp, fobj.getCommonBorderPaddingBackground()
+        TraitSetter.addBorders(vp, borderProps
                                 , false, false, false, false, this);
-        TraitSetter.addPadding(vp, fobj.getCommonBorderPaddingBackground()
+        TraitSetter.addPadding(vp, borderProps
                                 , false, false, false, false, this);
-        TraitSetter.addBackground(vp, fobj.getCommonBorderPaddingBackground(), this);
+        TraitSetter.addBackground(vp, borderProps, this);
 
         return vp;
     }

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java Mon May 28 15:30:46 2012
@@ -19,12 +19,10 @@
 
 package org.apache.fop.layoutmgr.inline;
 
-import org.apache.fop.area.PageViewport;
 import org.apache.fop.area.Resolvable;
 import org.apache.fop.area.Trait;
 import org.apache.fop.area.inline.InlineArea;
 import org.apache.fop.area.inline.TextArea;
-import org.apache.fop.area.inline.UnresolvedPageNumber;
 import org.apache.fop.fo.flow.AbstractPageNumberCitation;
 import org.apache.fop.fonts.Font;
 import org.apache.fop.fonts.FontInfo;
@@ -81,10 +79,7 @@ public abstract class AbstractPageNumber
     }
 
     /** {@inheritDoc} */
-    public InlineArea get(LayoutContext context) {
-        curArea = getPageNumberCitationInlineArea();
-        return curArea;
-    }
+    public abstract InlineArea get(LayoutContext context);
 
     /**
      * {@inheritDoc}
@@ -98,35 +93,6 @@ public abstract class AbstractPageNumber
     }
 
     /**
-     * If id can be resolved then simply return a text area, otherwise
-     * return a resolvable area
-     *
-     * @return a corresponding InlineArea
-     */
-    private InlineArea getPageNumberCitationInlineArea() {
-        PageViewport page = getPSLM().getFirstPVWithID(fobj.getRefId());
-        TextArea text;
-        if (page != null) {
-            String str = page.getPageNumberString();
-            // get page string from parent, build area
-            text = new TextArea();
-            int width = getStringWidth(str);
-            text.addWord(str, 0);
-            text.setIPD(width);
-            resolved = true;
-        } else {
-            resolved = false;
-            text = new UnresolvedPageNumber(fobj.getRefId(), font);
-            String str = "MMM"; // reserve three spaces for page number
-            int width = getStringWidth(str);
-            text.setIPD(width);
-        }
-        updateTextAreaTraits(text);
-
-        return text;
-    }
-
-    /**
      * Updates the traits for the generated text area.
      * @param text the text area
      */
@@ -152,5 +118,12 @@ public abstract class AbstractPageNumber
         return width;
     }
 
+    /**
+     * @return bidi level governing abstract page number citation
+     */
+    protected int getBidiLevel() {
+        return fobj.getBidiLevel();
+    }
+
 }
 

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java Mon May 28 15:30:46 2012
@@ -24,6 +24,7 @@ import org.apache.fop.datatypes.LengthBa
 import org.apache.fop.datatypes.SimplePercentBaseContext;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fonts.Font;
+import org.apache.fop.traits.WritingMode;
 
 /**
  * The alignment context is carried within a LayoutContext and as
@@ -173,7 +174,7 @@ public class AlignmentContext implements
      * @param lineHeight the computed value of the lineHeight property
      * @param writingMode the current writing mode
      */
-    AlignmentContext(Font font, int lineHeight, int writingMode) {
+    AlignmentContext(Font font, int lineHeight, WritingMode writingMode) {
         this.areaHeight = font.getAscender() - font.getDescender();
         this.lineHeight = lineHeight;
         this.xHeight = font.getXHeight();
@@ -299,6 +300,14 @@ public class AlignmentContext implements
     }
 
     /**
+     * Return the writing mode.
+     * @return the writing mode
+     */
+/*    public WritingMode getWritingMode() {
+        return scaledBaselineTable.getWritingMode();
+    }*/
+
+    /**
      * Calculates the baseline shift value based on the baseline-shift
      * property value.
      * @param baselineShift the baseline shift property value
@@ -504,6 +513,10 @@ public class AlignmentContext implements
                     && parentAlignmentContext.usesInitialBaselineTable());
     }
 
+    /* private boolean isHorizontalWritingMode() {
+        return (getWritingMode() == WritingMode.LR_TB || getWritingMode() == WritingMode.RL_TB);
+    }*/
+
     /** {@inheritDoc} */
     public String toString() {
         StringBuffer sb = new StringBuffer(64);

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java Mon May 28 15:30:46 2012
@@ -69,6 +69,12 @@ public class BasicLinkLayoutManager exte
             res.resolveIDRef(idref, pslm.getFirstPVWithID(idref));
             if (!res.isResolved()) {
                 pslm.addUnresolvedArea(idref, res);
+                if ( area instanceof BasicLinkArea ) {
+                    // establish back-pointer from BasicLinkArea to LinkResolver to
+                    // handle inline area unflattening during line bidi reordering;
+                    // needed to create internal link trait on synthesized basic link area
+                    ((BasicLinkArea)area).setResolver(res);
+                }
             }
         } else if (fobj.hasExternalDestination()) {
             String url = URISpecification.getURL(fobj.getExternalDestination());

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java Mon May 28 15:30:46 2012
@@ -19,56 +19,19 @@
 
 package org.apache.fop.layoutmgr.inline;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.fop.area.inline.InlineArea;
 import org.apache.fop.fo.flow.BidiOverride;
 
-
 /**
- * If this bidi has a different writing mode direction
- * ltr or rtl than its parent writing mode then this
- * reverses the inline areas (at the character level).
+ * Layout manager for fo:bidi-override.
  */
-public class BidiLayoutManager extends LeafNodeLayoutManager {
-
-    private List children;
+public class BidiLayoutManager extends InlineLayoutManager {
 
     /**
      * Construct bidi layout manager.
-     * @param node bidi override FO
-     * @param cLM parent layout manager
+     * @param node an BidiOverride FONode
      */
-    public BidiLayoutManager(BidiOverride node, InlineLayoutManager cLM) {
+    public BidiLayoutManager(BidiOverride node) {
         super(node);
-        setParent(cLM);
-        children = new ArrayList();
-/*
-        for (int count = cLM.size() - 1; count >= 0; count--) {
-            InlineArea ia = cLM.get(count);
-            if (ia instanceof Word) {
-                // reverse word
-                Word word = (Word) ia;
-                StringBuffer sb = new StringBuffer(word.getWord());
-                word.setWord(sb.reverse().toString());
-            }
-            children.add(ia);
-        }
-*/
-    }
-
-    /** @return number of children */
-    public int size() {
-        return children.size();
-    }
-
-    /**
-     * @param index of child inline area
-     * @return a child inline area
-     */
-    public InlineArea get(int index) {
-        return (InlineArea) children.get(index);
     }
 
 }

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java Mon May 28 15:30:46 2012
@@ -77,13 +77,18 @@ public class CharacterLayoutManager exte
     private TextArea getCharacterInlineArea(Character node) {
         TextArea text = new TextArea();
         char ch = node.getCharacter();
+        int ipd = font.getCharWidth(ch);
+        int blockProgressionOffset = 0;
+        int level = node.getBidiLevel();
         if (CharUtilities.isAnySpace(ch)) {
             // add space unless it's zero-width:
             if (!CharUtilities.isZeroWidthSpace(ch)) {
-                text.addSpace(ch, 0, CharUtilities.isAdjustableSpace(ch));
+                text.addSpace(ch, ipd, CharUtilities.isAdjustableSpace(ch),
+                              blockProgressionOffset, level);
             }
         } else {
-            text.addWord(String.valueOf(ch), 0);
+            int[] levels = ( level >= 0 ) ? new int[] {level} : null;
+            text.addWord(String.valueOf(ch), ipd, null, levels, null, blockProgressionOffset);
         }
         TraitSetter.setProducerID(text, node.getId());
         TraitSetter.addTextDecoration(text, node.getTextDecoration());
@@ -105,9 +110,8 @@ public class CharacterLayoutManager exte
 
         Character fobj = (Character)this.fobj;
 
-        ipd = MinOptMax.getInstance(font.getCharWidth(fobj.getCharacter()));
+        ipd = MinOptMax.getInstance(curArea.getIPD());
 
-        curArea.setIPD(ipd.getOpt());
         curArea.setBPD(font.getAscender() - font.getDescender());
 
         TraitSetter.addFontTraits(curArea, font);
@@ -227,4 +231,3 @@ public class CharacterLayoutManager exte
     }
 
 }
-

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java Mon May 28 15:30:46 2012
@@ -25,6 +25,7 @@ import java.util.ListIterator;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.apache.fop.fo.flow.Footnote;
 import org.apache.fop.layoutmgr.FootnoteBodyLayoutManager;
 import org.apache.fop.layoutmgr.InlineKnuthSequence;

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/ImageLayout.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/ImageLayout.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/ImageLayout.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/ImageLayout.java Mon May 28 15:30:46 2012
@@ -228,6 +228,9 @@ public class ImageLayout implements Cons
             } else if (rat1 > rat2) {
                 adjusted.width = (int)(rat2 * size.width);
                 adjusted.height = effHeight;
+            } else {
+                adjusted.width = effWidth;
+                adjusted.height = effHeight;
             }
         } else {
             adjusted.width = effWidth;
@@ -361,4 +364,4 @@ public class ImageLayout implements Cons
         return this.clip;
     }
 
-}
\ No newline at end of file
+}

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java Mon May 28 15:30:46 2012
@@ -207,7 +207,7 @@ public class InlineLayoutManager extends
         InlineArea area;
         if (isInline) {
             area = createInlineParent();
-            area.setOffset(0);
+            area.setBlockProgressionOffset(0);
         } else {
             area = new InlineBlockParent();
         }
@@ -388,6 +388,13 @@ public class InlineLayoutManager extends
             }
             lastSequence = ListUtil.getLast(returnList);
             lastChildLM = curLM;
+            // the context used to create this childLC above was applied a LayoutContext.SUPPRESS_BREAK_BEFORE
+            // in the getNextChildElements() method of the parent BlockLayoutManger; as a consequence all
+            // line breaks in blocks nested inside the inline associated with this ILM are being supressed;
+            // here we revert that supression; we do not need to do that for the first element since that
+            // is handled by the getBreakBefore() method of the wrapping BlockStackingLayoutManager.
+            // Note: this fix seems to work but is far from being the ideal way to do this
+            childLC.setFlags(LayoutContext.SUPPRESS_BREAK_BEFORE, false);
         }
 
         if (lastSequence != null) {
@@ -482,12 +489,12 @@ public class InlineLayoutManager extends
                                         || lastLM instanceof InlineLevelLayoutManager);
         parent.setBPD(alignmentContext.getHeight());
         if (parent instanceof InlineParent) {
-            parent.setOffset(alignmentContext.getOffset());
+            parent.setBlockProgressionOffset(alignmentContext.getOffset());
         } else if (parent instanceof InlineBlockParent) {
             // All inline elements are positioned by the renderers relative to
             // the before edge of their content rectangle
             if (borderProps != null) {
-                parent.setOffset(borderProps.getPaddingBefore(false, this)
+                parent.setBlockProgressionOffset(borderProps.getPaddingBefore(false, this)
                                 + borderProps.getBorderBeforeWidth(false));
             }
         }

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java Mon May 28 15:30:46 2012
@@ -28,6 +28,8 @@ import org.apache.fop.area.inline.Space;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.properties.SpaceProperty;
 import org.apache.fop.layoutmgr.AbstractLayoutManager;
+import org.apache.fop.layoutmgr.BreakOpportunity;
+import org.apache.fop.layoutmgr.BreakOpportunityHelper;
 import org.apache.fop.layoutmgr.KnuthElement;
 import org.apache.fop.layoutmgr.LayoutContext;
 import org.apache.fop.layoutmgr.NonLeafPosition;
@@ -39,8 +41,8 @@ import org.apache.fop.traits.MinOptMax;
  * which stack children in the inline direction, such as Inline or
  * Line. It should not be instantiated directly.
  */
-public abstract class InlineStackingLayoutManager extends AbstractLayoutManager
-                                         implements InlineLevelLayoutManager {
+public abstract class InlineStackingLayoutManager extends AbstractLayoutManager implements
+        InlineLevelLayoutManager, BreakOpportunity {
 
     /**
      * Size of border and padding in BPD (ie, before and after).
@@ -180,6 +182,10 @@ public abstract class InlineStackingLayo
                 //getLogger().debug("Add leading space: " + iAdjust);
                 Space ls = new Space();
                 ls.setIPD(iAdjust);
+                int level = parentArea.getBidiLevel();
+                if ( level >= 0 ) {
+                    ls.setBidiLevel ( level );
+                }
                 parentArea.addChildArea(ls);
             }
         }
@@ -381,4 +387,9 @@ public abstract class InlineStackingLayo
 
         return returnList;
     }
+
+    public int getBreakBefore() {
+        return BreakOpportunityHelper.getBreakBefore(this);
+    }
+
 }

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java Mon May 28 15:30:46 2012
@@ -115,7 +115,7 @@ public class LeaderLayoutManager extends
 
     private InlineArea getLeaderInlineArea(LayoutContext context) {
         InlineArea leaderArea = null;
-
+        int level = fobj.getBidiLevel();
         if (fobj.getLeaderPattern() == EN_RULE) {
             if (fobj.getRuleStyle() != EN_NONE) {
                 org.apache.fop.area.inline.Leader leader
@@ -125,28 +125,41 @@ public class LeaderLayoutManager extends
                 leaderArea = leader;
             } else {
                 leaderArea = new Space();
+                if ( level >= 0 ) {
+                    leaderArea.setBidiLevel ( level );
+                }
             }
             leaderArea.setBPD(fobj.getRuleThickness().getValue(this));
             leaderArea.addTrait(Trait.COLOR, fobj.getColor());
+            if ( level >= 0 ) {
+                leaderArea.setBidiLevel ( level );
+            }
         } else if (fobj.getLeaderPattern() == EN_SPACE) {
             leaderArea = new Space();
             leaderArea.setBPD(fobj.getRuleThickness().getValue(this));
+            if ( level >= 0 ) {
+                leaderArea.setBidiLevel ( level );
+            }
         } else if (fobj.getLeaderPattern() == EN_DOTS) {
             TextArea t = new TextArea();
             char dot = '.'; // userAgent.getLeaderDotCharacter();
-
             int width = font.getCharWidth(dot);
-            t.addWord("" + dot, 0);
+            int[] levels = ( level < 0 ) ? null : new int[] {level};
+            t.addWord("" + dot, width, null, levels, null, 0);
             t.setIPD(width);
             t.setBPD(width);
             t.setBaselineOffset(width);
             TraitSetter.addFontTraits(t, font);
             t.addTrait(Trait.COLOR, fobj.getColor());
             Space spacer = null;
-            if (fobj.getLeaderPatternWidth().getValue(this) > width) {
+            int widthLeaderPattern = fobj.getLeaderPatternWidth().getValue(this);
+            if (widthLeaderPattern > width) {
                 spacer = new Space();
-                spacer.setIPD(fobj.getLeaderPatternWidth().getValue(this) - width);
-                width = fobj.getLeaderPatternWidth().getValue(this);
+                spacer.setIPD(widthLeaderPattern - width);
+                if ( level >= 0 ) {
+                    spacer.setBidiLevel ( level );
+                }
+                width = widthLeaderPattern;
             }
             FilledArea fa = new FilledArea();
             fa.setUnitWidth(width);
@@ -155,7 +168,6 @@ public class LeaderLayoutManager extends
                 fa.addChildArea(spacer);
             }
             fa.setBPD(t.getBPD());
-
             leaderArea = fa;
         } else if (fobj.getLeaderPattern() == EN_USECONTENT) {
             if (fobj.getChildNodes() == null) {
@@ -188,6 +200,9 @@ public class LeaderLayoutManager extends
                 if (fobj.getLeaderPatternWidth().getValue(this) > width) {
                     spacer = new Space();
                     spacer.setIPD(fobj.getLeaderPatternWidth().getValue(this) - width);
+                    if ( level >= 0 ) {
+                        spacer.setBidiLevel ( level );
+                    }
                     width = fobj.getLeaderPatternWidth().getValue(this);
                 }
                 fa.setUnitWidth(width);
@@ -199,6 +214,7 @@ public class LeaderLayoutManager extends
                 //Content collapsed to nothing, so use a space
                 leaderArea = new Space();
                 leaderArea.setBPD(fobj.getRuleThickness().getValue(this));
+                leaderArea.setBidiLevel ( fobj.getBidiLevelRecursive() );
             }
         }
         TraitSetter.setProducerID(leaderArea, fobj.getId());

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java Mon May 28 15:30:46 2012
@@ -19,12 +19,13 @@
 
 package org.apache.fop.layoutmgr.inline;
 
+import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Collections;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.apache.fop.area.Area;
 import org.apache.fop.area.inline.InlineArea;
 import org.apache.fop.fo.FObj;
@@ -224,7 +225,7 @@ public abstract class LeafNodeLayoutMana
      * @param context the layout context used for adding the area
      */
     protected void offsetArea(InlineArea area, LayoutContext context) {
-        area.setOffset(alignmentContext.getOffset());
+        area.setBlockProgressionOffset(alignmentContext.getOffset());
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java Mon May 28 15:30:46 2012
@@ -32,6 +32,7 @@ import org.apache.fop.area.Area;
 import org.apache.fop.area.LineArea;
 import org.apache.fop.area.Trait;
 import org.apache.fop.area.inline.InlineArea;
+import org.apache.fop.complexscripts.bidi.BidiResolver;
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.datatypes.Numeric;
 import org.apache.fop.fo.Constants;
@@ -44,6 +45,7 @@ import org.apache.fop.fonts.FontTriplet;
 import org.apache.fop.hyphenation.Hyphenation;
 import org.apache.fop.hyphenation.Hyphenator;
 import org.apache.fop.layoutmgr.Adjustment;
+import org.apache.fop.layoutmgr.BlockLayoutManager;
 import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
 import org.apache.fop.layoutmgr.BreakElement;
 import org.apache.fop.layoutmgr.BreakingAlgorithm;
@@ -111,6 +113,7 @@ public class LineLayoutManager extends I
         private final double dAdjust; // Percentage to adjust (stretch or shrink)
         private final double ipdAdjust; // Percentage to adjust (stretch or shrink)
         private final int startIndent;
+        private final int endIndent;
         private final int lineHeight;
         private final int lineWidth;
         private final int spaceBefore;
@@ -119,8 +122,8 @@ public class LineLayoutManager extends I
 
         LineBreakPosition(                                       // CSOK: ParameterNumber
                 LayoutManager lm, int index, int startIndex, int breakIndex,
-                int shrink, int stretch, int diff, double ipdA, double adjust, int ind,
-                int lh, int lw, int sb, int sa, int bl) {
+                int shrink, int stretch, int diff, double ipdA, double adjust, int si,
+                int ei, int lh, int lw, int sb, int sa, int bl) {
             super(lm, breakIndex);
             availableShrink = shrink;
             availableStretch = stretch;
@@ -129,7 +132,8 @@ public class LineLayoutManager extends I
             this.startIndex = startIndex;
             ipdAdjust = ipdA;
             dAdjust = adjust;
-            startIndent = ind;
+            startIndent = si;
+            endIndent = ei;
             lineHeight = lh;
             lineWidth = lw;
             spaceBefore = sb;
@@ -140,6 +144,7 @@ public class LineLayoutManager extends I
     }
 
 
+    private int bidiLevel = -1;
     private int textAlignment = EN_JUSTIFY;
     private int textAlignmentLast;
     private int effectiveAlignment;
@@ -333,13 +338,38 @@ public class LineLayoutManager extends I
                                 int total) {
             // compute indent and adjustment ratio, according to
             // the value of text-align and text-align-last
-            int indent = 0;
+            int startIndent;
+            int endIndent;
             int difference = bestActiveNode.difference;
             int textAlign = (bestActiveNode.line < total) ? alignment : alignmentLast;
-            indent += (textAlign == Constants.EN_CENTER)
+
+            switch ( textAlign ) {
+            case Constants.EN_START:
+                startIndent = 0;
+                endIndent = difference > 0 ? difference : 0;
+                break;
+            case Constants.EN_END:
+                startIndent = difference > 0 ? difference : 0;
+                endIndent = 0;
+                break;
+            case Constants.EN_CENTER:
+                startIndent = difference / 2;
+                endIndent = startIndent;
+                break;
+            default:
+            case Constants.EN_JUSTIFY:
+                startIndent = 0;
+                endIndent = 0;
+                break;
+            }
+
+            /*
+            startIndent += (textAlign == Constants.EN_CENTER)
                       ? difference / 2 : (textAlign == Constants.EN_END) ? difference : 0;
-            indent += (bestActiveNode.line == 1 && indentFirstPart && isFirstInBlock)
+            */
+            startIndent += (bestActiveNode.line == 1 && indentFirstPart && isFirstInBlock)
                       ? textIndent : 0;
+
             double ratio = (textAlign == Constants.EN_JUSTIFY
                 || difference < 0 && -difference <= bestActiveNode.availableShrink)
                         ? bestActiveNode.adjustRatio : 0;
@@ -360,7 +390,10 @@ public class LineLayoutManager extends I
 
             if (log.isWarnEnabled()) {
                 int lack = difference + bestActiveNode.availableShrink;
-                if (lack < 0) {
+                // if this LLM is nested inside a BlockContainerLayoutManager that is constraining
+                // the available width and thus responsible for the overflow then we do not issue
+                // warning event here and instead let the BCLM handle that at a later stage
+                if (lack < 0 && !handleOverflow(-lack)) {
                     InlineLevelEventProducer eventProducer
                         = InlineLevelEventProducer.Provider.get(
                             getFObj().getUserAgent().getEventBroadcaster());
@@ -377,7 +410,7 @@ public class LineLayoutManager extends I
                    bestActiveNode.availableShrink - (addedPositions > 0
                        ? 0 : ((Paragraph) par).lineFiller.getShrink()),
                    bestActiveNode.availableStretch,
-                   difference, ratio, indent), activePossibility);
+                   difference, ratio, startIndent, endIndent), activePossibility);
             addedPositions++;
         }
 
@@ -389,7 +422,8 @@ public class LineLayoutManager extends I
 
         private LineBreakPosition makeLineBreakPosition(         // CSOK: ParameterNumber
                 KnuthSequence par, int firstElementIndex, int lastElementIndex, int availableShrink,
-                int availableStretch, int difference, double ratio, int indent) {
+                int availableStretch, int difference, double ratio, int startIndent,
+                int endIndent) {
             // line height calculation - spaceBefore may differ from spaceAfter
             // by 1mpt due to rounding
             int spaceBefore = (lineHeight - lead - follow) / 2;
@@ -456,14 +490,14 @@ public class LineLayoutManager extends I
                                              knuthParagraphs.indexOf(par),
                                              firstElementIndex, lastElementIndex,
                                              availableShrink, availableStretch,
-                                             difference, ratio, 0, indent,
+                                             difference, ratio, 0, startIndent, endIndent,
                                              0, ipd, 0, 0, 0);
             } else {
                 return new LineBreakPosition(thisLLM,
                                              knuthParagraphs.indexOf(par),
                                              firstElementIndex, lastElementIndex,
                                              availableShrink, availableStretch,
-                                             difference, ratio, 0, indent,
+                                             difference, ratio, 0, startIndent, endIndent,
                                              lineLead + lineFollow,
                                              ipd, spaceBefore, spaceAfter,
                                              lineLead);
@@ -544,6 +578,7 @@ public class LineLayoutManager extends I
     /** {@inheritDoc} */
     @Override
     public void initialize() {
+        bidiLevel = fobj.getBidiLevel();
         textAlignment = fobj.getTextAlign();
         textAlignmentLast = fobj.getTextAlignLast();
         textIndent = fobj.getTextIndent();
@@ -1200,7 +1235,8 @@ public class LineLayoutManager extends I
         ListIterator currParIterator = currPar.listIterator(currPar.ignoreAtStart);
         // list of TLM involved in hyphenation
         List updateList = new LinkedList();
-        KnuthElement firstElement, nextElement;
+        KnuthElement firstElement;
+        KnuthElement nextElement;
         // current InlineLevelLayoutManager
         InlineLevelLayoutManager currLM = null;
         // number of KnuthBox elements containing word fragments
@@ -1429,8 +1465,12 @@ public class LineLayoutManager extends I
         if (lbp.startIndent != 0) {
             lineArea.addTrait(Trait.START_INDENT, lbp.startIndent);
         }
+        if (lbp.endIndent != 0) {
+            lineArea.addTrait(Trait.END_INDENT, new Integer(lbp.endIndent));
+        }
         lineArea.setBPD(lbp.lineHeight);
         lineArea.setIPD(lbp.lineWidth);
+        lineArea.setBidiLevel(bidiLevel);
         lineArea.addTrait(Trait.SPACE_BEFORE, lbp.spaceBefore);
         lineArea.addTrait(Trait.SPACE_AFTER, lbp.spaceAfter);
         alignmentContext.resizeLine(lbp.lineHeight, lbp.baseline);
@@ -1506,7 +1546,10 @@ public class LineLayoutManager extends I
                 && (!context.isLastArea() || !isLastPosition)) {
             lineArea.setBPD(lineArea.getBPD() + context.getSpaceAfter());
         }
-        lineArea.finalise();
+        lineArea.finish();
+        if ( lineArea.getBidiLevel() >= 0 ) {
+            BidiResolver.reorder ( lineArea );
+        }
         parentLayoutManager.addChildArea(lineArea);
     }
 
@@ -1556,6 +1599,9 @@ public class LineLayoutManager extends I
             blocklc.setTrailingSpace(new SpaceSpecifier(false));
         }
         lineArea.updateExtentsFromChildren();
+        if ( lineArea.getBidiLevel() >= 0 ) {
+            BidiResolver.reorder ( lineArea );
+        }
         parentLayoutManager.addChildArea(lineArea);
     }
 
@@ -1593,4 +1639,15 @@ public class LineLayoutManager extends I
         return true;
     }
 
+    /**
+     * Whether this LM can handle horizontal overflow error messages (only a BlockContainerLayoutManager can).
+     * @param milliPoints horizontal overflow
+     * @return true if handled by a BlockContainerLayoutManager
+     */
+    public boolean handleOverflow(int milliPoints) {
+        if (getParent() instanceof BlockLayoutManager) {
+            return ((BlockLayoutManager) getParent()).handleOverflow(milliPoints);
+        }
+        return false;
+    }
 }

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java Mon May 28 15:30:46 2012
@@ -56,22 +56,24 @@ public class PageNumberCitationLastLayou
      */
     private InlineArea getPageNumberCitationLastInlineArea(LayoutManager parentLM) {
         TextArea text = null;
-        resolved = false;
+        int level = getBidiLevel();
         if (!getPSLM().associateLayoutManagerID(fobj.getRefId())) {
             text = new UnresolvedPageNumber(fobj.getRefId(), font, UnresolvedPageNumber.LAST);
             getPSLM().addUnresolvedArea(fobj.getRefId(), (Resolvable)text);
             String str = "MMM"; // reserve three spaces for page number
             int width = getStringWidth(str);
+            text.setBidiLevel(level);
             text.setIPD(width);
+            resolved = false;
         } else {
             PageViewport page = getPSLM().getLastPVWithID(fobj.getRefId());
             String str = page.getPageNumberString();
             // get page string from parent, build area
             text = new TextArea();
             int width = getStringWidth(str);
-            text.addWord(str, 0);
+            text.setBidiLevel(level);
+            text.addWord(str, 0, level);
             text.setIPD(width);
-
             resolved = true;
         }
 

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java Mon May 28 15:30:46 2012
@@ -50,27 +50,32 @@ public class PageNumberCitationLayoutMan
     /**
      * if id can be resolved then simply return a word, otherwise
      * return a resolvable area
+     *
+     * TODO: [GA] May need to run bidi algorithm and script processor
+     * on resolved page number.
      */
     private InlineArea getPageNumberCitationInlineArea() {
         PageViewport page = getPSLM().getFirstPVWithID(fobj.getRefId());
         TextArea text = null;
+        int level = getBidiLevel();
         if (page != null) {
             String str = page.getPageNumberString();
             // get page string from parent, build area
             text = new TextArea();
-            int width = getStringWidth(str);
-            text.addWord(str, 0);
-            text.setIPD(width);
+            int width = getStringWidth(str);    // TODO: [GA] !I18N!
+            text.setBidiLevel(level);
+            text.addWord(str, 0, level);
+            text.setIPD(width);                 // TODO: [GA] !I18N!
             resolved = true;
         } else {
-            resolved = false;
             text = new UnresolvedPageNumber(fobj.getRefId(), font);
             String str = "MMM"; // reserve three spaces for page number
-            int width = getStringWidth(str);
-            text.setIPD(width);
+            int width = getStringWidth(str);    // TODO: [GA] !I18N!
+            text.setBidiLevel(level);
+            text.setIPD(width);                 // TODO: [GA] !I18N!
+            resolved = false;
         }
         updateTextAreaTraits(text);
-
         return text;
     }
 

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java Mon May 28 15:30:46 2012
@@ -101,7 +101,7 @@ public class PageNumberLayoutManager ext
         TraitSetter.setProducerID(ta, fobj.getId());
         ta.setIPD(baseArea.getIPD());
         ta.setBPD(baseArea.getBPD());
-        ta.setOffset(baseArea.getOffset());
+        ta.setBlockProgressionOffset(baseArea.getBlockProgressionOffset());
         ta.setBaselineOffset(baseArea.getBaselineOffset());
         ta.addTrait(Trait.COLOR, fobj.getColor()); //only to initialize the trait map
         ta.getTraits().putAll(baseArea.getTraits());



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Mime
View raw message