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

(-)src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java (-1 / +6 lines)
Lines 617-629 Link Here
617
        // save position and offset
617
        // save position and offset
618
        int saveIP = currentIPPosition;
618
        int saveIP = currentIPPosition;
619
        int saveBP = currentBPPosition;
619
        int saveBP = currentBPPosition;
620
620
        int saveBO = getBeginOffset();
621
        
621
        //Establish a new coordinate system
622
        //Establish a new coordinate system
622
        AffineTransform at = new AffineTransform();
623
        AffineTransform at = new AffineTransform();
623
        at.translate(currentIPPosition, currentBPPosition);
624
        at.translate(currentIPPosition, currentBPPosition);
624
        at.translate(block.getXOffset(), block.getYOffset());
625
        at.translate(block.getXOffset(), block.getYOffset());
625
        at.translate(0, block.getSpaceBefore());
626
        at.translate(0, block.getSpaceBefore());
626
627
628
        setBeginOffset(saveBO - block.getXOffset());
629
        
627
        if (!at.isIdentity()) {
630
        if (!at.isIdentity()) {
628
            establishTransformationMatrix(at);
631
            establishTransformationMatrix(at);
629
        }
632
        }
Lines 641-646 Link Here
641
            restoreGraphicsState();
644
            restoreGraphicsState();
642
        }
645
        }
643
646
647
        setBeginOffset(saveBO);
648
        
644
        // stacked and relative blocks effect stacking
649
        // stacked and relative blocks effect stacking
645
        currentIPPosition = saveIP;
650
        currentIPPosition = saveIP;
646
        currentBPPosition = saveBP;
651
        currentBPPosition = saveBP;
