Преглед изворни кода

Add support for nested inlines using the BreakPoss logic.


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194817 13f79535-47bb-0310-9956-ffa450edef68
pull/30/head
Karen Lease пре 22 година
родитељ
комит
125861079b

+ 41
- 0
src/org/apache/fop/area/inline/InlineParent.java Прегледај датотеку

@@ -0,0 +1,41 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

package org.apache.fop.area.inline;

import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
import org.apache.fop.render.Renderer;

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

// this is an inline area that can have other inlines as children
public class InlineParent extends InlineArea {
ArrayList inlines = new ArrayList();
int width;

public InlineParent() {
}

public void render(Renderer renderer) {
renderer.renderInlineParent(this);
}

public void addChild(InlineArea child) {
inlines.add(child);
}

public List getChildAreas() {
return inlines;
}

public int getWidth() {
return width;
}

}

+ 2
- 2
src/org/apache/fop/fo/FOText.java Прегледај датотеку

@@ -81,9 +81,9 @@ public class FOText extends FObj {
ca = new char[length];
System.arraycopy(tmp, 0, ca, 0, length);
}
list.add(new TextLayoutManager(this, ca, textInfo));
// list.add(new TextLayoutManager(this, ca, textInfo));
// TEST VARIANT USING Karen's BreakPoss scheme
// list.add(new TextBPLayoutManager(this, ca, textInfo));
list.add(new TextBPLayoutManager(this, ca, textInfo));
}

public CharIterator charIterator() {

+ 13
- 9
src/org/apache/fop/fo/FObjMixed.java Прегледај датотеку

@@ -13,6 +13,8 @@ import org.apache.fop.layout.FontInfo;
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.StreamRenderer;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.layoutmgr.InlineStackingBPLayoutManager;
import org.apache.fop.layoutmgr.LMiter;

import java.util.List;

@@ -33,15 +35,17 @@ public class FObjMixed extends FObj {
}

public void addLayoutManager(List lms) {
// set start and end properties for this element, id, etc.
int numChildren = this.children.size();
for (int i = 0; i < numChildren; i++) {
Object o = children.get(i);
if (o instanceof FObj) {
FObj fo = (FObj) o;
fo.addLayoutManager(lms);
}
}
lms.add(new InlineStackingBPLayoutManager(this,
new LMiter(children.listIterator())));
// set start and end properties for this element, id, etc.
// int numChildren = this.children.size();
// for (int i = 0; i < numChildren; i++) {
// Object o = children.get(i);
// if (o instanceof FObj) {
// FObj fo = (FObj) o;
// fo.addLayoutManager(lms);
// }
// }
}

protected void addCharacters(char data[], int start, int length) {

+ 8
- 19
src/org/apache/fop/fo/PropertyManager.java Прегледај датотеку

@@ -47,10 +47,10 @@ public class PropertyManager {
private HyphenationProps hyphProps = null;
private TextInfo textInfo = null;

private String[] saLeft;
private String[] saRight;
private String[] saTop;
private String[] saBottom;
private static String[] saBefore = new String[] {"before"};
private static String[] saAfter = new String[] {"after"};
private static String[] saStart = new String[] {"start"};
private static String[] saEnd = new String[] {"end"};

private static MessageFormat msgColorFmt =
new MessageFormat("border-{0}-color");
@@ -69,16 +69,6 @@ public class PropertyManager {
m_fontInfo = fontInfo;
}

private void initDirections() {
saLeft = new String[1];
saRight = new String[1];
saTop = new String[1];
saBottom = new String[1];
saTop[0] = properties.wmAbsToRel(PropertyList.TOP);
saBottom[0] = properties.wmAbsToRel(PropertyList.BOTTOM);
saLeft[0] = properties.wmAbsToRel(PropertyList.LEFT);
saRight[0] = properties.wmAbsToRel(PropertyList.RIGHT);
}

public FontState getFontState(FontInfo fontInfo) throws FOPException {
if (fontState == null) {
@@ -106,12 +96,11 @@ public class PropertyManager {
public BorderAndPadding getBorderAndPadding() {
if (borderAndPadding == null) {
this.borderAndPadding = new BorderAndPadding();
initDirections();

initBorderInfo(BorderAndPadding.TOP, saTop);
initBorderInfo(BorderAndPadding.BOTTOM, saBottom);
initBorderInfo(BorderAndPadding.LEFT, saLeft);
initBorderInfo(BorderAndPadding.RIGHT, saRight);
initBorderInfo(BorderAndPadding.BEFORE, saBefore);
initBorderInfo(BorderAndPadding.AFTER, saAfter);
initBorderInfo(BorderAndPadding.START, saStart);
initBorderInfo(BorderAndPadding.END, saEnd);
}
return borderAndPadding;
}

+ 11
- 6
src/org/apache/fop/layout/BorderAndPadding.java Прегледај датотеку

@@ -12,10 +12,15 @@ import org.apache.fop.datatypes.CondLength;

public class BorderAndPadding implements Cloneable {

public static final int TOP = 0;
public static final int RIGHT = 1;
public static final int BOTTOM = 2;
public static final int LEFT = 3;
public static final int BEFORE = 0;
public static final int AFTER = 1;
public static final int START = 2;
public static final int END = 3;

public static final int TOP = BEFORE;
public static final int BOTTOM = AFTER;
public static final int LEFT = START;
public static final int RIGHT = END;

private static class ResolvedCondLength implements Cloneable {
int iLength; // Resolved length value
@@ -126,7 +131,7 @@ public class BorderAndPadding implements Cloneable {
}


private int getBorderWidth(int side, boolean bDiscard) {
public int getBorderWidth(int side, boolean bDiscard) {
if ((borderInfo[side] == null)
|| (bDiscard && borderInfo[side].mWidth.bDiscard)) {
return 0;
@@ -148,7 +153,7 @@ public class BorderAndPadding implements Cloneable {
return 0;
}

private int getPadding(int side, boolean bDiscard) {
public int getPadding(int side, boolean bDiscard) {
if ((padding[side] == null) || (bDiscard && padding[side].bDiscard)) {
return 0;
} else

Loading…
Откажи
Сачувај