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

(-)src/java/org/apache/fop/area/inline/TextArea.java (+4 lines)
Lines 93-98 Link Here
93
        WordArea wordArea = new WordArea
93
        WordArea wordArea = new WordArea
94
            ( blockProgressionOffset, minWordLevel, word, letterAdjust, levels, gposAdjustments );
94
            ( blockProgressionOffset, minWordLevel, word, letterAdjust, levels, gposAdjustments );
95
        wordArea.setIPD ( ipd );
95
        wordArea.setIPD ( ipd );
96
        wordArea.setChangeBars(getChangeBars());
97
96
        addChildArea(wordArea);
98
        addChildArea(wordArea);
97
        wordArea.setParentArea(this);
99
        wordArea.setParentArea(this);
98
        updateLevel(minWordLevel);
100
        updateLevel(minWordLevel);
Lines 111-116 Link Here
111
        ( char space, int ipd, boolean adjustable, int blockProgressionOffset, int level ) {
113
        ( char space, int ipd, boolean adjustable, int blockProgressionOffset, int level ) {
112
        SpaceArea spaceArea = new SpaceArea(blockProgressionOffset, level, space, adjustable);
114
        SpaceArea spaceArea = new SpaceArea(blockProgressionOffset, level, space, adjustable);
113
        spaceArea.setIPD ( ipd );
115
        spaceArea.setIPD ( ipd );
116
       spaceArea.setChangeBars(getChangeBars());
117
114
        addChildArea(spaceArea);
118
        addChildArea(spaceArea);
115
        spaceArea.setParentArea(this);
119
        spaceArea.setParentArea(this);
116
        updateLevel(level);
120
        updateLevel(level);
(-)src/java/org/apache/fop/area/Area.java (+23 lines)
Lines 22-27 Link Here
22
import java.io.Serializable;
22
import java.io.Serializable;
23
import java.util.Map;
23
import java.util.Map;
24
import java.util.TreeMap;
24
import java.util.TreeMap;
25
import java.util.Vector;
25
26
26
import org.apache.commons.logging.Log;
27
import org.apache.commons.logging.Log;
27
import org.apache.commons.logging.LogFactory;
28
import org.apache.commons.logging.LogFactory;
Lines 127-132 Link Here
127
    protected static final Log log = LogFactory.getLog(Area.class);
128
    protected static final Log log = LogFactory.getLog(Area.class);
128
129
129
    /**
130
    /**
131
     * The vector of change bars this arrea is affected by
132
     */
133
    private Vector/*<ChangeBar>*/ changeBars = null;
134
135
    /**
136
     * Return the vector of change bars this area is affected by
137
     * @return Vector of change bars or null
138
     */
139
    public Vector/*<ChangeBar>*/ getChangeBars()   {
140
        return changeBars;
141
    }
142
143
    /**
144
     * Set the vector of change bars affecting this area
145
     *
146
     * @param cbs the vector of change bars affecting the area
147
     */
148
    public void setChangeBars(Vector/*<ChangeBar>*/ cbs)   {
149
        changeBars = cbs;
150
    }
151
152
    /**
130
     * Get the area class of this area.
153
     * Get the area class of this area.
131
     *
154
     *
132
     * @return the area class
155
     * @return the area class
(-)src/java/org/apache/fop/render/AbstractRenderer.java (+269 lines)
Lines 28-33 Link Here
28
import java.util.List;
28
import java.util.List;
29
import java.util.Locale;
29
import java.util.Locale;
30
import java.util.Set;
30
import java.util.Set;
31
import java.util.Vector;
31
32
32
import org.w3c.dom.Document;
33
import org.w3c.dom.Document;
33
34
Lines 69-75 Link Here
69
import org.apache.fop.area.inline.TextArea;
70
import org.apache.fop.area.inline.TextArea;
70
import org.apache.fop.area.inline.WordArea;
71
import org.apache.fop.area.inline.WordArea;
71
import org.apache.fop.fo.Constants;
72
import org.apache.fop.fo.Constants;
73
import org.apache.fop.fo.flow.ChangeBar;
72
import org.apache.fop.fonts.FontInfo;
74
import org.apache.fop.fonts.FontInfo;
75
import org.apache.fop.traits.BorderProps;
76
import org.apache.fop.traits.WritingMode;
73
77
74
/**
78
/**
75
 * Abstract base class for all renderers. The Abstract renderer does all the
79
 * Abstract base class for all renderers. The Abstract renderer does all the
Lines 109-114 Link Here
109
     */
113
     */
110
    protected int containingIPPosition = 0;
114
    protected int containingIPPosition = 0;
111
115
116
    /**
117
     * The "start edge" IP Position of the current column (for change bars)
118
     */
119
    protected int columnStartIPPosition = 0;
120
121
    /**
122
     * The "end edge" IP Position of the current column (for change bars)
123
     */
124
    protected int columnEndIPPosition = 0;
125
126
    /**
127
     * The "left" position of the current column (for change bars)
128
     */
129
    protected int columnLeftIPPosition = 0;
130
131
    /**
132
     * The "right" position of the current column (for change bars)
133
     */
134
    protected int columnRightIPPosition = 0;
135
136
    /**
137
     * The number of columns in the span (for change bars)
138
     */
139
    protected int columnCount = 0;
140
141
    /**
142
     * The index number of the current column (for change bars)
143
     */
144
    protected int columnNumber = 0;
145
146
    /**
147
     * Is binding on start edge of column?
148
     */
149
    protected boolean bindingOnStartEdge = false;
150
151
    /**
152
     * Is binding on end edge of column?
153
     */
154
    protected boolean bindingOnEndEdge = false;
155
156
    /**
157
     * The IP begin offset of coordinate 0
158
     */
159
    private int beginOffset  = 0;
160
112
    /** the currently active PageViewport */
161
    /** the currently active PageViewport */
113
    protected PageViewport currentPageViewport;
162
    protected PageViewport currentPageViewport;
114
163
Lines 409-414 Link Here
409
        int saveIPPos = currentIPPosition;
458
        int saveIPPos = currentIPPosition;
410
        for (int count = 0; count < spans.size(); count++) {
459
        for (int count = 0; count < spans.size(); count++) {
411
            span = (Span) spans.get(count);
460
            span = (Span) spans.get(count);
461
            columnCount = span.getColumnCount();
462
412
            int level = span.getBidiLevel();
463
            int level = span.getBidiLevel();
413
            if ( level < 0 ) {
464
            if ( level < 0 ) {
414
                level = 0;
465
                level = 0;
Lines 418-425 Link Here
418
                currentIPPosition += mr.getColumnGap();
469
                currentIPPosition += mr.getColumnGap();
419
            }
470
            }
420
            for (int c = 0; c < span.getColumnCount(); c++) {
471
            for (int c = 0; c < span.getColumnCount(); c++) {
472
                columnNumber = c;
473
421
                NormalFlow flow = span.getNormalFlow(c);
474
                NormalFlow flow = span.getNormalFlow(c);
475
                // XXX to be changed once writing mode et.al. is implemented differently
476
                WritingMode writingMode = WritingMode.LR_TB;
477
                int referenceOrientation = 0;
478
479
480
422
                if (flow != null) {
481
                if (flow != null) {
482
                    columnStartIPPosition = currentIPPosition;
483
                    columnEndIPPosition = currentIPPosition + flow.getIPD() + mr.getColumnGap();
484
485
                    // if direction is right to left, then end is left, else end is right edge
486
                    // if orientation is portrait, then binding edge is on left edge for odd pages
487
                    // and on right edge for even pages
488
                    int pageIndex = currentPageViewport.getPageIndex();
489
                    CTM trans = currentPageViewport.getBodyRegion().getCTM();
490
491
                    bindingOnStartEdge = false;
492
                    bindingOnEndEdge = false;
493
494
                    if (writingMode == WritingMode.RL_TB) {
495
                        columnLeftIPPosition = columnEndIPPosition;
496
                        columnRightIPPosition = columnStartIPPosition;
497
                        if (referenceOrientation == 0) {
498
                            if (pageIndex % 2 == 0 ) {
499
                                bindingOnEndEdge = true;
500
                            } else {
501
                                bindingOnStartEdge = true;
502
                            }
503
                        }
504
                    } else {
505
                        columnLeftIPPosition = columnStartIPPosition;
506
                        columnRightIPPosition = columnEndIPPosition;
507
                        if (referenceOrientation == 0) {
508
                            if (pageIndex % 2 == 0 ) {
509
                                bindingOnStartEdge = true;
510
                            } else {
511
                                bindingOnEndEdge = true;
512
                            }
513
                        }
514
                    }
515
423
                    currentBPPosition = saveSpanBPPos;
516
                    currentBPPosition = saveSpanBPPos;
424
                    if ( ( level & 1 ) == 1 ) {
517
                    if ( ( level & 1 ) == 1 ) {
425
                        currentIPPosition -= flow.getIPD();
518
                        currentIPPosition -= flow.getIPD();
Lines 571-576 Link Here
571
     * @param block  The block area
664
     * @param block  The block area
572
     */
665
     */
573
    protected void renderBlock(Block block) {
666
    protected void renderBlock(Block block) {
667
        Vector changeBars = block.getChangeBars();
668
669
        if (changeBars != null && !changeBars.isEmpty()) {
670
            // this block has change bars attached to it
671
            int saveIP = currentIPPosition;
672
            int saveBP = currentBPPosition;
673
674
            drawChangeBars(block, changeBars);
675
676
            currentIPPosition = saveIP;
677
            currentBPPosition = saveBP;
678
        }
679
574
        assert block != null;
680
        assert block != null;
575
        List children = block.getChildAreas();
681
        List children = block.getChildAreas();
576
        if (block instanceof BlockViewport) {
682
        if (block instanceof BlockViewport) {
Lines 660-665 Link Here
660
     * @param inlineArea inline area text to render
766
     * @param inlineArea inline area text to render
661
     */
767
     */
662
    protected void renderInlineArea(InlineArea inlineArea) {
768
    protected void renderInlineArea(InlineArea inlineArea) {
769
        Vector changeBars = inlineArea.getChangeBars();
770
771
        if (changeBars != null && !changeBars.isEmpty()) {
772
            // area has change bar, handle
773
            drawChangeBars(inlineArea, changeBars);
774
        }
775
663
        if (inlineArea instanceof TextArea) {
776
        if (inlineArea instanceof TextArea) {
664
            renderText((TextArea) inlineArea);
777
            renderText((TextArea) inlineArea);
665
        //} else if (inlineArea instanceof Character) {
778
        //} else if (inlineArea instanceof Character) {
Lines 715-720 Link Here
715
     * @param text the text to render
828
     * @param text the text to render
716
     */
829
     */
717
    protected void renderText(TextArea text) {
830
    protected void renderText(TextArea text) {
831
      Vector changeBars = text.getChangeBars();
832
833
        if (changeBars != null && !changeBars.isEmpty()) {
834
            // this block has change bars attached to it
835
            int saveIP = currentIPPosition;
836
            int saveBP = currentBPPosition;
837
838
            drawChangeBars(text, changeBars);
839
840
            currentIPPosition = saveIP;
841
            currentBPPosition = saveBP;
842
        }
843
718
        List children = text.getChildAreas();
844
        List children = text.getChildAreas();
719
        int saveIP = currentIPPosition;
845
        int saveIP = currentIPPosition;
720
        int saveBP = currentBPPosition;
846
        int saveBP = currentBPPosition;
Lines 833-838 Link Here
833
     * (todo) Make renderImage() protected
959
     * (todo) Make renderImage() protected
834
     */
960
     */
835
    public void renderImage(Image image, Rectangle2D pos) {
961
    public void renderImage(Image image, Rectangle2D pos) {
962
        // handle change bars
963
        Vector changeBars = image.getChangeBars();
964
965
        if (changeBars != null && !changeBars.isEmpty()) {
966
            drawChangeBars(image, changeBars);
967
        }
836
        // Default: do nothing.
968
        // Default: do nothing.
837
        // Some renderers (ex. Text) don't support images.
969
        // Some renderers (ex. Text) don't support images.
838
    }
970
    }
Lines 859-864 Link Here
859
     * (todo) Make renderForeignObject() protected
991
     * (todo) Make renderForeignObject() protected
860
     */
992
     */
861
    protected void renderForeignObject(ForeignObject fo, Rectangle2D pos) {
993
    protected void renderForeignObject(ForeignObject fo, Rectangle2D pos) {
994
        // handle change bars
995
        Vector changeBars = fo.getChangeBars();
996
997
        if (changeBars != null && !changeBars.isEmpty()) {
998
            drawChangeBars(fo, changeBars);
999
        }
1000
862
        // Default: do nothing.
1001
        // Default: do nothing.
863
        // Some renderers (ex. Text) don't support foreign objects.
1002
        // Some renderers (ex. Text) don't support foreign objects.
864
    }
1003
    }
Lines 931-934 Link Here
931
        matrix[5] = Math.round(matrix[5] * 1000);
1070
        matrix[5] = Math.round(matrix[5] * 1000);
932
        return new AffineTransform(matrix);
1071
        return new AffineTransform(matrix);
933
    }
1072
    }
1073
1074
    /**
1075
     * Draw all change bars associated with an area
1076
     *
1077
     * @param block  The area to draw change bars for
1078
     * @param changeBars The list of change bars affecting the area
1079
     */
1080
    private void drawChangeBars(Area block, Vector changeBars) {
1081
        Block cbArea;
1082
1083
        int saveIP = currentIPPosition;
1084
        int saveBP = currentBPPosition;
1085
1086
        for (int idx = 0; idx < changeBars.size(); idx++) {
1087
            ChangeBar bar = (ChangeBar)changeBars.get(idx);
1088
            cbArea = new Block();
1089
1090
            currentIPPosition = 0;
1091
            currentBPPosition = saveBP;
1092
1093
            // offset by default is negative width for change bars placed on the start edge
1094
            // this will be overriden if placement is at the end edge
1095
            // xScale is for adding or subtracting the offset of the change bar depending on
1096
            //  placing the bar towards or away from the edge it is bound to
1097
            int xOffset = -bar.getWidth().getValue();
1098
            int xScale = 1;
1099
1100
            // determine currentIPPosition based on placement
1101
            switch (bar.getPlacement()) {
1102
            case EN_START:
1103
                xOffset += columnStartIPPosition;
1104
                xScale = -1;
1105
                break;
1106
            case EN_END:
1107
                xOffset = columnEndIPPosition;
1108
                break;
1109
            case EN_LEFT:
1110
                xOffset += columnLeftIPPosition;
1111
                xScale = -1;
1112
                break;
1113
            case EN_RIGHT:
1114
                xOffset = columnRightIPPosition;
1115
                break;
1116
            case EN_INSIDE:
1117
                if (bindingOnStartEdge) {
1118
                    xOffset += columnStartIPPosition;
1119
                    xScale = -1;
1120
                } else if (bindingOnEndEdge) {
1121
                    xOffset = columnEndIPPosition;
1122
                } else {
1123
                    xOffset += columnStartIPPosition;
1124
                    xScale = -1;
1125
                }
1126
                break;
1127
            case EN_OUTSIDE:
1128
                if (bindingOnStartEdge) {
1129
                    xOffset = columnEndIPPosition;
1130
                } else if (bindingOnEndEdge) {
1131
                    xOffset += columnStartIPPosition;
1132
                    xScale = -1;
1133
                } else {
1134
                    xOffset += columnStartIPPosition;
1135
                    xScale = -1;
1136
                }
1137
                break;
1138
            case EN_ALTERNATE:
1139
                if (columnCount == 0) {
1140
                    if (columnNumber == 0) {
1141
                        xOffset += columnStartIPPosition;
1142
                        xScale = -1;
1143
                    } else {
1144
                        xOffset = columnEndIPPosition;
1145
                    }
1146
                } else {
1147
                    if (bindingOnStartEdge) {
1148
                        xOffset = columnEndIPPosition;
1149
                    } else if (bindingOnEndEdge) {
1150
                        xOffset += columnStartIPPosition;
1151
                        xScale = -1;
1152
                    } else {
1153
                        xOffset = columnStartIPPosition;
1154
                        xScale = -1;
1155
                    }
1156
                }
1157
                break;
1158
            default:
1159
                break;
1160
            }
1161
1162
            xOffset += getBeginOffset();
1163
1164
            // Change bar area has 0 ipd, class xsl-absolute, no margin or padding
1165
            cbArea.setAreaClass(Area.CLASS_ABSOLUTE);
1166
            cbArea.setIPD(0);
1167
            cbArea.setPositioning(Block.ABSOLUTE);
1168
            cbArea.setBPD(block.getAllocBPD());
1169
1170
            BorderProps props = new BorderProps(bar.getStyle(), bar.getWidth().getValue(),
1171
                    bar.getColor(), BorderProps.SEPARATE);
1172
1173
            cbArea.addTrait(Trait.BORDER_END, props);
1174
1175
            cbArea.setXOffset(xOffset + xScale * bar.getOffset().getValue());
1176
            cbArea.setYOffset(block.getSpaceBefore());
1177
1178
            renderBlock(cbArea);
1179
1180
            // restore position on page
1181
            currentIPPosition = saveIP;
1182
            currentBPPosition = saveBP;
1183
1184
        }
1185
    }
1186
1187
    /**
1188
     * return the begin offset of the inline begin (changes by reference area transforms)
1189
     * @return the offset from current coordinate system 0 that the IP begin is at
1190
     */
1191
    protected int getBeginOffset() {
1192
        return beginOffset;
1193
    }
1194
1195
    /**
1196
     * Set the begin offset for inline progression begin (changes by reference area tranforms)
1197
     * @param offset the new offset from IPP 0 that true IP start is at
1198
     */
1199
    protected void setBeginOffset(int offset) {
1200
        beginOffset = offset;
1201
    }
1202
934
}
1203
}
(-)src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java (+5 lines)
Lines 690-695 Link Here
690
        // save position and offset
690
        // save position and offset
691
        int saveIP = currentIPPosition;
691
        int saveIP = currentIPPosition;
692
        int saveBP = currentBPPosition;
692
        int saveBP = currentBPPosition;
693
        int saveBO = getBeginOffset();
693
694
694
        //Establish a new coordinate system
695
        //Establish a new coordinate system
695
        AffineTransform at = new AffineTransform();
696
        AffineTransform at = new AffineTransform();
Lines 697-702 Link Here
697
        at.translate(block.getXOffset(), block.getYOffset());
698
        at.translate(block.getXOffset(), block.getYOffset());
698
        at.translate(0, block.getSpaceBefore());
699
        at.translate(0, block.getSpaceBefore());
699
700
701
        setBeginOffset(saveBO - block.getXOffset());
702
700
        if (!at.isIdentity()) {
703
        if (!at.isIdentity()) {
701
            establishTransformationMatrix(at);
704
            establishTransformationMatrix(at);
702
        }
705
        }
Lines 714-719 Link Here
714
            restoreGraphicsState();
717
            restoreGraphicsState();
715
        }
718
        }
716
719
720
        setBeginOffset(saveBO);
721
717
        // stacked and relative blocks effect stacking
722
        // stacked and relative blocks effect stacking
718
        currentIPPosition = saveIP;
723
        currentIPPosition = saveIP;
719
        currentBPPosition = saveBP;
724
        currentBPPosition = saveBP;
(-)src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java (+2 lines)
Lines 172-177 Link Here
172
    public Area getParentArea(Area childArea) {
172
    public Area getParentArea(Area childArea) {
173
        if (curBlockArea == null) {
173
        if (curBlockArea == null) {
174
            curBlockArea = new Block();
174
            curBlockArea = new Block();
175
            curBlockArea.setChangeBars(getChangeBars());
176
175
            curBlockArea.setPositioning(Block.ABSOLUTE);
177
            curBlockArea.setPositioning(Block.ABSOLUTE);
176
            // set position
178
            // set position
177
            curBlockArea.setXOffset(xOffset);
179
            curBlockArea.setXOffset(xOffset);
(-)src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java (+1 lines)
Lines 218-223 Link Here
218
    public Area getParentArea(Area childArea) {
218
    public Area getParentArea(Area childArea) {
219
        if (curBlockArea == null) {
219
        if (curBlockArea == null) {
220
            curBlockArea = new Block();
220
            curBlockArea = new Block();
221
            curBlockArea.setChangeBars(getChangeBars());
221
222
222
            // Set up dimensions
223
            // Set up dimensions
223
            // Must get dimensions from parent area
224
            // Must get dimensions from parent area
(-)src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java (+1 lines)
Lines 585-590 Link Here
585
    public Area getParentArea(Area childArea) {
585
    public Area getParentArea(Area childArea) {
586
        if (curBlockArea == null) {
586
        if (curBlockArea == null) {
587
            curBlockArea = new Block();
587
            curBlockArea = new Block();
588
            curBlockArea.setChangeBars(getChangeBars());
588
589
589
            // Set up dimensions
590
            // Set up dimensions
590
            /*Area parentArea =*/ parentLayoutManager.getParentArea(curBlockArea);
591
            /*Area parentArea =*/ parentLayoutManager.getParentArea(curBlockArea);
(-)src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java (+15 lines)
Lines 21-26 Link Here
21
21
22
import java.util.List;
22
import java.util.List;
23
import java.util.Stack;
23
import java.util.Stack;
24
import java.util.Vector;
24
25
25
import org.apache.commons.logging.Log;
26
import org.apache.commons.logging.Log;
26
import org.apache.commons.logging.LogFactory;
27
import org.apache.commons.logging.LogFactory;
Lines 257-262 Link Here
257
        return fobj;
258
        return fobj;
258
    }
259
    }
259
260
261
    /**
262
     * Obtain vector of change bars affecting object in this layout.
263
     * @return Vector of all change bars affecting this or null
264
     */
265
    public Vector/*<ChangeBar>*/ getChangeBars() {
266
       if (fobj == null) {
267
               return null;
268
       } else {
269
               return fobj.getChangeBars();
270
       }
271
    }
272
273
274
260
    /** {@inheritDoc} */
275
    /** {@inheritDoc} */
261
    public void reset() {
276
    public void reset() {
262
        throw new UnsupportedOperationException("Not implemented");
277
        throw new UnsupportedOperationException("Not implemented");
(-)src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (+1 lines)
Lines 356-361 Link Here
356
    public Area getParentArea(Area childArea) {
356
    public Area getParentArea(Area childArea) {
357
        if (curBlockArea == null) {
357
        if (curBlockArea == null) {
358
            curBlockArea = new Block();
358
            curBlockArea = new Block();
359
           curBlockArea.setChangeBars(getChangeBars());
359
360
360
            curBlockArea.setIPD(super.getContentAreaIPD());
361
            curBlockArea.setIPD(super.getContentAreaIPD());
361
362
(-)src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java (-1 / +3 lines)
Lines 46-52 Link Here
46
        org.w3c.dom.Document doc = child.getDOMDocument();
46
        org.w3c.dom.Document doc = child.getDOMDocument();
47
        String ns = child.getNamespaceURI();
47
        String ns = child.getNamespaceURI();
48
48
49
        return new ForeignObject(doc, ns);
49
        ForeignObject obj = new ForeignObject(doc, ns);
50
        obj.setChangeBars(getChangeBars());
51
        return obj;
50
    }
52
    }
51
53
52
}
54
}
(-)src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java (+12 lines)
Lines 24-29 Link Here
24
import java.util.LinkedList;
24
import java.util.LinkedList;
25
import java.util.List;
25
import java.util.List;
26
import java.util.ListIterator;
26
import java.util.ListIterator;
27
import java.util.Vector;
27
28
28
import org.apache.commons.logging.Log;
29
import org.apache.commons.logging.Log;
29
import org.apache.commons.logging.LogFactory;
30
import org.apache.commons.logging.LogFactory;
Lines 387-392 Link Here
387
388
388
        TextArea textArea = new TextAreaBuilder(realWidth, totalAdjust, context, firstAreaInfoIndex,
389
        TextArea textArea = new TextAreaBuilder(realWidth, totalAdjust, context, firstAreaInfoIndex,
389
                lastAreaInfoIndex, context.isLastArea(), areaInfo.font).build();
390
                lastAreaInfoIndex, context.isLastArea(), areaInfo.font).build();
391
        textArea.setChangeBars(getChangeBars());
390
392
391
        // wordSpaceDim is computed in relation to wordSpaceIPD.opt
393
        // wordSpaceDim is computed in relation to wordSpaceIPD.opt
392
        // but the renderer needs to know the adjustment in relation
394
        // but the renderer needs to know the adjustment in relation
Lines 484-489 Link Here
484
                textArea = new TextArea(width.getStretch(), width.getShrink(),
486
                textArea = new TextArea(width.getStretch(), width.getShrink(),
485
                        adjust);
487
                        adjust);
486
            }
488
            }
489
490
            textArea.setChangeBars(getChangeBars());
487
        }
491
        }
488
492
489
        private void setInlineProgressionDimension() {
493
        private void setInlineProgressionDimension() {
Lines 1694-1699 Link Here
1694
1698
1695
    }
1699
    }
1696
1700
1701
    @Override
1702
    public Vector/*<ChangeBar>*/ getChangeBars() {
1703
       if (foText == null) {
1704
               return null;
1705
       } else {
1706
               return foText.getChangeBars();
1707
       }
1708
    }
1697
    /** {@inheritDoc} */
1709
    /** {@inheritDoc} */
1698
    public String toString() {
1710
    public String toString() {
1699
        return super.toString() + "{"
1711
        return super.toString() + "{"
(-)src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java (+4 lines)
Lines 77-82 Link Here
77
    public InlineArea get(LayoutContext context) {
77
    public InlineArea get(LayoutContext context) {
78
        // get page string from parent, build area
78
        // get page string from parent, build area
79
        TextArea text = new TextArea();
79
        TextArea text = new TextArea();
80
        text.setChangeBars(getChangeBars());
81
80
        String str = getCurrentPV().getPageNumberString();
82
        String str = getCurrentPV().getPageNumberString();
81
        int width = getStringWidth(str);
83
        int width = getStringWidth(str);
82
        text.addWord(str, 0);
84
        text.addWord(str, 0);
Lines 98-103 Link Here
98
        //TODO or even better: delay area creation until addAreas() stage
100
        //TODO or even better: delay area creation until addAreas() stage
99
        //TextArea is cloned because the LM is reused in static areas and the area can't be.
101
        //TextArea is cloned because the LM is reused in static areas and the area can't be.
100
        TextArea ta = new TextArea();
102
        TextArea ta = new TextArea();
103
        ta.setChangeBars(getChangeBars());
104
101
        TraitSetter.setProducerID(ta, fobj.getId());
105
        TraitSetter.setProducerID(ta, fobj.getId());
102
        ta.setIPD(baseArea.getIPD());
106
        ta.setIPD(baseArea.getIPD());
103
        ta.setBPD(baseArea.getBPD());
107
        ta.setBPD(baseArea.getBPD());
(-)src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java (+4 lines)
Lines 1462-1467 Link Here
1462
        LineArea lineArea = new LineArea(
1462
        LineArea lineArea = new LineArea(
1463
                (lbp.getLeafPos() < seq.size() - 1 ? textAlignment : textAlignmentLast),
1463
                (lbp.getLeafPos() < seq.size() - 1 ? textAlignment : textAlignmentLast),
1464
                lbp.difference, lbp.availableStretch, lbp.availableShrink);
1464
                lbp.difference, lbp.availableStretch, lbp.availableShrink);
1465
        lineArea.setChangeBars(getChangeBars());
1466
1465
        if (lbp.startIndent != 0) {
1467
        if (lbp.startIndent != 0) {
1466
            lineArea.addTrait(Trait.START_INDENT, lbp.startIndent);
1468
            lineArea.addTrait(Trait.START_INDENT, lbp.startIndent);
1467
        }
1469
        }
Lines 1577-1582 Link Here
1577
        }
1579
        }
1578
1580
1579
        LineArea lineArea = new LineArea();
1581
        LineArea lineArea = new LineArea();
1582
        lineArea.setChangeBars(getChangeBars());
1583
1580
        setCurrentArea(lineArea);
1584
        setCurrentArea(lineArea);
1581
        LayoutContext lc = new LayoutContext(0);
1585
        LayoutContext lc = new LayoutContext(0);
1582
        lc.setAlignmentContext(alignmentContext);
1586
        lc.setAlignmentContext(alignmentContext);
(-)src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java (+2 lines)
Lines 76-81 Link Here
76
76
77
    private TextArea getCharacterInlineArea(Character node) {
77
    private TextArea getCharacterInlineArea(Character node) {
78
        TextArea text = new TextArea();
78
        TextArea text = new TextArea();
79
        text.setChangeBars(getChangeBars());
80
79
        char ch = node.getCharacter();
81
        char ch = node.getCharacter();
80
        int ipd = font.getCharWidth(ch);
82
        int ipd = font.getCharWidth(ch);
81
        int blockProgressionOffset = 0;
83
        int blockProgressionOffset = 0;
(-)src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java (+3 lines)
Lines 217-222 Link Here
217
                leaderArea.setBidiLevel ( fobj.getBidiLevelRecursive() );
217
                leaderArea.setBidiLevel ( fobj.getBidiLevelRecursive() );
218
            }
218
            }
219
        }
219
        }
220
221
       leaderArea.setChangeBars(getChangeBars());
222
220
        TraitSetter.setProducerID(leaderArea, fobj.getId());
223
        TraitSetter.setProducerID(leaderArea, fobj.getId());
221
        return leaderArea;
224
        return leaderArea;
222
     }
225
     }
(-)src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java (+1 lines)
Lines 181-186 Link Here
181
            if (iAdjust != 0) {
181
            if (iAdjust != 0) {
182
                //getLogger().debug("Add leading space: " + iAdjust);
182
                //getLogger().debug("Add leading space: " + iAdjust);
183
                Space ls = new Space();
183
                Space ls = new Space();
184
                ls.setChangeBars(getChangeBars());
184
                ls.setIPD(iAdjust);
185
                ls.setIPD(iAdjust);
185
                int level = parentArea.getBidiLevel();
186
                int level = parentArea.getBidiLevel();
186
                if ( level >= 0 ) {
187
                if ( level >= 0 ) {
(-)src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java (+1 lines)
Lines 77-82 Link Here
77
            resolved = true;
77
            resolved = true;
78
        }
78
        }
79
79
80
        text.setChangeBars(getChangeBars());
80
        updateTextAreaTraits(text);
81
        updateTextAreaTraits(text);
81
82
82
        return text;
83
        return text;
(-)src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java (+42 lines)
Lines 19-28 Link Here
19
19
20
package org.apache.fop.layoutmgr.inline;
20
package org.apache.fop.layoutmgr.inline;
21
21
22
import org.apache.fop.area.PageViewport;
22
import org.apache.fop.area.Resolvable;
23
import org.apache.fop.area.Resolvable;
23
import org.apache.fop.area.Trait;
24
import org.apache.fop.area.Trait;
24
import org.apache.fop.area.inline.InlineArea;
25
import org.apache.fop.area.inline.InlineArea;
25
import org.apache.fop.area.inline.TextArea;
26
import org.apache.fop.area.inline.TextArea;
27
import org.apache.fop.area.inline.UnresolvedPageNumber;
26
import org.apache.fop.fo.flow.AbstractPageNumberCitation;
28
import org.apache.fop.fo.flow.AbstractPageNumberCitation;
27
import org.apache.fop.fonts.Font;
29
import org.apache.fop.fonts.Font;
28
import org.apache.fop.fonts.FontInfo;
30
import org.apache.fop.fonts.FontInfo;
Lines 93-98 Link Here
93
    }
95
    }
94
96
95
    /**
97
    /**
98
     * If id can be resolved then simply return a text area, otherwise
99
     * return a resolvable area
100
     *
101
     * @return a corresponding InlineArea
102
     */
103
    private InlineArea getPageNumberCitationInlineArea() {
104
        PageViewport page = getPSLM().getFirstPVWithID(fobj.getRefId());
105
        TextArea text;
106
        String str = null;
107
108
        if (page != null) {
109
            str = page.getPageNumberString();
110
        } else {
111
            str = null;
112
        }
113
114
        if (str != null) {
115
            // get page string from parent, build area
116
            text = new TextArea();
117
            text.setChangeBars(getChangeBars());
118
119
            int width = getStringWidth(str);
120
            text.addWord(str, 0);
121
            text.setIPD(width);
122
            resolved = true;
123
        } else {
124
            resolved = false;
125
            text = new UnresolvedPageNumber(fobj.getRefId(), font);
126
            text.setChangeBars(getChangeBars());
127
128
            String repStr = "MMM"; // reserve three spaces for page number
129
            int width = getStringWidth(repStr);
130
            text.setIPD(width);
131
        }
132
        updateTextAreaTraits(text);
133
134
        return text;
135
    }
136
137
    /**
96
     * Updates the traits for the generated text area.
138
     * Updates the traits for the generated text area.
97
     * @param text the text area
139
     * @param text the text area
98
     */
140
     */
(-)src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java (+1 lines)
Lines 86-91 Link Here
86
        // get breaks then add areas to title
86
        // get breaks then add areas to title
87
        this.parentLM = pslm;
87
        this.parentLM = pslm;
88
        holder = new LineArea();
88
        holder = new LineArea();
89
        holder.setChangeBars(getChangeBars());
89
90
90
        //        setUserAgent(foTitle.getUserAgent());
91
        //        setUserAgent(foTitle.getUserAgent());
91
92
(-)src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java (+3 lines)
Lines 207-215 Link Here
207
        InlineArea area;
207
        InlineArea area;
208
        if (isInline) {
208
        if (isInline) {
209
            area = createInlineParent();
209
            area = createInlineParent();
210
            area.setChangeBars(getChangeBars());
211
            //area.setOffset(0);
210
            area.setBlockProgressionOffset(0);
212
            area.setBlockProgressionOffset(0);
211
        } else {
213
        } else {
212
            area = new InlineBlockParent();
214
            area = new InlineBlockParent();
215
            area.setChangeBars(getChangeBars());
213
        }
216
        }
214
        if (fobj instanceof Inline || fobj instanceof BasicLink) {
217
        if (fobj instanceof Inline || fobj instanceof BasicLink) {
215
            TraitSetter.setProducerID(area, fobj.getId());
218
            TraitSetter.setProducerID(area, fobj.getId());
(-)src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java (-2 / +4 lines)
Lines 42-49 Link Here
42
42
43
    /** {@inheritDoc} */
43
    /** {@inheritDoc} */
44
    protected Area getChildArea() {
44
    protected Area getChildArea() {
45
        return new Image(((ExternalGraphic) fobj).getSrc());
45
        Image im = new Image(((ExternalGraphic) fobj).getSrc());
46
    }
46
        im.setChangeBars(getChangeBars());
47
        return im;
48
     }
47
49
48
}
50
}
49
51
(-)src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java (+2 lines)
Lines 75-80 Link Here
75
            text.setIPD(width);                 // TODO: [GA] !I18N!
75
            text.setIPD(width);                 // TODO: [GA] !I18N!
76
            resolved = false;
76
            resolved = false;
77
        }
77
        }
78
79
        text.setChangeBars(getChangeBars());
78
        updateTextAreaTraits(text);
80
        updateTextAreaTraits(text);
79
        return text;
81
        return text;
80
    }
82
    }
(-)src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java (+2 lines)
Lines 68-77 Link Here
68
            if (parentLayoutManager instanceof BlockStackingLayoutManager
68
            if (parentLayoutManager instanceof BlockStackingLayoutManager
69
                    && !(parentLayoutManager instanceof BlockLayoutManager)) {
69
                    && !(parentLayoutManager instanceof BlockLayoutManager)) {
70
                Block helperBlock = new Block();
70
                Block helperBlock = new Block();
71
                helperBlock.setChangeBars(getChangeBars());
71
                TraitSetter.setProducerID(helperBlock, fobj.getId());
72
                TraitSetter.setProducerID(helperBlock, fobj.getId());
72
                parentLayoutManager.addChildArea(helperBlock);
73
                parentLayoutManager.addChildArea(helperBlock);
73
            } else {
74
            } else {
74
                InlineArea area = getEffectiveArea();
75
                InlineArea area = getEffectiveArea();
76
                area.setChangeBars(getChangeBars());
75
                parentLayoutManager.addChildArea(area);
77
                parentLayoutManager.addChildArea(area);
76
            }
78
            }
77
        }
79
        }
(-)src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java (+10 lines)
Lines 398-407 Link Here
398
        if (usedBPD < cellBPD) {
398
        if (usedBPD < cellBPD) {
399
            if (getTableCell().getDisplayAlign() == EN_CENTER) {
399
            if (getTableCell().getDisplayAlign() == EN_CENTER) {
400
                Block space = new Block();
400
                Block space = new Block();
401
                space.setChangeBars(getChangeBars());
402
401
                space.setBPD((cellBPD - usedBPD) / 2);
403
                space.setBPD((cellBPD - usedBPD) / 2);
402
                curBlockArea.addBlock(space);
404
                curBlockArea.addBlock(space);
403
            } else if (getTableCell().getDisplayAlign() == EN_AFTER) {
405
            } else if (getTableCell().getDisplayAlign() == EN_AFTER) {
404
                Block space = new Block();
406
                Block space = new Block();
407
                space.setChangeBars(getChangeBars());
408
405
                space.setBPD(cellBPD - usedBPD);
409
                space.setBPD(cellBPD - usedBPD);
406
                curBlockArea.addBlock(space);
410
                curBlockArea.addBlock(space);
407
            }
411
            }
Lines 456-461 Link Here
456
            boolean outer) {
460
            boolean outer) {
457
        if (blocks[i][j] == null) {
461
        if (blocks[i][j] == null) {
458
            blocks[i][j] = new Block();
462
            blocks[i][j] = new Block();
463
            blocks[i][j].setChangeBars(getChangeBars());
464
459
            blocks[i][j].addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
465
            blocks[i][j].addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
460
            blocks[i][j].setPositioning(Block.ABSOLUTE);
466
            blocks[i][j].setPositioning(Block.ABSOLUTE);
461
        }
467
        }
Lines 486-491 Link Here
486
        int paddingEnd = padding.getPaddingEnd(false, this);
492
        int paddingEnd = padding.getPaddingEnd(false, this);
487
493
488
        Block block = new Block();
494
        Block block = new Block();
495
        block.setChangeBars(getChangeBars());
496
489
        TraitSetter.setProducerID(block, getTable().getId());
497
        TraitSetter.setProducerID(block, getTable().getId());
490
        block.setPositioning(Block.ABSOLUTE);
498
        block.setPositioning(Block.ABSOLUTE);
491
        block.setIPD(cellIPD + paddingStart + paddingEnd);
499
        block.setIPD(cellIPD + paddingStart + paddingEnd);
Lines 511-516 Link Here
511
    public Area getParentArea(Area childArea) {
519
    public Area getParentArea(Area childArea) {
512
        if (curBlockArea == null) {
520
        if (curBlockArea == null) {
513
            curBlockArea = new Block();
521
            curBlockArea = new Block();
522
            curBlockArea.setChangeBars(getChangeBars());
523
514
            curBlockArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
524
            curBlockArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
515
            TraitSetter.setProducerID(curBlockArea, getTableCell().getId());
525
            TraitSetter.setProducerID(curBlockArea, getTableCell().getId());
516
            curBlockArea.setPositioning(Block.ABSOLUTE);
526
            curBlockArea.setPositioning(Block.ABSOLUTE);
(-)src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java (+2 lines)
Lines 420-425 Link Here
420
    public Area getParentArea(Area childArea) {
420
    public Area getParentArea(Area childArea) {
421
        if (curBlockArea == null) {
421
        if (curBlockArea == null) {
422
            curBlockArea = new Block();
422
            curBlockArea = new Block();
423
            curBlockArea.setChangeBars(getChangeBars());
424
423
            // Set up dimensions
425
            // Set up dimensions
424
            // Must get dimensions from parent area
426
            // Must get dimensions from parent area
425
            /*Area parentArea =*/ parentLayoutManager.getParentArea(curBlockArea);
427
            /*Area parentArea =*/ parentLayoutManager.getParentArea(curBlockArea);
(-)src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java (+2 lines)
Lines 179-184 Link Here
179
    public Area getParentArea(Area childArea) {
179
    public Area getParentArea(Area childArea) {
180
        if (curBlockArea == null) {
180
        if (curBlockArea == null) {
181
            curBlockArea = new Block();
181
            curBlockArea = new Block();
182
           curBlockArea.setChangeBars(getChangeBars());
183
182
            // Set up dimensions
184
            // Set up dimensions
183
            // Must get dimensions from parent area
185
            // Must get dimensions from parent area
184
            Area parentArea = parentLayoutManager.getParentArea(curBlockArea);
186
            Area parentArea = parentLayoutManager.getParentArea(curBlockArea);
(-)src/java/org/apache/fop/layoutmgr/table/RowPainter.java (+2 lines)
Lines 464-469 Link Here
464
464
465
        //generate the block area
465
        //generate the block area
466
        Block block = new Block();
466
        Block block = new Block();
467
        block.setChangeBars(tclm.getTableLM().getFObj().getChangeBars());
468
467
        block.setPositioning(Block.ABSOLUTE);
469
        block.setPositioning(Block.ABSOLUTE);
468
        block.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
470
        block.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
469
        block.setIPD(ipd);
471
        block.setIPD(ipd);
(-)src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java (+2 lines)
Lines 175-180 Link Here
175
    public Area getParentArea(Area childArea) {
175
    public Area getParentArea(Area childArea) {
176
        if (curBlockArea == null) {
176
        if (curBlockArea == null) {
177
            curBlockArea = new Block();
177
            curBlockArea = new Block();
178
            curBlockArea.setChangeBars(getChangeBars());
179
178
            // Set up dimensions
180
            // Set up dimensions
179
            // Must get dimensions from parent area
181
            // Must get dimensions from parent area
180
            Area parentArea = parentLayoutManager.getParentArea(curBlockArea);
182
            Area parentArea = parentLayoutManager.getParentArea(curBlockArea);
(-)src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (+2 lines)
Lines 123-128 Link Here
123
        int sp = TraitSetter.getEffectiveSpace(adjust, minoptmax);
123
        int sp = TraitSetter.getEffectiveSpace(adjust, minoptmax);
124
        if (sp != 0) {
124
        if (sp != 0) {
125
            Block spacer = new Block();
125
            Block spacer = new Block();
126
           spacer.setChangeBars(getChangeBars());
127
126
            spacer.setBPD(sp);
128
            spacer.setBPD(sp);
127
            parentLayoutManager.addChildArea(spacer);
129
            parentLayoutManager.addChildArea(spacer);
128
        }
130
        }
(-)src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (+4 lines)
Lines 852-857 Link Here
852
            int level = getBlockContainerFO().getBidiLevel();
852
            int level = getBlockContainerFO().getBidiLevel();
853
853
854
            viewportBlockArea = new BlockViewport(allowBPDUpdate);
854
            viewportBlockArea = new BlockViewport(allowBPDUpdate);
855
            viewportBlockArea.setChangeBars(getChangeBars());
856
855
            viewportBlockArea.addTrait(Trait.IS_VIEWPORT_AREA, Boolean.TRUE);
857
            viewportBlockArea.addTrait(Trait.IS_VIEWPORT_AREA, Boolean.TRUE);
856
            if ( level >= 0 ) {
858
            if ( level >= 0 ) {
857
                viewportBlockArea.setBidiLevel ( level );
859
                viewportBlockArea.setBidiLevel ( level );
Lines 889-894 Link Here
889
            }
891
            }
890
892
891
            referenceArea = new Block();
893
            referenceArea = new Block();
894
            referenceArea.setChangeBars(getChangeBars());
895
892
            referenceArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
896
            referenceArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
893
            if ( level >= 0 ) {
897
            if ( level >= 0 ) {
894
                referenceArea.setBidiLevel ( level );
898
                referenceArea.setBidiLevel ( level );
(-)src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java (+2 lines)
Lines 178-183 Link Here
178
        Dimension imageSize = this.imageLayout.getViewportSize();
178
        Dimension imageSize = this.imageLayout.getViewportSize();
179
179
180
        Block blockArea = new Block();
180
        Block blockArea = new Block();
181
        blockArea.setChangeBars(getChangeBars());
182
181
        blockArea.setIPD(imageSize.width);
183
        blockArea.setIPD(imageSize.width);
182
        LineArea lineArea = new LineArea();
184
        LineArea lineArea = new LineArea();
183
185
(-)src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java (+4 lines)
Lines 38-43 Link Here
38
import org.apache.fop.fo.flow.BidiOverride;
38
import org.apache.fop.fo.flow.BidiOverride;
39
import org.apache.fop.fo.flow.Block;
39
import org.apache.fop.fo.flow.Block;
40
import org.apache.fop.fo.flow.BlockContainer;
40
import org.apache.fop.fo.flow.BlockContainer;
41
import org.apache.fop.fo.flow.ChangeBarBegin;
42
import org.apache.fop.fo.flow.ChangeBarEnd;
41
import org.apache.fop.fo.flow.Character;
43
import org.apache.fop.fo.flow.Character;
42
import org.apache.fop.fo.flow.ExternalGraphic;
44
import org.apache.fop.fo.flow.ExternalGraphic;
43
import org.apache.fop.fo.flow.Footnote;
45
import org.apache.fop.fo.flow.Footnote;
Lines 141-146 Link Here
141
        registerMaker(TableHeader.class, new Maker());
143
        registerMaker(TableHeader.class, new Maker());
142
        registerMaker(Wrapper.class, new WrapperLayoutManagerMaker());
144
        registerMaker(Wrapper.class, new WrapperLayoutManagerMaker());
143
        registerMaker(Title.class, new InlineLayoutManagerMaker());
145
        registerMaker(Title.class, new InlineLayoutManagerMaker());
146
        registerMaker(ChangeBarBegin.class, new Maker());
147
        registerMaker(ChangeBarEnd.class, new Maker());
144
    }
148
    }
145
149
146
    /**
150
    /**
(-)src/java/org/apache/fop/fo/FObj.java (+49 lines)
Lines 26-31 Link Here
26
import java.util.Map;
26
import java.util.Map;
27
import java.util.NoSuchElementException;
27
import java.util.NoSuchElementException;
28
import java.util.Set;
28
import java.util.Set;
29
import java.util.Vector;
29
30
30
import org.xml.sax.Attributes;
31
import org.xml.sax.Attributes;
31
import org.xml.sax.Locator;
32
import org.xml.sax.Locator;
Lines 35-40 Link Here
35
import org.apache.fop.apps.FOPException;
36
import org.apache.fop.apps.FOPException;
36
import org.apache.fop.fo.extensions.ExtensionAttachment;
37
import org.apache.fop.fo.extensions.ExtensionAttachment;
37
import org.apache.fop.fo.flow.Marker;
38
import org.apache.fop.fo.flow.Marker;
39
import org.apache.fop.fo.pagination.PageSequence;
38
import org.apache.fop.fo.properties.PropertyMaker;
40
import org.apache.fop.fo.properties.PropertyMaker;
39
41
40
/**
42
/**
Lines 153-161 Link Here
153
        if (id != null) {
155
        if (id != null) {
154
            checkId(id);
156
            checkId(id);
155
        }
157
        }
158
        // check if we are under the influence of change bars
159
        PageSequence pageSequence = getRoot().getLastPageSequence();
160
161
        if (pageSequence != null && pageSequence.topChangeBar() != null) {
162
            // OK, so copy over the stack of change bars
163
            affectedByChangeBarsStart =  getRoot().getLastPageSequence().copyChangeBars();
164
        }
156
    }
165
    }
157
166
158
    /**
167
    /**
168
     * {@inheritDoc}
169
     * @throws FOPException FOP Exception
170
     */
171
     protected void endOfNode() throws FOPException {
172
         // now take all change bars that are active now and were active at the start
173
         //  of node and put them into the affectedByChangeBars
174
         PageSequence pageSequence = getRoot().getLastPageSequence();
175
         Vector nowChangeBars =  null;
176
177
         if (pageSequence != null) {
178
             nowChangeBars = pageSequence.copyChangeBars();
179
         }
180
181
182
         if (affectedByChangeBarsStart != null && nowChangeBars != null) {
183
                 // to save memory, we first try to match all elements to the start
184
                 if (affectedByChangeBarsStart.containsAll(nowChangeBars)
185
                       && nowChangeBars.containsAll(affectedByChangeBarsStart)) {
186
                         affectedByChangeBars = affectedByChangeBarsStart;
187
                 } else {
188
                         affectedByChangeBars = new Vector();
189
190
                         for (int idx = 0; idx < nowChangeBars.size(); idx++) {
191
                                 if (affectedByChangeBarsStart.contains(nowChangeBars.get(idx))) {
192
                                     affectedByChangeBars.add(nowChangeBars.get(idx));
193
                                 }
194
                         }
195
196
                         if (affectedByChangeBars.size() == 0) {
197
                                 affectedByChangeBars = null;
198
                         }
199
                 }
200
201
                 affectedByChangeBarsStart = null;
202
         }
203
204
        super.endOfNode();
205
    }
206
207
    /**
159
     * Setup the id for this formatting object.
208
     * Setup the id for this formatting object.
160
     * Most formatting objects can have an id that can be referenced.
209
     * Most formatting objects can have an id that can be referenced.
161
     * This methods checks that the id isn't already used by another FO
210
     * This methods checks that the id isn't already used by another FO
(-)src/java/org/apache/fop/fo/flow/ChangeBarEnd.java (+76 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
/* $Id$ */
19
20
package org.apache.fop.fo.flow;
21
22
23
import org.xml.sax.Attributes;
24
import org.xml.sax.Locator;
25
26
import org.apache.fop.apps.FOPException;
27
import org.apache.fop.fo.FONode;
28
import org.apache.fop.fo.PropertyList;
29
30
/**
31
 * End of a change bar element. Notes the end of the affected objects of a change bar.
32
 *  */
33
public class ChangeBarEnd extends ChangeBar {
34
35
    /**
36
     * Construct a new ChangeBarEnd element
37
     * @param parent the parent of the element
38
     */
39
    public ChangeBarEnd(FONode parent) {
40
        super(parent);
41
    }
42
43
    /** {@inheritDoc} */
44
    public String getLocalName() {
45
        return "change-bar-end";
46
    }
47
48
49
    /**
50
     * {@inheritDoc}
51
     * @return {@link org.apache.fop.fo.Constants#FO_CHANGE_BAR_END}
52
     */
53
    public int getNameId() {
54
        return FO_CHANGE_BAR_END;
55
    }
56
57
    /** {@inheritDoc} */
58
    public void processNode(String elementName, Locator locator,
59
                            Attributes attlist, PropertyList pList) throws FOPException {
60
        super.processNode(elementName, locator, attlist, pList);
61
62
        // check if we have an element on the stack at all
63
        ChangeBar topElement = top();
64
65
        if (topElement == null) {
66
            getFOValidationEventProducer().changeBarNoBegin(this, getName(), locator);
67
        } else {
68
            if (!topElement.cbClass.equals(cbClass)) {
69
                getFOValidationEventProducer().changeBarWrongStacking(this,
70
                        getName(), topElement.cbClass, cbClass, locator);
71
            }
72
            pop();
73
        }
74
    }
75
76
}
(-)src/java/org/apache/fop/fo/flow/ChangeBar.java (+187 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
/* $Id$ */
19
20
package org.apache.fop.fo.flow;
21
22
import java.awt.Color;
23
24
25
import org.xml.sax.Attributes;
26
import org.xml.sax.Locator;
27
28
import org.apache.fop.apps.FOPException;
29
import org.apache.fop.datatypes.Length;
30
import org.apache.fop.fo.FONode;
31
import org.apache.fop.fo.FObj;
32
import org.apache.fop.fo.PropertyList;
33
import org.apache.fop.fo.ValidationException;
34
35
/** Common change bar base class. Handles properties and local child validation */
36
public abstract class ChangeBar extends FObj {
37
38
39
    /**
40
     * Construct a ChangeBar element, common parts for start and end
41
     *
42
     * @param parent the parent element, containing the change bars start/end
43
     */
44
    public ChangeBar(FONode parent) {
45
        super(parent);
46
47
48
    }
49
50
51
    /**
52
     * The class of the change bar, must be provided
53
     */
54
    protected String cbClass = null;
55
56
    /**
57
     * The color of the change bar
58
     */
59
    protected Color color = null;
60
61
    /**
62
     * The offset of the bar from the column
63
     */
64
    protected Length offset = null;
65
66
    /**
67
     * The placement of the bar
68
     */
69
    protected int placement = -1;
70
71
    /**
72
     * The style of the bar
73
     */
74
    protected int style = -1;
75
76
    /**
77
     * The width of the bar
78
     */
79
    protected Length width = null;
80
81
82
    /** {@inheritDoc} */
83
    public void bind(PropertyList pList) throws FOPException {
84
        super.bind(pList);
85
86
        cbClass = pList.get(PR_CHANGE_BAR_CLASS).getString();
87
        color = pList.get(PR_CHANGE_BAR_COLOR).getColor(getUserAgent());
88
        offset = pList.get(PR_CHANGE_BAR_OFFSET).getLength();
89
        placement = pList.get(PR_CHANGE_BAR_PLACEMENT).getEnum();
90
        style = pList.get(PR_CHANGE_BAR_STYLE).getEnum();
91
        width = pList.get(PR_CHANGE_BAR_WIDTH).getLength();
92
    }
93
94
    /**
95
     * Return the class of the change bar.
96
     * @return the class of the change bar as a string
97
     */
98
    public String getCBClass() {
99
        return cbClass;
100
    }
101
102
    /** {@inheritDoc} */
103
    protected void validateChildNode(
104
            Locator loc,
105
            String namespaceURI,
106
            String localName)
107
   throws ValidationException {
108
        // no children allowed
109
        invalidChildError(loc, namespaceURI, localName);
110
    }
111
112
    /** {@inheritDoc} */
113
    public void processNode(String elementName, Locator locator,
114
                            Attributes attlist, PropertyList pList) throws FOPException {
115
        super.processNode(elementName, locator, attlist, pList);
116
        if (cbClass == null || "".equals(cbClass)) {
117
            missingPropertyError("change-bar-class");
118
        }
119
120
        if (findAncestor(FO_FLOW) == -1
121
             && findAncestor(FO_STATIC_CONTENT) == -1) {
122
            getFOValidationEventProducer().changeBarWrongAncestor(this, getName(), locator);
123
          }
124
    }
125
126
127
128
129
    /**
130
     * Push the current change bar on the stack
131
     */
132
    protected void push() {
133
        getRoot().getLastPageSequence().pushChangeBar(this);
134
    }
135
136
    /**
137
     * Remove top level change bar from stack
138
     */
139
    protected void pop() {
140
        getRoot().getLastPageSequence().popChangeBar();
141
142
    }
143
144
    /**
145
     * Return top-most change bar from the stack of nested change bars.
146
     *
147
     * @return the topmost changebar or null
148
     */
149
    protected ChangeBar top() {
150
        return  getRoot().getLastPageSequence().topChangeBar();
151
    }
152
153
    /**
154
     * @return the color
155
     */
156
    public Color getColor() {
157
        return color;
158
    }
159
160
    /**
161
     * @return the offset
162
     */
163
    public Length getOffset() {
164
        return offset;
165
    }
166
167
    /**
168
     * @return the placement
169
     */
170
    public int getPlacement() {
171
        return placement;
172
    }
173
174
    /**
175
     * @return the style
176
     */
177
    public int getStyle() {
178
        return style;
179
    }
180
181
    /**
182
     * @return the width
183
     */
184
    public Length getWidth() {
185
        return width;
186
    }
187
}
(-)src/java/org/apache/fop/fo/flow/ChangeBarBegin.java (+68 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
/* $Id$ */
19
20
package org.apache.fop.fo.flow;
21
22
23
import org.xml.sax.Attributes;
24
import org.xml.sax.Locator;
25
26
import org.apache.fop.apps.FOPException;
27
import org.apache.fop.fo.FONode;
28
import org.apache.fop.fo.PropertyList;
29
30
/**
31
 * Change bar begin element. Notes the beginning of change bar of a certain class.
32
 *
33
 */
34
public class ChangeBarBegin extends ChangeBar {
35
36
37
    /**
38
     * Construct a new ChangeBarEnd element
39
     *
40
     * @param parent the parent element of the new change bar end element
41
     */
42
    public ChangeBarBegin(FONode parent) {
43
        super(parent);
44
    }
45
46
    /** {@inheritDoc} */
47
    public String getLocalName() {
48
        return "change-bar-begin";
49
    }
50
51
52
    /**
53
     * {@inheritDoc}
54
     * @return {@link org.apache.fop.fo.Constants#FO_CHANGE_BAR_BEGIN}
55
     */
56
    public int getNameId() {
57
        return FO_CHANGE_BAR_BEGIN;
58
    }
59
60
    /** {@inheritDoc} */
61
    public void processNode(String elementName, Locator locator,
62
                            Attributes attlist, PropertyList pList) throws FOPException {
63
        super.processNode(elementName, locator, attlist, pList);
64
65
        push();
66
67
    }
68
}
(-)src/java/org/apache/fop/fo/FOElementMapping.java (+17 lines)
Lines 141-146 Link Here
141
            foObjs.put("marker", new MarkerMaker());
141
            foObjs.put("marker", new MarkerMaker());
142
            foObjs.put("retrieve-marker", new RetrieveMarkerMaker());
142
            foObjs.put("retrieve-marker", new RetrieveMarkerMaker());
143
            foObjs.put("retrieve-table-marker", new RetrieveTableMarkerMaker());
143
            foObjs.put("retrieve-table-marker", new RetrieveTableMarkerMaker());
144
145
            // change bars
146
            foObjs.put("change-bar-begin", new ChangeBarBeginMaker());
147
            foObjs.put("change-bar-end", new ChangeBarEndMaker());
144
        }
148
        }
145
    }
149
    }
146
150
Lines 527-530 Link Here
527
            return new org.apache.fop.fo.flow.RetrieveTableMarker(parent);
531
            return new org.apache.fop.fo.flow.RetrieveTableMarker(parent);
528
        }
532
        }
529
    }
533
    }
534
535
    static class ChangeBarBeginMaker extends ElementMapping.Maker {
536
        public FONode make(FONode parent) {
537
            return new org.apache.fop.fo.flow.ChangeBarBegin(parent);
538
        }
539
    }
540
541
    static class ChangeBarEndMaker extends ElementMapping.Maker {
542
        public FONode make(FONode parent) {
543
            return new org.apache.fop.fo.flow.ChangeBarEnd(parent);
544
        }
545
    }
546
530
}
547
}
(-)src/java/org/apache/fop/fo/pagination/PageSequence.java (+53 lines)
Lines 21-26 Link Here
21
21
22
import java.util.Map;
22
import java.util.Map;
23
import java.util.Stack;
23
import java.util.Stack;
24
import java.util.Vector;
24
25
25
import org.xml.sax.Locator;
26
import org.xml.sax.Locator;
26
27
Lines 30-35 Link Here
30
import org.apache.fop.fo.FONode;
31
import org.apache.fop.fo.FONode;
31
import org.apache.fop.fo.PropertyList;
32
import org.apache.fop.fo.PropertyList;
32
import org.apache.fop.fo.ValidationException;
33
import org.apache.fop.fo.ValidationException;
34
import org.apache.fop.fo.flow.ChangeBar;
33
import org.apache.fop.traits.Direction;
35
import org.apache.fop.traits.Direction;
34
import org.apache.fop.traits.WritingMode;
36
import org.apache.fop.traits.WritingMode;
35
import org.apache.fop.traits.WritingModeTraits;
37
import org.apache.fop.traits.WritingModeTraits;
Lines 78-83 Link Here
78
    private Flow mainFlow = null;
80
    private Flow mainFlow = null;
79
81
80
    /**
82
    /**
83
     * The change bars encountered
84
     */
85
    private static Vector stackedChangeBars = new Vector();
86
87
    /**
81
     * Create a PageSequence instance that is a child of the
88
     * Create a PageSequence instance that is a child of the
82
     * given {@link FONode}.
89
     * given {@link FONode}.
83
     *
90
     *
Lines 116-121 Link Here
116
                        masterReference, getLocator());
123
                        masterReference, getLocator());
117
            }
124
            }
118
        }
125
        }
126
        getRoot().addPageSequence(this);
119
        getFOEventHandler().startPageSequence(this);
127
        getFOEventHandler().startPageSequence(this);
120
    }
128
    }
121
129
Lines 442-445 Link Here
442
        this.flowMap.clear();
450
        this.flowMap.clear();
443
    }
451
    }
444
452
453
    /**
454
     * Add another change bar to the stack of active change bars
455
     * @param bar The change bar top add
456
     */
457
    public void pushChangeBar(ChangeBar bar) {
458
        stackedChangeBars.addElement(bar);
459
    }
460
461
462
    /**
463
     * Remove top level change bar from stack
464
     */
465
    public void popChangeBar() {
466
        stackedChangeBars.removeElementAt(stackedChangeBars.size() - 1);
467
    }
468
469
    /**
470
     * Return top-most changebar from stack of nested change bars
471
     *
472
     * @return change bar that is the top most changebar or null
473
     */
474
    public ChangeBar topChangeBar() {
475
        if (stackedChangeBars.isEmpty()) {
476
            return null;
477
        } else {
478
            return (ChangeBar)stackedChangeBars.lastElement();
479
        }
480
    }
481
482
    /**
483
     * Return the list of change bars in effect currently
484
     * @return The vector of change bars in effect currently
485
     */
486
    public Vector getChangeBars() {
487
        return stackedChangeBars;
488
    }
489
490
491
    /**
492
     * Copy the change bars in affect currently
493
     * @return A copy of the change bars in effect currently
494
     */
495
    public  Vector copyChangeBars() {
496
        return (Vector)(stackedChangeBars.clone());
497
    }
445
}
498
}
(-)src/java/org/apache/fop/fo/pagination/Root.java (+20 lines)
Lines 281-286 Link Here
281
    }
281
    }
282
282
283
    /**
283
    /**
284
     * Add another page sequence
285
     * @param pageSequence to add
286
     */
287
    public void addPageSequence(PageSequence pageSequence) {
288
        pageSequences.add(pageSequence);
289
    }
290
291
    /**
292
     * Return last page sequence (current while parsing)
293
     * @return last page sequence or null
294
     */
295
    public PageSequence getLastPageSequence() {
296
        if (getPageSequenceCount() > 0) {
297
            return pageSequences.get(getPageSequenceCount() - 1);
298
        } else {
299
            return null;
300
        }
301
    }
302
303
    /**
284
     * Returns the associated LayoutMasterSet.
304
     * Returns the associated LayoutMasterSet.
285
     * @return the LayoutMasterSet instance
305
     * @return the LayoutMasterSet instance
286
     */
306
     */
(-)src/java/org/apache/fop/fo/FOValidationEventProducer.java (+41 lines)
Lines 357-362 Link Here
357
            QName offendingNode, Locator loc);
357
            QName offendingNode, Locator loc);
358
358
359
    /**
359
    /**
360
     * A class for change bars is not unique.
361
     * @param source the event source
362
     * @param elementName the name of the context node
363
     * @param name the class name
364
     * @param loc the location of the error or null
365
     * @event.severity FATAL
366
     */
367
    void changeBarClassNotUnique(Object source, String elementName, String name,
368
            Locator loc);
369
370
    /**
371
     * Change bars were not stacked correctly
372
     * @param source the event source
373
     * @param elementName the name of the context node
374
     * @param beginName the class name of the beginning change bar
375
     * @param endName the class name of the ending change bar
376
     * @param loc the location of the error or null
377
     * @event.severity FATAL
378
     */
379
    void changeBarWrongStacking(Object source, String elementName, String beginName,
380
            String endName, Locator loc);
381
382
    /**
383
     * Change bar ended without a start of bar occurred
384
     * @param source the event source
385
     * @param elementName the name of the context node
386
     * @param loc the location of the error or null
387
     * @event.severity FATAL
388
     */
389
    void changeBarNoBegin(Object source, String elementName,
390
            Locator loc);
391
    /**
392
     * Change bar not descendant of fo:flow or fo:static-content
393
     * @param source the event source
394
     * @param elementName the name of the context node
395
     * @param loc the location of the error or null
396
     * @event.severity FATAL
397
     */
398
    void changeBarWrongAncestor(Object source, String elementName, Locator loc);
399
400
    /**
360
     * Alternate text is missing for a graphic element.
401
     * Alternate text is missing for a graphic element.
361
     *
402
     *
362
     * @param source the event source
403
     * @param source the event source
(-)src/java/org/apache/fop/fo/FOPropertyMapping.java (+57 lines)
Lines 318-323 Link Here
318
            gp.createTableProperties();
318
            gp.createTableProperties();
319
            gp.createWritingModeProperties();
319
            gp.createWritingModeProperties();
320
            gp.createMiscProperties();
320
            gp.createMiscProperties();
321
            gp.createChangeBarProperties();
321
322
322
            // Hardcode the subproperties.
323
            // Hardcode the subproperties.
323
            addSubpropMakerName("length", CP_LENGTH);
324
            addSubpropMakerName("length", CP_LENGTH);
Lines 2576-2581 Link Here
2576
        addPropertyMaker("writing-mode", m);
2577
        addPropertyMaker("writing-mode", m);
2577
    }
2578
    }
2578
2579
2580
    private void createChangeBarProperties() {
2581
        PropertyMaker m;
2582
2583
        // change-bar-class
2584
        m = new StringProperty.Maker(PR_CHANGE_BAR_CLASS);
2585
        m.setInherited(false);
2586
        m.setDefault("");
2587
        addPropertyMaker("change-bar-class", m);
2588
2589
        // change-bar-color
2590
        m  = new ColorProperty.Maker(PR_CHANGE_BAR_COLOR);
2591
2592
        m.setInherited(true);
2593
        // TODO: fall back to "color" property
2594
        m.setDefault("black");
2595
        addPropertyMaker("change-bar-color", m);
2596
2597
        // change-bar-offset
2598
        m  = new LengthProperty.Maker(PR_CHANGE_BAR_OFFSET);
2599
        m.setInherited(true);
2600
        m.setDefault("6pt");
2601
        addPropertyMaker("change-bar-offset", m);
2602
2603
        // change-bar-placement
2604
        m = new EnumProperty.Maker(PR_CHANGE_BAR_PLACEMENT);
2605
        m.setInherited(true);
2606
        m.setDefault("start");
2607
        m.addEnum("start", getEnumProperty(EN_START, "START"));
2608
        m.addEnum("end", getEnumProperty(EN_END, "END"));
2609
        m.addEnum("left", getEnumProperty(EN_LEFT, "LEFT"));
2610
        m.addEnum("right", getEnumProperty(EN_RIGHT, "RIGHT"));
2611
        m.addEnum("inside", getEnumProperty(EN_INSIDE, "INSIDE"));
2612
        m.addEnum("outside", getEnumProperty(EN_OUTSIDE, "OUTSIDE"));
2613
        m.addEnum("alternate", getEnumProperty(EN_ALTERNATE, "ALTERNATE"));
2614
        addPropertyMaker("change-bar-placement", m);
2615
2616
        // change-bar-style
2617
        m = new EnumProperty.Maker(PR_CHANGE_BAR_STYLE);
2618
        m.useGeneric(genericBorderStyle);
2619
        m.setInherited(true);
2620
        m.setDefault("solid");
2621
        addPropertyMaker("change-bar-style", m);
2622
2623
        // change-bar-width
2624
        m  = new LengthProperty.Maker(PR_CHANGE_BAR_WIDTH);
2625
        m.setInherited(true);
2626
        m.setDefault("6pt");
2627
        addPropertyMaker("change-bar-width", m);
2628
2629
        // change-bar-offset
2630
        m  = new LengthProperty.Maker(PR_CHANGE_BAR_OFFSET);
2631
        m.setInherited(true);
2632
        m.setDefault("6pt");
2633
        addPropertyMaker("change-bar-offset", m);
2634
    }
2635
2579
    private void createMiscProperties() {
2636
    private void createMiscProperties() {
2580
        PropertyMaker m;
2637
        PropertyMaker m;
2581
2638
(-)src/java/org/apache/fop/fo/FOTreeBuilder.java (-1 / +3 lines)
Lines 262-268 Link Here
262
            } else { // check that incoming node is valid for currentFObj
262
            } else { // check that incoming node is valid for currentFObj
263
                if (currentFObj.getNamespaceURI().equals(FOElementMapping.URI)
263
                if (currentFObj.getNamespaceURI().equals(FOElementMapping.URI)
264
                    || currentFObj.getNamespaceURI().equals(ExtensionElementMapping.URI)) {
264
                    || currentFObj.getNamespaceURI().equals(ExtensionElementMapping.URI)) {
265
                    currentFObj.validateChildNode(locator, namespaceURI, localName);
265
                    if (!currentFObj.isChangeBarElement(namespaceURI, localName)) {
266
                        currentFObj.validateChildNode(locator, namespaceURI, localName);
267
                    }
266
                }
268
                }
267
            }
269
            }
268
270
(-)src/java/org/apache/fop/fo/FOText.java (+7 lines)
Lines 32-37 Link Here
32
import org.apache.fop.complexscripts.bidi.DelimitedTextRange;
32
import org.apache.fop.complexscripts.bidi.DelimitedTextRange;
33
import org.apache.fop.datatypes.Length;
33
import org.apache.fop.datatypes.Length;
34
import org.apache.fop.fo.flow.Block;
34
import org.apache.fop.fo.flow.Block;
35
import org.apache.fop.fo.pagination.PageSequence;
35
import org.apache.fop.fo.properties.CommonFont;
36
import org.apache.fop.fo.properties.CommonFont;
36
import org.apache.fop.fo.properties.CommonHyphenation;
37
import org.apache.fop.fo.properties.CommonHyphenation;
37
import org.apache.fop.fo.properties.CommonTextDecoration;
38
import org.apache.fop.fo.properties.CommonTextDecoration;
Lines 107-112 Link Here
107
     */
108
     */
108
    public FOText(FONode parent) {
109
    public FOText(FONode parent) {
109
        super(parent);
110
        super(parent);
111
        // check if we are under the influence of change bars
112
        PageSequence pageSequence = getRoot().getLastPageSequence();
113
        if (pageSequence != null && pageSequence.topChangeBar() != null) {
114
            // OK, so copy over the stack of change bars
115
            affectedByChangeBars =  getRoot().getLastPageSequence().copyChangeBars();
116
        }
110
    }
117
    }
111
118
112
    /** {@inheritDoc} */
119
    /** {@inheritDoc} */
(-)src/java/org/apache/fop/fo/FONode.java (+29 lines)
Lines 24-29 Link Here
24
import java.util.ListIterator;
24
import java.util.ListIterator;
25
import java.util.Map;
25
import java.util.Map;
26
import java.util.Stack;
26
import java.util.Stack;
27
import java.util.Vector;
27
28
28
import org.xml.sax.Attributes;
29
import org.xml.sax.Attributes;
29
import org.xml.sax.Locator;
30
import org.xml.sax.Locator;
Lines 63-68 Link Here
63
    /** pointer to the sibling nodes */
64
    /** pointer to the sibling nodes */
64
    protected FONode[] siblings;
65
    protected FONode[] siblings;
65
66
67
    /** change bars affecting this */
68
    protected Vector affectedByChangeBars = null;
69
70
    /** change bars at start of element */
71
    protected Vector affectedByChangeBarsStart = null;
72
66
    /**
73
    /**
67
     * Marks the location of this object from the input FO
74
     * Marks the location of this object from the input FO
68
     *   <br>Call <code>locator.getSystemId()</code>,
75
     *   <br>Call <code>locator.getSystemId()</code>,
Lines 174-179 Link Here
174
    }
181
    }
175
182
176
    /**
183
    /**
184
     * Convenience function to check if this element is a change bar element
185
     * @param namespaceURI  The name space of the element
186
     * @param localName  The local name of the element
187
     * @return true if a member, false if not
188
     */
189
    public boolean isChangeBarElement(String namespaceURI, String localName) {
190
        return FO_URI.equals(namespaceURI)
191
                   && ( "change-bar-begin".equals(localName)
192
                        || "change-bar-end".equals(localName) );
193
    }
194
195
    /**
177
     * Returns the user agent that is associated with the
196
     * Returns the user agent that is associated with the
178
     * tree's <code>FOEventHandler</code>.
197
     * tree's <code>FOEventHandler</code>.
179
     *
198
     *
Lines 1055-1060 Link Here
1055
    }
1074
    }
1056
1075
1057
    /**
1076
    /**
1077
     * Return the change bars that affect this element
1078
     *
1079
     * @return vector of change bars elements affecting this element
1080
     */
1081
    public Vector/*<ChangeBar>*/getChangeBars() {
1082
        return affectedByChangeBars;
1083
    }
1084
1085
1086
    /**
1058
     * Sets the structure tree element.
1087
     * Sets the structure tree element.
1059
     *
1088
     *
1060
     * @param structureTreeElement set.
1089
     * @param structureTreeElement set.

Return to bug 48548