Line 0
Link Here
|
|
|
1 |
/* |
2 |
* Copyright 2005 The Apache Software Foundation. |
3 |
* |
4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
5 |
* you may not use this file except in compliance with the License. |
6 |
* You may obtain a copy of the License at |
7 |
* |
8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
9 |
* |
10 |
* Unless required by applicable law or agreed to in writing, software |
11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 |
* See the License for the specific language governing permissions and |
14 |
* limitations under the License. |
15 |
*/ |
16 |
|
17 |
/* $Id$ */ |
18 |
|
19 |
package org.apache.fop.render.txt; |
20 |
|
21 |
import java.io.OutputStream; |
22 |
import java.util.Arrays; |
23 |
import java.util.Iterator; |
24 |
import java.util.List; |
25 |
|
26 |
import org.apache.fop.apps.FOPException; |
27 |
import org.apache.fop.apps.FOUserAgent; |
28 |
import org.apache.fop.area.AreaTreeHandler; |
29 |
import org.apache.fop.datatypes.CompoundDatatype; |
30 |
import org.apache.fop.datatypes.Length; |
31 |
import org.apache.fop.datatypes.PercentBaseContext; |
32 |
import org.apache.fop.fo.Constants; |
33 |
import org.apache.fop.fo.FONode; |
34 |
import org.apache.fop.fo.FOText; |
35 |
import org.apache.fop.fo.expr.NumericProperty; |
36 |
import org.apache.fop.fo.expr.RelativeNumericProperty; |
37 |
import org.apache.fop.fo.flow.Block; |
38 |
import org.apache.fop.fo.flow.BlockContainer; |
39 |
import org.apache.fop.fo.flow.ExternalGraphic; |
40 |
import org.apache.fop.fo.flow.Inline; |
41 |
import org.apache.fop.fo.flow.ListBlock; |
42 |
import org.apache.fop.fo.flow.ListItem; |
43 |
import org.apache.fop.fo.flow.PageNumber; |
44 |
import org.apache.fop.fo.flow.Table; |
45 |
import org.apache.fop.fo.flow.TableCell; |
46 |
import org.apache.fop.fo.flow.TableColumn; |
47 |
import org.apache.fop.fo.pagination.PageSequence; |
48 |
import org.apache.fop.fo.properties.CommonAbsolutePosition; |
49 |
import org.apache.fop.fo.properties.CommonBorderPaddingBackground; |
50 |
import org.apache.fop.fo.properties.CommonFont; |
51 |
import org.apache.fop.fo.properties.CommonMarginBlock; |
52 |
import org.apache.fop.fo.properties.FixedLength; |
53 |
import org.apache.fop.fo.properties.Property; |
54 |
import org.apache.fop.fo.properties.SpaceProperty; |
55 |
import org.apache.fop.layoutmgr.BlockLayoutManager; |
56 |
|
57 |
/** |
58 |
* Handler for formatting objects in case of rendering to txt. |
59 |
* |
60 |
* This handler gets page-sequence, modifies formatting objects and return them |
61 |
* to superclass. So areas are generated from modified FO. Idea of modifying is |
62 |
* to quantize FO properties, making them divisible by width of char or height |
63 |
* of char. |
64 |
*/ |
65 |
public class TXTHandler extends AreaTreeHandler { |
66 |
|
67 |
/** Percent base context. Needed for line-height. */ |
68 |
private static final PercentBaseContext CONTEXT |
69 |
= new BlockLayoutManager(new Block(null)); |
70 |
|
71 |
/** Modified font size in millipoints. */ |
72 |
private static final int MODIFIED_FONT_SIZE = 10000; |
73 |
|
74 |
/** Quantum for each side (BEFORE, AFTER, START, END). */ |
75 |
private final int[] quantum = {TXTRenderer.CHAR_HEIGHT, |
76 |
TXTRenderer.CHAR_HEIGHT, TXTRenderer.CHAR_WIDTH, |
77 |
TXTRenderer.CHAR_WIDTH}; |
78 |
|
79 |
/** Keeps overpatching for each side. */ |
80 |
private int[] overPatching = new int[4]; |
81 |
|
82 |
/** |
83 |
* Keeps last overpatching for each side. Needed for selective modifying of |
84 |
* start-indent and end-indent. |
85 |
*/ |
86 |
private int[] lastOverPatching = new int[4]; |
87 |
|
88 |
/** |
89 |
* Constructs a newly allocated <code>TXTHandler</code> object. |
90 |
* |
91 |
* @param userAgent FOUserAgent |
92 |
* @param stream OutputStream |
93 |
* @throws FOPException if the RenderPagesModel cannot be created |
94 |
*/ |
95 |
public TXTHandler(FOUserAgent userAgent, OutputStream stream) |
96 |
throws FOPException { |
97 |
super(userAgent, Constants.RENDER_TXT, stream); |
98 |
} |
99 |
|
100 |
/** |
101 |
* Sets a component <code>CP_LENGTH</code> of <code>cd</code> to |
102 |
* <code>value</code>. |
103 |
|
104 |
* @param cd CompoundDatatype |
105 |
* @param value new integer value |
106 |
*/ |
107 |
private static void setLength(CompoundDatatype cd, int value) { |
108 |
cd.setComponent(Constants.CP_LENGTH, new FixedLength(value), true); |
109 |
} |
110 |
|
111 |
/** |
112 |
* Sets components <code>CP_MINIMUM, CP_OPTIMUM, CP_MAXIMUM</code> of |
113 |
* <code>cd</code> to <code>p</code>. |
114 |
* |
115 |
* @param cd instance of CompoundDatatype for modifying. |
116 |
* @param p property for setting. |
117 |
*/ |
118 |
private static void setMinOptMax(CompoundDatatype cd, Property p) { |
119 |
cd.setComponent(Constants.CP_MINIMUM, p, true); |
120 |
cd.setComponent(Constants.CP_OPTIMUM, p, true); |
121 |
cd.setComponent(Constants.CP_MAXIMUM, p, true); |
122 |
} |
123 |
|
124 |
/** |
125 |
* Modifies border of side. If there is no border of given side, does |
126 |
* nothing, otherwise sets border-width to half of char width or char height |
127 |
* depending on side. <p> |
128 |
* Difference between values of new border-width and old border-width is |
129 |
* saved in <code>lastOverPatching</code>. |
130 |
* |
131 |
* @param side side to modify. |
132 |
* @param bpb instance of CommonBorderPaddingBackground for modifying. |
133 |
*/ |
134 |
private void modifyBorder(int side, CommonBorderPaddingBackground bpb) { |
135 |
CommonBorderPaddingBackground.BorderInfo bi = bpb.getBorderInfo(side); |
136 |
|
137 |
if (bi != null) { |
138 |
int width = bpb.getBorderWidth(side, false); |
139 |
setLength(bi.getWidth(), quantum[side] / 2); |
140 |
lastOverPatching[side] += bpb.getBorderWidth(side, false) - width; |
141 |
} |
142 |
} |
143 |
|
144 |
/** |
145 |
* Modifies padding of side. First rounds padding to nearest integer, |
146 |
* divisible by char width or char height depending on side. If border of |
147 |
* given side is available, modifies padding in such a way, so sum of border |
148 |
* width and padding will be divisible by char width or char height, |
149 |
* depending on side. <p> |
150 |
* Difference between values of new padding and old padding is saved |
151 |
* in <code>lastOverPatching</code>. |
152 |
* |
153 |
* @param side side to modify. |
154 |
* @param bpb instance of CommonBorderPaddingBackground for modifying. |
155 |
*/ |
156 |
private void modifyPadding(int side, CommonBorderPaddingBackground bpb) { |
157 |
int oldPadding = bpb.getPadding(side, false, null); |
158 |
int newPadding = Helper.round(oldPadding, quantum[side]); |
159 |
if (bpb.getBorderInfo(side) != null) { |
160 |
newPadding = Math.max(newPadding, quantum[side]) |
161 |
- bpb.getBorderWidth(side, false); |
162 |
} |
163 |
|
164 |
setLength(bpb.getPaddingLengthProperty(side), newPadding); |
165 |
lastOverPatching[side] += newPadding - oldPadding; |
166 |
} |
167 |
|
168 |
/** |
169 |
* Modifies borders and paddings of <code>bpb</code>. |
170 |
* |
171 |
* @param bpb instance of CommonBorderPaddingBackground for modifying. |
172 |
*/ |
173 |
private void modifyBPB(CommonBorderPaddingBackground bpb) { |
174 |
modifyBorder(CommonBorderPaddingBackground.BEFORE, bpb); |
175 |
modifyBorder(CommonBorderPaddingBackground.AFTER, bpb); |
176 |
modifyBorder(CommonBorderPaddingBackground.START, bpb); |
177 |
modifyBorder(CommonBorderPaddingBackground.END, bpb); |
178 |
|
179 |
modifyPadding(CommonBorderPaddingBackground.BEFORE, bpb); |
180 |
modifyPadding(CommonBorderPaddingBackground.AFTER, bpb); |
181 |
modifyPadding(CommonBorderPaddingBackground.START, bpb); |
182 |
modifyPadding(CommonBorderPaddingBackground.END, bpb); |
183 |
} |
184 |
|
185 |
/** |
186 |
* Rounds optimum value of <code>space</code> to nearest integer, |
187 |
* divisible by <code>q</code>. |
188 |
* |
189 |
* @param space instance of SpaceProperty. |
190 |
* @param q integer. |
191 |
*/ |
192 |
private void modifySpace(SpaceProperty space, int q) { |
193 |
int value = space.getOptimum(null).getLength().getValue(); |
194 |
setMinOptMax(space, new FixedLength(Helper.round(value, q))); |
195 |
} |
196 |
|
197 |
/** |
198 |
* @param length instance of Length. |
199 |
* @param q integer. |
200 |
* @return instance of Length, having value nearest to value of |
201 |
* <code>length</code>, and divisible by <code>q</code>. |
202 |
*/ |
203 |
private Length roundLength(Length length, int q) { |
204 |
int x = Helper.round(length.getValue(), q); |
205 |
return new FixedLength(x); |
206 |
} |
207 |
|
208 |
/** |
209 |
* @param length instance of Length. |
210 |
* @param q integer. |
211 |
* @return instance of Length, having minimal value, greater value of |
212 |
* <code>length</code>, and divisible by <code>q</code>. |
213 |
*/ |
214 |
private Length ceilLength(Length length, int q) { |
215 |
int x = Helper.ceil(length.getValue(), q); |
216 |
return new FixedLength(x); |
217 |
} |
218 |
|
219 |
/** |
220 |
* Modifies indent for given side. Summarizes value of indent and modifing |
221 |
* error (i.e. overPatching). Rounds result to nearest integer, divisible by |
222 |
* quantum. |
223 |
* |
224 |
* @param indent Length to modify. |
225 |
* @param side an integer, representing side. |
226 |
* @return modified Length. |
227 |
*/ |
228 |
private Length modifyIndent(Length indent, int side) { |
229 |
if (indent instanceof NumericProperty) { |
230 |
overPatching[side] += lastOverPatching[side]; |
231 |
} |
232 |
int newValue = indent.getValue() + overPatching[side]; |
233 |
newValue = Helper.round(newValue, quantum[side]); |
234 |
return new FixedLength(newValue); |
235 |
} |
236 |
|
237 |
/** |
238 |
* Modifies Common Margin Properties-Block: |
239 |
* <ul> |
240 |
* <li>margin-top, margin-left, margin-bottom, margin-right |
241 |
* <li>start-indent, end-indent |
242 |
* <li>space-before, space-after. |
243 |
* </ul> |
244 |
* |
245 |
* @param cmb instance of CommonMarginBlock to modify. |
246 |
*/ |
247 |
private void modifyCommonMarginBlock(CommonMarginBlock cmb) { |
248 |
cmb.marginTop = roundLength(cmb.marginTop, TXTRenderer.CHAR_HEIGHT); |
249 |
cmb.marginBottom = roundLength(cmb.marginBottom, |
250 |
TXTRenderer.CHAR_HEIGHT); |
251 |
cmb.marginLeft = roundLength(cmb.marginLeft, TXTRenderer.CHAR_WIDTH); |
252 |
cmb.marginRight = roundLength(cmb.marginRight, TXTRenderer.CHAR_WIDTH); |
253 |
|
254 |
modifySpace(cmb.spaceBefore, TXTRenderer.CHAR_HEIGHT); |
255 |
modifySpace(cmb.spaceAfter, TXTRenderer.CHAR_HEIGHT); |
256 |
|
257 |
if (!(cmb.startIndent instanceof RelativeNumericProperty)) { |
258 |
cmb.startIndent = modifyIndent(cmb.startIndent, |
259 |
CommonBorderPaddingBackground.START); |
260 |
} |
261 |
if (!(cmb.endIndent instanceof RelativeNumericProperty)) { |
262 |
cmb.endIndent = modifyIndent(cmb.endIndent, |
263 |
CommonBorderPaddingBackground.END); |
264 |
} |
265 |
} |
266 |
|
267 |
/** |
268 |
* Modifies fo:table attributes: |
269 |
* <ul> |
270 |
* <li>Common Margin Properties Block |
271 |
* <li>Common Border, Padding, and Background Properties |
272 |
* <li>columns. |
273 |
* </ul> |
274 |
* |
275 |
* @param table Table to modify. |
276 |
*/ |
277 |
private void modifyTable(Table table) { |
278 |
CommonMarginBlock cmb = table.getCommonMarginBlock(); |
279 |
if (table.getBorderCollapse() == Constants.EN_COLLAPSE) { |
280 |
// If border-collapse == "collapse", add space-after in order to |
281 |
// impove interaction with other FO. |
282 |
int value = cmb.spaceAfter.getOptimum(null).getLength().getValue(); |
283 |
value += TXTRenderer.CHAR_HEIGHT; |
284 |
setMinOptMax(cmb.spaceAfter, new FixedLength(value)); |
285 |
} |
286 |
modifyCommonMarginBlock(cmb); |
287 |
|
288 |
modifyBPB(table.getCommonBorderPaddingBackground()); |
289 |
|
290 |
// modify all table-columns |
291 |
List columnList = table.getColumns(); |
292 |
Iterator iter = columnList.iterator(); |
293 |
while (iter.hasNext()) { |
294 |
modifyTableColumn((TableColumn) iter.next()); |
295 |
} |
296 |
} |
297 |
|
298 |
/** |
299 |
* Modifies fo:table-column attributes: |
300 |
* <ul> |
301 |
* <li>width. |
302 |
* </ul> |
303 |
* |
304 |
* @param column TableColumn to modify. |
305 |
*/ |
306 |
private void modifyTableColumn(TableColumn column) { |
307 |
column.setColumnWidth(ceilLength(column.getColumnWidth(), |
308 |
TXTRenderer.CHAR_WIDTH)); |
309 |
} |
310 |
|
311 |
/** |
312 |
* Modifies padding of fo:table-cell. |
313 |
* |
314 |
* @param side side. |
315 |
* @param bpb instance of CommonBorderPaddingBackground to modify. |
316 |
*/ |
317 |
private void modifyCellPadding(int side, CommonBorderPaddingBackground bpb) { |
318 |
if (bpb.getBorderInfo(side) == null) { |
319 |
int oldPadding = bpb.getPadding(side, false, null); |
320 |
int newPadding = oldPadding + quantum[side] / 2; |
321 |
setLength(bpb.getPaddingLengthProperty(side), newPadding); |
322 |
} |
323 |
} |
324 |
|
325 |
/** |
326 |
* Modifies table-cell properties: |
327 |
* <ul> |
328 |
* <li>Common Border, Padding, and Background Properties. |
329 |
* </ul> |
330 |
* |
331 |
* @param c TableCell to modify. |
332 |
*/ |
333 |
private void modifyTableCell(TableCell c) { |
334 |
CommonBorderPaddingBackground bpb = c |
335 |
.getCommonBorderPaddingBackground(); |
336 |
modifyBPB(bpb); |
337 |
modifyCellPadding(CommonBorderPaddingBackground.BEFORE, bpb); |
338 |
modifyCellPadding(CommonBorderPaddingBackground.AFTER, bpb); |
339 |
modifyCellPadding(CommonBorderPaddingBackground.START, bpb); |
340 |
modifyCellPadding(CommonBorderPaddingBackground.END, bpb); |
341 |
} |
342 |
|
343 |
/** |
344 |
* Modifies Common Absolute Position Properties: |
345 |
* <ul> |
346 |
* <li>left |
347 |
* <li>top. |
348 |
* </ul> |
349 |
* |
350 |
* @param cap CommonAbsolutePosition to modify. |
351 |
*/ |
352 |
private void modifyCommonAbsolutePosition(CommonAbsolutePosition cap) { |
353 |
if (cap.absolutePosition == Constants.EN_ABSOLUTE) { |
354 |
cap.left = roundLength(cap.left, TXTRenderer.CHAR_WIDTH); |
355 |
cap.top = roundLength(cap.top, TXTRenderer.CHAR_HEIGHT); |
356 |
} |
357 |
} |
358 |
|
359 |
/** |
360 |
* Modifies line-height property. Sets a value of line-height to max(char |
361 |
* height; lowest integer, divisible by char height). |
362 |
* |
363 |
* @param lineHeight SpaceProperty to modify. |
364 |
*/ |
365 |
private void modifyLineHeight(SpaceProperty lineHeight) { |
366 |
Property p = lineHeight.getOptimum(null); |
367 |
int value = p.getLength().getValue(CONTEXT); |
368 |
|
369 |
int height = TXTRenderer.CHAR_HEIGHT; |
370 |
int newValue = Math.max(Helper.floor(value, height), height); |
371 |
setMinOptMax(lineHeight, new FixedLength(newValue)); |
372 |
} |
373 |
|
374 |
/** |
375 |
* Modifies Common Font Properties: |
376 |
* <ul> |
377 |
* <li>font-family = Courier; |
378 |
* <li>font-size = MODIFIED_FONT_SIZE; |
379 |
* <li>font-stretch = EN_NORMAL; |
380 |
* <li>font-weight = EN_NORMAL. |
381 |
* </ul> |
382 |
* |
383 |
* @param cf the font to modify. |
384 |
*/ |
385 |
private void modifyCommonFont(CommonFont cf) { |
386 |
if (cf != null) { |
387 |
cf.fontFamily = "Courier"; |
388 |
cf.fontSize = new FixedLength(MODIFIED_FONT_SIZE); |
389 |
cf.fontStretch = Constants.EN_NORMAL; |
390 |
cf.fontWeight = Constants.EN_NORMAL; |
391 |
} |
392 |
} |
393 |
|
394 |
/** |
395 |
* Modifies fo:block: |
396 |
* <ul> |
397 |
* <li>Common Border, Padding, and Background Properties |
398 |
* <li>Common Margin Properties-Block |
399 |
* <li>Common Font Properties |
400 |
* <li>line-height. |
401 |
* </ul> |
402 |
* |
403 |
* @param block Block to modify. |
404 |
*/ |
405 |
private void modifyBlock(Block block) { |
406 |
modifyBPB(block.getCommonBorderPaddingBackground()); |
407 |
modifyCommonMarginBlock(block.getCommonMarginBlock()); |
408 |
modifyCommonFont(block.getCommonFont()); |
409 |
modifyLineHeight(block.getLineHeight()); |
410 |
} |
411 |
|
412 |
/** |
413 |
* Modifies fo:block-container: |
414 |
* <ul> |
415 |
* <li>Common Border, Padding, and Background Properties |
416 |
* <li>Common Margin Properties-Block |
417 |
* <li>Common Absolute Position Properties. |
418 |
* </ul> |
419 |
* |
420 |
* @param bc BlockContainer to modify. |
421 |
*/ |
422 |
private void modifyBlockContainer(BlockContainer bc) { |
423 |
modifyBPB(bc.getCommonBorderPaddingBackground()); |
424 |
modifyCommonMarginBlock(bc.getCommonMarginBlock()); |
425 |
modifyCommonAbsolutePosition(bc.getCommonAbsolutePosition()); |
426 |
} |
427 |
|
428 |
/** |
429 |
* Modifies fo:inline: |
430 |
* <ul> |
431 |
* <li>Common Font Properties |
432 |
* </ul> |
433 |
* |
434 |
* @param inline Inline to modify. |
435 |
*/ |
436 |
private void modifyInline(Inline inline) { |
437 |
modifyCommonFont(inline.getCommonFont()); |
438 |
} |
439 |
|
440 |
/** |
441 |
* Modifies FOText: |
442 |
* <ul> |
443 |
* <li>Common Font Properties |
444 |
* </ul> |
445 |
* |
446 |
* @param text FOText to modify. |
447 |
*/ |
448 |
private void modifyFOText(FOText text) { |
449 |
modifyCommonFont(text.getCommonFont()); |
450 |
} |
451 |
|
452 |
/** |
453 |
* Modifies fo:external-graphic: |
454 |
* <ul> |
455 |
* <li>Common Border, Padding, and Background Properties |
456 |
* <li>line-height. |
457 |
* </ul> |
458 |
* |
459 |
* @param eg ExternalGraphic to modify. |
460 |
*/ |
461 |
private void modifyExternalGraphic(ExternalGraphic eg) { |
462 |
modifyBPB(eg.getCommonBorderPaddingBackground()); |
463 |
modifyLineHeight(eg.getLineHeight()); |
464 |
} |
465 |
|
466 |
/** |
467 |
* Modifies fo:list-block: |
468 |
* <ul> |
469 |
* <li>Common Border, Padding, and Background Properties |
470 |
* <li>Common Margin Properties-Block. |
471 |
* </ul> |
472 |
* |
473 |
* @param lb ListBlock to modify. |
474 |
*/ |
475 |
private void modifyListBlock(ListBlock lb) { |
476 |
modifyBPB(lb.getCommonBorderPaddingBackground()); |
477 |
modifyCommonMarginBlock(lb.getCommonMarginBlock()); |
478 |
} |
479 |
|
480 |
/** |
481 |
* Modifies fo:list-item: |
482 |
* <ul> |
483 |
* <li>Common Border, Padding, and Background Properties |
484 |
* <li>Common Margin Properties-Block. |
485 |
* </ul> |
486 |
* <p> |
487 |
* Make refinement for fo:list-item-label and fo:list-item-body. |
488 |
* |
489 |
* @param li ListItem to modify. |
490 |
*/ |
491 |
private void modifyListItem(ListItem li) { |
492 |
modifyBPB(li.getCommonBorderPaddingBackground()); |
493 |
modifyCommonMarginBlock(li.getCommonMarginBlock()); |
494 |
refinement(li.getLabel()); |
495 |
refinement(li.getBody()); |
496 |
} |
497 |
|
498 |
/** |
499 |
* Does refinement for particular node. Modifies node's properties and |
500 |
* refines its children recursively. |
501 |
* |
502 |
* @param node the node to refine. |
503 |
*/ |
504 |
private void refinement(FONode node) { |
505 |
int[] saveOverPatching = (int[]) overPatching.clone(); |
506 |
Arrays.fill(lastOverPatching, 0); |
507 |
|
508 |
if (node instanceof Block) { |
509 |
modifyBlock((Block) node); |
510 |
} else if (node instanceof BlockContainer) { |
511 |
modifyBlockContainer((BlockContainer) node); |
512 |
} else if (node instanceof Inline) { |
513 |
modifyInline((Inline) node); |
514 |
} else if (node instanceof FOText) { |
515 |
modifyFOText((FOText) node); |
516 |
} else if (node instanceof Table) { |
517 |
modifyTable((Table) node); |
518 |
Arrays.fill(overPatching, 0); |
519 |
} else if (node instanceof TableCell) { |
520 |
modifyTableCell((TableCell) node); |
521 |
} else if (node instanceof ExternalGraphic) { |
522 |
modifyExternalGraphic((ExternalGraphic) node); |
523 |
} else if (node instanceof ListBlock) { |
524 |
modifyListBlock((ListBlock) node); |
525 |
} else if (node instanceof ListItem) { |
526 |
modifyListItem((ListItem) node); |
527 |
} else if (node instanceof PageNumber) { |
528 |
modifyCommonFont(((PageNumber) node).getCommonFont()); |
529 |
} |
530 |
|
531 |
Iterator it = node.getChildNodes(); |
532 |
if (it != null) { |
533 |
while (it.hasNext()) { |
534 |
refinement((FONode) it.next()); |
535 |
} |
536 |
} |
537 |
overPatching = saveOverPatching; |
538 |
} |
539 |
|
540 |
/** |
541 |
* Run refinement for: |
542 |
* <ul> |
543 |
* <li>mainflow (xsl-region-body) |
544 |
* <li>staticflow (xsl-region-before, xsl-region-after, xsl-region-start, |
545 |
* xsl-region-end). |
546 |
* </ul> |
547 |
* |
548 |
* @param pageSequence PageSequence to refine. |
549 |
*/ |
550 |
public void endPageSequence(PageSequence pageSequence) { |
551 |
Arrays.fill(overPatching, 0); |
552 |
|
553 |
refinement(pageSequence.getMainFlow()); |
554 |
|
555 |
if (pageSequence.getStaticContent("xsl-region-before") != null) { |
556 |
refinement(pageSequence.getStaticContent("xsl-region-before")); |
557 |
} |
558 |
if (pageSequence.getStaticContent("xsl-region-after") != null) { |
559 |
refinement(pageSequence.getStaticContent("xsl-region-after")); |
560 |
} |
561 |
if (pageSequence.getStaticContent("xsl-region-start") != null) { |
562 |
refinement(pageSequence.getStaticContent("xsl-region-start")); |
563 |
} |
564 |
if (pageSequence.getStaticContent("xsl-region-end") != null) { |
565 |
refinement(pageSequence.getStaticContent("xsl-region-end")); |
566 |
} |
567 |
|
568 |
super.endPageSequence(pageSequence); |
569 |
} |
570 |
} |