ソースを参照

Moved inline-level LMs and support classes to "inline" subpackage.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@219509 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-0_90-alpha1
Jeremias Maerki 19年前
コミット
7bf1e40ebb
36個のファイルの変更181行の追加834行の削除
  1. 3
    7
      src/java/org/apache/fop/fo/flow/BasicLink.java
  2. 1
    8
      src/java/org/apache/fop/fo/flow/BidiOverride.java
  3. 3
    8
      src/java/org/apache/fop/fo/flow/InlineContainer.java
  4. 7
    8
      src/java/org/apache/fop/fo/flow/InlineLevel.java
  5. 17
    15
      src/java/org/apache/fop/fo/flow/InstreamForeignObject.java
  6. 11
    13
      src/java/org/apache/fop/fo/flow/Leader.java
  7. 2
    0
      src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
  8. 1
    0
      src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
  9. 1
    1
      src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
  10. 1
    0
      src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
  11. 0
    748
      src/java/org/apache/fop/layoutmgr/KnuthParagraph.java
  12. 1
    0
      src/java/org/apache/fop/layoutmgr/LayoutContext.java
  13. 14
    0
      src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java
  14. 1
    0
      src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
  15. 1
    0
      src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
  16. 2
    1
      src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java
  17. 1
    1
      src/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java
  18. 9
    1
      src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
  19. 9
    1
      src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
  20. 2
    1
      src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java
  21. 6
    1
      src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java
  22. 1
    1
      src/java/org/apache/fop/layoutmgr/inline/HyphContext.java
  23. 1
    1
      src/java/org/apache/fop/layoutmgr/inline/ICLayoutManager.java
  24. 6
    1
      src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
  25. 4
    1
      src/java/org/apache/fop/layoutmgr/inline/InlineLevelLayoutManager.java
  26. 9
    1
      src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
  27. 3
    2
      src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java
  28. 5
    1
      src/java/org/apache/fop/layoutmgr/inline/KnuthInlineBox.java
  29. 9
    1
      src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
  30. 6
    1
      src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
  31. 18
    1
      src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
  32. 2
    1
      src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java
  33. 6
    2
      src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java
  34. 4
    2
      src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java
  35. 10
    1
      src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
  36. 4
    3
      src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java

+ 3
- 7
src/java/org/apache/fop/fo/flow/BasicLink.java ファイルの表示

@@ -1,5 +1,5 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
* Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,16 +18,12 @@

package org.apache.fop.fo.flow;

// Java
import java.util.List;

import org.xml.sax.Locator;

import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
import org.apache.fop.layoutmgr.BasicLinkLayoutManager;

/**
* The fo:basic-link formatting object.
@@ -118,14 +114,14 @@ public class BasicLink extends Inline {
}

/**
* Return the "internal-destination" property.
* @return the "internal-destination" property.
*/
public String getInternalDestination() {
return internalDestination;
}

