View | Details | Raw Unified | Return to bug 37579
Collapse All | Expand All

(-)src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java (-3 / +21 lines)
Lines 37-42 Link Here
37
import org.apache.fop.layoutmgr.TraitSetter;
37
import org.apache.fop.layoutmgr.TraitSetter;
38
import org.apache.fop.layoutmgr.KnuthElement;
38
import org.apache.fop.layoutmgr.KnuthElement;
39
import org.apache.fop.layoutmgr.KnuthBox;
39
import org.apache.fop.layoutmgr.KnuthBox;
40
import org.apache.fop.layoutmgr.KnuthBlockBox;
40
import org.apache.fop.layoutmgr.KnuthPenalty;
41
import org.apache.fop.layoutmgr.KnuthPenalty;
41
import org.apache.fop.layoutmgr.KnuthPossPosIter;
42
import org.apache.fop.layoutmgr.KnuthPossPosIter;
42
import org.apache.fop.area.Area;
43
import org.apache.fop.area.Area;
Lines 62-67 Link Here
62
63
63
    private LinkedList labelList = null;
64
    private LinkedList labelList = null;
64
    private LinkedList bodyList = null;
65
    private LinkedList bodyList = null;
66
    private LinkedList footnoteList;
65
67
66
    private int listItemHeight;
68
    private int listItemHeight;
67
    
69
    
Lines 221-227 Link Here
221
223
222
        // "wrap" the Position inside each element
224
        // "wrap" the Position inside each element
223
        wrapPositionElements(returnedList, returnList, true);
225
        wrapPositionElements(returnedList, returnList, true);
224
        
226
225
        addKnuthElementsForSpaceAfter(returnList, alignment);
227
        addKnuthElementsForSpaceAfter(returnList, alignment);
