aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/fo/flow/FootnoteBody.java
blob: 029ea5b92bf456a921abe06f773c91e8ecf41e29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * $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.fo.flow;

// FOP
import org.apache.fop.fo.*;
import org.apache.fop.layout.Area;
import org.apache.fop.layout.AreaClass;
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.properties.*;
import org.apache.fop.layout.*;

// Java
import java.util.Enumeration;

public class FootnoteBody extends FObj {

    int align;
    int alignLast;
    int lineHeight;
    int startIndent;
    int endIndent;
    int textIndent;

    public static class Maker extends FObj.Maker {
        public FObj make(FObj parent,
                         PropertyList propertyList) throws FOPException {
            return new FootnoteBody(parent, propertyList);
        }

    }

    public static FObj.Maker maker() {
        return new FootnoteBody.Maker();
    }

    public FootnoteBody(FObj parent,
                        PropertyList propertyList) throws FOPException {
        super(parent, propertyList);
        this.name = "fo:footnote-body";
        this.areaClass = AreaClass.setAreaClass(AreaClass.XSL_FOOTNOTE);
    }

    public Status layout(Area area) throws FOPException {
        if (this.marker == START) {
            this.marker = 0;
        }
        BlockArea blockArea =
            new BlockArea(propMgr.getFontState(area.getFontInfo()),
                          area.getAllocationWidth(), area.spaceLeft(),
                          startIndent, endIndent, textIndent, align,
                          alignLast, lineHeight);
        blockArea.setGeneratedBy(this);
        blockArea.isFirst(true);
        blockArea.setPage(area.getPage());
        blockArea.start();

        blockArea.setAbsoluteHeight(area.getAbsoluteHeight());
        blockArea.setIDReferences(area.getIDReferences());

        blockArea.setTableCellXOffset(area.getTableCellXOffset());

        int numChildren = this.children.size();
        for (int i = this.marker; i < numChildren; i++) {
            FONode fo = (FONode)children.elementAt(i);
            Status status;
            if ((status = fo.layout(blockArea)).isIncomplete()) {
                this.resetMarker();
                return status;
            }
        }
        blockArea.end();
        area.addChild(blockArea);
        area.increaseHeight(blockArea.getHeight());
        blockArea.isLast(true);
        return new Status(Status.OK);
    }

}