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

(-)src/java/org/apache/fop/render/xml/XMLRenderer.java (+20 lines)
Lines 27-32 Link Here
27
import java.util.Iterator;
27
import java.util.Iterator;
28
import java.util.List;
28
import java.util.List;
29
import java.util.Map;
29
import java.util.Map;
30
import java.util.Vector;
30
31
31
import javax.xml.transform.TransformerConfigurationException;
32
import javax.xml.transform.TransformerConfigurationException;
32
import javax.xml.transform.sax.SAXTransformerFactory;
33
import javax.xml.transform.sax.SAXTransformerFactory;
Lines 84-89 Link Here
84
import org.apache.fop.fo.extensions.ExtensionAttachment;
85
import org.apache.fop.fo.extensions.ExtensionAttachment;
85
import org.apache.fop.fo.extensions.ExtensionElementMapping;
86
import org.apache.fop.fo.extensions.ExtensionElementMapping;
86
import org.apache.fop.fo.extensions.InternalElementMapping;
87
import org.apache.fop.fo.extensions.InternalElementMapping;
88
import org.apache.fop.fo.flow.ChangeBar;
87
import org.apache.fop.fonts.FontInfo;
89
import org.apache.fop.fonts.FontInfo;
88
import org.apache.fop.fonts.FontTriplet;
90
import org.apache.fop.fonts.FontTriplet;
89
import org.apache.fop.render.Renderer;
91
import org.apache.fop.render.Renderer;
Lines 181-186 Link Here
181
                    + area.getBorderAndPaddingWidthEnd() + " "
183
                    + area.getBorderAndPaddingWidthEnd() + " "
182
                    + area.getBorderAndPaddingWidthBefore() + " "
184
                    + area.getBorderAndPaddingWidthBefore() + " "
183
                    + area.getBorderAndPaddingWidthAfter());
185
                    + area.getBorderAndPaddingWidthAfter());
186
            
187
            Vector v = area.getChangeBars();
188
            
189
            if (null != v && v.size() > 0) {
190
                StringBuffer buf = new StringBuffer();
191
            
192
                for (int idx = 0; idx < v.size(); idx++) {
193
                    ChangeBar cb = (ChangeBar)v.get(idx);
194
 
195
                    if (0 != idx) {
196
                        buf.append(",");
197
                    }
198
                    buf.append(cb.getCBClass());
199
                }
200
                addAttribute("change-bars", buf.toString());
201
            }
184
        }
202
        }
185
    }
203
    }
186
204
Lines 517-522 Link Here
517
            addAreaAttributes(region);
535
            addAreaAttributes(region);
518
            addTraitAttributes(region);
536
            addTraitAttributes(region);
519
            addAttribute("name", region.getRegionName());
537
            addAttribute("name", region.getRegionName());
538
            addAttribute("writingMode", region.getWritingMode());
539
            addAttribute("referenceOrientation", region.getReferenceOrientation());
520
            addAttribute("ctm", region.getCTM().toString());
540
            addAttribute("ctm", region.getCTM().toString());
