Lines 48-53
Link Here
|
48 |
import org.apache.fop.layoutmgr.BreakElement; |
48 |
import org.apache.fop.layoutmgr.BreakElement; |
49 |
import org.apache.fop.layoutmgr.InlineKnuthSequence; |
49 |
import org.apache.fop.layoutmgr.InlineKnuthSequence; |
50 |
import org.apache.fop.layoutmgr.KnuthBox; |
50 |
import org.apache.fop.layoutmgr.KnuthBox; |
|
|
51 |
import org.apache.fop.layoutmgr.KnuthElement; |
51 |
import org.apache.fop.layoutmgr.KnuthSequence; |
52 |
import org.apache.fop.layoutmgr.KnuthSequence; |
52 |
import org.apache.fop.layoutmgr.LayoutContext; |
53 |
import org.apache.fop.layoutmgr.LayoutContext; |
53 |
import org.apache.fop.layoutmgr.LayoutManager; |
54 |
import org.apache.fop.layoutmgr.LayoutManager; |
Lines 74-80
Link Here
|
74 |
private CommonMarginInline inlineProps = null; |
75 |
private CommonMarginInline inlineProps = null; |
75 |
private CommonBorderPaddingBackground borderProps = null; |
76 |
private CommonBorderPaddingBackground borderProps = null; |
76 |
|
77 |
|
77 |
private boolean areaCreated = false; |
|
|
78 |
private LayoutManager lastChildLM = null; // Set when return last breakposs; |
78 |
private LayoutManager lastChildLM = null; // Set when return last breakposs; |
79 |
|
79 |
|
80 |
private Position auxiliaryPosition; |
80 |
private Position auxiliaryPosition; |
Lines 96-101
Link Here
|
96 |
|
96 |
|
97 |
private AlignmentContext alignmentContext = null; |
97 |
private AlignmentContext alignmentContext = null; |
98 |
|
98 |
|
|
|
99 |
private KnuthElement firstKnuthElement = null; |
100 |
|
99 |
/** |
101 |
/** |
100 |
* Create an inline layout manager. |
102 |
* Create an inline layout manager. |
101 |
* This is used for fo's that create areas that |
103 |
* This is used for fo's that create areas that |
Lines 396-404
Link Here
|
396 |
} |
398 |
} |
397 |
} |
399 |
} |
398 |
|
400 |
|
399 |
return returnList.isEmpty() ? null : returnList; |
401 |
boolean isEmpty = returnList.isEmpty(); |
|
|
402 |
|
403 |
if (!isEmpty) { |
404 |
storeFirstKnuthElement((List)returnList.get(0)); |
405 |
} |
406 |
|
407 |
return isEmpty ? null : returnList; |
400 |
} |
408 |
} |
401 |
|
409 |
|
|
|
410 |
private void storeFirstKnuthElement(List knuthSequence) { |
411 |
firstKnuthElement = knuthSequence.isEmpty() ? null : (KnuthElement)knuthSequence.get(0); |
412 |
} |
413 |
|
414 |
private boolean isDescendantPosition(KnuthElement ke, Position position) { |
415 |
Position pos = ke.getPosition(); |
416 |
while (pos instanceof NonLeafPosition && pos != null) { |
417 |
if (pos == position) { |
418 |
return true; |
419 |
} |
420 |
pos = pos.getPosition(); |
421 |
} |
422 |
return false; |
423 |
} |
424 |
|
402 |
/** |
425 |
/** |
403 |
* Generate and add areas to parent area. |
426 |
* Generate and add areas to parent area. |
404 |
* Set size of each area. This should only create and return one |
427 |
* Set size of each area. This should only create and return one |
Lines 415-432
Link Here
|
415 |
|
438 |
|
416 |
setChildContext(new LayoutContext(context)); // Store current value |
439 |
setChildContext(new LayoutContext(context)); // Store current value |
417 |
|
440 |
|
418 |
// If this LM has fence, make a new leading space specifier. |
441 |
boolean areaCreated = firstKnuthElement != null; |
419 |
if (hasLeadingFence(areaCreated)) { |
|
|
420 |
getContext().setLeadingSpace(new SpaceSpecifier(false)); |
421 |
getContext().setFlags(LayoutContext.RESOLVE_LEADING_SPACE, true); |
422 |
} else { |
423 |
getContext().setFlags(LayoutContext.RESOLVE_LEADING_SPACE, false); |
424 |
} |
425 |
|
442 |
|
426 |
if (getSpaceStart() != null) { |
|
|
427 |
context.getLeadingSpace().addSpace(new SpaceVal(getSpaceStart(), this)); |
428 |
} |
429 |
|
430 |
// "Unwrap" the NonLeafPositions stored in parentIter and put |
443 |
// "Unwrap" the NonLeafPositions stored in parentIter and put |
431 |
// them in a new list. Set lastLM to be the LayoutManager |
444 |
// them in a new list. Set lastLM to be the LayoutManager |
432 |
// which created the last Position: if the LAST_AREA flag is |
445 |
// which created the last Position: if the LAST_AREA flag is |
Lines 434-450
Link Here
|
434 |
// layout context given to lastLM, but must be cleared in the |
447 |
// layout context given to lastLM, but must be cleared in the |
435 |
// layout context given to the other LMs. |
448 |
// layout context given to the other LMs. |
436 |
List positionList = new LinkedList(); |
449 |
List positionList = new LinkedList(); |
437 |
NonLeafPosition pos; |
450 |
Position pos; |
438 |
LayoutManager lastLM = null; // last child LM in this iterator |
451 |
LayoutManager lastLM = null; // last child LM in this iterator |
439 |
Position lastPos = null; |
452 |
Position lastPos = null; |
440 |
while (parentIter.hasNext()) { |
453 |
while (parentIter.hasNext()) { |
441 |
pos = (NonLeafPosition) parentIter.next(); |
454 |
if ((parentIter.peekNext() instanceof KnuthElement |
|
|
455 |
&& parentIter.peekNext() == firstKnuthElement) |
456 |
|| (parentIter.peekNext() instanceof Position) |
457 |
&& isDescendantPosition(firstKnuthElement, (Position)parentIter.peekNext())) |
458 |
areaCreated = false; |
459 |
pos = (Position) parentIter.next(); |
442 |
if (pos != null && pos.getPosition() != null) { |
460 |
if (pos != null && pos.getPosition() != null) { |
443 |
positionList.add(pos.getPosition()); |
461 |
positionList.add(pos.getPosition()); |
444 |
lastLM = pos.getPosition().getLM(); |
462 |
lastLM = pos.getPosition().getLM(); |
445 |
lastPos = pos; |
463 |
lastPos = pos; |
446 |
} |
464 |
} |
447 |
} |
465 |
} |
|
|
466 |
|
467 |
// If this LM has fence, make a new leading space specifier. |
468 |
if (hasLeadingFence(areaCreated)) { |
469 |
getContext().setLeadingSpace(new SpaceSpecifier(false)); |
470 |
getContext().setFlags(LayoutContext.RESOLVE_LEADING_SPACE, true); |
471 |
} else { |
472 |
getContext().setFlags(LayoutContext.RESOLVE_LEADING_SPACE, false); |
473 |
} |
474 |
|
475 |
if (getSpaceStart() != null) { |
476 |
context.getLeadingSpace().addSpace(new SpaceVal(getSpaceStart(), this)); |
477 |
} |
478 |
|
448 |
/*if (pos != null) { |
479 |
/*if (pos != null) { |
449 |
lastLM = pos.getPosition().getLM(); |
480 |
lastLM = pos.getPosition().getLM(); |
450 |
}*/ |
481 |
}*/ |
Lines 537-542
Link Here
|
537 |
addKnuthElementsForBorderPaddingStart(returnedList); |
568 |
addKnuthElementsForBorderPaddingStart(returnedList); |
538 |
returnedList.addAll(super.getChangedKnuthElements(oldList, alignment)); |
569 |
returnedList.addAll(super.getChangedKnuthElements(oldList, alignment)); |
539 |
addKnuthElementsForBorderPaddingEnd(returnedList); |
570 |
addKnuthElementsForBorderPaddingEnd(returnedList); |
|
|
571 |
storeFirstKnuthElement(returnedList); |
540 |
return returnedList; |
572 |
return returnedList; |
541 |
} |
573 |
} |
542 |
|
574 |
|