/**
* Return the "external-destination" property.
* @return the "external-destination" property.
*/
public String getExternalDestination() {
return externalDestination;

+ 1
- 8
src/java/org/apache/fop/fo/flow/BidiOverride.java ファイルの表示

@@ -1,5 +1,5 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
* Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,10 +18,6 @@

package org.apache.fop.fo.flow;

// Java
import java.util.ArrayList;
import java.util.List;

import org.xml.sax.Locator;

import org.apache.fop.apps.FOPException;
@@ -35,9 +31,6 @@ import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonFont;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.properties.SpaceProperty;
import org.apache.fop.layoutmgr.BidiLayoutManager;
import org.apache.fop.layoutmgr.InlineLayoutManager;
import org.apache.fop.layoutmgr.LayoutManager;

/**
* fo:bidi-override element.

+ 3
- 8
src/java/org/apache/fop/fo/flow/InlineContainer.java ファイルの表示

@@ -1,5 +1,5 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
* Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,10 +18,6 @@

package org.apache.fop.fo.flow;

// Java
import java.util.ArrayList;
import java.util.List;

import org.xml.sax.Locator;

import org.apache.fop.apps.FOPException;
@@ -36,13 +32,12 @@ import org.apache.fop.fo.properties.CommonMarginInline;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.properties.KeepProperty;
import org.apache.fop.fo.properties.LengthRangeProperty;
import org.apache.fop.layoutmgr.ICLayoutManager;
import org.apache.fop.layoutmgr.LayoutManager;

/**
* Class modelling the fo:inline-container object.
*/
public class InlineContainer extends FObj {
// The value of properties relevant for fo:inline-container.
private CommonBorderPaddingBackground commonBorderPaddingBackground;
private CommonMarginInline commonMarginInline;
@@ -138,7 +133,7 @@ public class InlineContainer extends FObj {
}

/**
* Return the "id" property.
* @return the "id" property.
*/
public String getId() {
return id;

+ 7
- 8
src/java/org/apache/fop/fo/flow/InlineLevel.java ファイルの表示

@@ -1,5 +1,5 @@
/*
* Copyright 2004 The Apache Software Foundation.
* Copyright 2004-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +18,6 @@

package org.apache.fop.fo.flow;

import java.util.List;

import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.Length;
@@ -31,13 +29,14 @@ import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.CommonFont;
import org.apache.fop.fo.properties.CommonMarginInline;
import org.apache.fop.layoutmgr.InlineLayoutManager;

/**
* Class modelling the commonalities of several inline-level
* formatting objects.
*/
public abstract class InlineLevel extends FObjMixed {
// The value of properties relevant for inline-level FOs.
protected CommonBorderPaddingBackground commonBorderPaddingBackground;
protected CommonAccessibility commonAccessibility;
protected CommonMarginInline commonMarginInline;
@@ -70,28 +69,28 @@ public abstract class InlineLevel extends FObjMixed {
}

/**
* Return the Common Margin Properties-Inline.
* @return the Common Margin Properties-Inline.
*/
public CommonMarginInline getCommonMarginInline() {
return commonMarginInline;
}

/**
* Return the Common Border, Padding, and Background Properties.
* @return the Common Border, Padding, and Background Properties.
*/
public CommonBorderPaddingBackground getCommonBorderPaddingBackground() {
return commonBorderPaddingBackground;
}

/**
* Return the Common Font Properties.
* @return the Common Font Properties.
*/
public CommonFont getCommonFont() {
return commonFont;
}

/**
* Return the "color" property.
* @return the "color" property.
*/
public ColorType getColor() {
return color;

+ 17
- 15
src/java/org/apache/fop/fo/flow/InstreamForeignObject.java ファイルの表示

@@ -188,84 +188,84 @@ public class InstreamForeignObject extends FObj {
}

/**
* Return the "id" property.
* @return the "id" property.
*/
public String getId() {
return id;
}

/**
* Return the Common Border, Padding, and Background Properties.
* @return the Common Border, Padding, and Background Properties.
*/
public CommonBorderPaddingBackground getCommonBorderPaddingBackground() {
return commonBorderPaddingBackground;
}

/**
* Return the "line-height" property.
* @return the "line-height" property.
*/
public Length getLineHeight() {
return lineHeight;
}

/**
* Return the "inline-progression-dimension" property.
* @return the "inline-progression-dimension" property.
*/
public LengthRangeProperty getInlineProgressionDimension() {
return inlineProgressionDimension;
}

/**
* Return the "block-progression-dimension" property.
* @return the "block-progression-dimension" property.
*/
public LengthRangeProperty getBlockProgressionDimension() {
return blockProgressionDimension;
}

/**
* Return the "height" property.
* @return the "height" property.
*/
public Length getHeight() {
return height;
}

/**
* Return the "width" property.
* @return the "width" property.
*/
public Length getWidth() {
return width;
}

/**
* Return the "content-height" property.
* @return the "content-height" property.
*/
public Length getContentHeight() {
return contentHeight;
}

/**
* Return the "content-width" property.
* @return the "content-width" property.
*/
public Length getContentWidth() {
return contentWidth;
}

/**
* Return the "scaling" property.
* @return the "scaling" property.
*/
public int getScaling() {
return scaling;
}

/**
* Return the "vertical-align" property.
* @return the "vertical-align" property.
*/
public int getVerticalAlign() {
return verticalAlign;
}

/**
* Return the "overflow" property.
* @return the "overflow" property.
*/
public int getOverflow() {
return overflow;
@@ -285,9 +285,7 @@ public class InstreamForeignObject extends FObj {
return FO_INSTREAM_FOREIGN_OBJECT;
}

/**
* @see org.apache.fop.fo.FObj#getLayoutDimension(org.apache.fop.datatypes.PercentBase.DimensionType)
*/
/** @see org.apache.fop.fo.FObj */
public Number getLayoutDimension(PercentBase.LayoutDimension key) {
if (key == PercentBase.IMAGE_INTRINSIC_WIDTH) {
return new Integer(getIntrinsicWidth());
@@ -337,4 +335,8 @@ public class InstreamForeignObject extends FObj {
}
}
/** @see org.apache.fop.fo.FONode#addChildNode(org.apache.fop.fo.FONode) */
protected void addChildNode(FONode child) throws FOPException {
super.addChildNode(child);
}
}

+ 11
- 13
src/java/org/apache/fop/fo/flow/Leader.java ファイルの表示

@@ -1,5 +1,5 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
* Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,9 +18,6 @@

package org.apache.fop.fo.flow;

// Java
import java.util.List;

import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
@@ -29,7 +26,6 @@ import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.properties.KeepProperty;
import org.apache.fop.fo.properties.LengthRangeProperty;
import org.apache.fop.fo.properties.SpaceProperty;
import org.apache.fop.layoutmgr.LeaderLayoutManager;

/**
* Class modelling fo:leader object.
@@ -105,6 +101,8 @@ public class Leader extends InlineLevel {
// use inline layout manager to create inline areas
// add the inline parent multiple times until leader full
break;
default:
throw new RuntimeException("Invalid leader pattern: " + leaderPattern);
}
// letterSpacing = pList.get(PR_LETTER_SPACING);
// textShadow = pList.get(PR_TEXT_SHADOW);
@@ -120,56 +118,56 @@ public class Leader extends InlineLevel {


/**
* Return the "id" property.
* @return the "id" property.
*/
public String getId() {
return id;
}

/**
* Return the "rule-style" property.
* @return the "rule-style" property.
*/
public int getRuleStyle() {
return ruleStyle;
}

/**
* Return the "rule-thickness" property.
* @return the "rule-thickness" property.
*/
public Length getRuleThickness() {
return ruleThickness;
}

/**
* Return the "leader-alignment" property.
* @return the "leader-alignment" property.
*/
public int getLeaderAlignment() {
return leaderAlignment;
}

/**
* Return the "leader-length" property.
* @return the "leader-length" property.
*/
public LengthRangeProperty getLeaderLength() {
return leaderLength;
}

/**
* Return the "leader-pattern" property.
* @return the "leader-pattern" property.
*/
public int getLeaderPattern() {
return leaderPattern;
}

/**
* Return the "leader-pattern-width" property.
* @return the "leader-pattern-width" property.
*/
public Length getLeaderPatternWidth() {
return leaderPatternWidth;
}

/**
* Return the "vertical-align" property.
* @return the "vertical-align" property.
*/
public int getVerticalAlign() {
return verticalAlign;

+ 2
- 0
src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java ファイルの表示

@@ -23,6 +23,8 @@ import java.util.ListIterator;
import java.util.List;

import org.apache.fop.fonts.Font;
import org.apache.fop.layoutmgr.inline.InlineLevelLayoutManager;
import org.apache.fop.layoutmgr.inline.LineLayoutManager;
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
import org.apache.fop.area.LineArea;

+ 1
- 0
src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java ファイルの表示

@@ -30,6 +30,7 @@ import org.apache.fop.datatypes.PercentBase;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.SpaceProperty;
import org.apache.fop.layoutmgr.inline.LineLayoutManager;
import org.apache.fop.traits.MinOptMax;

/**

+ 1
- 1
src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java ファイルの表示

@@ -135,7 +135,7 @@ public abstract class BreakingAlgorithm {


// this class represent a feasible breaking point
protected class KnuthNode {
public class KnuthNode {
/** index of the breakpoint represented by this node */
public int position;


+ 1
- 0
src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java ファイルの表示

@@ -20,6 +20,7 @@ package org.apache.fop.layoutmgr;

import org.apache.fop.datatypes.PercentBase;
import org.apache.fop.fo.pagination.Flow;
import org.apache.fop.layoutmgr.inline.InlineLevelLayoutManager;
import org.apache.fop.area.Area;
import org.apache.fop.area.BlockParent;


+ 0
- 748
src/java/org/apache/fop/layoutmgr/KnuthParagraph.java ファイルの表示

@@ -1,748 +0,0 @@
/*
* Copyright 2004-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/* $Id$ */

package org.apache.fop.layoutmgr;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.apache.fop.traits.MinOptMax;

/**
* A knuth paragraph
*
* The set is sorted into lines indexed into activeLines.
* The nodes in each line is linked together in a single linked list by the
* KnuthNode.next field. The activeLines array contains a link to the head of
* the linked list in index 'line*2' and a link to the tail at index 'line*2+1'.
* <p>
* The set of active nodes can be traversed by
* <pre>
* for (int line = startLine; line < endLine; line++) {
* for (KnuthNode node = getNode(line); node != null; node = node.next) {
* // Do something with 'node'
* }
* }
* </pre>
*/
public class KnuthParagraph {
// parameters of Knuth's algorithm:
// penalty value for flagged penalties
private int flaggedPenalty = 50;
// demerit for consecutive lines ending at flagged penalties
private int repeatedFlaggedDemerit = 50;
// demerit for consecutive lines belonging to incompatible fitness classes
private int incompatibleFitnessDemerit = 50;
// suggested modification to the "optimum" number of lines
private int looseness = 0;

/**
* The threshold for considering breaks to be acceptable.
*/
private double threshold;

/**
* The paragraph of KnuthElements.
*/
private List par;
/**
* The width of a line.
*/
private int lineWidth = 0;
private boolean force = false;

private KnuthNode lastTooLong;
private KnuthNode lastTooShort;
private KnuthNode lastDeactivated;

/**
* The set of active nodes.
*/
private KnuthNode[] activeLines;
/**
* The number of active nodes.
*/
private int activeNodeCount;
/**
* The lowest available line in the set of active nodes.
*/
private int startLine = 0;

/**
* The highest + 1 available line in the set of active nodes.
*/
private int endLine = 0;

/**
* The total width of all elements handled so far.
*/
private int totalWidth;

/**
* The total stretch of all elements handled so far.
*/
private int totalStretch = 0;

/**
* The total shrink of all elements handled so far.
*/
private int totalShrink = 0;

private BestRecords best;
private KnuthNode[] positions;
private static final int INFINITE_RATIO = 1000;
protected static Log log = LogFactory.getLog(KnuthParagraph.class);
public KnuthParagraph(List par) {
this.best = new BestRecords();
this.par = par;
}


// this class represent a feasible breaking point
private class KnuthNode {
// index of the breakpoint represented by this node
public int position;

// number of the line ending at this breakpoint
public int line;

// fitness class of the line ending at his breakpoint
public int fitness;

// accumulated width of the KnuthElements
public int totalWidth;

public int totalStretch;

public int totalShrink;

// adjustment ratio if the line ends at this breakpoint
public double adjustRatio;

// difference between target and actual line width
public int difference;

// minimum total demerits up to this breakpoint
public double totalDemerits;

// best node for the preceding breakpoint
public KnuthNode previous;

// Next possible node in the same line
public KnuthNode next;

public KnuthNode(int position, int line, int fitness,
int totalWidth, int totalStretch, int totalShrink,
double adjustRatio, int difference,
double totalDemerits, KnuthNode previous) {
this.position = position;
this.line = line;
this.fitness = fitness;
this.totalWidth = totalWidth;
this.totalStretch = totalStretch;
this.totalShrink = totalShrink;
this.adjustRatio = adjustRatio;
this.difference = difference;
this.totalDemerits = totalDemerits;
this.previous = previous;
}

public String toString() {
return "<KnuthNode at " + position + " " +
totalWidth + "+" + totalStretch + "-" + totalShrink +
" line:" + line +
" prev:" + (previous != null ? previous.position : -1) +
" dem:" + totalDemerits +
">";
}
}
// this class stores information about how the nodes
// which could start a line
// ending at the current element
private class BestRecords {
private static final double INFINITE_DEMERITS = Double.POSITIVE_INFINITY;

private double bestDemerits[] = new double[4];
private KnuthNode bestNode[] = new KnuthNode[4];
private double bestAdjust[] = new double[4];
private int bestDifference[] = new int[4];
private int bestIndex = -1;

public BestRecords() {
reset();
}

public void addRecord(double demerits, KnuthNode node, double adjust,
int difference, int fitness) {
if (demerits > bestDemerits[fitness]) {
log.error("New demerits value greter than the old one");
}
bestDemerits[fitness] = demerits;
bestNode[fitness] = node;
bestAdjust[fitness] = adjust;
bestDifference[fitness] = difference;
if (bestIndex == -1 || demerits < bestDemerits[bestIndex]) {
bestIndex = fitness;
}
}

public boolean hasRecords() {
return (bestIndex != -1);
}

public boolean notInfiniteDemerits(int fitness) {
return (bestDemerits[fitness] != INFINITE_DEMERITS);
}

public double getDemerits(int fitness) {
return bestDemerits[fitness];
}

public KnuthNode getNode(int fitness) {
return bestNode[fitness];
}

public double getAdjust(int fitness) {
return bestAdjust[fitness];
}

public int getDifference(int fitness) {
return bestDifference[fitness];
}

public double getMinDemerits() {
if (bestIndex != -1) {
return getDemerits(bestIndex);
} else {
// anyway, this should never happen
return INFINITE_DEMERITS;
}
}
public void reset() {
bestDemerits[0] = INFINITE_DEMERITS;
bestDemerits[1] = INFINITE_DEMERITS;
bestDemerits[2] = INFINITE_DEMERITS;
bestDemerits[3] = INFINITE_DEMERITS;
bestIndex = -1;
}
}

public int findBreakPoints(int lineWidth, double threshold, boolean force) {
this.lineWidth = lineWidth;
this.totalWidth = 0;
this.totalStretch = 0;
this.totalShrink = 0;
this.threshold = threshold;
this.force = force;
activeLines = new KnuthNode[20];
addNode(0, new KnuthNode(0, 0, 1, 0, 0, 0, 0, 0, 0, null));
boolean bForced = false;

// previous element in the paragraph is a KnuthBox
boolean previousIsBox = false;

if (log.isTraceEnabled()) {
log.trace("Looping over " + par.size() + " box objects");
}

KnuthNode lastForced = getNode(0);
// main loop
for (int i = 0; i < par.size(); i++) {
KnuthElement element = getElement(i);
if (element.isBox()) {
// a KnuthBox object is not a legal line break
totalWidth += element.getW();
previousIsBox = true;
} else if (element.isGlue()) {
// a KnuthGlue object is a legal line break
// only if the previous object is a KnuthBox
if (previousIsBox) {
considerLegalBreak(element, i);
}
totalWidth += element.getW();
totalStretch += element.getY();
totalShrink += element.getZ();
previousIsBox = false;
} else {
// a KnuthPenalty is a legal line break
// only if its penalty is not infinite
if (element.getP() < KnuthElement.INFINITE) {
considerLegalBreak(element, i);
}
previousIsBox = false;
}
if (activeNodeCount == 0) {
if (!force) {
log.debug("Could not find a set of breaking points " + threshold);
return 0;
}
/*
if (lastForced != null && lastForced.position == lastDeactivated.position) {
lastForced = lastTooShort != null ? lastTooShort : lastTooLong;
} else {
lastForced = lastDeactivated;
}
*/
if (lastTooShort == null || lastForced.position == lastTooShort.position) {
lastForced = lastTooLong;
} else {
lastForced = lastTooShort;
}

log.debug("Restarting at node " + lastForced);
lastForced.totalDemerits = 0;
addNode(lastForced.line, lastForced);
i = lastForced.position;
startLine = lastForced.line;
endLine = startLine + 1;
totalWidth = lastForced.totalWidth;
totalStretch = lastForced.totalStretch;
totalShrink = lastForced.totalShrink;
lastTooShort = lastTooLong = null;
}
}
if (log.isTraceEnabled()) {
log.trace("Main loop completed " + activeNodeCount);
log.trace("Active nodes=" + toString(""));
}

// there is at least one set of breaking points
// choose the active node with fewest total demerits
KnuthNode bestActiveNode = findBestNode();
int line = bestActiveNode.line;
/*
if (looseness != 0) {
// choose the appropriate active node
int s = 0;
double bestDemerits = 0;
for (int i = 0; i < activeList.size(); i++) {
KnuthNode node = getNode(i);
int delta = node.line - line;
if (looseness <= delta && delta < s
|| s < delta && delta <= looseness) {
s = delta;
bestActiveNode = node;
bestDemerits = node.totalDemerits;
} else if (delta == s
&& node.totalDemerits < bestDemerits) {
bestActiveNode = node;
bestDemerits = node.totalDemerits;
}
}
line = bestActiveNode.line;
}
*/
// Reverse the list of nodes from bestActiveNode.
positions = new KnuthNode[line];
// use the chosen node to determine the optimum breakpoints
for (int i = line - 1; i >= 0; i--) {
positions[i] = bestActiveNode;
bestActiveNode = bestActiveNode.previous;
}
activeLines = null;
return positions.length;
}

private void considerLegalBreak(KnuthElement element, int elementIdx) {

if (log.isTraceEnabled()) {
log.trace("Feasible breakpoint at " + par.indexOf(element) + " " + totalWidth + "+" + totalStretch + "-" + totalShrink);
log.trace("\tCurrent active node list: " + activeNodeCount + " " + this.toString("\t"));
}

lastDeactivated = null;
lastTooLong = null;
for (int line = startLine; line < endLine; line++) {
for (KnuthNode node = getNode(line); node != null; node = node.next) {
if (node.position == elementIdx) {
continue;
}
int difference = computeDifference(node, element);
double r = computeAdjustmentRatio(node, difference);
if (log.isTraceEnabled()) {
log.trace("\tr=" + r);
log.trace("\tline=" + line);
}
// The line would be too long.
if (r < -1 || element.isForcedBreak()) {
// Deactivate node.
if (log.isTraceEnabled()) {
log.trace("Removing " + node);
}
removeNode(line, node);
lastDeactivated = compareNodes(lastDeactivated, node);
}
// The line is within the available shrink and the threshold.
if (r >= -1 && r <= threshold) {
int fitnessClass = computeFitness(r);
double demerits = computeDemerits(node, element, fitnessClass, r);
if (log.isTraceEnabled()) {
log.trace("\tDemerits=" + demerits);
log.trace("\tFitness class=" + fitnessClass);
}
if (demerits < best.getDemerits(fitnessClass)) {
// updates best demerits data
best.addRecord(demerits, node, r, difference, fitnessClass);
}
}
// The line is way too short, but we are in forcing mode, so a node is
// calculated and stored in lastValidNode.
if (force && (r <= -1 || r > threshold)) {
int fitnessClass = computeFitness(r);
double demerits = computeDemerits(node, element, fitnessClass, r);
if (r <= -1) {
if (lastTooLong == null || demerits < lastTooLong.totalDemerits) {
lastTooLong = new KnuthNode(elementIdx, line + 1, fitnessClass,
totalWidth, totalStretch, totalShrink,
r, difference, demerits, node);
if (log.isTraceEnabled()) {
log.trace("Picking tooLong " + lastTooLong);
}
}
} else {
if (lastTooShort == null || demerits <= lastTooShort.totalDemerits) {
lastTooShort = new KnuthNode(elementIdx, line + 1, fitnessClass,
totalWidth, totalStretch, totalShrink,
r, difference, demerits, node);
if (log.isTraceEnabled()) {
log.trace("Picking tooShort " + lastTooShort);
}
}
}
}
}
addBreaks(line, elementIdx);
}
}

private void addBreaks(int line, int elementIdx) {
if (!best.hasRecords()) {
return;
}

int newWidth = totalWidth;
int newStretch = totalStretch;
int newShrink = totalShrink;

for (int i = elementIdx; i < par.size(); i++) {
KnuthElement tempElement = getElement(i);
if (tempElement.isBox()) {
break;
} else if (tempElement.isGlue()) {
newWidth += tempElement.getW();
newStretch += tempElement.getY();
newShrink += tempElement.getZ();
} else if (tempElement.isForcedBreak() && i != elementIdx) {
break;
}
}

// add nodes to the active nodes list
double minimumDemerits = best.getMinDemerits() + incompatibleFitnessDemerit;
for (int i = 0; i <= 3; i++) {
if (best.notInfiniteDemerits(i) && best.getDemerits(i) <= minimumDemerits) {
// the nodes in activeList must be ordered
// by line number and position;
if (log.isTraceEnabled()) {
log.trace("\tInsert new break in list of " + activeNodeCount);
}
KnuthNode newNode = new KnuthNode(elementIdx, line + 1, i,
newWidth, newStretch, newShrink,
best.getAdjust(i),
best.getDifference(i),
best.getDemerits(i),
best.getNode(i));
addNode(line + 1, newNode);
}
}
best.reset();
}

/**
* Return the difference between the line width and the width of the break that
* ends in 'element'.
* @param activeNode
* @param element
* @return The difference in width. Positive numbers mean extra space in the line,
* negative number that the line overflows.
*/
private int computeDifference(KnuthNode activeNode, KnuthElement element) {
// compute the adjustment ratio
int actualWidth = totalWidth - activeNode.totalWidth;
if (element.isPenalty()) {
actualWidth += element.getW();
}
return lineWidth - actualWidth;
}

/**
* Return the adjust ration needed to make up for the difference. A ration of
* <ul>
* <li>0 means that the break has the exact right width</li>
* <li>&gt;= -1 && &lt; 0 means that the break is to wider than the line,
* but within the minimim values of the glues.</li>
* <li>&gt;0 && &lt 1 means that the break is smaller than the line width,
* but within the maximum values of the glues.</li>
* <li>&gt 1 means that the break is too small to make up for the glues.</li>
* </ul>
* @param activeNode
* @param difference
* @return The ration.
*/
private double computeAdjustmentRatio(KnuthNode activeNode, int difference) {
// compute the adjustment ratio
if (difference > 0) {
int maxAdjustment = totalStretch - activeNode.totalStretch;
if (maxAdjustment > 0) {
return (double) difference / maxAdjustment;
} else {
return INFINITE_RATIO;
}
} else if (difference < 0) {
int maxAdjustment = totalShrink - activeNode.totalShrink;
if (maxAdjustment > 0) {
return (double) difference / maxAdjustment;
} else {
return -INFINITE_RATIO;
}
} else {
return 0;
}
}
/**
* Figure out the fitness class of this line (tight, loose,
* very tight or very loose).
* @param r
* @return
*/
private int computeFitness(double r) {
int newFitnessClass;
if (r < -0.5) {
return 0;
} else if (r <= 0.5) {
return 1;
} else if (r <= 1) {
return 2;
} else {
return 3;
}
}

/**
* Find and return the KnuthNode in the active set of nodes with the
* lowest demerit.
*/
private KnuthNode findBestNode() {
// choose the active node with fewest total demerits
KnuthNode bestActiveNode = null;
for (int i = startLine; i < endLine; i++) {
for (KnuthNode node = getNode(i); node != null; node = node.next) {
bestActiveNode = compareNodes(bestActiveNode, node);
}
}
if (log.isTraceEnabled()) {
log.trace("Best demerits " + bestActiveNode.totalDemerits + " for paragraph size " + par.size());
}
return bestActiveNode;
}
/**
* Compare two KnuthNodes and return the node with the least demerit.
* @param node1 The first knuth node.
* @param node2 The other knuth node.
* @return
*/
private KnuthNode compareNodes(KnuthNode node1, KnuthNode node2) {
if (node1 == null || node2.position > node1.position) {
return node2;
}
if (node2.position == node1.position) {
if (node2.totalDemerits < node1.totalDemerits) {
return node2;
}
}
return node1;
}

private double computeDemerits(KnuthNode activeNode, KnuthElement element,
int fitnessClass, double r) {
double demerits = 0;
// compute demerits
double f = Math.abs(r);
f = 1 + 100 * f * f * f;
if (element.isPenalty() && element.getP() >= 0) {
f += element.getP();
demerits = f * f;
} else if (element.isPenalty() && !element.isForcedBreak()) {
double penalty = element.getP();
demerits = f * f - penalty * penalty;
} else {
demerits = f * f;
}
if (element.isPenalty() && ((KnuthPenalty) element).isFlagged()
&& getElement(activeNode.position).isPenalty()
&& ((KnuthPenalty) getElement(activeNode.position)).isFlagged()) {
// add demerit for consecutive breaks at flagged penalties
demerits += repeatedFlaggedDemerit;
}
if (Math.abs(fitnessClass - activeNode.fitness) > 1) {
// add demerit for consecutive breaks
// with very different fitness classes
demerits += incompatibleFitnessDemerit;
}
demerits += activeNode.totalDemerits;
return demerits;
}

/**
* Return the element at index idx in the paragraph.
* @param idx index of the element.
* @return
*/
private KnuthElement getElement(int idx) {
return (KnuthElement) par.get(idx);
}

/**
* Add a KnuthNode at the end of line 'line'.
* If this is the first node in the line, adjust endLine accordingly.
* @param line
* @param node
*/
private void addNode(int line, KnuthNode node) {
int headIdx = line * 2;
if (headIdx >= activeLines.length) {
KnuthNode[] oldList = activeLines;
activeLines = new KnuthNode[headIdx + headIdx];
System.arraycopy(oldList, 0, activeLines, 0, oldList.length);
}
node.next = null;
if (activeLines[headIdx + 1] != null) {
activeLines[headIdx + 1].next = node;
} else {
activeLines[headIdx] = node;
endLine = line+1;
}
activeLines[headIdx + 1] = node;
activeNodeCount++;
}

/**
* Remove the first node in line 'line'. If the line then becomes empty, adjust the
* startLine accordingly.
* @param line
* @param node
*/
private void removeNode(int line, KnuthNode node) {
KnuthNode n = getNode(line);
if (n != node) {
log.error("Should be first");
} else {
activeLines[line*2] = node.next;
if (node.next == null) {
activeLines[line*2+1] = null;
}
while (startLine < endLine && getNode(startLine) == null) {
startLine++;
}
}
activeNodeCount--;
}

private KnuthNode getNode(int line) {
return activeLines[line * 2];
}

/**
* Return true if the position 'idx' is a legal breakpoint.
* @param idx
* @return
*/
private boolean isLegalBreakpoint(int idx) {
KnuthElement elm = getElement(idx);
if (elm.isPenalty() && elm.getP() != KnuthElement.INFINITE) {
return true;
} else if (idx > 0 && elm.isGlue() && getElement(idx-1).isBox()) {
return true;
} else {
return false;
}
}
public int getDifference(int line) {
return positions[line].difference;
}

public double getAdjustRatio(int line) {
return positions[line].adjustRatio;
}

public int getStart(int line) {
KnuthNode previous = positions[line].previous;
return line == 0 ? 0 : previous.position + 1;
}

public int getEnd(int line) {
return positions[line].position;
}

/**
* Return a string representation of a MinOptMax in the form of a
* "width+stretch-shrink". Useful only for debugging.
* @param mom
* @return
*/
private static String width(MinOptMax mom) {
return mom.opt + "+" + (mom.max - mom.opt) + "-" + (mom.opt - mom.min);

}

public String toString(String prepend) {
StringBuffer sb = new StringBuffer();
sb.append("[\n");
for (int i = startLine; i < endLine; i++) {
for (KnuthNode node = getNode(i); node != null; node = node.next) {
sb.append(prepend + "\t" + node + ",\n");
}
}
sb.append(prepend + "]");
return sb.toString();
}
}

+ 1
- 0
src/java/org/apache/fop/layoutmgr/LayoutContext.java ファイルの表示

@@ -19,6 +19,7 @@
package org.apache.fop.layoutmgr;

import org.apache.fop.fo.Constants;
import org.apache.fop.layoutmgr.inline.HyphContext;
import org.apache.fop.traits.MinOptMax;



+ 14
- 0
src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java ファイルの表示

@@ -61,6 +61,20 @@ import org.apache.fop.fo.pagination.StaticContent;
import org.apache.fop.fo.pagination.Title;
import org.apache.fop.area.AreaTreeHandler;

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.ExternalGraphicLayoutManager;
import org.apache.fop.layoutmgr.inline.FootnoteLayoutManager;
import org.apache.fop.layoutmgr.inline.ICLayoutManager;
import org.apache.fop.layoutmgr.inline.InlineLayoutManager;
import org.apache.fop.layoutmgr.inline.InlineLevelLayoutManager;
import org.apache.fop.layoutmgr.inline.InstreamForeignObjectLM;
import org.apache.fop.layoutmgr.inline.LeaderLayoutManager;
import org.apache.fop.layoutmgr.inline.PageNumberCitationLayoutManager;
import org.apache.fop.layoutmgr.inline.PageNumberLayoutManager;
import org.apache.fop.layoutmgr.inline.TextLayoutManager;
import org.apache.fop.layoutmgr.inline.WrapperLayoutManager;
import org.apache.fop.layoutmgr.list.ListBlockLayoutManager;
import org.apache.fop.layoutmgr.list.ListItemLayoutManager;
import org.apache.fop.layoutmgr.table.TableLayoutManager;

+ 1
- 0
src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java ファイルの表示

@@ -40,6 +40,7 @@ import org.apache.fop.fo.pagination.Region;
import org.apache.fop.fo.pagination.SideRegion;
import org.apache.fop.fo.pagination.SimplePageMaster;
import org.apache.fop.fo.pagination.StaticContent;
import org.apache.fop.layoutmgr.inline.ContentLayoutManager;

import org.apache.fop.traits.MinOptMax;


+ 1
- 0
src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java ファイルの表示

@@ -27,6 +27,7 @@ import org.apache.fop.area.Block;
import org.apache.fop.datatypes.PercentBase;
import org.apache.fop.fo.pagination.SideRegion;
import org.apache.fop.fo.pagination.StaticContent;
import org.apache.fop.layoutmgr.inline.InlineLevelLayoutManager;
import org.apache.fop.traits.MinOptMax;

/**

src/java/org/apache/fop/layoutmgr/BasicLinkLayoutManager.java → src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java ファイルの表示

@@ -16,9 +16,10 @@

/* $Id$ */

package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;

import org.apache.fop.fo.flow.BasicLink;
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.area.inline.InlineParent;
import org.apache.fop.area.Trait;
import org.apache.fop.area.LinkResolver;

src/java/org/apache/fop/layoutmgr/BidiLayoutManager.java → src/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java ファイルの表示

@@ -16,7 +16,7 @@

/* $Id$ */

package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;

import java.util.ArrayList;
import java.util.List;

src/java/org/apache/fop/layoutmgr/CharacterLayoutManager.java → src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java ファイルの表示

@@ -16,10 +16,18 @@

/* $Id$ */

package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;

import org.apache.fop.fo.flow.Character;
import org.apache.fop.fonts.Font;
import org.apache.fop.layoutmgr.KnuthElement;
import org.apache.fop.layoutmgr.KnuthGlue;
import org.apache.fop.layoutmgr.KnuthPenalty;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LeafPosition;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.layoutmgr.inline.LeafNodeLayoutManager.AreaInfo;
import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.area.Trait;
import org.apache.fop.traits.MinOptMax;

src/java/org/apache/fop/layoutmgr/ContentLayoutManager.java → src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java ファイルの表示

@@ -16,11 +16,19 @@

/* $Id$ */

package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;

import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.pagination.Title;
import org.apache.fop.layoutmgr.KnuthElement;
import org.apache.fop.layoutmgr.KnuthPossPosIter;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.PageSequenceLayoutManager;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.SpaceSpecifier;
import org.apache.fop.area.Area;
import org.apache.fop.area.LineArea;
import org.apache.fop.area.inline.InlineArea;

src/java/org/apache/fop/layoutmgr/ExternalGraphicLayoutManager.java → src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java ファイルの表示

@@ -16,7 +16,7 @@

/* $Id$ */

package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;

// Java
import java.awt.geom.Rectangle2D;
@@ -27,6 +27,7 @@ import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.area.inline.Viewport;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.flow.ExternalGraphic;
import org.apache.fop.layoutmgr.TraitSetter;

/**
* LayoutManager for the fo:external-graphic formatting object

src/java/org/apache/fop/layoutmgr/FootnoteLayoutManager.java → src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java ファイルの表示

@@ -16,13 +16,18 @@

/* $Id$ */

package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;

import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;

import org.apache.fop.fo.flow.Footnote;
import org.apache.fop.layoutmgr.AbstractLayoutManager;
import org.apache.fop.layoutmgr.FootnoteBodyLayoutManager;
import org.apache.fop.layoutmgr.KnuthElement;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.Position;

public class FootnoteLayoutManager extends AbstractLayoutManager
implements InlineLevelLayoutManager {

src/java/org/apache/fop/layoutmgr/HyphContext.java → src/java/org/apache/fop/layoutmgr/inline/HyphContext.java ファイルの表示

@@ -16,7 +16,7 @@

/* $Id$ */
package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;

/**
* This class is used to pass information to the getNextBreakPoss()

src/java/org/apache/fop/layoutmgr/ICLayoutManager.java → src/java/org/apache/fop/layoutmgr/inline/ICLayoutManager.java ファイルの表示

@@ -16,7 +16,7 @@

/* $Id$ */

package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;

// Java
import java.util.List;

src/java/org/apache/fop/layoutmgr/InlineLayoutManager.java → src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java ファイルの表示

@@ -16,7 +16,7 @@

/* $Id$ */

package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;

import java.util.ListIterator;
import java.util.LinkedList;
@@ -25,6 +25,11 @@ import org.apache.fop.fo.flow.InlineLevel;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.CommonMarginInline;
import org.apache.fop.fo.properties.SpaceProperty;
import org.apache.fop.layoutmgr.KnuthElement;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.NonLeafPosition;
import org.apache.fop.layoutmgr.SpaceSpecifier;
import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.traits.MinOptMax;
import org.apache.fop.traits.SpaceVal;


src/java/org/apache/fop/layoutmgr/InlineLevelLayoutManager.java → src/java/org/apache/fop/layoutmgr/inline/InlineLevelLayoutManager.java ファイルの表示

@@ -16,10 +16,13 @@

/* $Id$ */
package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;

import java.util.List;

import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.Position;

/**
* The interface for LayoutManagers which generate inline areas
*/

src/java/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java → src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java ファイルの表示

@@ -16,7 +16,7 @@

/* $Id$ */

package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;

import java.util.LinkedList;
import java.util.Iterator;
@@ -26,6 +26,14 @@ import java.util.HashMap;

import org.apache.fop.fo.FObj;
import org.apache.fop.fo.properties.SpaceProperty;
import org.apache.fop.layoutmgr.AbstractLayoutManager;
import org.apache.fop.layoutmgr.KnuthElement;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.NonLeafPosition;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.SpaceSpecifier;
import org.apache.fop.traits.SpaceVal;
import org.apache.fop.area.Area;
import org.apache.fop.area.inline.InlineArea;

src/java/org/apache/fop/layoutmgr/InstreamForeignObjectLM.java → src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java ファイルの表示

@@ -16,7 +16,7 @@

/* $Id$ */

package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;

// Java
import java.awt.geom.Rectangle2D;
@@ -25,6 +25,7 @@ import java.awt.geom.Rectangle2D;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.XMLObj;
import org.apache.fop.fo.flow.InstreamForeignObject;
import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.area.inline.ForeignObject;
import org.apache.fop.area.inline.Viewport;

@@ -190,7 +191,7 @@ public class InstreamForeignObjectLM extends LeafNodeLayoutManager {
}
/**
* @see org.apache.fop.layoutmgr.LeafNodeLayoutManager#addId()
* @see org.apache.fop.layoutmgr.inline.LeafNodeLayoutManager#addId()
*/
protected void addId() {
getPSLM().addIDToPage(fobj.getId());

src/java/org/apache/fop/layoutmgr/KnuthInlineBox.java → src/java/org/apache/fop/layoutmgr/inline/KnuthInlineBox.java ファイルの表示

@@ -16,7 +16,11 @@

/* $Id$ */

package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;

import org.apache.fop.layoutmgr.FootnoteBodyLayoutManager;
import org.apache.fop.layoutmgr.KnuthBox;
import org.apache.fop.layoutmgr.Position;

public class KnuthInlineBox extends KnuthBox {

src/java/org/apache/fop/layoutmgr/LeaderLayoutManager.java → src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java ファイルの表示

@@ -16,7 +16,7 @@

/* $Id$ */

package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;

import org.apache.fop.area.Trait;
import org.apache.fop.area.inline.FilledArea;
@@ -26,6 +26,14 @@ import org.apache.fop.area.inline.TextArea;
import org.apache.fop.datatypes.PercentBase;
import org.apache.fop.fo.flow.Leader;
import org.apache.fop.fonts.Font;
import org.apache.fop.layoutmgr.KnuthElement;
import org.apache.fop.layoutmgr.KnuthGlue;
import org.apache.fop.layoutmgr.KnuthPenalty;
import org.apache.fop.layoutmgr.KnuthPossPosIter;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LeafPosition;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.traits.MinOptMax;

import java.util.List;

src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java → src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java ファイルの表示

@@ -16,11 +16,16 @@

/* $Id$ */

package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;

import org.apache.fop.area.Area;
import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.fo.FObj;
import org.apache.fop.layoutmgr.AbstractLayoutManager;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LeafPosition;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.traits.MinOptMax;

import java.util.List;

src/java/org/apache/fop/layoutmgr/LineLayoutManager.java → src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java ファイルの表示

@@ -16,7 +16,7 @@

/* $Id: LineLayoutManager.java,v 1.17 2004/04/02 10:38:29 cbowditch Exp $ */

package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;

import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.Constants;
@@ -24,6 +24,23 @@ import org.apache.fop.fo.flow.Block;
import org.apache.fop.fo.properties.CommonHyphenation;
import org.apache.fop.hyphenation.Hyphenation;
import org.apache.fop.hyphenation.Hyphenator;
import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
import org.apache.fop.layoutmgr.BreakingAlgorithm;
import org.apache.fop.layoutmgr.ElementListObserver;
import org.apache.fop.layoutmgr.KnuthBlockBox;
import org.apache.fop.layoutmgr.KnuthBox;
import org.apache.fop.layoutmgr.KnuthElement;
import org.apache.fop.layoutmgr.KnuthGlue;
import org.apache.fop.layoutmgr.KnuthPenalty;
import org.apache.fop.layoutmgr.KnuthPossPosIter;
import org.apache.fop.layoutmgr.KnuthSequence;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.LeafPosition;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.SpaceSpecifier;
import org.apache.fop.layoutmgr.BreakingAlgorithm.KnuthNode;
import org.apache.fop.area.LineArea;

import java.util.ListIterator;

src/java/org/apache/fop/layoutmgr/LineLayoutPossibilities.java → src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java ファイルの表示

@@ -16,12 +16,13 @@

/* $Id$ */

package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.fop.layoutmgr.Position;

public class LineLayoutPossibilities {


src/java/org/apache/fop/layoutmgr/PageNumberCitationLayoutManager.java → src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java ファイルの表示

@@ -16,7 +16,7 @@

/* $Id$ */

package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;

import org.apache.fop.fo.flow.PageNumberCitation;
import org.apache.fop.area.PageViewport;
@@ -26,6 +26,10 @@ import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.area.inline.UnresolvedPageNumber;
import org.apache.fop.area.inline.TextArea;
import org.apache.fop.fonts.Font;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.TraitSetter;

/**
* LayoutManager for the fo:page-number-citation formatting object
@@ -62,7 +66,7 @@ public class PageNumberCitationLayoutManager extends LeafNodeLayoutManager {
}
}
/** @see org.apache.fop.layoutmgr.LeafNodeLayoutManager#getLead() */
/** @see org.apache.fop.layoutmgr.inline.LeafNodeLayoutManager#getLead() */
public int getLead() {
return font.getAscender();
}

src/java/org/apache/fop/layoutmgr/PageNumberLayoutManager.java → src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java ファイルの表示

@@ -16,13 +16,15 @@

/* $Id$ */

package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;

import org.apache.fop.fo.flow.PageNumber;
import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.area.inline.TextArea;
import org.apache.fop.area.Trait;
import org.apache.fop.fonts.Font;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.TraitSetter;

/**
* LayoutManager for the fo:page-number formatting object
@@ -66,7 +68,7 @@ public class PageNumberLayoutManager extends LeafNodeLayoutManager {
}
/** @see org.apache.fop.layoutmgr.LeafNodeLayoutManager#getLead() */
/** @see org.apache.fop.layoutmgr.inline.LeafNodeLayoutManager#getLead() */
public int getLead() {
return font.getAscender();
}

src/java/org/apache/fop/layoutmgr/TextLayoutManager.java → src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java ファイルの表示

@@ -16,7 +16,7 @@

/* $Id$ */

package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;

import java.util.ArrayList;
import java.util.List;
@@ -26,6 +26,15 @@ import java.util.ListIterator;
import org.apache.fop.fo.FOText;
import org.apache.fop.fo.flow.Inline;
import org.apache.fop.fonts.Font;
import org.apache.fop.layoutmgr.KnuthBox;
import org.apache.fop.layoutmgr.KnuthElement;
import org.apache.fop.layoutmgr.KnuthGlue;
import org.apache.fop.layoutmgr.KnuthPenalty;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LeafPosition;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.traits.SpaceVal;
import org.apache.fop.area.Trait;
import org.apache.fop.area.inline.InlineArea;

src/java/org/apache/fop/layoutmgr/WrapperLayoutManager.java → src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java ファイルの表示

@@ -16,10 +16,11 @@
/* $Id$ */
package org.apache.fop.layoutmgr;
package org.apache.fop.layoutmgr.inline;
import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.fo.flow.Wrapper;
import org.apache.fop.layoutmgr.LayoutContext;
/**
* This is the layout manager for the fo:wrapper formatting object.
@@ -37,7 +38,7 @@ public class WrapperLayoutManager extends LeafNodeLayoutManager {
fobj = node;
}
/** @see org.apache.fop.layoutmgr.LeafNodeLayoutManager */
/** @see org.apache.fop.layoutmgr.inline.LeafNodeLayoutManager */
public InlineArea get(LayoutContext context) {
//Create a zero-width, zero-height dummy area so this node can
//participate in the ID handling. Otherwise, addId() wouldn't
@@ -46,7 +47,7 @@ public class WrapperLayoutManager extends LeafNodeLayoutManager {
return area;
}
/** @see org.apache.fop.layoutmgr.LeafNodeLayoutManager#addId() */
/** @see org.apache.fop.layoutmgr.inline.LeafNodeLayoutManager#addId() */
protected void addId() {
getPSLM().addIDToPage(fobj.getId());
}

読み込み中…
キャンセル
保存