(-)src/java/org/apache/fop/render/AbstractRenderer.java (+281 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.Viewport;
69
import org.apache.fop.area.inline.Viewport;
69
import org.apache.fop.area.inline.WordArea;
70
import org.apache.fop.area.inline.WordArea;
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
     * The IP begin offset of coordinate 0
156
     */
157
    private int beginOffset  = 0;
158
    
111
    /** the currently active PageViewport */
159
    /** the currently active PageViewport */
112
    protected PageViewport currentPageViewport;
160
    protected PageViewport currentPageViewport;
113
161
Lines 406-415 Link Here
406
        int saveSpanBPPos = saveBPPos;
454
        int saveSpanBPPos = saveBPPos;
407
        for (int count = 0; count < spans.size(); count++) {
455
        for (int count = 0; count < spans.size(); count++) {
408
            span = (Span) spans.get(count);
456
            span = (Span) spans.get(count);
457
            columnCount = span.getColumnCount();
458
            
409
            for (int c = 0; c < span.getColumnCount(); c++) {
459
            for (int c = 0; c < span.getColumnCount(); c++) {
460
                columnNumber = c;
461
                
410
                NormalFlow flow = span.getNormalFlow(c);
462
                NormalFlow flow = span.getNormalFlow(c);
411
463
464
                int writingMode = mr.getParent().getWritingMode();
465
                int referenceOrientation = mr.getParent().getReferenceOrientation();
466
                
467
                
468
412
                if (flow != null) {
469
                if (flow != null) {
470
                    columnStartIPPosition = currentIPPosition;
471
                    columnEndIPPosition = currentIPPosition + flow.getIPD() + mr.getColumnGap();
472
                    
473
                    // if direction is right to left, then end is left, else end is right edge
474
                    // if orientation is portrait, then binding edge is on left edge for odd pages
475
                    // and on right edge for even pages
476
                    int pageIndex = currentPageViewport.getPageIndex();
477
                    CTM trans = currentPageViewport.getBodyRegion().getCTM();
478
                    
479
                    bindingOnStartEdge = false;
480
                    bindingOnEndEdge = false;
481
                    
482
                    if (writingMode == Constants.EN_RL_TB) {
483
                        columnLeftIPPosition = columnEndIPPosition;
484
                        columnRightIPPosition = columnStartIPPosition;
485
                        if (0 == referenceOrientation) {
486
                            if (pageIndex % 2 == 0 ) {
487
                                bindingOnEndEdge = true;
488
                            }
489
                            else {
490
                                bindingOnStartEdge = true;
491
                            }
492
                        }
493
                    }
494
                    else {
495
                        columnLeftIPPosition = columnStartIPPosition;
496
                        columnRightIPPosition = columnEndIPPosition;
497
                        if (0 == referenceOrientation) {
498
                            if (pageIndex % 2 == 0 ) {
499
                                bindingOnStartEdge = true;
500
                            }
501
                            else {
502
                                bindingOnEndEdge = true;
503
                            }
504
                        }
505
                    }
506
                    
507
508
 
509
                    
510
                    
413
                    currentBPPosition = saveSpanBPPos;
511
                    currentBPPosition = saveSpanBPPos;
414
                    renderFlow(flow);
512
                    renderFlow(flow);
415
                    currentIPPosition += flow.getIPD();
513
                    currentIPPosition += flow.getIPD();
Lines 558-563 Link Here
558
     * @param block  The block area
656
     * @param block  The block area
559
     */
657
     */
560
    protected void renderBlock(Block block) {
658
    protected void renderBlock(Block block) {
659
        Vector changeBars = block.getChangeBars();
660
        
661
        if (null != changeBars && !changeBars.isEmpty()) {
662
            // this block has change bars attached to it
663
            int saveIP = currentIPPosition;
664
            int saveBP = currentBPPosition;
665
            
666
            drawChangeBars(block, changeBars);
667
            
668
            currentIPPosition = saveIP;
669
            currentBPPosition = saveBP;
670
        }
671
        
561
        List children = block.getChildAreas();
672
        List children = block.getChildAreas();
562
        if (block instanceof BlockViewport) {
673
        if (block instanceof BlockViewport) {
563
            if (children != null) {
674
            if (children != null) {
Lines 619-624 Link Here
619
     * @param inlineArea inline area text to render
730
     * @param inlineArea inline area text to render
620
     */
731
     */
621
    protected void renderInlineArea(InlineArea inlineArea) {
732
    protected void renderInlineArea(InlineArea inlineArea) {
733
        Vector changeBars = inlineArea.getChangeBars();
734
        
735
        if (null != changeBars && !changeBars.isEmpty()) {
736
            // area has change bar, handle
737
            drawChangeBars(inlineArea, changeBars);
738
        }
739
        
622
        if (inlineArea instanceof TextArea) {
740
        if (inlineArea instanceof TextArea) {
623
            renderText((TextArea) inlineArea);
741
            renderText((TextArea) inlineArea);
624
        //} else if (inlineArea instanceof Character) {
742
        //} else if (inlineArea instanceof Character) {
Lines 674-679 Link Here
674
     * @param text the text to render
792
     * @param text the text to render
675
     */
793
     */
676
    protected void renderText(TextArea text) {
794
    protected void renderText(TextArea text) {
795
      Vector changeBars = text.getChangeBars();
796
        
797
        if (null != changeBars && !changeBars.isEmpty()) {
798
            // this block has change bars attached to it
799
            int saveIP = currentIPPosition;
800
            int saveBP = currentBPPosition;
801
            
802
            drawChangeBars(text, changeBars);
803
            
804
            currentIPPosition = saveIP;
805
            currentBPPosition = saveBP;
806
        }
807
        
677
        int saveIP = currentIPPosition;
808
        int saveIP = currentIPPosition;
678
        int saveBP = currentBPPosition;
809
        int saveBP = currentBPPosition;
679
        Iterator iter = text.getChildAreas().iterator();
810
        Iterator iter = text.getChildAreas().iterator();
Lines 761-766 Link Here
761
     * (todo) Make renderImage() protected
892
     * (todo) Make renderImage() protected
762
     */
893
     */
763
    public void renderImage(Image image, Rectangle2D pos) {
894
    public void renderImage(Image image, Rectangle2D pos) {
895
        // handle change bars
896
        Vector changeBars = image.getChangeBars();
897
        
898
        if (null != changeBars && !changeBars.isEmpty()) {
899
            drawChangeBars(image, changeBars);
900
        }
764
        // Default: do nothing.
901
        // Default: do nothing.
765
        // Some renderers (ex. Text) don't support images.
902
        // Some renderers (ex. Text) don't support images.
766
    }
903
    }
Lines 787-792 Link Here
787
     * (todo) Make renderForeignObject() protected
924
     * (todo) Make renderForeignObject() protected
788
     */
925
     */
789
    protected void renderForeignObject(ForeignObject fo, Rectangle2D pos) {
926
    protected void renderForeignObject(ForeignObject fo, Rectangle2D pos) {
927
        // handle change bars
928
        Vector changeBars = fo.getChangeBars();
929
        
930
        if (null != changeBars && !changeBars.isEmpty()) {
931
            drawChangeBars(fo, changeBars);
932
        }
933
        
790
        // Default: do nothing.
934
        // Default: do nothing.
791
        // Some renderers (ex. Text) don't support foreign objects.
935
        // Some renderers (ex. Text) don't support foreign objects.
792
    }
936
    }
Lines 859-862 Link Here
859
        matrix[5] = Math.round(matrix[5] * 1000);
1003
        matrix[5] = Math.round(matrix[5] * 1000);
860
        return new AffineTransform(matrix);
1004
        return new AffineTransform(matrix);
861
    }
1005
    }
1006
    
1007
    /**
1008
     * Draw all change bars associated with an area
1009
     * 
1010
     * @param block  The area to draw change bars for
1011
     * @param changeBars The list of change bars affecting the area
1012
     */
1013
    private void drawChangeBars(Area block, Vector changeBars) {
1014
        Block cbArea;
1015
        
1016
        int saveIP = currentIPPosition;
1017
        int saveBP = currentBPPosition;
1018
        
1019
        for (int idx = 0; idx < changeBars.size(); idx++) {
1020
            ChangeBar bar = (ChangeBar)changeBars.get(idx);
1021
            cbArea = new Block();
1022
1023
            currentIPPosition = 0;
1024
            currentBPPosition = saveBP;
1025
            
1026
            // offset by default is negative width for change bars placed on the start edge
1027
            // this will be overriden if placement is at the end edge
1028
            // xScale is for adding or subtracting the offset of the change bar depending on
1029
            //  placing the bar towards or away from the edge it is bound to
1030
            int xOffset = -bar.getWidth().getValue();
1031
            int xScale = 1;
1032
            
1033
            // determine currentIPPosition based on placement
1034
            switch (bar.getPlacement()) {
1035
            case EN_START:
1036
                xOffset += columnStartIPPosition;
1037
                xScale = -1;
1038
                break;
1039
            case EN_END:
1040
                xOffset = columnEndIPPosition;
1041
                break;
1042
            case EN_LEFT:
1043
                xOffset += columnLeftIPPosition;
1044
                xScale = -1;
1045
                break;
1046
            case EN_RIGHT:
1047
                xOffset = columnRightIPPosition;
1048
                break;
1049
            case EN_INSIDE:
1050
                if (bindingOnStartEdge) {
1051
                    xOffset += columnStartIPPosition;
1052
                    xScale = -1;
1053
                }
1054
                else if (bindingOnEndEdge) {
1055
                    xOffset = columnEndIPPosition;
1056
                }
1057
                else {
1058
                    xOffset += columnStartIPPosition;
1059
                    xScale = -1;
1060
                }
1061
                break;
1062
            case EN_OUTSIDE:
1063
                if (bindingOnStartEdge) {
1064
                    xOffset = columnEndIPPosition;
1065
                }
1066
                else if (bindingOnEndEdge) {
1067
                    xOffset += columnStartIPPosition;
1068
                    xScale = -1;
1069
                }
1070
                else {
1071
                    xOffset += columnStartIPPosition;
1072
                    xScale = -1;
1073
                }               
1074
                break;
1075
            case EN_ALTERNATE:
1076
                if (2 == columnCount) {
1077
                    if ( 0 == columnNumber) {
1078
                        xOffset += columnStartIPPosition;
1079
                        xScale = -1;
1080
                    }
1081
                    else {
1082
                        xOffset = columnEndIPPosition;
1083
                    }
1084
                }
1085
                else {
1086
                    if (bindingOnStartEdge) {
1087
                        xOffset = columnEndIPPosition;
1088
                    }
1089
                    else if (bindingOnEndEdge) {
1090
                        xOffset += columnStartIPPosition;
1091
                        xScale = -1;
1092
                    }
1093
                    else {
1094
                        xOffset = columnStartIPPosition;
1095
                        xScale = -1;
1096
                    }   
1097
                }
1098
                break;
1099
            default:
1100
                break;
1101
            }
1102
1103
            xOffset += getBeginOffset();
1104
            
1105
            // Change bar area has 0 ipd, class xsl-absolute, no margin or padding
1106
            cbArea.setAreaClass(Area.CLASS_ABSOLUTE);
1107
            cbArea.setIPD(0);
1108
            cbArea.setPositioning(Block.ABSOLUTE);
1109
            cbArea.setBPD(block.getBPD());
1110
            BorderProps props = new BorderProps(bar.getStyle(), bar.getWidth().getValue(),
1111
                    bar.getColor(), BorderProps.SEPARATE);
1112
1113
            cbArea.addTrait(Trait.BORDER_END, props);
1114
 
1115
            cbArea.setXOffset(xOffset + xScale * bar.getOffset().getValue());
1116
            cbArea.setYOffset(block.getSpaceBefore());
1117
1118
            renderBlock(cbArea);
1119
1120
            // restore position on page
1121
            currentIPPosition = saveIP;
1122
            currentBPPosition = saveBP;
1123
                       
1124
        }
1125
    }
1126
    
1127
    /**
1128
     * return the begin offset of the inline begin (changes by reference area transforms)
1129
     * @return the offset from current coordinate system 0 that the IP begin is at
1130
     */
1131
    protected int getBeginOffset() {
1132
        return beginOffset;
1133
    }
1134
    
1135
    /**
1136
     * Set the begin offset for inline progression begin (changes by reference area tranforms)
1137
     * @param offset the new offset from IPP 0 that true IP start is at
1138
     */
1139
    protected void setBeginOffset(int offset) {
1140
        beginOffset = offset;
1141
    }
1142
    
862
}
1143
}
(-)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 140-145 Link Here
140
        registerMaker(TableHeader.class, new Maker());
142
        registerMaker(TableHeader.class, new Maker());
141
        registerMaker(Wrapper.class, new WrapperLayoutManagerMaker());
143
        registerMaker(Wrapper.class, new WrapperLayoutManagerMaker());
142
        registerMaker(Title.class, new InlineLayoutManagerMaker());
144
        registerMaker(Title.class, new InlineLayoutManagerMaker());
145
        registerMaker(ChangeBarBegin.class, new Maker());
146
        registerMaker(ChangeBarEnd.class, new Maker());
143
    }
147
    }
144
148
145
    /**
149
    /**
(-)src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java (+1 lines)
Lines 86-91 Link Here
86
        // get breaks then add areas to title
86
        // get breaks then add areas to title
87
        this.parentLM = pslm;
87
        this.parentLM = pslm;
88
        holder = new LineArea();
88
        holder = new LineArea();
89
        holder.setChangeBars(getChangeBars());
89
90
90
        //        setUserAgent(foTitle.getUserAgent());
91
        //        setUserAgent(foTitle.getUserAgent());
91
92
(-)src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java (+2 lines)
Lines 205-213 Link Here
205
        InlineArea area;
205
        InlineArea area;
206
        if (hasInlineParent) {
206
        if (hasInlineParent) {
207
            area = new InlineParent();
207
            area = new InlineParent();
208
            area.setChangeBars(getChangeBars());
208
            area.setOffset(0);
209
            area.setOffset(0);
209
        } else {
210
        } else {
210
            area = new InlineBlockParent();
211
            area = new InlineBlockParent();
212
            area.setChangeBars(getChangeBars());
211
        }
213
        }
212
        if (fobj instanceof Inline) {
214
        if (fobj instanceof Inline) {
213
            TraitSetter.setProducerID(area, getInlineFO().getId());
215
            TraitSetter.setProducerID(area, getInlineFO().getId());
(-)src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java (-2 / +4 lines)
Lines 42-49 Link Here
42
42
43
    /** {@inheritDoc} */
43
    /** {@inheritDoc} */
44
    protected Area getChildArea() {
44
    protected Area getChildArea() {
45
        return new Image(((ExternalGraphic) fobj).getSrc());
45
        Image im = new Image(((ExternalGraphic) fobj).getSrc());
46
    }
46
        im.setChangeBars(getChangeBars());
47
        return im;
48
     }
47
49
48
}
50
}
49
51
(-)src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java (+2 lines)
Lines 69-74 Link Here
69
            int width = getStringWidth(str);
69
            int width = getStringWidth(str);
70
            text.setIPD(width);
70
            text.setIPD(width);
71
        }
71
        }
72
73
        text.setChangeBars(getChangeBars());
72
        updateTextAreaTraits(text);
74
        updateTextAreaTraits(text);
73
75
74
        return text;
76
        return text;
(-)src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java (+2 lines)
Lines 68-77 Link Here
68
            if (parentLayoutManager instanceof BlockStackingLayoutManager
68
            if (parentLayoutManager instanceof BlockStackingLayoutManager
69
                    && !(parentLayoutManager instanceof BlockLayoutManager)) {
69
                    && !(parentLayoutManager instanceof BlockLayoutManager)) {
70
                Block helperBlock = new Block();
70
                Block helperBlock = new Block();
71
                helperBlock.setChangeBars(getChangeBars());
71
                TraitSetter.setProducerID(helperBlock, fobj.getId());
72
                TraitSetter.setProducerID(helperBlock, fobj.getId());
72
                parentLayoutManager.addChildArea(helperBlock);
73
                parentLayoutManager.addChildArea(helperBlock);
73
            } else {
74
            } else {
74
                InlineArea area = getEffectiveArea();
75
                InlineArea area = getEffectiveArea();
76
                area.setChangeBars(getChangeBars());
75
                parentLayoutManager.addChildArea(area);
77
                parentLayoutManager.addChildArea(area);
76
            }
78
            }
77
        }
79
        }
(-)src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java (-1 / +3 lines)
Lines 46-52 Link Here
46
        org.w3c.dom.Document doc = child.getDOMDocument();
46
        org.w3c.dom.Document doc = child.getDOMDocument();
47
        String ns = child.getNamespaceURI();
47
        String ns = child.getNamespaceURI();
48
48
49
        return new ForeignObject(doc, ns);
49
        ForeignObject obj = new ForeignObject(doc, ns);
50
        obj.setChangeBars(getChangeBars());
51
        return obj;
50
    }
52
    }
51
53
52
}
54
}
(-)src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java (-1 / +14 lines)
Lines 23-28 Link Here
23
import java.util.LinkedList;
23
import java.util.LinkedList;
24
import java.util.List;
24
import java.util.List;
25
import java.util.ListIterator;
25
import java.util.ListIterator;
26
import java.util.Vector;
26
27
27
import org.apache.commons.logging.Log;
28
import org.apache.commons.logging.Log;
28
import org.apache.commons.logging.LogFactory;
29
import org.apache.commons.logging.LogFactory;
Lines 363-369 Link Here
363
364
364
        TextArea textArea = new TextAreaBuilder(realWidth, totalAdjust, context, firstAreaInfoIndex,
365
        TextArea textArea = new TextAreaBuilder(realWidth, totalAdjust, context, firstAreaInfoIndex,
365
                lastAreaInfoIndex, context.isLastArea(), areaInfo.font).build();
366
                lastAreaInfoIndex, context.isLastArea(), areaInfo.font).build();
366
367
        textArea.setChangeBars(getChangeBars());
368
        
367
        // wordSpaceDim is computed in relation to wordSpaceIPD.opt
369
        // wordSpaceDim is computed in relation to wordSpaceIPD.opt
368
        // but the renderer needs to know the adjustment in relation
370
        // but the renderer needs to know the adjustment in relation
369
        // to the size of the space character in the current font;
371
        // to the size of the space character in the current font;
Lines 455-460 Link Here
455
                textArea = new TextArea(width.getStretch(), width.getShrink(),
457
                textArea = new TextArea(width.getStretch(), width.getShrink(),
456
                        adjust);
458
                        adjust);
457
            }
459
            }
460
            
461
            textArea.setChangeBars(getChangeBars());
458
        }