521
            if (region.getRegionClass() == FO_REGION_BEFORE) {
541
            if (region.getRegionClass() == FO_REGION_BEFORE) {
522
                startElement("regionBefore", atts);
542
                startElement("regionBefore", atts);
(-)src/java/org/apache/fop/render/pdf/PDFEventProducer.xml (-1 / +1 lines)
Lines 1-5 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<catalogue xml:lang="en">
2
<catalogue xml:lang="en">
3
  <message key="org.apache.fop.render.pdf.PDFEventProducer.nonFullyResolvedLinkTargets">{count} link target{count,equals,1,,s} could not be fully resolved and now point{count,equals,1,,s} to the top of the page or {count,equals,1,is,are} dysfunctional.</message>
3
  <message key="org.apache.fop.render.pdf.PDFEventProducer.nonFullyResolvedLinkTargets">{count} link target{count,equals,1,,s} could not be fully resolved and now point{count,equals,1,,s} to the top of the page or {count,equals,1,is,are} dysfunctional.</message>
4
  <message key="org.apache.fop.render.pdf.PDFEventProducer.nonStandardStructureType">‘{type}’ is not a standard structure type defined by the PDF Reference. Falling back to ‘{fallback}’.</message>
4
  <message key="org.apache.fop.render.pdf.PDFEventProducer.nonStandardStructureType">???{type}??? is not a standard structure type defined by the PDF Reference. Falling back to ???{fallback}???.</message>
5
</catalogue>
5
</catalogue>
(-)src/java/org/apache/fop/render/AbstractRenderer.java (+247 lines)
Lines 28-33 Link Here
28
import java.util.Iterator;
28
import java.util.Iterator;
29
import java.util.List;
29
import java.util.List;
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 68-74 Link Here
68
import org.apache.fop.area.inline.WordArea;
69
import org.apache.fop.area.inline.WordArea;
69
import org.apache.fop.events.ResourceEventProducer;
70
import org.apache.fop.events.ResourceEventProducer;
70
import org.apache.fop.fo.Constants;
71
import org.apache.fop.fo.Constants;
72
import org.apache.fop.fo.flow.ChangeBar;
71
import org.apache.fop.fonts.FontInfo;
73
import org.apache.fop.fonts.FontInfo;
74
import org.apache.fop.traits.BorderProps;
72
75
73
/**
76
/**
74
 * Abstract base class for all renderers. The Abstract renderer does all the
77
 * Abstract base class for all renderers. The Abstract renderer does all the
Lines 108-113 Link Here
108
     */
111
     */
109
    protected int containingIPPosition = 0;
112
    protected int containingIPPosition = 0;
110
113
114
    /**
115
     * The "start edge" IP Position of the current column (for change bars)
116
     */
117
    protected int columnStartIPPosition = 0;
118
    
119
    /**
120
     * The "end edge" IP Position of the current column (for change bars)
121
     */
122
    protected int columnEndIPPosition = 0;
123
    
124
    /**
125
     * The "left" position of the current column (for change bars)
126
     */
127
    protected int columnLeftIPPosition = 0;
128
    
129
    /**
130
     * The "right" position of the current column (for change bars)
131
     */
132
    protected int columnRightIPPosition = 0;
133
    
134
    /**
135
     * The number of columns in the span (for change bars)
136
     */
137
    protected int columnCount = 0;
138
    
139
    /**
140
     * The index number of the current column (for change bars)
141
     */
142
    protected int columnNumber = 0;
143
    
144
    /**
145
     * Is binding on start edge of column?
146
     */
147
    protected boolean bindingOnStartEdge = false;
148
    
149
    /**
150
     * Is binding on end edge of column?
151
     */
152
    protected boolean bindingOnEndEdge = false;
153
    
154
    
155
    
111
    /** the currently active PageViewport */
156
    /** the currently active PageViewport */
112
    protected PageViewport currentPageViewport;
157
    protected PageViewport currentPageViewport;
113
158
Lines 403-412 Link Here
403
        int saveSpanBPPos = saveBPPos;
448
        int saveSpanBPPos = saveBPPos;
404
        for (int count = 0; count < spans.size(); count++) {
449
        for (int count = 0; count < spans.size(); count++) {
405
            span = (Span) spans.get(count);
450
            span = (Span) spans.get(count);
451
            columnCount = span.getColumnCount();
452
            
406
            for (int c = 0; c < span.getColumnCount(); c++) {
453
            for (int c = 0; c < span.getColumnCount(); c++) {
454
                columnNumber = c;
455
                
407
                NormalFlow flow = span.getNormalFlow(c);
456
                NormalFlow flow = span.getNormalFlow(c);
408
457
458
                int writingMode = mr.getParent().getWritingMode();
459
                int referenceOrientation = mr.getParent().getReferenceOrientation();
460
                
461
                
462
409
                if (flow != null) {
463
                if (flow != null) {
464
                    columnStartIPPosition = currentIPPosition;
465
                    columnEndIPPosition = currentIPPosition + flow.getIPD() + mr.getColumnGap();
466
                    
467
                    // if direction is right to left, then end is left, else end is right edge
468
                    // if orientation is portrait, then binding edge is on left edge for odd pages
469
                    // and on right edge for even pages
470
                    int pageIndex = currentPageViewport.getPageIndex();
471
                    CTM trans = currentPageViewport.getBodyRegion().getCTM();
472
                    
473
                    bindingOnStartEdge = false;
474
                    bindingOnEndEdge = false;
475
                    
476
                    if (writingMode == Constants.EN_RL_TB) {
477
                        columnLeftIPPosition = columnEndIPPosition;
478
                        columnRightIPPosition = columnStartIPPosition;
479
                        if (0 == referenceOrientation) {
480
                            if (pageIndex % 2 == 0 ) {
481
                                bindingOnEndEdge = true;
482
                            }
483
                            else {
484
                                bindingOnStartEdge = true;
485
                            }
486
                        }
487
                    }
488
                    else {
489
                        columnLeftIPPosition = columnStartIPPosition;
490
                        columnRightIPPosition = columnEndIPPosition;
491
                        if (0 == referenceOrientation) {
492
                            if (pageIndex % 2 == 0 ) {
493
                                bindingOnStartEdge = true;
494
                            }
495
                            else {
496
                                bindingOnEndEdge = true;
497
                            }
498
                        }
499
                    }
500
                    
501
502
 
503
                    
504
                    
410
                    currentBPPosition = saveSpanBPPos;
505
                    currentBPPosition = saveSpanBPPos;
411
                    renderFlow(flow);
506
                    renderFlow(flow);
412
                    currentIPPosition += flow.getIPD();
507
                    currentIPPosition += flow.getIPD();
Lines 555-560 Link Here
555
     * @param block  The block area
650
     * @param block  The block area
556
     */
651
     */
557
    protected void renderBlock(Block block) {
652
    protected void renderBlock(Block block) {
653
        Vector changeBars = block.getChangeBars();
654
        
655
        if (null != changeBars && !changeBars.isEmpty()) {
656
            // this block has change bars attached to it
657
            int saveIP = currentIPPosition;
658
            int saveBP = currentBPPosition;
659
            
660
            drawChangeBars(block, changeBars);
661
            
662
            currentIPPosition = saveIP;
663
            currentBPPosition = saveBP;
664
        }
665
        
558
        List children = block.getChildAreas();
666
        List children = block.getChildAreas();
559
        if (block instanceof BlockViewport) {
667
        if (block instanceof BlockViewport) {
560
            if (children != null) {
668
            if (children != null) {
Lines 616-621 Link Here
616
     * @param inlineArea inline area text to render
724
     * @param inlineArea inline area text to render
617
     */
725
     */
618
    protected void renderInlineArea(InlineArea inlineArea) {
726
    protected void renderInlineArea(InlineArea inlineArea) {
727
        Vector changeBars = inlineArea.getChangeBars();
728
        
729
        if (null != changeBars && !changeBars.isEmpty()) {
730
            // area has change bar, handle
731
            drawChangeBars(inlineArea, changeBars);
732
        }
733
        
619
        if (inlineArea instanceof TextArea) {
734
        if (inlineArea instanceof TextArea) {
620
            renderText((TextArea) inlineArea);
735
            renderText((TextArea) inlineArea);
621
        //} else if (inlineArea instanceof Character) {
736
        //} else if (inlineArea instanceof Character) {
Lines 758-763 Link Here
758
     * (todo) Make renderImage() protected
873
     * (todo) Make renderImage() protected
759
     */
874
     */
760
    public void renderImage(Image image, Rectangle2D pos) {
875
    public void renderImage(Image image, Rectangle2D pos) {
876
        // handle change bars
877
        Vector changeBars = image.getChangeBars();
878
        
879
        if (null != changeBars && !changeBars.isEmpty()) {
880
            drawChangeBars(image, changeBars);
881
        }
761
        // Default: do nothing.
882
        // Default: do nothing.
762
        // Some renderers (ex. Text) don't support images.
883
        // Some renderers (ex. Text) don't support images.
763
    }
884
    }
Lines 784-789 Link Here
784
     * (todo) Make renderForeignObject() protected
905
     * (todo) Make renderForeignObject() protected
785
     */
906
     */
786
    protected void renderForeignObject(ForeignObject fo, Rectangle2D pos) {
907
    protected void renderForeignObject(ForeignObject fo, Rectangle2D pos) {
908
        // handle change bars
909
        Vector changeBars = fo.getChangeBars();
910
        
911
        if (null != changeBars && !changeBars.isEmpty()) {
912
            drawChangeBars(fo, changeBars);
913
        }
914
        
787
        // Default: do nothing.
915
        // Default: do nothing.
788
        // Some renderers (ex. Text) don't support foreign objects.
916
        // Some renderers (ex. Text) don't support foreign objects.
789
    }
917
    }
Lines 856-859 Link Here
856
        matrix[5] = Math.round(matrix[5] * 1000);
984
        matrix[5] = Math.round(matrix[5] * 1000);
857
        return new AffineTransform(matrix);
985
        return new AffineTransform(matrix);
858
    }
986
    }
987
    
988
    /**
989
     * Draw all change bars associated with an area
990
     * 
991
     * @param block  The area to draw change bars for
992
     * @param changeBars The list of change bars affecting the area
993
     */
994
    private void drawChangeBars(Area block, Vector changeBars) {
995
        Block cbArea;
996
        
997
        int saveIP = currentIPPosition;
998
        int saveBP = currentBPPosition;
999
        
1000
        for (int idx = 0; idx < changeBars.size(); idx++) {
1001
            ChangeBar bar = (ChangeBar)changeBars.get(idx);
1002
            cbArea = new Block();
1003
1004
            currentIPPosition = 0;
1005
            currentBPPosition = saveBP;
1006
            
1007
            // offset by default is negative width for change bars placed on the start edge
1008
            // this will be overriden if placement is at the end edge
1009
            // xScale is for adding or subtracting the offset of the change bar depending on
1010
            //  placing the bar towards or away from the edge it is bound to
1011
            int xOffset = -bar.getWidth().getValue();
1012
            int xScale = 1;
1013
            
1014
            // determine currentIPPosition based on placement
1015
            switch (bar.getPlacement()) {
1016
            case EN_START:
1017
                xOffset += columnStartIPPosition;
1018
                xScale = -1;
1019
                break;
1020
            case EN_END:
1021
                xOffset = columnEndIPPosition;
1022
                break;
1023
            case EN_LEFT:
1024
                xOffset += columnLeftIPPosition;
1025
                xScale = -1;
1026
                break;
1027
            case EN_RIGHT:
1028
                xOffset = columnRightIPPosition;
1029
                break;
1030
            case EN_INSIDE:
1031
                if (bindingOnStartEdge) {
1032
                    xOffset += columnStartIPPosition;
1033
                    xScale = -1;
1034
                }
1035
                else if (bindingOnEndEdge) {
1036
                    xOffset = columnEndIPPosition;
1037
                }
1038
                else {
1039
                    xOffset += columnStartIPPosition;
1040
                    xScale = -1;
1041
                }
1042
                break;
1043
            case EN_OUTSIDE:
1044
                if (bindingOnStartEdge) {
1045
                    xOffset = columnEndIPPosition;
1046
                }
1047
                else if (bindingOnEndEdge) {
1048
                    xOffset += columnStartIPPosition;
1049
                    xScale = -1;
1050
                }
1051
                else {
1052
                    xOffset += columnStartIPPosition;
1053
                    xScale = -1;
1054
                }               
1055
                break;
1056
            case EN_ALTERNATE:
1057
                if (2 == columnCount) {
1058
                    if ( 0 == columnNumber) {
1059
                        xOffset += columnStartIPPosition;
1060
                        xScale = -1;
1061
                    }
1062
                    else {
1063
                        xOffset = columnEndIPPosition;
1064
                    }
1065
                }
1066
                else {
1067
                    if (bindingOnStartEdge) {
1068
                        xOffset = columnEndIPPosition;
1069
                    }
1070
                    else if (bindingOnEndEdge) {
1071
                        xOffset += columnStartIPPosition;
1072
                        xScale = -1;
1073
                    }
1074
                    else {
1075
                        xOffset = columnStartIPPosition;
1076
                        xScale = -1;
1077
                    }   
1078
                }
1079
                break;
1080
                default:
1081
                    // Cannot happen
1082
                    break;
1083
            }
1084
1085
            // Change bar area has 0 ipd, class xsl-absolute, no margin or padding
1086
            cbArea.setAreaClass(Area.CLASS_ABSOLUTE);
1087
            cbArea.setIPD(0);
1088
            cbArea.setPositioning(Block.ABSOLUTE);
1089
            cbArea.setBPD(block.getBPD());
1090
            BorderProps props = new BorderProps(bar.getStyle(), bar.getWidth().getValue(),
1091
                    bar.getColor(), BorderProps.SEPARATE);
1092
1093
            cbArea.addTrait(Trait.BORDER_END, props);
1094
 
1095
            cbArea.setXOffset(xOffset + xScale * bar.getOffset().getValue());
1096
            cbArea.setYOffset(block.getSpaceBefore());
1097
1098
            renderBlock(cbArea);
1099
1100
            // restore position on page
1101
            currentIPPosition = saveIP;
1102
            currentBPPosition = saveBP;
1103
                       
1104
        }
1105
    }
859
}
1106
}
(-)src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java (-2 / +5 lines)
Lines 178-186 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
        
184
        Image imageArea = new Image(uri);
186
        Image imageArea = new Image(uri);
185
        TraitSetter.setProducerID(imageArea, fobj.getId());
187
        TraitSetter.setProducerID(imageArea, fobj.getId());
186
        transferForeignAttributes(imageArea);
188
        transferForeignAttributes(imageArea);
Lines 246-252 Link Here
246
        rv.setClip(true);
248
        rv.setClip(true);
247
249
248
        BodyRegion body = new BodyRegion(Constants.FO_REGION_BODY,
250
        BodyRegion body = new BodyRegion(Constants.FO_REGION_BODY,
249
                "fop-image-region", rv, 1, 0);
251
                "fop-image-region", rv, 1, 0,
252
                pageSeq.getReferenceOrientation(), pageSeq.getReferenceOrientation());
250
        body.setIPD(imageSize.width);
253
        body.setIPD(imageSize.width);
251
        body.setBPD(imageSize.height);
254
        body.setBPD(imageSize.height);
252
        body.setCTM(pageCTM);
255
        body.setCTM(pageCTM);
(-)src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (+1 lines)
Lines 418-423 Link Here
418
    public Area getParentArea(Area childArea) {
418
    public Area getParentArea(Area childArea) {
419
        if (curBlockArea == null) {
419
        if (curBlockArea == null) {
420
            curBlockArea = new Block();
420
            curBlockArea = new Block();
421
           curBlockArea.setChangeBars(getChangeBars());
421
422
422
            curBlockArea.setIPD(super.getContentAreaIPD());
423
            curBlockArea.setIPD(super.getContentAreaIPD());
423
424
(-)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/layoutmgr/list/ListBlockLayoutManager.java (+1 lines)
Lines 238-243 Link Here
238
    public Area getParentArea(Area childArea) {
238
    public Area getParentArea(Area childArea) {
239
        if (curBlockArea == null) {
239
        if (curBlockArea == null) {
240
            curBlockArea = new Block();
240
            curBlockArea = new Block();
241
            curBlockArea.setChangeBars(getChangeBars());
241
242
242
            // Set up dimensions
243
            // Set up dimensions
243
            // Must get dimensions from parent area
244
            // Must get dimensions from parent area
(-)src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java (+1 lines)
Lines 602-607 Link Here
602
    public Area getParentArea(Area childArea) {
602
    public Area getParentArea(Area childArea) {
603
        if (curBlockArea == null) {
603
        if (curBlockArea == null) {
604
            curBlockArea = new Block();
604
            curBlockArea = new Block();
605
            curBlockArea.setChangeBars(getChangeBars());
605
606
606
            // Set up dimensions
607
            // Set up dimensions
607
            /*Area parentArea =*/ parentLayoutManager.getParentArea(curBlockArea);
608
            /*Area parentArea =*/ parentLayoutManager.getParentArea(curBlockArea);
(-)src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java (+2 lines)
Lines 192-197 Link Here
192
    public Area getParentArea(Area childArea) {
192
    public Area getParentArea(Area childArea) {
193
        if (curBlockArea == null) {
193
        if (curBlockArea == null) {
194
            curBlockArea = new Block();
194
            curBlockArea = new Block();
195
            curBlockArea.setChangeBars(getChangeBars());
196
            
195
            curBlockArea.setPositioning(Block.ABSOLUTE);
197
            curBlockArea.setPositioning(Block.ABSOLUTE);
196
            // set position
198
            // set position
197
            curBlockArea.setXOffset(xoffset);
199
            curBlockArea.setXOffset(xoffset);
(-)src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java (+2 lines)
Lines 85-90 Link Here
85
        // get breaks then add areas to title
85
        // get breaks then add areas to title
86
        this.parentLM = pslm;
86
        this.parentLM = pslm;
87
        holder = new LineArea();
87
        holder = new LineArea();
88
        holder.setChangeBars(getChangeBars());
88
89
89
        //        setUserAgent(foTitle.getUserAgent());
90
        //        setUserAgent(foTitle.getUserAgent());
90
91
Lines 161-166 Link Here
161
        childContext.setIPDAdjust(0.0);
162
        childContext.setIPDAdjust(0.0);
162
        childLM.addAreas(posIter, childContext);
163
        childLM.addAreas(posIter, childContext);
163
        ((InlineArea)holder).setIPD(savedIPD);
164
        ((InlineArea)holder).setIPD(savedIPD);
165
        
164
    }
166
    }
165
167
166
    public int getStackingSize() {
168
    public int getStackingSize() {
(-)src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java (+3 lines)
Lines 201-209 Link Here
201
        InlineArea area;
201
        InlineArea area;
202
        if (hasInlineParent) {
202
        if (hasInlineParent) {
203
            area = new InlineParent();
203
            area = new InlineParent();
204
            area.setChangeBars(getChangeBars());
204
            area.setOffset(0);
205
            area.setOffset(0);
205
        } else {
206
        } else {
206
            area = new InlineBlockParent();
207
            area = new InlineBlockParent();
208
            area.setChangeBars(getChangeBars());
207
        }
209
        }
208
        if (fobj instanceof Inline) {
210
        if (fobj instanceof Inline) {
209
            TraitSetter.setProducerID(area, getInlineFO().getId());
211
            TraitSetter.setProducerID(area, getInlineFO().getId());
Lines 518-523 Link Here
518
        context.setFlags(LayoutContext.LAST_AREA, isLast);
520
        context.setFlags(LayoutContext.LAST_AREA, isLast);
519
        areaCreated = true;
521
        areaCreated = true;
520
        checkEndOfLayout(lastPos);
522
        checkEndOfLayout(lastPos);
523
        
521
    }
524
    }
522
525
523
    /** {@inheritDoc} */
526
    /** {@inheritDoc} */
(-)src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java (+3 lines)
Lines 68-83 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
        }
78
        while (posIter.hasNext()) {
80
        while (posIter.hasNext()) {
79
            posIter.next();
81
            posIter.next();
80
        }
82
        }
83
        
81
    }
84
    }
82
85
83
    /** {@inheritDoc} */
86
    /** {@inheritDoc} */
(-)src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java (+2 lines)
Lines 70-75 Link Here
70
            int width = getStringWidth(str);
70
            int width = getStringWidth(str);
71
            text.setIPD(width);
71
            text.setIPD(width);
72
        }
72
        }
73
74
        text.setChangeBars(getChangeBars());
73
        updateTextAreaTraits(text);
75
        updateTextAreaTraits(text);
74
76
75
        return text;
77
        return text;
(-)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/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/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 (+5 lines)
Lines 1451-1456 Link Here
1451
            }
1451
            }
1452
        }
1452
        }
1453
        setCurrentArea(null); // ?? necessary
1453
        setCurrentArea(null); // ?? necessary
1454
        
1454
    }
1455
    }
1455
1456
1456
    /**
1457
    /**
Lines 1471-1476 Link Here
1471
        LineArea lineArea = new LineArea(
1472
        LineArea lineArea = new LineArea(
1472
                (lbp.getLeafPos() < seq.size() - 1 ? textAlignment : textAlignmentLast),
1473
                (lbp.getLeafPos() < seq.size() - 1 ? textAlignment : textAlignmentLast),
1473
                lbp.difference, lbp.availableStretch, lbp.availableShrink);
1474
                lbp.difference, lbp.availableStretch, lbp.availableShrink);
1475
        lineArea.setChangeBars(getChangeBars());
1476
        
1474
        if (lbp.startIndent != 0) {
1477
        if (lbp.startIndent != 0) {
1475
            lineArea.addTrait(Trait.START_INDENT, new Integer(lbp.startIndent));
1478
            lineArea.addTrait(Trait.START_INDENT, new Integer(lbp.startIndent));
1476
        }
1479
        }
Lines 1609-1614 Link Here
1609
        }
1612
        }
1610
1613
1611
        LineArea lineArea = new LineArea();
1614
        LineArea lineArea = new LineArea();
1615
        lineArea.setChangeBars(getChangeBars());
1616
        
1612
        setCurrentArea(lineArea);
1617
        setCurrentArea(lineArea);
1613
        LayoutContext lc = new LayoutContext(0);
1618
        LayoutContext lc = new LayoutContext(0);
1614
        lc.setAlignmentContext(alignmentContext);
1619
        lc.setAlignmentContext(alignmentContext);
(-)src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java (+2 lines)
Lines 75-80 Link Here
75
75
76
    private TextArea getCharacterInlineArea(Character node) {
76
    private TextArea getCharacterInlineArea(Character node) {
77
        TextArea text = new TextArea();
77
        TextArea text = new TextArea();
78
        text.setChangeBars(getChangeBars());
79
        
78
        char ch = node.getCharacter();
80
        char ch = node.getCharacter();
79
        if (CharUtilities.isAnySpace(ch)) {
81
        if (CharUtilities.isAnySpace(ch)) {
80
            // add space unless it's zero-width:
82
            // add space unless it's zero-width:
(-)src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java (+4 lines)
Lines 201-206 Link Here
201
                leaderArea.setBPD(fobj.getRuleThickness().getValue(this));
201
                leaderArea.setBPD(fobj.getRuleThickness().getValue(this));
202
            }
202
            }
203
        }
203
        }
204
        
205
       leaderArea.setChangeBars(getChangeBars());
206
       
204
        TraitSetter.setProducerID(leaderArea, fobj.getId());
207
        TraitSetter.setProducerID(leaderArea, fobj.getId());
205
        return leaderArea;
208
        return leaderArea;
206
     }
209
     }
Lines 233-238 Link Here
233
                posIter.next();
236
                posIter.next();
234
            }
237
            }
235
        }
238
        }
239
        
236
    }
240
    }
237
241
238
    /** {@inheritDoc} */
242
    /** {@inheritDoc} */
(-)src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java (+1 lines)
Lines 198-203 Link Here
198
            if (iAdjust != 0) {
198
            if (iAdjust != 0) {
199
                //getLogger().debug("Add leading space: " + iAdjust);
199
                //getLogger().debug("Add leading space: " + iAdjust);
200
                Space ls = new Space();
200
                Space ls = new Space();
201
                ls.setChangeBars(getChangeBars());
201
                ls.setIPD(iAdjust);
202
                ls.setIPD(iAdjust);
202
                parentArea.addChildArea(ls);
203
                parentArea.addChildArea(ls);
203
            }
204
            }
(-)src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java (+5 lines)
Lines 96-101 Link Here
96
        if (!resolved) {
96
        if (!resolved) {
97
            getPSLM().addUnresolvedArea(fobj.getRefId(), (Resolvable) curArea);
97
            getPSLM().addUnresolvedArea(fobj.getRefId(), (Resolvable) curArea);
98
        }
98
        }
99
        
99
    }
100
    }
100
101
101
    /**
102
    /**
Lines 112-117 Link Here
112
            String str = page.getPageNumberString();
113
            String str = page.getPageNumberString();
113
            // get page string from parent, build area
114
            // get page string from parent, build area
114
            text = new TextArea();
115
            text = new TextArea();
116
            text.setChangeBars(getChangeBars());
117
            
115
            int width = getStringWidth(str);
118
            int width = getStringWidth(str);
116
            text.addWord(str, 0);
119
            text.addWord(str, 0);
117
            text.setIPD(width);
120
            text.setIPD(width);
Lines 119-124 Link Here
119
        } else {
122
        } else {
120
            resolved = false;
123
            resolved = false;
121
            text = new UnresolvedPageNumber(fobj.getRefId(), font);
124
            text = new UnresolvedPageNumber(fobj.getRefId(), font);
125
            text.setChangeBars(getChangeBars());
126
            
122
            String str = "MMM"; // reserve three spaces for page number
127
            String str = "MMM"; // reserve three spaces for page number
123
            int width = getStringWidth(str);
128
            int width = getStringWidth(str);
124
            text.setIPD(width);
129
            text.setIPD(width);
(-)src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java (-1 / +5 lines)
Lines 297-302 Link Here
297
            addAreaInfoAreas(lastAreaInfo, wordSpaceCount, letterSpaceCount, firstAreaInfoIndex,
297
            addAreaInfoAreas(lastAreaInfo, wordSpaceCount, letterSpaceCount, firstAreaInfoIndex,
298
                    lastAreaInfoIndex, realWidth, context);
298
                    lastAreaInfoIndex, realWidth, context);
299
        }
299
        }
300
        
300
    }
301
    }
301
302
302
    private void addAreaInfoAreas(AreaInfo areaInfo, int wordSpaceCount, int letterSpaceCount,
303
    private void addAreaInfoAreas(AreaInfo areaInfo, int wordSpaceCount, int letterSpaceCount,
Lines 367-373 Link Here
367
368
368
        TextArea textArea = new TextAreaBuilder(realWidth, totalAdjust, context, firstAreaInfoIndex,
369
        TextArea textArea = new TextAreaBuilder(realWidth, totalAdjust, context, firstAreaInfoIndex,
369
                lastAreaInfoIndex, context.isLastArea(), areaInfo.font).build();
370
                lastAreaInfoIndex, context.isLastArea(), areaInfo.font).build();
370
371
        textArea.setChangeBars(getChangeBars());
372
        
371
        // wordSpaceDim is computed in relation to wordSpaceIPD.opt
373
        // wordSpaceDim is computed in relation to wordSpaceIPD.opt
372
        // but the renderer needs to know the adjustment in relation
374
        // but the renderer needs to know the adjustment in relation
373
        // to the size of the space character in the current font;
375
        // to the size of the space character in the current font;
Lines 459-464 Link Here
459
                textArea = new TextArea(width.getStretch(), width.getShrink(),
461
                textArea = new TextArea(width.getStretch(), width.getShrink(),
460
                        adjust);
462
                        adjust);
461
            }
463
            }
464
            
465
            textArea.setChangeBars(getChangeBars());
462
        }
466
        }
463
467
464
        private void setInlineProgressionDimension() {
468
        private void setInlineProgressionDimension() {
(-)src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java (+1 lines)
Lines 75-80 Link Here
75
            resolved = true;
75
            resolved = true;
76
        }
76
        }
77
77
78
        text.setChangeBars(getChangeBars());
78
        updateTextAreaTraits(text);
79
        updateTextAreaTraits(text);
79
80
80
        return text;
81
        return text;
(-)src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (+2 lines)
Lines 127-132 Link Here
127
        int sp = TraitSetter.getEffectiveSpace(adjust, minoptmax);
127
        int sp = TraitSetter.getEffectiveSpace(adjust, minoptmax);
128
        if (sp != 0) {
128
        if (sp != 0) {
129
            Block spacer = new Block();
129
            Block spacer = new Block();
130
           spacer.setChangeBars(getChangeBars());
131
           
130
            spacer.setBPD(sp);
132
            spacer.setBPD(sp);
131
            parentLayoutManager.addChildArea(spacer);
133
            parentLayoutManager.addChildArea(spacer);
132
        }
134
        }
(-)src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java (+10 lines)
Lines 405-414 Link Here
405
        if (usedBPD < cellBPD) {
405
        if (usedBPD < cellBPD) {
406
            if (getTableCell().getDisplayAlign() == EN_CENTER) {
406
            if (getTableCell().getDisplayAlign() == EN_CENTER) {
407
                Block space = new Block();
407
                Block space = new Block();
408
                space.setChangeBars(getChangeBars());
409
                
408
                space.setBPD((cellBPD - usedBPD) / 2);
410
                space.setBPD((cellBPD - usedBPD) / 2);
409
                curBlockArea.addBlock(space);
411
                curBlockArea.addBlock(space);
410
            } else if (getTableCell().getDisplayAlign() == EN_AFTER) {
412
            } else if (getTableCell().getDisplayAlign() == EN_AFTER) {
411
                Block space = new Block();
413
                Block space = new Block();
414
                space.setChangeBars(getChangeBars());
415
                
412
                space.setBPD(cellBPD - usedBPD);
416
                space.setBPD(cellBPD - usedBPD);
413
                curBlockArea.addBlock(space);
417
                curBlockArea.addBlock(space);
414
            }
418
            }
Lines 463-468 Link Here
463
            boolean outer) {
467
            boolean outer) {
464
        if (blocks[i][j] == null) {
468
        if (blocks[i][j] == null) {
465
            blocks[i][j] = new Block();
469
            blocks[i][j] = new Block();
470
            blocks[i][j].setChangeBars(getChangeBars());
471
            
466
            blocks[i][j].addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
472
            blocks[i][j].addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
467
            blocks[i][j].setPositioning(Block.ABSOLUTE);
473
            blocks[i][j].setPositioning(Block.ABSOLUTE);
468
        }
474
        }
Lines 493-498 Link Here
493
        int paddingEnd = padding.getPaddingEnd(false, this);
499
        int paddingEnd = padding.getPaddingEnd(false, this);
494
500
495
        Block block = new Block();
501
        Block block = new Block();
502
        block.setChangeBars(getChangeBars());
503
        
496
        TraitSetter.setProducerID(block, getTable().getId());
504
        TraitSetter.setProducerID(block, getTable().getId());
497
        block.setPositioning(Block.ABSOLUTE);
505
        block.setPositioning(Block.ABSOLUTE);
498
        block.setIPD(cellIPD + paddingStart + paddingEnd);
506
        block.setIPD(cellIPD + paddingStart + paddingEnd);
Lines 518-523 Link Here
518
    public Area getParentArea(Area childArea) {
526
    public Area getParentArea(Area childArea) {
519
        if (curBlockArea == null) {
527
        if (curBlockArea == null) {
520
            curBlockArea = new Block();
528
            curBlockArea = new Block();
529
            curBlockArea.setChangeBars(getChangeBars());
530
            
521
            curBlockArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
531
            curBlockArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
522
            TraitSetter.setProducerID(curBlockArea, getTableCell().getId());
532
            TraitSetter.setProducerID(curBlockArea, getTableCell().getId());
523
            curBlockArea.setPositioning(Block.ABSOLUTE);
533
            curBlockArea.setPositioning(Block.ABSOLUTE);
(-)src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java (+2 lines)
Lines 402-407 Link Here
402
    public Area getParentArea(Area childArea) {
402
    public Area getParentArea(Area childArea) {
403
        if (curBlockArea == null) {
403
        if (curBlockArea == null) {
404
            curBlockArea = new Block();
404
            curBlockArea = new Block();
405
            curBlockArea.setChangeBars(getChangeBars());
406
            
405
            // Set up dimensions
407
            // Set up dimensions
406
            // Must get dimensions from parent area
408
            // Must get dimensions from parent area
407
            /*Area parentArea =*/ parentLayoutManager.getParentArea(curBlockArea);
409
            /*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 465-470 Link Here
465
465
466
        //generate the block area
466
        //generate the block area
467
        Block block = new Block();
467
        Block block = new Block();
468
        block.setChangeBars(tclm.getTableLM().getFObj().getChangeBars());
469
        
468
        block.setPositioning(Block.ABSOLUTE);
470
        block.setPositioning(Block.ABSOLUTE);
469
        block.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
471
        block.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
470
        block.setIPD(ipd);
472
        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/PageBreaker.java (+1 lines)
Lines 470-475 Link Here
470
            parentArea.setTop(topOffset);
470
            parentArea.setTop(topOffset);
471
            parentArea.setSeparator(separatorArea);
471
            parentArea.setSeparator(separatorArea);
472
        }
472
        }
473
473
        pslm.getCurrentPV().getCurrentSpan().notifyFlowsFinished();
474
        pslm.getCurrentPV().getCurrentSpan().notifyFlowsFinished();
474
    }
475
    }
475
476
(-)src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (+4 lines)
Lines 1184-1189 Link Here
1184
            boolean allowBPDUpdate = autoHeight && !switchedProgressionDirection;
1184
            boolean allowBPDUpdate = autoHeight && !switchedProgressionDirection;
1185
1185
1186
            viewportBlockArea = new BlockViewport(allowBPDUpdate);
1186
            viewportBlockArea = new BlockViewport(allowBPDUpdate);
1187
            viewportBlockArea.setChangeBars(getChangeBars());
1188
            
1187
            viewportBlockArea.addTrait(Trait.IS_VIEWPORT_AREA, Boolean.TRUE);
1189
            viewportBlockArea.addTrait(Trait.IS_VIEWPORT_AREA, Boolean.TRUE);
1188
1190
1189
            viewportBlockArea.setIPD(getContentAreaIPD());
1191
            viewportBlockArea.setIPD(getContentAreaIPD());
Lines 1229-1234 Link Here
1229
            }
1231
            }
1230
1232
1231
            referenceArea = new Block();
1233
            referenceArea = new Block();
1234
            referenceArea.setChangeBars(getChangeBars());
1235
            
1232
            referenceArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
1236
            referenceArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
1233
            TraitSetter.setProducerID(referenceArea, getBlockContainerFO().getId());
1237
            TraitSetter.setProducerID(referenceArea, getBlockContainerFO().getId());
1234
1238
(-)src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java (+14 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 (null == fobj) {
267
            return null;
268
        } else {
269
            return fobj.getChangeBars();
270
        }
271
    }
272
273
    
260
    /** {@inheritDoc} */
274
    /** {@inheritDoc} */
261
    public void reset() {
275
    public void reset() {
262
        throw new UnsupportedOperationException("Not implemented");
276
        throw new UnsupportedOperationException("Not implemented");
(-)src/java/org/apache/fop/apps/FOUserAgent.java (+55 lines)
Lines 24-29 Link Here
24
import java.net.MalformedURLException;
24
import java.net.MalformedURLException;
25
import java.util.Date;
25
import java.util.Date;
26
import java.util.Map;
26
import java.util.Map;
27
import java.util.Vector;
27
28
28
import javax.xml.transform.Source;
29
import javax.xml.transform.Source;
29
import javax.xml.transform.TransformerException;
30
import javax.xml.transform.TransformerException;
Lines 46-51 Link Here
46
import org.apache.fop.events.FOPEventListenerProxy;
47
import org.apache.fop.events.FOPEventListenerProxy;
47
import org.apache.fop.events.LoggingEventListener;
48
import org.apache.fop.events.LoggingEventListener;
48
import org.apache.fop.fo.FOEventHandler;
49
import org.apache.fop.fo.FOEventHandler;
50
import org.apache.fop.fo.flow.ChangeBar;
49
import org.apache.fop.fonts.FontManager;
51
import org.apache.fop.fonts.FontManager;
50
import org.apache.fop.render.Renderer;
52
import org.apache.fop.render.Renderer;
51
import org.apache.fop.render.RendererFactory;
53
import org.apache.fop.render.RendererFactory;
Lines 81-87 Link Here
81
    private static Log log = LogFactory.getLog("FOP");
83
    private static Log log = LogFactory.getLog("FOP");
82
84
83
    private FopFactory factory;
85
    private FopFactory factory;
86
   
87
    /**
88
     * The change bars encountered
89
     */
90
    private static Vector stackedChangeBars = new Vector();
84
91
92
    
85
    /**
93
    /**
86
     *  The base URL for all URL resolutions, especially for
94
     *  The base URL for all URL resolutions, especially for
87
     *  external-graphics.
95
     *  external-graphics.
Lines 692-696 Link Here
692
    public StructureTree getStructureTree() {
700
    public StructureTree getStructureTree() {
693
        return this.structureTree;
701
        return this.structureTree;
694
    }
702
    }
703
    
704
    /**
705
     * Add another change bar to the stack of active change bars
706
     * @param bar The change bar top add
707
     */
708
    public void pushChangeBar(ChangeBar bar) {
709
        stackedChangeBars.addElement(bar);
710
    }
711
    
712
    
713
    /**
714
     * Remove top level change bar from stack
715
     */
716
    public void popChangeBar() {
717
        stackedChangeBars.removeElementAt(stackedChangeBars.size() - 1);
718
    }
719
    
720
    /**
721
     * Return the nearest change bar in effect, i.e. the youngest one
722
     * 
723
     * @return youngest change bar in effect or null
724
     */
725
    public ChangeBar topChangeBar() {
726
        if (stackedChangeBars.isEmpty()) {
727
            return null;
728
        }
729
        else {
730
            return (ChangeBar)stackedChangeBars.lastElement();
731
        }
732
    }
733
    
734
    /**
735
     * Return the list of change bars in effect currently
736
     * @return The vector of change bars in effect currently
737
     */
738
    public Vector getChangeBars() {
739
        return stackedChangeBars;
740
    }
741
    
742
743
    /**
744
     * Copy the change bars in affect currently 
745
     * @return A copy of the change bars in effect currently
746
     */
747
    public  Vector copyChangeBars() {
748
        return (Vector)(stackedChangeBars.clone());        
749
    }
695
}
750
}
696
751
(-)src/java/org/apache/fop/events/EventFormatter.xml (+3 lines)
Lines 58-63 Link Here
58
  <message key="org.apache.fop.fo.FOValidationEventProducer.invalidFORoot">First element must be the fo:root formatting object. Found {elementName} instead. Please make sure you're producing a valid XSL-FO document.</message>
58
  <message key="org.apache.fop.fo.FOValidationEventProducer.invalidFORoot">First element must be the fo:root formatting object. Found {elementName} instead. Please make sure you're producing a valid XSL-FO document.</message>
59
  <message key="org.apache.fop.fo.FOValidationEventProducer.emptyDocument">Document is empty (something might be wrong with your XSLT stylesheet).</message>
59
  <message key="org.apache.fop.fo.FOValidationEventProducer.emptyDocument">Document is empty (something might be wrong with your XSLT stylesheet).</message>
60
  <message key="org.apache.fop.fo.FOValidationEventProducer.unknownFormattingObject">Unknown formatting object "{offendingNode}" encountered (a child of {elementName}}.{{locator}}</message>
60
  <message key="org.apache.fop.fo.FOValidationEventProducer.unknownFormattingObject">Unknown formatting object "{offendingNode}" encountered (a child of {elementName}}.{{locator}}</message>
61
  <message key="org.apache.fop.fo.FOValidationEventProducer.changeBarWrongStacking">End class "{endName}" of {elementName} does not match latest starting class {beginName}.{{locator}}</message>
62
  <message key="org.apache.fop.fo.FOValidationEventProducer.changeBarNoBegin">An {elementName} without an fo:change-bar-begin found.{{locator}}</message>
63
  <message key="org.apache.fop.fo.FOValidationEventProducer.changeBarWrongAncestor">Element {elementName} not descendant of fo:flow or fo:static-content.{{locator}}</message>
61
  <message key="org.apache.fop.fo.flow.table.TableEventProducer.nonAutoBPDOnTable">Only a value of "auto" for block-progression-dimension has a well-specified behavior on fo:table. Falling back to "auto".{{locator}}</message>
64
  <message key="org.apache.fop.fo.flow.table.TableEventProducer.nonAutoBPDOnTable">Only a value of "auto" for block-progression-dimension has a well-specified behavior on fo:table. Falling back to "auto".{{locator}}</message>
62
  <message key="org.apache.fop.fo.flow.table.TableEventProducer.noTablePaddingWithCollapsingBorderModel">In collapsing border model a table does not have padding (see http://www.w3.org/TR/REC-CSS2/tables.html#collapsing-borders), but a non-zero value for padding was found. The padding will be ignored.{{locator}}</message>
65
  <message key="org.apache.fop.fo.flow.table.TableEventProducer.noTablePaddingWithCollapsingBorderModel">In collapsing border model a table does not have padding (see http://www.w3.org/TR/REC-CSS2/tables.html#collapsing-borders), but a non-zero value for padding was found. The padding will be ignored.{{locator}}</message>
63
  <message key="org.apache.fop.fo.flow.table.TableEventProducer.noMixRowsAndCells">Either fo:table-rows or fo:table-cells may be children of an {elementName} but not both.{{locator}}</message>
66
  <message key="org.apache.fop.fo.flow.table.TableEventProducer.noMixRowsAndCells">Either fo:table-rows or fo:table-cells may be children of an {elementName} but not both.{{locator}}</message>
(-)src/java/org/apache/fop/fo/FOText.java (+6 lines)
Lines 28-33 Link Here
28
import org.apache.fop.apps.FOPException;
28
import org.apache.fop.apps.FOPException;
29
import org.apache.fop.datatypes.Length;
29
import org.apache.fop.datatypes.Length;
30
import org.apache.fop.fo.flow.Block;
30
import org.apache.fop.fo.flow.Block;
31
import org.apache.fop.fo.flow.ChangeBar;
31
import org.apache.fop.fo.properties.CommonFont;
32
import org.apache.fop.fo.properties.CommonFont;
32
import org.apache.fop.fo.properties.CommonHyphenation;
33
import org.apache.fop.fo.properties.CommonHyphenation;
33
import org.apache.fop.fo.properties.CommonTextDecoration;
34
import org.apache.fop.fo.properties.CommonTextDecoration;
Lines 90-95 Link Here
90
     */
91
     */
91
    public FOText(FONode parent) {
92
    public FOText(FONode parent) {
92
        super(parent);
93
        super(parent);
94
        // check if we are under the influence of change bars
95
        if (null != getUserAgent().topChangeBar()) {
96
            // OK, so copy over the stack of change bars
97
            affectedByChangeBars = getUserAgent().copyChangeBars();
98
        }
93
    }
99
    }
94
100
95
    /** {@inheritDoc} */
101
    /** {@inheritDoc} */
(-)src/java/org/apache/fop/fo/FONode.java (-2 / +23 lines)
Lines 22-27 Link Here
22
// Java
22
// Java
23
import java.util.ListIterator;
23
import java.util.ListIterator;
24
import java.util.Map;
24
import java.util.Map;
25
import java.util.Vector;
25
26
26
import org.xml.sax.Attributes;
27
import org.xml.sax.Attributes;
27
import org.xml.sax.Locator;
28
import org.xml.sax.Locator;
Lines 59-64 Link Here
59
    /** pointer to the sibling nodes */
60
    /** pointer to the sibling nodes */
60
    protected FONode[] siblings;
61
    protected FONode[] siblings;
61
62
63
    /** list of change bars affecting the FObj */
64
    protected Vector affectedByChangeBars = null;
65
    
62
    /**
66
    /**
63
     * Marks the location of this object from the input FO
67
     * Marks the location of this object from the input FO
64
     *   <br>Call <code>locator.getSystemId()</code>,
68
     *   <br>Call <code>locator.getSystemId()</code>,
Lines 170-175 Link Here
170
    }
174
    }
171
175
172
    /**
176
    /**
177
     * Convenience function to check if this element is a change bar element
178
     * @param namespaceURI  The name space of the element
179
     * @param localName  The local name of the element
180
     * @return true if a member, false if not
181
     */
182
    public boolean isChangeBarElement(String namespaceURI, String localName) {
183
        return FO_URI.equals(namespaceURI) &&
184
                    ( "change-bar-begin".equals(localName) ||
185
                       "change-bar-end".equals(localName) );
186
    }
187
    
188
    /**
173
     * Returns the user agent that is associated with the
189
     * Returns the user agent that is associated with the
174
     * tree's <code>FOEventHandler</code>.
190
     * tree's <code>FOEventHandler</code>.
175
     *
191
     *
Lines 244-249 Link Here
244
        //nop
260
        //nop
245
    }
261
    }
246
262
263
264
    
265
    
247
    /**
266
    /**
248
     * Static version of {@link FONode#validateChildNode(Locator, String, String)} that
267
     * Static version of {@link FONode#validateChildNode(Locator, String, String)} that
249
     * can be used by subclasses that need to validate children against a different node
268
     * can be used by subclasses that need to validate children against a different node
Lines 252-259 Link Here
252
     *
271
     *
253
     * @param fo    the {@link FONode} to validate against
272
     * @param fo    the {@link FONode} to validate against
254
     * @param loc   location in the source file
273
     * @param loc   location in the source file
255
     * @param namespaceURI  namespace of the incoming node
274
     * @param namespaceURI  name space of the incoming node
256
     * @param localName     name of the incoming node (without namespace prefix)
275
     * @param localName     name of the incoming node (without name space prefix)
257
     * @throws ValidationException if the incoming node is not a valid child for the given FO
276
     * @throws ValidationException if the incoming node is not a valid child for the given FO
258
     */
277
     */
259
    protected static void validateChildNode(
278
    protected static void validateChildNode(
Lines 861-866 Link Here
861
        followingSibling.siblings[0] = precedingSibling;
880
        followingSibling.siblings[0] = precedingSibling;
862
    }
881
    }
863
882
883
  
884
    
864
    /**
885
    /**
865
     * Base iterator interface over a FO's children
886
     * Base iterator interface over a FO's children
866
     */
887
     */
(-)src/java/org/apache/fop/fo/FObj.java (-3 / +31 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 36-41 Link Here
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;
38
import org.apache.fop.fo.properties.PropertyMaker;
39
import org.apache.fop.fo.properties.PropertyMaker;
40
import org.apache.fop.fo.flow.ChangeBar;
39
41
40
/**
42
/**
41
 * Base class for representation of formatting objects and their processing.
43
 * Base class for representation of formatting objects and their processing.
Lines 68-74 Link Here
68
70
69
    // The value of properties relevant for all fo objects
71
    // The value of properties relevant for all fo objects
70
    private String id = null;
72
    private String id = null;
71
    // End of property values
73
    
74
    
72
75
73
    /**
76
    /**
74
     * Create a new formatting object.
77
     * Create a new formatting object.
Lines 118-126 Link Here
118
        setLocator(locator);
121
        setLocator(locator);
119
        pList.addAttributesToList(attlist);
122
        pList.addAttributesToList(attlist);
120
        if (!inMarker()
123
        if (!inMarker()
121
                || "marker".equals(elementName)) {
124
                || "marker".equals(elementName) ) {
122
            pList.setWritingMode();
125
            pList.setWritingMode();
123
            bind(pList);
126
            bind(pList);
127
        } else if (elementName.startsWith("change-bar")) {
128
            bind(pList);
124
        }
129
        }
125
    }
130
    }
126
131
Lines 152-160 Link Here
152
        if (id != null) {
157
        if (id != null) {
153
            checkId(id);
158
            checkId(id);
154
        }
159
        }
160
        
155
    }
161
    }
156
162
157
    /**
163
    /**
164
     * {@inheritDoc}
165
     * @throws FOPException FOP Exception
166
     */
167
     protected void endOfNode() throws FOPException {
168
        // check if we are under the influence of change bars
169
        if (null != getUserAgent().topChangeBar()) {
170
            // OK, so copy over the stack of change bars
171
            affectedByChangeBars = getUserAgent().copyChangeBars();
172
        }
173
174
        super.endOfNode();
175
    }
176
177
    /**
158
     * Setup the id for this formatting object.
178
     * Setup the id for this formatting object.
159
     * Most formatting objects can have an id that can be referenced.
179
     * Most formatting objects can have an id that can be referenced.
160
     * This methods checks that the id isn't already used by another FO
180
     * This methods checks that the id isn't already used by another FO
Lines 417-423 Link Here
417
        }
437
        }
418
    }
438
    }
419
439
420
    /**
440
    
441
    
442
     /**
421
     * Convenience method for validity checking.  Checks if the
443
     * Convenience method for validity checking.  Checks if the
422
     * incoming node is a member of the "%block;" parameter entity
444
     * incoming node is a member of the "%block;" parameter entity
423
     * as defined in Sect. 6.2 of the XSL 1.0 & 1.1 Recommendations
445
     * as defined in Sect. 6.2 of the XSL 1.0 & 1.1 Recommendations
Lines 610-615 Link Here
610
        return (super.toString() + "[@id=" + this.id + "]");
632
        return (super.toString() + "[@id=" + this.id + "]");
611
    }
633
    }
612
634
635
    public Vector/*<ChangeBar>*/getChangeBars()
636
    {
637
        return affectedByChangeBars;
638
    }
639
    
640
    
613
    /** Basic {@link FONodeIterator} implementation */
641
    /** Basic {@link FONodeIterator} implementation */
614
    public class FObjIterator implements FONodeIterator {
642
    public class FObjIterator implements FONodeIterator {
615
643
(-)src/java/org/apache/fop/fo/flow/ChangeBar.java (+195 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
import org.xml.sax.Attributes;
25
import org.xml.sax.Locator;
26
27
import org.apache.fop.apps.FOPException;
28
import org.apache.fop.fo.FONode;
29
import org.apache.fop.fo.FObj;
30
import org.apache.fop.fo.PropertyList;
31
import org.apache.fop.fo.ValidationException;
32
import org.apache.fop.fo.properties.Property;
33
import org.apache.fop.datatypes.Length;
34
35
/** Common change bar base class. Handles properties and local child validation */
36
public abstract class ChangeBar extends FObj {
37
38
    
39
    /**
40
     * Create a new ChangeBar object
41
     * @param parent The parent FObj
42
     */
43
    public ChangeBar(FONode parent) {
44
        super(parent);       
45
    }
46
47
    
48
    /**
49
     * The class of the change bar, must be provided
50
     */
51
    protected String cbClass = null;
52
    
53
    /**
54
     * The color of the change bar
55
     */
56
    protected Color color = null;
57
    
58
    /**
59
     * The offset of the bar from the column
60
     */
61
    protected Length offset = null;
62
    
63
    /**
64
     * The placement of the bar
65
     */
66
    protected int placement = -1;
67
    
68
    /**
69
     * The style of the bar
70
     */
71
    protected int style = -1;
72
    
73
    /**
74
     * The width of the bar
75
     */
76
    protected Length width = null;
77
    
78
    
79
    /** {@inheritDoc} */
80
    public void bind(PropertyList pList) throws FOPException {
81
        super.bind(pList);
82
               
83
        Property classProperty = pList.get(PR_CHANGE_BAR_CLASS);
84
        if (null == classProperty) {
85
            cbClass = "inMarker";
86
        }
87
        else {
88
            cbClass = classProperty.getString();
89
        }
90
        
91
        
92
        Property colorProperty = pList.get(PR_CHANGE_BAR_COLOR, true, false);
93
        if (null == colorProperty) {
94
            colorProperty = pList.get(PR_COLOR);
95
        }
96
        color = colorProperty.getColor(getUserAgent());
97
        offset = pList.get(PR_CHANGE_BAR_OFFSET).getLength(); 
98
        placement = pList.get(PR_CHANGE_BAR_PLACEMENT).getEnum();
99
        style = pList.get(PR_CHANGE_BAR_STYLE).getEnum();
100
        width = pList.get(PR_CHANGE_BAR_WIDTH).getLength();
101
    }
102
    
103
104
    /**
105
     * @return the class of the change bar
106
     */
107
    public String getCBClass() {
108
        return cbClass;
109
    }
110
111
    /** {@inheritDoc} */
112
    protected void validateChildNode(
113
            Locator loc,
114
            String namespaceURI,
115
            String localName)
116
   throws ValidationException {
117
        // no children allowed
118
        invalidChildError(loc, namespaceURI, localName);
119
    }
120
121
    /** {@inheritDoc} */
122
    public void processNode(String elementName, Locator locator,
123
                            Attributes attlist, PropertyList pList) throws FOPException {
124
        super.processNode(elementName, locator, attlist, pList);
125
126
        if (cbClass == null || "".equals(cbClass)) {
127
            missingPropertyError("change-bar-class");
128
        }
129
        
130
        if ( -1 == findAncestor(FO_FLOW)
131
             && -1 == findAncestor(FO_STATIC_CONTENT) ) {
132
            getFOValidationEventProducer().changeBarWrongAncestor(this, getName(), locator);
133
          }
134
    }
135
    
136
    
137
    /**
138
     * Push the current change bar on the stack
139
     */
140
    protected void push() {
141
        getUserAgent().pushChangeBar(this);
142
    }
143
    
144
    /**
145
     * Remove top level change bar from stack
146
     */
147
    protected void pop() {
148
        getUserAgent().popChangeBar();
149
 
150
    }
151
    
152
    /**
153
     * Retrieve youngest open change bar element
154
     *
155
     * @return null, if no change bar is open, otherwise the youngest change bar
156
     */
157
    protected ChangeBar top() {
158
        return getUserAgent().topChangeBar();
159
    }
160
161
    /**
162
     * @return the color
163
     */
164
    public Color getColor() {
165
        return color;
166
    }
167
168
    /**
169
     * @return the offset
170
     */
171
    public Length getOffset() {
172
        return offset;
173
    }
174
175
    /**
176
     * @return the placement
177
     */
178
    public int getPlacement() {
179
        return placement;
180
    }
181
182
    /**
183
     * @return the style
184
     */
185
    public int getStyle() {
186
        return style;
187
    }
188
189
    /**
190
     * @return the width
191
     */
192
    public Length getWidth() {
193
        return width;
194
    }
195
}
0
  + *
196
  + *
(-)src/java/org/apache/fop/fo/flow/ChangeBarEnd.java (+79 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
/**
32
 * End of a change bar element. Notes the end of the affected objects of a change bar.
33
 *  */
34
public class ChangeBarEnd extends ChangeBar {
35
36
    /**
37
     * Create a change bar end object 
38
     * @param parent the parent FObj
39
     */
40
    public ChangeBarEnd(FONode parent) {
41
        super(parent);
42
    }
43
44
    /** {@inheritDoc} */
45
    public String getLocalName() {
46
        return "change-bar-end";
47
    }
48
49
50
    /**
51
     * {@inheritDoc}
52
     * @return {@link org.apache.fop.fo.Constants#FO_CHANGE_BAR_END}
53
     */
54
    public int getNameId() {
55
        return FO_CHANGE_BAR_END;
56
    }
57
    
58
    /** {@inheritDoc} */
59
    public void processNode(String elementName, Locator locator,
60
                            Attributes attlist, PropertyList pList) throws FOPException {
61
        super.processNode(elementName, locator, attlist, pList);
62
        
63
        // check if we have an element on the stack at all
64
        ChangeBar topElement = top();
65
        
66
        if (null == topElement) {
67
            getFOValidationEventProducer().changeBarNoBegin(this, getName(), locator);
68
        } else {
69
            if (!topElement.cbClass.equals(cbClass)) {
70
                getFOValidationEventProducer().changeBarWrongStacking(this,
71
                        getName(), topElement.cbClass, cbClass, locator);
72
            }
73
            pop();
74
        }
75
        
76
        
77
    }
78
    
79
}
(-)src/java/org/apache/fop/fo/flow/ChangeBarBegin.java (+67 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
32
/**
33
 * Change bar begin element. Notes the beginning of change bar of a certain class.
34
 * 
35
 */
36
public class ChangeBarBegin extends ChangeBar {
37
38
    
39
    /**
40
     * Create a new change bar begin object
41
     * @param parent The parent FObj
42
     */
43
    public ChangeBarBegin(FONode parent) {
44
        super(parent);
45
    }
46
47
    /** {@inheritDoc} */
48
    public String getLocalName() {
49
        return "change-bar-begin";
50
    }
51
52
53
    /**
54
     * {@inheritDoc}
55
     * @return {@link org.apache.fop.fo.Constants#FO_CHANGE_BAR_BEGIN}
56
     */
57
    public int getNameId() {
58
        return FO_CHANGE_BAR_BEGIN;
59
    }
60
    
61
    /** {@inheritDoc} */
62
    public void processNode(String elementName, Locator locator,
63
                            Attributes attlist, PropertyList pList) throws FOPException {
64
        super.processNode(elementName, locator, attlist, pList);
65
        push();
66
    }
67
}
(-)src/java/org/apache/fop/fo/flow/Marker.java (-2 / +9 lines)
Lines 90-97 Link Here
90
        savePropertyListMaker = builderContext.getPropertyListMaker();
90
        savePropertyListMaker = builderContext.getPropertyListMaker();
91
        builderContext.setPropertyListMaker(new PropertyListMaker() {
91
        builderContext.setPropertyListMaker(new PropertyListMaker() {
92
            public PropertyList make(FObj fobj, PropertyList parentPropertyList) {
92
            public PropertyList make(FObj fobj, PropertyList parentPropertyList) {
93
                PropertyList pList = new MarkerPropertyList(fobj, parentPropertyList);
93
                PropertyList pList;
94
                descendantPropertyLists.put(fobj, pList);
94
                
95
                if (fobj.getLocalName().startsWith("change-bar-")) {
96
                    pList = savePropertyListMaker.make(fobj, parentPropertyList);
97
                }
98
                else {
99
                 pList = new MarkerPropertyList(fobj, parentPropertyList);
100
                 descendantPropertyLists.put(fobj, pList);
101
                }
95
                return pList;
102
                return pList;
96
            }
103
            }
97
        });
104
        });
(-)src/java/org/apache/fop/fo/FOElementMapping.java (+17 lines)
Lines 136-141 Link Here
136
            foObjs.put("marker", new MarkerMaker());
136
            foObjs.put("marker", new MarkerMaker());
137
            foObjs.put("retrieve-marker", new RetrieveMarkerMaker());
137
            foObjs.put("retrieve-marker", new RetrieveMarkerMaker());
138
            foObjs.put("retrieve-table-marker", new RetrieveTableMarkerMaker());
138
            foObjs.put("retrieve-table-marker", new RetrieveTableMarkerMaker());
139
            
140
            // change bars
141
            foObjs.put("change-bar-begin", new ChangeBarBeginMaker());
142
            foObjs.put("change-bar-end", new ChangeBarEndMaker());
139
        }
143
        }
140
    }
144
    }
141
145
Lines 520-523 Link Here
520
            return new org.apache.fop.fo.flow.RetrieveTableMarker(parent);
524
            return new org.apache.fop.fo.flow.RetrieveTableMarker(parent);
521
        }
525
        }
522
    }
526
    }
527
    
528
    static class ChangeBarBeginMaker extends ElementMapping.Maker {
529
        public FONode make(FONode parent) {
530
            return new org.apache.fop.fo.flow.ChangeBarBegin(parent);
531
        }
532
    }
533
    
534
    static class ChangeBarEndMaker extends ElementMapping.Maker {
535
        public FONode make(FONode parent) {
536
            return new org.apache.fop.fo.flow.ChangeBarEnd(parent);
537
        }
538
    }  
539
    
523
}
540
}
(-)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 (+55 lines)
Lines 313-318 Link Here
313
            gp.createTableProperties();
313
            gp.createTableProperties();
314
            gp.createWritingModeProperties();
314
            gp.createWritingModeProperties();
315
            gp.createMiscProperties();
315
            gp.createMiscProperties();
316
            gp.createChangeBarProperties();
316
317
317
            // Hardcode the subproperties.
318
            // Hardcode the subproperties.
318
            addSubpropMakerName("length", CP_LENGTH);
319
            addSubpropMakerName("length", CP_LENGTH);
Lines 2500-2505 Link Here
2500
        addPropertyMaker("writing-mode", m);
2501
        addPropertyMaker("writing-mode", m);
2501
    }
2502
    }
2502
2503
2504
    private void createChangeBarProperties() {
2505
        PropertyMaker m;
2506
        
2507
        // change-bar-class
2508
        m = new StringProperty.Maker(PR_CHANGE_BAR_CLASS);
2509
        m.setInherited(false);
2510
        addPropertyMaker("change-bar-class", m);
2511
        
2512
        // change-bar-color
2513
        m  = new ColorProperty.Maker(PR_CHANGE_BAR_COLOR);
2514
        m.useGeneric(genericColor);
2515
        m.setInherited(true);
2516
        // TODO determine default color by current color profile
2517
        addPropertyMaker("change-bar-color", m);
2518
        
2519
        // change-bar-offset
2520
        m  = new LengthProperty.Maker(PR_CHANGE_BAR_OFFSET);
2521
        m.setInherited(true);
2522
        m.setDefault("6pt");
2523
        addPropertyMaker("change-bar-offset", m);      
2524
        
2525
        // change-bar-placement
2526
        m = new EnumProperty.Maker(PR_CHANGE_BAR_PLACEMENT);
2527
        m.setInherited(true);
2528
        m.setDefault("start");
2529
        m.addEnum("start", getEnumProperty(EN_START, "START"));
2530
        m.addEnum("end", getEnumProperty(EN_END, "END"));
2531
        m.addEnum("left", getEnumProperty(EN_LEFT, "LEFT"));
2532
        m.addEnum("right", getEnumProperty(EN_RIGHT, "RIGHT"));
2533
        m.addEnum("inside", getEnumProperty(EN_INSIDE, "INSIDE"));
2534
        m.addEnum("outside", getEnumProperty(EN_OUTSIDE, "OUTSIDE"));
2535
        m.addEnum("alternate", getEnumProperty(EN_ALTERNATE, "ALTERNATE"));
2536
        addPropertyMaker("change-bar-placement", m);
2537
        
2538
        // change-bar-style
2539
        m = new EnumProperty.Maker(PR_CHANGE_BAR_STYLE);
2540
        m.useGeneric(genericBorderStyle);      
2541
        m.setInherited(true); 
2542
        m.setDefault("solid");
2543
        addPropertyMaker("change-bar-style", m);
2544
        
2545
        // change-bar-width
2546
        m  = new LengthProperty.Maker(PR_CHANGE_BAR_WIDTH);
2547
        m.setInherited(true);
2548
        m.setDefault("6pt");
2549
        addPropertyMaker("change-bar-width", m);
2550
        
2551
        // change-bar-offset
2552
        m = new LengthProperty.Maker(PR_CHANGE_BAR_OFFSET);
2553
        m.setInherited(true);
2554
        m.setDefault("6pt");
2555
        addPropertyMaker("change-bar-offset", m);
2556
    }
2557
    
2503
    private void createMiscProperties() {
2558
    private void createMiscProperties() {
2504
        PropertyMaker m;
2559
        PropertyMaker m;
2505
2560
(-)src/java/org/apache/fop/fo/FOTreeBuilder.java (-1 / +3 lines)
Lines 264-270 Link Here
264
            } else { // check that incoming node is valid for currentFObj
264
            } else { // check that incoming node is valid for currentFObj
265
                if (currentFObj.getNamespaceURI().equals(FOElementMapping.URI)
265
                if (currentFObj.getNamespaceURI().equals(FOElementMapping.URI)
266
                    || currentFObj.getNamespaceURI().equals(ExtensionElementMapping.URI)) {
266
                    || currentFObj.getNamespaceURI().equals(ExtensionElementMapping.URI)) {
267
                    currentFObj.validateChildNode(locator, namespaceURI, localName);
267
                    if (!currentFObj.isChangeBarElement(namespaceURI, localName)) {
268
                        currentFObj.validateChildNode(locator, namespaceURI, localName);
269
                    }
268
                }
270
                }
269
            }
271
            }
270
272
(-)src/java/org/apache/fop/area/BodyRegion.java (-4 / +9 lines)
Lines 36-41 Link Here
36
    private int columnGap;
36
    private int columnGap;
37
    private int columnCount;
37
    private int columnCount;
38
38
39
    
39
    /**
40
    /**
40
     * Constructor which can read traits directly
41
     * Constructor which can read traits directly
41
     * from an fo:region-body formatting object.
42
     * from an fo:region-body formatting object.
Lines 43-49 Link Here
43
     * @param parent the parent region viewport
44
     * @param parent the parent region viewport
44
     */
45
     */
45
    public BodyRegion(RegionBody rb, RegionViewport parent) {
46
    public BodyRegion(RegionBody rb, RegionViewport parent) {
46
        this(rb.getNameId(), rb.getRegionName(), parent, rb.getColumnCount(), rb.getColumnGap());
47
        this(rb.getNameId(), rb.getRegionName(), parent, rb.getColumnCount(), rb.getColumnGap(),
48
                rb.getWritingMode(), rb.getReferenceOrientation());
47
    }
49
    }
48
50
49
    /**
51
    /**
Lines 54-63 Link Here
54
     * @param parent the parent region viewport
56
     * @param parent the parent region viewport
55
     * @param columnCount the number of columns
57
     * @param columnCount the number of columns
56
     * @param columnGap the gap between columns
58
     * @param columnGap the gap between columns
59
     * @param wrMode writing Mode
60
     * @param refOrient reference orientation
57
     */
61
     */
58
    public BodyRegion(int regionClass, String regionName, RegionViewport parent,
62
    public BodyRegion(int regionClass, String regionName, RegionViewport parent,
59
            int columnCount, int columnGap) {
63
            int columnCount, int columnGap, int wrMode, int refOrient) {
60
        super(regionClass, regionName, parent);
64
        super(regionClass, regionName, parent, wrMode, refOrient);
65
        
61
        this.columnCount = columnCount;
66
        this.columnCount = columnCount;
62
        this.columnGap = columnGap;
67
        this.columnGap = columnGap;
63
        mainReference = new MainReference(this);
68
        mainReference = new MainReference(this);
Lines 143-149 Link Here
143
     */
148
     */
144
    public Object clone() {
149
    public Object clone() {
145
        BodyRegion br = new BodyRegion(getRegionClass(), getRegionName(), regionViewport,
150
        BodyRegion br = new BodyRegion(getRegionClass(), getRegionName(), regionViewport,
146
                getColumnCount(), getColumnGap());
151
                getColumnCount(), getColumnGap(), getWritingMode(), getReferenceOrientation());
147
        br.setCTM(getCTM());
152
        br.setCTM(getCTM());
148
        br.setIPD(getIPD());
153
        br.setIPD(getIPD());
149
        br.beforeFloat = beforeFloat;
154
        br.beforeFloat = beforeFloat;
(-)src/java/org/apache/fop/area/MainReference.java (+4 lines)
Lines 125-129 Link Here
125
        return parent.getColumnGap();
125
        return parent.getColumnGap();
126
    }
126
    }
127
127
128
    /** @return parent area of area */
129
    public BodyRegion getParent() {
130
        return parent;
131
    }
128
}
132
}
129
133
(-)src/java/org/apache/fop/area/AreaTreeParser.java (-2 / +5 lines)
Lines 571-579 Link Here
571
                String regionName = attributes.getValue("name");
571
                String regionName = attributes.getValue("name");
572
                int columnCount = XMLUtil.getAttributeAsInt(attributes, "columnCount", 1);
572
                int columnCount = XMLUtil.getAttributeAsInt(attributes, "columnCount", 1);
573
                int columnGap = XMLUtil.getAttributeAsInt(attributes, "columnGap", 0);
573
                int columnGap = XMLUtil.getAttributeAsInt(attributes, "columnGap", 0);
574
                int wrMode = XMLUtil.getAttributeAsInt(attributes, "writingMode", Constants.EN_LR_TB);
575
                int refOrient = XMLUtil.getAttributeAsInt(attributes, "referenceOrientation", 0);
574
                RegionViewport rv = getCurrentRegionViewport();
576
                RegionViewport rv = getCurrentRegionViewport();
575
                body = new BodyRegion(Constants.FO_REGION_BODY,
577
                body = new BodyRegion(Constants.FO_REGION_BODY,
576
                        regionName, rv, columnCount, columnGap);
578
                        regionName, rv, columnCount, columnGap, wrMode, refOrient);
577
                transferForeignObjects(attributes, body);
579
                transferForeignObjects(attributes, body);
578
                body.setCTM(getAttributeAsCTM(attributes, "ctm"));
580
                body.setCTM(getAttributeAsCTM(attributes, "ctm"));
579
                setAreaAttributes(attributes, body);
581
                setAreaAttributes(attributes, body);
Lines 1019-1025 Link Here
1019
            String regionName = attributes.getValue("name");
1021
            String regionName = attributes.getValue("name");
1020
            RegionViewport rv = getCurrentRegionViewport();
1022
            RegionViewport rv = getCurrentRegionViewport();
1021
            RegionReference reg = new RegionReference(side,
1023
            RegionReference reg = new RegionReference(side,
1022
                    regionName, rv);
1024
                    regionName, rv, XMLUtil.getAttributeAsInt(attributes, "writingMode", Constants.EN_LR_TB),
1025
                    XMLUtil.getAttributeAsInt(attributes, "referenceOrientation", 0));
1023
            transferForeignObjects(attributes, reg);
1026
            transferForeignObjects(attributes, reg);
1024
            reg.setCTM(getAttributeAsCTM(attributes, "ctm"));
1027
            reg.setCTM(getAttributeAsCTM(attributes, "ctm"));
1025
            setAreaAttributes(attributes, reg);
1028
            setAreaAttributes(attributes, reg);
(-)src/java/org/apache/fop/area/inline/TextArea.java (+4 lines)
Lines 67-72 Link Here
67
     */
67
     */
68
    public void addWord(String word, int offset, int[] letterAdjust) {
68
    public void addWord(String word, int offset, int[] letterAdjust) {
69
        WordArea wordArea = new WordArea(word, offset, letterAdjust);
69
        WordArea wordArea = new WordArea(word, offset, letterAdjust);
70
        wordArea.setChangeBars(getChangeBars());
71
        
70
        addChildArea(wordArea);
72
        addChildArea(wordArea);
71
        wordArea.setParentArea(this);
73
        wordArea.setParentArea(this);
72
    }
74
    }
Lines 80-85 Link Here
80
     */
82
     */
81
    public void addSpace(char space, int offset, boolean adjustable) {
83
    public void addSpace(char space, int offset, boolean adjustable) {
82
        SpaceArea spaceArea = new SpaceArea(space, offset, adjustable);
84
        SpaceArea spaceArea = new SpaceArea(space, offset, adjustable);
85
       spaceArea.setChangeBars(getChangeBars());
86
       
83
        addChildArea(spaceArea);
87
        addChildArea(spaceArea);
84
        spaceArea.setParentArea(this);
88
        spaceArea.setParentArea(this);
85
    }
89
    }
(-)src/java/org/apache/fop/area/RegionReference.java (-4 / +27 lines)
Lines 22-27 Link Here
22
import java.util.ArrayList;
22
import java.util.ArrayList;
23
import java.util.List;
23
import java.util.List;
24
24
25
import org.apache.fop.datatypes.Numeric;
26
import org.apache.fop.fo.Constants;
25
import org.apache.fop.fo.pagination.Region;
27
import org.apache.fop.fo.pagination.Region;
26
28
27
/**
29
/**
Lines 36-43 Link Here
36
    private int regionClass;
38
    private int regionClass;
37
    private String regionName;
39
    private String regionName;
38
    private CTM ctm;
40
    private CTM ctm;
41
    private int writingMode;
42
    private int referenceOrientation;
39
43
40
41
    // the list of block areas from the static flow
44
    // the list of block areas from the static flow
42
    private ArrayList blocks = new ArrayList();
45
    private ArrayList blocks = new ArrayList();
43
46
Lines 51-57 Link Here
51
     * @param parent the viewport for this region.
54
     * @param parent the viewport for this region.
52
     */
55
     */
53
    public RegionReference(Region regionFO, RegionViewport parent) {
56
    public RegionReference(Region regionFO, RegionViewport parent) {
54
        this(regionFO.getNameId(), regionFO.getRegionName(), parent);
57
        this(regionFO.getNameId(), regionFO.getRegionName(), parent,
58
                Constants.EN_LR_TB, 0);
55
    }
59
    }
56
60
57
    /**
61
    /**
Lines 60-69 Link Here
60
     * @param regionClass the region class (as returned by Region.getNameId())
64
     * @param regionClass the region class (as returned by Region.getNameId())
61
     * @param regionName the name of the region (as returned by Region.getRegionName())
65
     * @param regionName the name of the region (as returned by Region.getRegionName())
62
     * @param parent the viewport for this region.
66
     * @param parent the viewport for this region.
67
     * @param wrMode writing mode
68
     * @param refOrient reference orientation
63
     */
69
     */
64
    public RegionReference(int regionClass, String regionName, RegionViewport parent) {
70
    public RegionReference(int regionClass, String regionName, RegionViewport parent,
71
            int wrMode, int refOrient) {
65
        this.regionClass = regionClass;
72
        this.regionClass = regionClass;
66
        this.regionName = regionName;
73
        this.regionName = regionName;
74
        this.writingMode = wrMode;
75
        this.referenceOrientation = refOrient;
76
        
67
        addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
77
        addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
68
        regionViewport = parent;
78
        regionViewport = parent;
69
    }
79
    }
Lines 141-147 Link Here
141
     * @return a copy of this region reference area
151
     * @return a copy of this region reference area
142
     */
152
     */
143
    public Object clone() {
153
    public Object clone() {
144
        RegionReference rr = new RegionReference(regionClass, regionName, regionViewport);
154
        RegionReference rr = new RegionReference(regionClass, regionName,
155
                                   regionViewport, writingMode, referenceOrientation);
145
        rr.ctm = ctm;
156
        rr.ctm = ctm;
146
        rr.setIPD(getIPD());
157
        rr.setIPD(getIPD());
147
        rr.blocks = (ArrayList)blocks.clone();
158
        rr.blocks = (ArrayList)blocks.clone();
Lines 157-160 Link Here
157
        sb.append("}");
168
        sb.append("}");
158
        return sb.toString();
169
        return sb.toString();
159
    }
170
    }
171
    
172
    
173
    /** @return writing mode of region reference area */
174
    public int getWritingMode() {
175
        return writingMode;
176
    }
177
    
178
    /** @return reference orientation of region reference area */
179
    public int getReferenceOrientation() {
180
        return referenceOrientation;
181
    }
182
    
160
}
183
}
(-)src/java/org/apache/fop/area/Area.java (-1 / +22 lines)
Lines 21-26 Link Here
21
21
22
import java.io.Serializable;
22
import java.io.Serializable;
23
import java.util.Map;
23
import java.util.Map;
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 136-143 Link Here
136
     */
137
     */
137
    protected static Log log = LogFactory.getLog(Area.class);
138
    protected static Log log = LogFactory.getLog(Area.class);
138
139
139
140
    /**
140
    /**
141
     * The vector of change bars this area is affected by
142
     */
143
    private Vector/*<ChangeBar>*/ changeBars = null;
144
    
145
    /**
146
     * Return the vector of change bars this area is affected by
147
     * @return Vector of change bars or null
148
     */
149
    public Vector/*<ChangeBar>*/ getChangeBars() {
150
        return changeBars;
151
    }
152
    
153
    /**
154
     * Set set of change bars affecting this area
155
     * @param cbs The vector of change bars affecting the area
156
     */
157
    public void setChangeBars(Vector/*<ChangeBar>*/ cbs) {
158
        changeBars = cbs;
159
    }
160
    
161
    /**
141
     * Get the area class of this area.
162
     * Get the area class of this area.
142
     *
163
     *
143
     * @return the area class
164
     * @return the area class

Return to bug 48548