blob: f4b4a3164619a9096fa9f08132c6b25a335f6ef0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
package org.apache.fop.fo.pagination;
// FOP
import org.apache.fop.fo.*;
import org.apache.fop.fo.properties.WritingMode;
// Java
import java.awt.Rectangle;
public abstract class RegionSE extends RegionBASE {
protected RegionSE(FONode parent) {
super(parent);
}
/**
* Adjust the viewport reference rectangle for a region as a function
* of precedence.
* If before and after have precedence = true, the start and end
* regions only go to the limits of their extents, otherwise
* they extend in the BPD to the page reference rectangle
* diminish by extend of start and end if present.
*/
protected void adjustIPD(Rectangle refRect, int wm) {
int offset = 0;
Region before = getSiblingRegion(Region.BEFORE);
if (before != null && before.getPrecedence()) {
offset = before.getExtent();
refRect.translate(0, offset);
}
Region after = getSiblingRegion(Region.AFTER);
if (after != null && after.getPrecedence()) {
offset += after.getExtent();
}
if (offset > 0) {
if (wm == WritingMode.LR_TB || wm == WritingMode.RL_TB)
refRect.height-=offset;
else
refRect.width-=offset;
}
}
}
|