462
        }
459
463
460
        private void setInlineProgressionDimension() {
464
        private void setInlineProgressionDimension() {
Lines 1341-1344 Link Here
1341
1345
1342
    }
1346
    }
1343
1347
1348
    @Override
1349
    public Vector/*<ChangeBar>*/ getChangeBars() {
1350
       if (null == foText) {
1351
               return null;
1352
       }
1353
       else {
1354
               return foText.getChangeBars();
1355
       }
1356
    }
1344
}
1357
}
(-)src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java (+4 lines)
Lines 77-82 Link Here
77
    public InlineArea get(LayoutContext context) {
77
    public InlineArea get(LayoutContext context) {
78
        // get page string from parent, build area
78
        // get page string from parent, build area
79
        TextArea text = new TextArea();
79
        TextArea text = new TextArea();
80
        text.setChangeBars(getChangeBars());
81
        
80
        String str = getCurrentPV().getPageNumberString();
82
        String str = getCurrentPV().getPageNumberString();
81
        int width = getStringWidth(str);
83
        int width = getStringWidth(str);
82
        text.addWord(str, 0);
84
        text.addWord(str, 0);
Lines 98-103 Link Here
98
        //TODO or even better: delay area creation until addAreas() stage
100
        //TODO or even better: delay area creation until addAreas() stage
99
        //TextArea is cloned because the LM is reused in static areas and the area can't be.
101
        //TextArea is cloned because the LM is reused in static areas and the area can't be.
100
        TextArea ta = new TextArea();
102
        TextArea ta = new TextArea();
103
        ta.setChangeBars(getChangeBars());
104
        
101
        TraitSetter.setProducerID(ta, fobj.getId());
105
        TraitSetter.setProducerID(ta, fobj.getId());
102
        ta.setIPD(baseArea.getIPD());
106
        ta.setIPD(baseArea.getIPD());
103
        ta.setBPD(baseArea.getBPD());
107
        ta.setBPD(baseArea.getBPD());
(-)src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java (+4 lines)
Lines 1425-1430 Link Here
1425
        LineArea lineArea = new LineArea(
1425
        LineArea lineArea = new LineArea(
1426
                (lbp.getLeafPos() < seq.size() - 1 ? textAlignment : textAlignmentLast),
1426
                (lbp.getLeafPos() < seq.size() - 1 ? textAlignment : textAlignmentLast),
1427
                lbp.difference, lbp.availableStretch, lbp.availableShrink);
1427
                lbp.difference, lbp.availableStretch, lbp.availableShrink);
1428
        lineArea.setChangeBars(getChangeBars());
1429
        
1428
        if (lbp.startIndent != 0) {
1430
        if (lbp.startIndent != 0) {
1429
            lineArea.addTrait(Trait.START_INDENT, new Integer(lbp.startIndent));
1431
            lineArea.addTrait(Trait.START_INDENT, new Integer(lbp.startIndent));
1430
        }
1432
        }
Lines 1533-1538 Link Here
1533
        }
1535
        }
1534
1536
1535
        LineArea lineArea = new LineArea();
1537
        LineArea lineArea = new LineArea();
1538
        lineArea.setChangeBars(getChangeBars());
1539
        
1536
        setCurrentArea(lineArea);
1540
        setCurrentArea(lineArea);
1537
        LayoutContext lc = new LayoutContext(0);
1541
        LayoutContext lc = new LayoutContext(0);
1538
        lc.setAlignmentContext(alignmentContext);
1542
        lc.setAlignmentContext(alignmentContext);