226
228
227
        if (keepWithNextPendingOnLabel || keepWithNextPendingOnBody || mustKeepWithNext()) {
229
        if (keepWithNextPendingOnLabel || keepWithNextPendingOnBody || mustKeepWithNext()) {
Lines 256-262 Link Here
256
        LinkedList returnList = new LinkedList();
258
        LinkedList returnList = new LinkedList();
257
        while ((step = getNextStep(elementLists, start, end, partialHeights))
259
        while ((step = getNextStep(elementLists, start, end, partialHeights))
258
               > 0) {
260
               > 0) {
259
            
261
260
            if (end[0] + 1 == elementLists[0].size()) {
262
            if (end[0] + 1 == elementLists[0].size()) {
261
                if (keepWithNextPendingOnLabel) {
263
                if (keepWithNextPendingOnLabel) {
262
                    keepWithNextActive = true;
264
                    keepWithNextActive = true;
Lines 278-284 Link Here
278
            addedBoxHeight += boxHeight;
280
            addedBoxHeight += boxHeight;
279
            ListItemPosition stepPosition = new ListItemPosition(this, 
281
            ListItemPosition stepPosition = new ListItemPosition(this, 
280
                    start[0], end[0], start[1], end[1]);
282
                    start[0], end[0], start[1], end[1]);
281
            returnList.add(new KnuthBox(boxHeight, stepPosition, false));
283
            if (footnoteList.size() > 0) {
284
                returnList.add(new KnuthBlockBox(boxHeight, footnoteList, stepPosition, false));
285
            } else {
286
                returnList.add(new KnuthBox(boxHeight, stepPosition, false));
287
            }
288
            footnoteList = null;
282
            if (addedBoxHeight < totalHeight) {
289
            if (addedBoxHeight < totalHeight) {
283
                int p = 0;
290
                int p = 0;
284
                if (keepWithNextActive || mustKeepTogether()) {
291
                if (keepWithNextActive || mustKeepTogether()) {
Lines 300-311 Link Here
300
        start[0] = end[0] + 1;
307
        start[0] = end[0] + 1;
301
        start[1] = end[1] + 1;
308
        start[1] = end[1] + 1;
302
309
310
        // empty list for footnote-transport
311
        footnoteList = new LinkedList();
312
303
        // get next possible sequence for label and body
313
        // get next possible sequence for label and body
304
        int seqCount = 0;
314
        int seqCount = 0;
305
        for (int i = 0; i < start.length; i++) {
315
        for (int i = 0; i < start.length; i++) {
306
            while (end[i] + 1 < elementLists[i].size()) {
316
            while (end[i] + 1 < elementLists[i].size()) {
307
                end[i]++;
317
                end[i]++;
308
                KnuthElement el = (KnuthElement)elementLists[i].get(end[i]);
318
                KnuthElement el = (KnuthElement)elementLists[i].get(end[i]);
319
320
                // receive footnotes
321
                if (el instanceof KnuthBlockBox) {
322
                    if (((KnuthBlockBox)el).hasAnchors()) {
323
                        footnoteList.addAll(((KnuthBlockBox)el).getFootnoteBodyLMs());
324
                    }
325
                }
326
309
                if (el.isPenalty()) {
327
                if (el.isPenalty()) {
310
                    if (el.getP() < KnuthElement.INFINITE) {
328
                    if (el.getP() < KnuthElement.INFINITE) {
311
                        //First legal break point
329
                        //First legal break point
(-)src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java (-2 / +40 lines)
Lines 41-46 Link Here
41
import org.apache.fop.layoutmgr.ElementListObserver;
41
import org.apache.fop.layoutmgr.ElementListObserver;
42
import org.apache.fop.layoutmgr.ElementListUtils;
42
import org.apache.fop.layoutmgr.ElementListUtils;
43
import org.apache.fop.layoutmgr.KnuthBox;
43
import org.apache.fop.layoutmgr.KnuthBox;
44
import org.apache.fop.layoutmgr.KnuthBlockBox;
44
import org.apache.fop.layoutmgr.KnuthElement;
45
import org.apache.fop.layoutmgr.KnuthElement;
45
import org.apache.fop.layoutmgr.KnuthPenalty;
46
import org.apache.fop.layoutmgr.KnuthPenalty;
46
import org.apache.fop.layoutmgr.KnuthPossPosIter;
47
import org.apache.fop.layoutmgr.KnuthPossPosIter;
Lines 139-144 Link Here
139
        KnuthBox headerAsFirst = null;
140
        KnuthBox headerAsFirst = null;
140
        KnuthBox headerAsSecondToLast = null;
141
        KnuthBox headerAsSecondToLast = null;
141
        KnuthBox footerAsLast = null;
142
        KnuthBox footerAsLast = null;
143
        LinkedList footnoteList;
144
        Iterator iter;
145
        ListElement el;
142
        if (headerIter != null && headerList == null) {
146
        if (headerIter != null && headerList == null) {
143
            this.headerList = getKnuthElementsForRowIterator(
147
            this.headerList = getKnuthElementsForRowIterator(
144
                    headerIter, context, alignment, TableRowIterator.HEADER);
148
                    headerIter, context, alignment, TableRowIterator.HEADER);
Lines 149-155 Link Here
149
            }
153
            }
150
            TableHeaderFooterPosition pos = new TableHeaderFooterPosition(
154
            TableHeaderFooterPosition pos = new TableHeaderFooterPosition(
151
                    getTableLM(), true, this.headerList);
155
                    getTableLM(), true, this.headerList);
152
            KnuthBox box = new KnuthBox(headerNetHeight, pos, false);
156
            // preserve footnotes
157
            footnoteList = new LinkedList();
158
            iter = this.headerList.iterator();
159
            while (iter.hasNext()) {
160
                el = (ListElement)iter.next();
161
                if (el instanceof KnuthBlockBox) {
162
                    if (((KnuthBlockBox)el).hasAnchors()) {
163
                        footnoteList.addAll(((KnuthBlockBox)el).getFootnoteBodyLMs());
164
                    }
165
                }
166
            }
167
            KnuthBox box;
168
            if (footnoteList.size() > 0) {
169
                box = (KnuthBox)(new KnuthBlockBox(headerNetHeight, footnoteList, pos, false));
170
            } else {
171
                box = new KnuthBox(headerNetHeight, pos, false);
172
            }
173
            footnoteList = null;
153
            if (getTableLM().getTable().omitHeaderAtBreak()) {
174
            if (getTableLM().getTable().omitHeaderAtBreak()) {
154
                //We can simply add the table header at the beginning of the whole list
175
                //We can simply add the table header at the beginning of the whole list
155
                headerAsFirst = box;
176
                headerAsFirst = box;
Lines 169-175 Link Here
169
                //We can simply add the table header at the end of the whole list
190
                //We can simply add the table header at the end of the whole list
170
                TableHeaderFooterPosition pos = new TableHeaderFooterPosition(
191
                TableHeaderFooterPosition pos = new TableHeaderFooterPosition(
171
                        getTableLM(), false, this.footerList);
192
                        getTableLM(), false, this.footerList);
172
                KnuthBox box = new KnuthBox(footerNetHeight, pos, false);
193
                // preserve footnotes
194
                footnoteList = new LinkedList();
195
                iter = this.footerList.iterator();
196
                while (iter.hasNext()) {
197
                    el = (ListElement)iter.next();
198
                    if (el instanceof KnuthBlockBox) {
199
                        if (((KnuthBlockBox)el).hasAnchors()) {
200
                            footnoteList.addAll(((KnuthBlockBox)el).getFootnoteBodyLMs());
201
                        }
202
                    }
203
                }
204
                KnuthBox box;
205
                if (footnoteList.size() > 0) {
206
                    box = (KnuthBox) new KnuthBlockBox(footerNetHeight, footnoteList, pos, false);
207
                } else {
208
                    box = new KnuthBox(footerNetHeight, pos, false);
209
                }
210
                footnoteList = null;
173
                footerAsLast = box;
211
                footerAsLast = box;
174
            }
212
            }
175
        }
213
        }
(-)src/java/org/apache/fop/layoutmgr/table/TableStepper.java (-1 / +19 lines)
Lines 30-35 Link Here
30
import org.apache.fop.layoutmgr.BreakElement;
30
import org.apache.fop.layoutmgr.BreakElement;
31
import org.apache.fop.layoutmgr.ElementListUtils;
31
import org.apache.fop.layoutmgr.ElementListUtils;
32
import org.apache.fop.layoutmgr.KnuthBox;
32
import org.apache.fop.layoutmgr.KnuthBox;
33
import org.apache.fop.layoutmgr.KnuthBlockBox;
33
import org.apache.fop.layoutmgr.KnuthElement;
34
import org.apache.fop.layoutmgr.KnuthElement;
34
import org.apache.fop.layoutmgr.KnuthPenalty;
35
import org.apache.fop.layoutmgr.KnuthPenalty;
35
import org.apache.fop.layoutmgr.LayoutContext;
36
import org.apache.fop.layoutmgr.LayoutContext;
Lines 64-69 Link Here
64
    private boolean skippedStep;
65
    private boolean skippedStep;
65
    private boolean[] keepWithNextSignals;
66
    private boolean[] keepWithNextSignals;
66
    private boolean[] forcedBreaks;
67
    private boolean[] forcedBreaks;
68
    private LinkedList footnoteList;
67
    
69
    
68
    /**
70
    /**
69
     * Main constructor
71
     * Main constructor
Lines 315-321 Link Here
315
                log.debug(" - backtrack=" + rowBacktrackForLastStep 
317
                log.debug(" - backtrack=" + rowBacktrackForLastStep 
316
                        + " - row=" + activeRow + " - " + tcpos);
318
                        + " - row=" + activeRow + " - " + tcpos);
317
            }
319
            }
318
            returnList.add(new KnuthBox(boxLen, tcpos, false));
320
321
            if (footnoteList.size() > 0) {
322
                returnList.add(new KnuthBlockBox(boxLen, footnoteList, tcpos, false));
323
            } else {
324
                returnList.add(new KnuthBox(boxLen, tcpos, false));
325
            }
326
            footnoteList = null;
327
319
            TableHFPenaltyPosition penaltyPos = new TableHFPenaltyPosition(getTableLM());
328
            TableHFPenaltyPosition penaltyPos = new TableHFPenaltyPosition(getTableLM());
320
            if (bodyType == TableRowIterator.BODY) {
329
            if (bodyType == TableRowIterator.BODY) {
321
                if (!getTableLM().getTable().omitHeaderAtBreak()) {
330
                if (!getTableLM().getTable().omitHeaderAtBreak()) {
Lines 441-446 Link Here
441
            }
450
            }
442
        }
451
        }
443
452
453
        // empty list for footnote-transport
454
        footnoteList = new LinkedList();
455
444
        //Get next possible sequence for each cell
456
        //Get next possible sequence for each cell
445
        int seqCount = 0;
457
        int seqCount = 0;
446
        for (int i = 0; i < start.length; i++) {
458
        for (int i = 0; i < start.length; i++) {
Lines 450-455 Link Here
450
            while (end[i] + 1 < elementLists[i].size()) {
462
            while (end[i] + 1 < elementLists[i].size()) {
451
                end[i]++;
463
                end[i]++;
452
                KnuthElement el = (KnuthElement)elementLists[i].get(end[i]);
464
                KnuthElement el = (KnuthElement)elementLists[i].get(end[i]);
465
                // receive footnotes
466
                if (el instanceof KnuthBlockBox) {
467
                    if (((KnuthBlockBox)el).hasAnchors()) {
468
                        footnoteList.addAll(((KnuthBlockBox)el).getFootnoteBodyLMs());
469
                    }
470
                }
453
                if (el.isPenalty()) {
471
                if (el.isPenalty()) {
454
                    if (el.getP() <= -KnuthElement.INFINITE) {
472
                    if (el.getP() <= -KnuthElement.INFINITE) {
455
                        log.debug("FORCED break encountered!");
473
                        log.debug("FORCED break encountered!");

Return to bug 37579