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

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

Return to bug 48548