(-)src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java (+2 lines)
Lines 76-81 Link Here
76
76
77
    private TextArea getCharacterInlineArea(Character node) {
77
    private TextArea getCharacterInlineArea(Character node) {
78
        TextArea text = new TextArea();
78
        TextArea text = new TextArea();
79
        text.setChangeBars(getChangeBars());
80
        
79
        char ch = node.getCharacter();
81
        char ch = node.getCharacter();
80
        if (CharUtilities.isAnySpace(ch)) {
82
        if (CharUtilities.isAnySpace(ch)) {
81
            // add space unless it's zero-width:
83
            // add space unless it's zero-width:
(-)src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java (+3 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
     }
(-)src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java (+1 lines)
Lines 179-184 Link Here
179
            if (iAdjust != 0) {
179
            if (iAdjust != 0) {
180
                //getLogger().debug("Add leading space: " + iAdjust);
180
                //getLogger().debug("Add leading space: " + iAdjust);
181
                Space ls = new Space();
181
                Space ls = new Space();
182
                ls.setChangeBars(getChangeBars());
182
                ls.setIPD(iAdjust);
183
                ls.setIPD(iAdjust);
183
                parentArea.addChildArea(ls);
184
                parentArea.addChildArea(ls);
184
            }
185
            }
(-)src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java (+4 lines)
Lines 110-115 Link Here
110
            String str = page.getPageNumberString();
110
            String str = page.getPageNumberString();
111
            // get page string from parent, build area
111
            // get page string from parent, build area
112
            text = new TextArea();
112
            text = new TextArea();
113
            text.setChangeBars(getChangeBars());
114
            
113
            int width = getStringWidth(str);
115
            int width = getStringWidth(str);
114
            text.addWord(str, 0);
116
            text.addWord(str, 0);
115
            text.setIPD(width);
117
            text.setIPD(width);
Lines 117-122 Link Here
117
        } else {
119
        } else {
118
            resolved = false;
120
            resolved = false;
119
            text = new UnresolvedPageNumber(fobj.getRefId(), font);
121
            text = new UnresolvedPageNumber(fobj.getRefId(), font);
122
            text.setChangeBars(getChangeBars());
123
            
120
            String str = "MMM"; // reserve three spaces for page number
124
            String str = "MMM"; // reserve three spaces for page number
121
            int width = getStringWidth(str);
125
            int width = getStringWidth(str);
122
            text.setIPD(width);
126
            text.setIPD(width);
(-)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/BlockContainerLayoutManager.java (+4 lines)
Lines 833-838 Link Here
833
            boolean allowBPDUpdate = autoHeight && !switchedProgressionDirection;
833
            boolean allowBPDUpdate = autoHeight && !switchedProgressionDirection;
834
834
835
            viewportBlockArea = new BlockViewport(allowBPDUpdate);
835
            viewportBlockArea = new BlockViewport(allowBPDUpdate);
836
            viewportBlockArea.setChangeBars(getChangeBars());
837
            
836
            viewportBlockArea.addTrait(Trait.IS_VIEWPORT_AREA, Boolean.TRUE);
838
            viewportBlockArea.addTrait(Trait.IS_VIEWPORT_AREA, Boolean.TRUE);
837
839
838
            viewportBlockArea.setIPD(getContentAreaIPD());
840
            viewportBlockArea.setIPD(getContentAreaIPD());
Lines 868-873 Link Here
868
            }
870
            }
869
871
870
            referenceArea = new Block();
872
            referenceArea = new Block();
873
            referenceArea.setChangeBars(getChangeBars());
874
            
871
            referenceArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
875
            referenceArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
872
            TraitSetter.setProducerID(referenceArea, getBlockContainerFO().getId());
876
            TraitSetter.setProducerID(referenceArea, getBlockContainerFO().getId());
873
877
(-)src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java (-1 / +4 lines)
Lines 177-182 Link Here
177
        Dimension imageSize = this.imageLayout.getViewportSize();
177
        Dimension imageSize = this.imageLayout.getViewportSize();
178
178
179
        Block blockArea = new Block();
179
        Block blockArea = new Block();
180
        blockArea.setChangeBars(getChangeBars());
181
        
180
        blockArea.setIPD(imageSize.width);
182
        blockArea.setIPD(imageSize.width);
181
        LineArea lineArea = new LineArea();
183
        LineArea lineArea = new LineArea();
182
184
Lines 245-251 Link Here
245
        rv.setClip(true);
247
        rv.setClip(true);
246
248
247
        BodyRegion body = new BodyRegion(Constants.FO_REGION_BODY,
249
        BodyRegion body = new BodyRegion(Constants.FO_REGION_BODY,
248
                "fop-image-region", rv, 1, 0);
250
                "fop-image-region", rv, 1, 0, pageSeq.getReferenceOrientation(),
251
                pageSeq.getReferenceOrientation());
249
        body.setIPD(imageSize.width);
252
        body.setIPD(imageSize.width);
250
        body.setBPD(imageSize.height);
253
        body.setBPD(imageSize.height);
251
        body.setCTM(pageCTM);
254
        body.setCTM(pageCTM);
(-)src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (+1 lines)
Lines 357-362 Link Here
357
    public Area getParentArea(Area childArea) {
357
    public Area getParentArea(Area childArea) {
358
        if (curBlockArea == null) {
358
        if (curBlockArea == null) {
359
            curBlockArea = new Block();
359
            curBlockArea = new Block();
360
           curBlockArea.setChangeBars(getChangeBars());
360
361
361
            curBlockArea.setIPD(super.getContentAreaIPD());
362
            curBlockArea.setIPD(super.getContentAreaIPD());
362
363
(-)src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java (+1 lines)
Lines 218-223 Link Here
218
    public Area getParentArea(Area childArea) {
218
    public Area getParentArea(Area childArea) {
219
        if (curBlockArea == null) {
219
        if (curBlockArea == null) {
220
            curBlockArea = new Block();
220
            curBlockArea = new Block();
221
            curBlockArea.setChangeBars(getChangeBars());
221
222
222
            // Set up dimensions
223
            // Set up dimensions
223
            // Must get dimensions from parent area
224
            // Must get dimensions from parent area
(-)src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java (+1 lines)
Lines 586-591 Link Here
586
    public Area getParentArea(Area childArea) {
586
    public Area getParentArea(Area childArea) {
587
        if (curBlockArea == null) {
587
        if (curBlockArea == null) {
588
            curBlockArea = new Block();
588
            curBlockArea = new Block();
589
            curBlockArea.setChangeBars(getChangeBars());
589
590
590
            // Set up dimensions
591
            // Set up dimensions
591
            /*Area parentArea =*/ parentLayoutManager.getParentArea(curBlockArea);
592
            /*Area parentArea =*/ parentLayoutManager.getParentArea(curBlockArea);
(-)src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java (+2 lines)
Lines 173-178 Link Here
173
    public Area getParentArea(Area childArea) {
173
    public Area getParentArea(Area childArea) {
174
        if (curBlockArea == null) {
174
        if (curBlockArea == null) {
175
            curBlockArea = new Block();
175
            curBlockArea = new Block();
176
            curBlockArea.setChangeBars(getChangeBars());
177
            
176
            curBlockArea.setPositioning(Block.ABSOLUTE);
178
            curBlockArea.setPositioning(Block.ABSOLUTE);
177
            // set position
179
            // set position
178
            curBlockArea.setXOffset(xoffset);
180
            curBlockArea.setXOffset(xoffset);
(-)src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java (+2 lines)
Lines 420-425 Link Here
420
    public Area getParentArea(Area childArea) {
420
    public Area getParentArea(Area childArea) {
421
        if (curBlockArea == null) {
421
        if (curBlockArea == null) {
422
            curBlockArea = new Block();
422
            curBlockArea = new Block();
423
            curBlockArea.setChangeBars(getChangeBars());
424
            
423
            // Set up dimensions
425
            // Set up dimensions
424
            // Must get dimensions from parent area
426
            // Must get dimensions from parent area
425
            /*Area parentArea =*/ parentLayoutManager.getParentArea(curBlockArea);
427
            /*Area parentArea =*/ parentLayoutManager.getParentArea(curBlockArea);
(-)src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java (+10 lines)
Lines 398-407 Link Here
398
        if (usedBPD < cellBPD) {
398
        if (usedBPD < cellBPD) {
399
            if (getTableCell().getDisplayAlign() == EN_CENTER) {
399
            if (getTableCell().getDisplayAlign() == EN_CENTER) {
400
                Block space = new Block();
400
                Block space = new Block();
401
                space.setChangeBars(getChangeBars());
402
                
401
                space.setBPD((cellBPD - usedBPD) / 2);
403
                space.setBPD((cellBPD - usedBPD) / 2);
402
                curBlockArea.addBlock(space);
404
                curBlockArea.addBlock(space);
403
            } else if (getTableCell().getDisplayAlign() == EN_AFTER) {
405
            } else if (getTableCell().getDisplayAlign() == EN_AFTER) {
404
                Block space = new Block();
406
                Block space = new Block();
407
                space.setChangeBars(getChangeBars());
408
                
405
                space.setBPD(cellBPD - usedBPD);
409
                space.setBPD(cellBPD - usedBPD);
406
                curBlockArea.addBlock(space);
410
                curBlockArea.addBlock(space);
407
            }
411
            }
Lines 456-461 Link Here
456
            boolean outer) {
460
            boolean outer) {
457
        if (blocks[i][j] == null) {
461
        if (blocks[i][j] == null) {
458
            blocks[i][j] = new Block();
462
            blocks[i][j] = new Block();
463
            blocks[i][j].setChangeBars(getChangeBars());
464
            
459
            blocks[i][j].addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
465
            blocks[i][j].addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
460
            blocks[i][j].setPositioning(Block.ABSOLUTE);
466
            blocks[i][j].setPositioning(Block.ABSOLUTE);
461
        }
467
        }
Lines 486-491 Link Here
486
        int paddingEnd = padding.getPaddingEnd(false, this);
492
        int paddingEnd = padding.getPaddingEnd(false, this);
487
493
488
        Block block = new Block();
494
        Block block = new Block();
495
        block.setChangeBars(getChangeBars());
496
        
489
        TraitSetter.setProducerID(block, getTable().getId());
497
        TraitSetter.setProducerID(block, getTable().getId());
490
        block.setPositioning(Block.ABSOLUTE);
498
        block.setPositioning(Block.ABSOLUTE);
491
        block.setIPD(cellIPD + paddingStart + paddingEnd);
499
        block.setIPD(cellIPD + paddingStart + paddingEnd);
Lines 511-516 Link Here
511
    public Area getParentArea(Area childArea) {
519
    public Area getParentArea(Area childArea) {
512
        if (curBlockArea == null) {
520
        if (curBlockArea == null) {
513
            curBlockArea = new Block();
521
            curBlockArea = new Block();
522
            curBlockArea.setChangeBars(getChangeBars());
523
            
514
            curBlockArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
524
            curBlockArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
515
            TraitSetter.setProducerID(curBlockArea, getTableCell().getId());
525
            TraitSetter.setProducerID(curBlockArea, getTableCell().getId());
516
            curBlockArea.setPositioning(Block.ABSOLUTE);
526
            curBlockArea.setPositioning(Block.ABSOLUTE);
(-)src/java/org/apache/fop/layoutmgr/table/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/BlockStackingLayoutManager.java (+2 lines)
Lines 124-129 Link Here
124
        int sp = TraitSetter.getEffectiveSpace(adjust, minoptmax);
124
        int sp = TraitSetter.getEffectiveSpace(adjust, minoptmax);
125
        if (sp != 0) {
125
        if (sp != 0) {
126
            Block spacer = new Block();
126
            Block spacer = new Block();
127
           spacer.setChangeBars(getChangeBars());
128
           
127
            spacer.setBPD(sp);
129
            spacer.setBPD(sp);
128
            parentLayoutManager.addChildArea(spacer);
130
            parentLayoutManager.addChildArea(spacer);
129
        }
131
        }
(-)src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java (+16 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
       }
269
       else {
270
               return fobj.getChangeBars();
271
       }
272
    }
273
274
275
260
    /** {@inheritDoc} */
276
    /** {@inheritDoc} */
261
    public void reset() {
277
    public void reset() {
262
        throw new UnsupportedOperationException("Not implemented");
278
        throw new UnsupportedOperationException("Not implemented");
(-)src/java/org/apache/fop/apps/FOUserAgent.java (+57 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.TreeMap;
28
import java.util.Vector;
27
29
28
import javax.xml.transform.Source;
30
import javax.xml.transform.Source;
29
import javax.xml.transform.TransformerException;
31
import javax.xml.transform.TransformerException;
Lines 47-52 Link Here
47
import org.apache.fop.events.FOPEventListenerProxy;
49
import org.apache.fop.events.FOPEventListenerProxy;
48
import org.apache.fop.events.LoggingEventListener;
50
import org.apache.fop.events.LoggingEventListener;
49
import org.apache.fop.fo.FOEventHandler;
51
import org.apache.fop.fo.FOEventHandler;
52
import org.apache.fop.fo.flow.ChangeBar;
50
import org.apache.fop.fonts.FontManager;
53
import org.apache.fop.fonts.FontManager;
51
import org.apache.fop.render.Renderer;
54
import org.apache.fop.render.Renderer;
52
import org.apache.fop.render.RendererFactory;
55
import org.apache.fop.render.RendererFactory;
Lines 83-89 Link Here
83
86
84
    private FopFactory factory;
87
    private FopFactory factory;
85
88
89
       
86
    /**
90
    /**
91
     * The change bars encountered
92
     */
93
    private static Vector stackedChangeBars = new Vector();
94
95
    
96
    /**
87
     *  The base URL for all URL resolutions, especially for
97
     *  The base URL for all URL resolutions, especially for
88
     *  external-graphics.
98
     *  external-graphics.
89
     */
99
     */
Lines 693-697 Link Here
693
    public StructureTree getStructureTree() {
703
    public StructureTree getStructureTree() {
694
        return this.structureTree;
704
        return this.structureTree;
695
    }
705
    }
706
    
707
    /**
708
     * Add another change bar to the stack of active change bars
709
     * @param bar The change bar top add
710
     */
711
    public void pushChangeBar(ChangeBar bar) {
712
        stackedChangeBars.addElement(bar);
713
    }
714
    
715
    
716
    /**
717
     * Remove top level change bar from stack
718
     */
719
    public void popChangeBar() {
720
        stackedChangeBars.removeElementAt(stackedChangeBars.size() - 1);
721
    }
722
    
723
    /**
724
     * Return top-most changebar from stack of nested change bars
725
     *
726
     * @return change bar that is the top most changebar or null
727
     */
728
    public ChangeBar topChangeBar() {
729
        if (stackedChangeBars.isEmpty()) {
730
            return null;
731
        }
732
        else {
733
            return (ChangeBar)stackedChangeBars.lastElement();
734
        }
735
    }
736
    
737
    /**
738
     * Return the list of change bars in effect currently
739
     * @return The vector of change bars in effect currently
740
     */
741
    public Vector getChangeBars() {
742
        return stackedChangeBars;
743
    }
744
    
745
746
    /**
747
     * Copy the change bars in affect currently 
748
     * @return A copy of the change bars in effect currently
749
     */
750
    public  Vector copyChangeBars() {
751
        return (Vector)(stackedChangeBars.clone());        
752
    }
696
}
753
}
697
754
(-)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 (+29 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
    /** change bars affecting this */
64
    protected Vector affectedByChangeBars = null;
65
    
66
    /** change bars at start of element */
67
    protected Vector affectedByChangeBarsStart = null;
68
    
62
    /**
69
    /**
63
     * Marks the location of this object from the input FO
70
     * Marks the location of this object from the input FO
64
     *   <br>Call <code>locator.getSystemId()</code>,
71
     *   <br>Call <code>locator.getSystemId()</code>,
Lines 170-175 Link Here
170
    }
177
    }
171
178
172
    /**
179
    /**
180
     * Convenience function to check if this element is a change bar element
181
     * @param namespaceURI  The name space of the element
182
     * @param localName  The local name of the element
183
     * @return true if a member, false if not
184
     */
185
    public boolean isChangeBarElement(String namespaceURI, String localName) {
186
        return FO_URI.equals(namespaceURI) 
187
                   && ( "change-bar-begin".equals(localName) 
188
                        || "change-bar-end".equals(localName) );
189
    }
190
    
191
    /**
173
     * Returns the user agent that is associated with the
192
     * Returns the user agent that is associated with the
174
     * tree's <code>FOEventHandler</code>.
193
     * tree's <code>FOEventHandler</code>.
175
     *
194
     *
Lines 912-915 Link Here
912
931
913
    }
932
    }
914
933
934
    /**
935
     * Return the change bars that affect this element 
936
     *
937
     * @return vector of change bars elements affecting this element 
938
     */
939
    public Vector/*<ChangeBar>*/getChangeBars() {
940
        return affectedByChangeBars;
941
    }
942
    
943
    
915
}
944
}
(-)src/java/org/apache/fop/fo/FObj.java (+43 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 153-161 Link Here
153
        if (id != null) {
155
        if (id != null) {
154
            checkId(id);
156
            checkId(id);
155
        }
157
        }
158
        // check if we are under the influence of change bars
159
        if (null != getUserAgent().topChangeBar()) {
160
            // OK, so copy over the stack of change bars
161
            affectedByChangeBarsStart = getUserAgent().copyChangeBars();
162
        }
156
    }
163
    }
157
164
158
    /**
165
    /**
166
     * {@inheritDoc}
167
     * @throws FOPException FOP Exception
168
     */
169
     protected void endOfNode() throws FOPException {
170
         // now take all change bars that are active now and were active at the start
171
         //  of node and put them into the affectedByChangeBars
172
         Vector nowChangeBars = getUserAgent().copyChangeBars();
173
     
174
 
175
         if (null != affectedByChangeBarsStart && null != nowChangeBars) {
176
                 // to save memory, we first try to match all elements to the start
177
                 if (affectedByChangeBarsStart.containsAll(nowChangeBars)
178
                       && nowChangeBars.containsAll(affectedByChangeBarsStart)) {
179
                         affectedByChangeBars = affectedByChangeBarsStart;
180
                 }
181
                 else {
182
                         affectedByChangeBars = new Vector();
183
184
                         for (int idx = 0; idx < nowChangeBars.size(); idx++) {
185
                                 if (affectedByChangeBarsStart.contains(nowChangeBars.get(idx))) {
186
                                     affectedByChangeBars.add(nowChangeBars.get(idx));
187
                                 }
188
                         }
189
    
190
                         if (0 == affectedByChangeBars.size()) {
191
                                 affectedByChangeBars = null;
192
                         }
193
                 }
194
195
                 affectedByChangeBarsStart = null;
196
         }
197
198
        super.endOfNode();
199
    }
200
201
    /**
159
     * Setup the id for this formatting object.
202
     * Setup the id for this formatting object.
160
     * Most formatting objects can have an id that can be referenced.
203
     * Most formatting objects can have an id that can be referenced.
161
     * This methods checks that the id isn't already used by another FO
204
     * This methods checks that the id isn't already used by another FO
(-)src/java/org/apache/fop/fo/flow/ChangeBar.java (+196 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 java.util.Collections;
25
import java.util.Map;
26
import java.util.Vector;
27
import java.util.TreeMap;
28
    
29
import org.xml.sax.Attributes;
30
import org.xml.sax.Locator;
31
32
import org.apache.fop.apps.FOPException;
33
import org.apache.fop.fo.FONode;
34
import org.apache.fop.fo.FOTreeBuilderContext;
35
import org.apache.fop.fo.FObj;
36
import org.apache.fop.fo.FObjMixed;
37
import org.apache.fop.fo.PropertyList;
38
import org.apache.fop.fo.PropertyListMaker;
39
import org.apache.fop.fo.ValidationException;
40
import org.apache.fop.fo.properties.Property;
41
import org.apache.fop.fo.properties.PropertyCache;
42
import org.apache.fop.datatypes.Length;
43
44
/** Common change bar base class. Handles properties and local child validation */
45
public abstract class ChangeBar extends FObj {
46
47
    
48
    /**
49
     * Construct a ChangeBar element, common parts for start and end
50
     *
51
     * @param parent the parent element, containing the change bars start/end
52
     */
53
    public ChangeBar(FONode parent) {
54
        super(parent);
55
56
        
57
    }
58
59
    
60
    /**
61
     * The class of the change bar, must be provided
62
     */
63
    protected String cbClass = null;
64
    
65
    /**
66
     * The color of the change bar
67
     */
68
    protected Color color = null;
69
    
70
    /**
71
     * The offset of the bar from the column
72
     */
73
    protected Length offset = null;
74
    
75
    /**
76
     * The placement of the bar
77
     */
78
    protected int placement = -1;
79
    
80
    /**
81
     * The style of the bar
82
     */
83
    protected int style = -1;
84
    
85
    /**
86
     * The width of the bar
87
     */
88
    protected Length width = null;
89
    
90
    
91
    /** {@inheritDoc} */
92
    public void bind(PropertyList pList) throws FOPException {
93
        super.bind(pList);
94
                    
95
        cbClass = pList.get(PR_CHANGE_BAR_CLASS).getString();
96
        color = pList.get(PR_CHANGE_BAR_COLOR).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
     * Return the class of the change bar.
105
     * @return the class of the change bar as a string
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
        if (cbClass == null || "".equals(cbClass)) {
126
            missingPropertyError("change-bar-class");
127
        }
128
        
129
        if ( -1 == findAncestor(FO_FLOW)
130
             && -1 == findAncestor(FO_STATIC_CONTENT) ) {
131
            getFOValidationEventProducer().changeBarWrongAncestor(this, getName(), locator);
132
          }
133
    }
134
    
135
 
136
    
137
    
138
    /**
139
     * Push the current change bar on the stack
140
     */
141
    protected void push() {
142
        getUserAgent().pushChangeBar(this);
143
    }
144
    
145
    /**
146
     * Remove top level change bar from stack
147
     */
148
    protected void pop() {
149
        getUserAgent().popChangeBar();
150
 
151
    }
152
    
153
    /**
154
     * Return top-most change bar from the stack of nested change bars.
155
     *
156
     * @return the topmost changebar or null
157
     */
158
    protected ChangeBar top() {
159
        return getUserAgent().topChangeBar();
160
    }
161
162
    /**
163
     * @return the color
164
     */
165
    public Color getColor() {
166
        return color;
167
    }
168
169
    /**
170
     * @return the offset
171
     */
172
    public Length getOffset() {
173
        return offset;
174
    }
175
176
    /**
177
     * @return the placement
178
     */
179
    public int getPlacement() {
180
        return placement;
181
    }
182
183
    /**
184
     * @return the style
185
     */
186
    public int getStyle() {
187
        return style;
188
    }
189
190
    /**
191
     * @return the width
192
     */
193
    public Length getWidth() {
194
        return width;
195
    }
196
}
(-)src/java/org/apache/fop/fo/flow/ChangeBarEnd.java (+87 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.util.Collections;
23
import java.util.Map;
24
25
import org.xml.sax.Attributes;
26
import org.xml.sax.Locator;
27
28
import org.apache.fop.apps.FOPException;
29
import org.apache.fop.fo.FONode;
30
import org.apache.fop.fo.FOTreeBuilderContext;
31
import org.apache.fop.fo.FObj;
32
import org.apache.fop.fo.FObjMixed;
33
import org.apache.fop.fo.PropertyList;
34
import org.apache.fop.fo.PropertyListMaker;
35
import org.apache.fop.fo.ValidationException;
36
import org.apache.fop.fo.properties.Property;
37
import org.apache.fop.fo.properties.PropertyCache;
38
39
/**
40
 * End of a change bar element. Notes the end of the affected objects of a change bar.
41
 *  */
42
public class ChangeBarEnd extends ChangeBar {
43
44
    /**
45
     * Construct a new ChangeBarEnd element
46
     * @param parent the parent of the element
47
     */
48
    public ChangeBarEnd(FONode parent) {
49
        super(parent);
50
    }
51
52
    /** {@inheritDoc} */
53
    public String getLocalName() {
54
        return "change-bar-end";
55
    }
56
57
58
    /**
59
     * {@inheritDoc}
60
     * @return {@link org.apache.fop.fo.Constants#FO_CHANGE_BAR_END}
61
     */
62
    public int getNameId() {
63
        return FO_CHANGE_BAR_END;
64
    }
65
    
66
    /** {@inheritDoc} */
67
    public void processNode(String elementName, Locator locator,
68
                            Attributes attlist, PropertyList pList) throws FOPException {
69
        super.processNode(elementName, locator, attlist, pList);
70
        
71
        // check if we have an element on the stack at all
72
        ChangeBar topElement = top();
73
        
74
        if (null == topElement) {
75
            getFOValidationEventProducer().changeBarNoBegin(this, getName(), locator);
76
        } else {
77
            if (!topElement.cbClass.equals(cbClass)) {
78
                getFOValidationEventProducer().changeBarWrongStacking(this,
79
                        getName(), topElement.cbClass, cbClass, locator);
80
            }
81
            pop();
82
        }
83
        
84
        
85
    }
86
    
87
}
(-)src/java/org/apache/fop/fo/flow/ChangeBarBegin.java (+77 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.util.Collections;
23
import java.util.Map;
24
25
import org.xml.sax.Attributes;
26
import org.xml.sax.Locator;
27
28
import org.apache.fop.apps.FOPException;
29
import org.apache.fop.fo.FONode;
30
import org.apache.fop.fo.FOTreeBuilderContext;
31
import org.apache.fop.fo.FObj;
32
import org.apache.fop.fo.FObjMixed;
33
import org.apache.fop.fo.PropertyList;
34
import org.apache.fop.fo.PropertyListMaker;
35
import org.apache.fop.fo.ValidationException;
36
import org.apache.fop.fo.properties.Property;
37
import org.apache.fop.fo.properties.PropertyCache;
38
39
/**
40
 * Change bar begin element. Notes the beginning of change bar of a certain class.
41
 * 
42
 */
43
public class ChangeBarBegin extends ChangeBar {
44
45
    
46
    /**
47
     * Construct a new ChangeBarEnd element
48
     *
49
     * @param parent the parent element of the new change bar end element
50
     */
51
    public ChangeBarBegin(FONode parent) {
52
        super(parent);
53
    }
54
55
    /** {@inheritDoc} */
56
    public String getLocalName() {
57
        return "change-bar-begin";
58
    }
59
60
61
    /**
62
     * {@inheritDoc}
63
     * @return {@link org.apache.fop.fo.Constants#FO_CHANGE_BAR_BEGIN}
64
     */
65
    public int getNameId() {
66
        return FO_CHANGE_BAR_BEGIN;
67
    }
68
    
69
    /** {@inheritDoc} */
70
    public void processNode(String elementName, Locator locator,
71
                            Attributes attlist, PropertyList pList) throws FOPException {
72
        super.processNode(elementName, locator, attlist, pList);
73
74
        push();
75
76
    }
77
}
(-)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/FOPropertyMapping.java (+57 lines)
Lines 318-323 Link Here
318
            gp.createTableProperties();
318
            gp.createTableProperties();
319
            gp.createWritingModeProperties();
319
            gp.createWritingModeProperties();
320
            gp.createMiscProperties();
320
            gp.createMiscProperties();
321
            gp.createChangeBarProperties();
321
322
322
            // Hardcode the subproperties.
323
            // Hardcode the subproperties.
323
            addSubpropMakerName("length", CP_LENGTH);
324
            addSubpropMakerName("length", CP_LENGTH);
Lines 2518-2523 Link Here
2518
        addPropertyMaker("writing-mode", m);
2519
        addPropertyMaker("writing-mode", m);
2519
    }
2520
    }
2520
2521
2522
    private void createChangeBarProperties() {
2523
        PropertyMaker m;
2524
        
2525
        // change-bar-class
2526
        m = new StringProperty.Maker(PR_CHANGE_BAR_CLASS);
2527
        m.setInherited(false);
2528
        m.setDefault("");
2529
        addPropertyMaker("change-bar-class", m);
2530
        
2531
        // change-bar-color
2532
        m  = new ColorProperty.Maker(PR_CHANGE_BAR_COLOR);
2533
        
2534
        m.setInherited(true);
2535
        // TODO: fall back to "color" property
2536
        m.setDefault("black");
2537
        addPropertyMaker("change-bar-color", m);
2538
        
2539
        // change-bar-offset
2540
        m  = new LengthProperty.Maker(PR_CHANGE_BAR_OFFSET);
2541
        m.setInherited(true);
2542
        m.setDefault("6pt");
2543
        addPropertyMaker("change-bar-offset", m);      
2544
        
2545
        // change-bar-placement
2546
        m = new EnumProperty.Maker(PR_CHANGE_BAR_PLACEMENT);
2547
        m.setInherited(true);
2548
        m.setDefault("start");
2549
        m.addEnum("start", getEnumProperty(EN_START, "START"));
2550
        m.addEnum("end", getEnumProperty(EN_END, "END"));
2551
        m.addEnum("left", getEnumProperty(EN_LEFT, "LEFT"));
2552
        m.addEnum("right", getEnumProperty(EN_RIGHT, "RIGHT"));
2553
        m.addEnum("inside", getEnumProperty(EN_INSIDE, "INSIDE"));
2554
        m.addEnum("outside", getEnumProperty(EN_OUTSIDE, "OUTSIDE"));
2555
        m.addEnum("alternate", getEnumProperty(EN_ALTERNATE, "ALTERNATE"));
2556
        addPropertyMaker("change-bar-placement", m);
2557
        
2558
        // change-bar-style
2559
        m = new EnumProperty.Maker(PR_CHANGE_BAR_STYLE);
2560
        m.useGeneric(genericBorderStyle);      
2561
        m.setInherited(true); 
2562
        m.setDefault("solid");
2563
        addPropertyMaker("change-bar-style", m);
2564
        
2565
        // change-bar-width
2566
        m  = new LengthProperty.Maker(PR_CHANGE_BAR_WIDTH);
2567
        m.setInherited(true);
2568
        m.setDefault("6pt");
2569
        addPropertyMaker("change-bar-width", m); 
2570
2571
        // change-bar-offset
2572
        m  = new LengthProperty.Maker(PR_CHANGE_BAR_OFFSET);
2573
        m.setInherited(true);
2574
        m.setDefault("6pt");
2575
        addPropertyMaker("change-bar-offset", m);      
2576
    }
2577
    
2521
    private void createMiscProperties() {
2578
    private void createMiscProperties() {
2522
        PropertyMaker m;
2579
        PropertyMaker m;
2523
2580
(-)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/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 / +8 lines)
Lines 46-52 Link Here
46
     * @param parent the parent region viewport
46
     * @param parent the parent region viewport
47
     */
47
     */
48
    public BodyRegion(RegionBody rb, RegionViewport parent) {
48
    public BodyRegion(RegionBody rb, RegionViewport parent) {
49
        this(rb.getNameId(), rb.getRegionName(), parent, rb.getColumnCount(), rb.getColumnGap());
49
        this(rb.getNameId(), rb.getRegionName(), parent, rb.getColumnCount(), rb.getColumnGap(),
50
                rb.getWritingMode(), rb.getReferenceOrientation());
50
    }
51
    }
51
52
52
    /**
53
    /**
Lines 57-66 Link Here
57
     * @param parent the parent region viewport
58
     * @param parent the parent region viewport
58
     * @param columnCount the number of columns
59
     * @param columnCount the number of columns
59
     * @param columnGap the gap between columns
60
     * @param columnGap the gap between columns
61
     * @param wrMode writing Mode
62
     * @param refOrient reference orientation
60
     */
63
     */
61
    public BodyRegion(int regionClass, String regionName, RegionViewport parent,
64
    public BodyRegion(int regionClass, String regionName, RegionViewport parent,
62
            int columnCount, int columnGap) {
65
            int columnCount, int columnGap, int wrMode, int refOrient) {
63
        super(regionClass, regionName, parent);
66
        super(regionClass, regionName, parent, wrMode, refOrient);
67
        
64
        this.columnCount = columnCount;
68
        this.columnCount = columnCount;
65
        this.columnGap = columnGap;
69
        this.columnGap = columnGap;
66
        mainReference = new MainReference(this);
70
        mainReference = new MainReference(this);
Lines 146-152 Link Here
146
     */
150
     */
147
    public Object clone() {
151
    public Object clone() {
148
        BodyRegion br = new BodyRegion(getRegionClass(), getRegionName(), regionViewport,
152
        BodyRegion br = new BodyRegion(getRegionClass(), getRegionName(), regionViewport,
149
                getColumnCount(), getColumnGap());
153
                getColumnCount(), getColumnGap(), getWritingMode(), getReferenceOrientation());
150
        br.setCTM(getCTM());
154
        br.setCTM(getCTM());
151
        br.setIPD(getIPD());
155
        br.setIPD(getIPD());
152
        br.beforeFloat = beforeFloat;
156
        br.beforeFloat = beforeFloat;
(-)src/java/org/apache/fop/area/MainReference.java (+4 lines)
Lines 124-128 Link Here
124
        return parent.getColumnGap();
124
        return parent.getColumnGap();
125
    }
125
    }
126
126
127
    /** @return the parent region of this area */
128
    public BodyRegion getParent() {
129
        return parent;
130
    }
127
}
131
}
128
132
(-)src/java/org/apache/fop/area/AreaTreeParser.java (-2 / +8 lines)
Lines 95-100 Link Here
95
import static org.apache.fop.fo.Constants.FO_REGION_BODY;
95
import static org.apache.fop.fo.Constants.FO_REGION_BODY;
96
import static org.apache.fop.fo.Constants.FO_REGION_END;
96
import static org.apache.fop.fo.Constants.FO_REGION_END;
97
import static org.apache.fop.fo.Constants.FO_REGION_START;
97
import static org.apache.fop.fo.Constants.FO_REGION_START;
98
import static org.apache.fop.fo.Constants.EN_LR_TB;
98
99
99
/**
100
/**
100
 * This is a parser for the area tree XML (intermediate format) which is used to reread an area
101
 * This is a parser for the area tree XML (intermediate format) which is used to reread an area
Lines 582-589 Link Here
582
                String regionName = attributes.getValue("name");
583
                String regionName = attributes.getValue("name");
583
                int columnCount = XMLUtil.getAttributeAsInt(attributes, "columnCount", 1);
584
                int columnCount = XMLUtil.getAttributeAsInt(attributes, "columnCount", 1);
584
                int columnGap = XMLUtil.getAttributeAsInt(attributes, "columnGap", 0);
585
                int columnGap = XMLUtil.getAttributeAsInt(attributes, "columnGap", 0);
586
                int wrMode = XMLUtil.getAttributeAsInt(attributes, "writingMode",
587
                        EN_LR_TB);
588
                int refOrient = XMLUtil.getAttributeAsInt(attributes, "referenceOrientation", 0);
585
                RegionViewport rv = getCurrentRegionViewport();
589
                RegionViewport rv = getCurrentRegionViewport();
586
                body = new BodyRegion(FO_REGION_BODY, regionName, rv, columnCount, columnGap);
590
                body = new BodyRegion(FO_REGION_BODY,
591
                        regionName, rv, columnCount, columnGap, wrMode, refOrient);
587
                transferForeignObjects(attributes, body);
592
                transferForeignObjects(attributes, body);
588
                body.setCTM(getAttributeAsCTM(attributes, "ctm"));
593
                body.setCTM(getAttributeAsCTM(attributes, "ctm"));
589
                setAreaAttributes(attributes, body);
594
                setAreaAttributes(attributes, body);
Lines 1028-1034 Link Here
1028
            String regionName = attributes.getValue("name");
1033
            String regionName = attributes.getValue("name");
1029
            RegionViewport rv = getCurrentRegionViewport();
1034
            RegionViewport rv = getCurrentRegionViewport();
1030
            RegionReference reg = new RegionReference(side,
1035
            RegionReference reg = new RegionReference(side,
1031
                    regionName, rv);
1036
                    regionName, rv, Integer.parseInt(attributes.getValue("writingMode")),
1037
                    Integer.parseInt(attributes.getValue("referenceOrientation")));
1032
            transferForeignObjects(attributes, reg);
1038
            transferForeignObjects(attributes, reg);
1033
            reg.setCTM(getAttributeAsCTM(attributes, "ctm"));
1039
            reg.setCTM(getAttributeAsCTM(attributes, "ctm"));
1034
            setAreaAttributes(attributes, reg);
1040
            setAreaAttributes(attributes, reg);
(-)src/java/org/apache/fop/area/inline/TextArea.java (+4 lines)
Lines 69-74 Link Here
69
     */
69
     */
70
    public void addWord(String word, int offset, int[] letterAdjust) {
70
    public void addWord(String word, int offset, int[] letterAdjust) {
71
        WordArea wordArea = new WordArea(word, offset, letterAdjust);
71
        WordArea wordArea = new WordArea(word, offset, letterAdjust);
72
        wordArea.setChangeBars(getChangeBars());
73
        
72
        addChildArea(wordArea);
74
        addChildArea(wordArea);
73
        wordArea.setParentArea(this);
75
        wordArea.setParentArea(this);
74
    }
76
    }
Lines 82-87 Link Here
82
     */
84
     */
83
    public void addSpace(char space, int offset, boolean adjustable) {
85
    public void addSpace(char space, int offset, boolean adjustable) {
84
        SpaceArea spaceArea = new SpaceArea(space, offset, adjustable);
86
        SpaceArea spaceArea = new SpaceArea(space, offset, adjustable);
87
       spaceArea.setChangeBars(getChangeBars());
88
       
85
        addChildArea(spaceArea);
89
        addChildArea(spaceArea);
86
        spaceArea.setParentArea(this);
90
        spaceArea.setParentArea(this);
87
    }
91
    }
(-)src/java/org/apache/fop/area/RegionReference.java (-3 / +26 lines)
Lines 23-28 Link Here
23
import java.util.List;
23
import java.util.List;
24
24
25
import org.apache.fop.fo.pagination.Region;
25
import org.apache.fop.fo.pagination.Region;
26
import org.apache.fop.fo.Constants;
26
27
27
/**
28
/**
28
 * This is a region reference area for a page regions.
29
 * This is a region reference area for a page regions.
Lines 36-41 Link Here
36
    private int regionClass;
37
    private int regionClass;
37
    private String regionName;
38
    private String regionName;
38
    private CTM ctm;
39
    private CTM ctm;
40
    private int writingMode;
41
    private int referenceOrientation;
39
42
40
    // the list of block areas from the static flow
43
    // the list of block areas from the static flow
41
    private ArrayList<Area> blocks = new ArrayList<Area>();
44
    private ArrayList<Area> blocks = new ArrayList<Area>();
Lines 50-56 Link Here
50
     * @param parent the viewport for this region.
53
     * @param parent the viewport for this region.
51
     */
54
     */
52
    public RegionReference(Region regionFO, RegionViewport parent) {
55
    public RegionReference(Region regionFO, RegionViewport parent) {
53
        this(regionFO.getNameId(), regionFO.getRegionName(), parent);
56
        this(regionFO.getNameId(), regionFO.getRegionName(), parent,
57
                Constants.EN_LR_TB, 0);
54
    }
58
    }
55
59
56
    /**
60
    /**
Lines 59-68 Link Here
59
     * @param regionClass the region class (as returned by Region.getNameId())
63
     * @param regionClass the region class (as returned by Region.getNameId())
60
     * @param regionName the name of the region (as returned by Region.getRegionName())
64
     * @param regionName the name of the region (as returned by Region.getRegionName())
61
     * @param parent the viewport for this region.
65
     * @param parent the viewport for this region.
66
     * @param wrMode writing mode
67
     * @param refOrient reference orientation
62
     */
68
     */
63
    public RegionReference(int regionClass, String regionName, RegionViewport parent) {
69
    public RegionReference(int regionClass, String regionName, RegionViewport parent,
70
            int wrMode, int refOrient) {
64
        this.regionClass = regionClass;
71
        this.regionClass = regionClass;
65
        this.regionName = regionName;
72
        this.regionName = regionName;
73
        this.writingMode = wrMode;
74
        this.referenceOrientation = refOrient;
75
        
66
        addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
76
        addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
67
        regionViewport = parent;
77
        regionViewport = parent;
68
    }
78
    }
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, regionViewport,
155
                                                 writingMode, referenceOrientation);
145
        rr.ctm = ctm;
156
        rr.ctm = ctm;
146
        rr.setIPD(getIPD());
157
        rr.setIPD(getIPD());
147
        rr.blocks = (ArrayList<Area>)blocks.clone();
158
        rr.blocks = (ArrayList<Area>)blocks.clone();
Lines 158-161 Link Here
158
        sb.append("}");
169
        sb.append("}");
159
        return sb.toString();
170
        return sb.toString();
160
    }
171
    }
172
    
173
    
174
    /** @return the writing mode of this region */
175
    public int getWritingMode() {
176
        return writingMode;
177
    }
178
    
179
    /** @return the reference orientation of this region */
180
    public int getReferenceOrientation() {
181
        return referenceOrientation;
182
    }
183
    
161
}
184
}
(-)src/java/org/apache/fop/area/Area.java (+23 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 141-146 Link Here
141
142
142
143
143
    /**
144
    /**
145
     * The vector of change bars this arrea is affected by
146
     */
147
    private Vector/*<ChangeBar>*/ changeBars = null;
148
    
149
    /**
150
     * Return the vector of change bars this area is affected by
151
     * @return Vector of change bars or null
152
     */
153
    public Vector/*<ChangeBar>*/ getChangeBars()   {
154
        return changeBars;
155
    }
156
    
157
    /**
158
     * Set the vector of change bars affecting this area
159
     * 
160
     * @param cbs the vector of change bars affecting the area
161
     */
162
    public void setChangeBars(Vector/*<ChangeBar>*/ cbs)   {
163
        changeBars = cbs;
164
    }
165
    
166
    /**
144
     * Get the area class of this area.
167
     * Get the area class of this area.
145
     *
168
     *
146
     * @return the area class
169
     * @return the area class

Return to bug 48548