| 1 |
lars |
1 |
<?php
|
|
|
2 |
class BoxTextFieldPageNo extends TextBoxString {
|
|
|
3 |
function BoxTextFieldPageNo() {
|
|
|
4 |
$this->TextBoxString('', 'iso-8859-1');
|
|
|
5 |
}
|
|
|
6 |
|
|
|
7 |
function from_box(&$box) {
|
|
|
8 |
$field = new BoxTextFieldPageNo;
|
|
|
9 |
|
|
|
10 |
$field->copy_style($box);
|
|
|
11 |
|
|
|
12 |
$field->words = array('000');
|
|
|
13 |
$field->encodings = array('iso-8859-1');
|
|
|
14 |
$field->_left = $box->_left;
|
|
|
15 |
$field->_top = $box->_top;
|
|
|
16 |
$field->baseline = $box->baseline;
|
|
|
17 |
|
|
|
18 |
return $field;
|
|
|
19 |
}
|
|
|
20 |
|
|
|
21 |
function show(&$viewport) {
|
|
|
22 |
$font = $this->get_css_property(CSS_FONT);
|
|
|
23 |
|
|
|
24 |
$this->words[0] = sprintf('%d', $viewport->current_page);
|
|
|
25 |
|
|
|
26 |
$field_width = $this->width;
|
|
|
27 |
$field_left = $this->_left;
|
|
|
28 |
|
|
|
29 |
if ($font->size->getPoints() > 0) {
|
|
|
30 |
$value_width = $viewport->stringwidth($this->words[0],
|
|
|
31 |
$this->_get_font_name($viewport,0),
|
|
|
32 |
$this->encodings[0],
|
|
|
33 |
$font->size->getPoints());
|
|
|
34 |
if (is_null($value_width)) { return null; };
|
|
|
35 |
} else {
|
|
|
36 |
$value_width = 0;
|
|
|
37 |
};
|
|
|
38 |
$this->width = $value_width;
|
|
|
39 |
$this->_left += ($field_width - $value_width) / 2;
|
|
|
40 |
|
|
|
41 |
if (is_null(TextBoxString::show($viewport))) {
|
|
|
42 |
return null;
|
|
|
43 |
};
|
|
|
44 |
|
|
|
45 |
$this->width = $field_width;
|
|
|
46 |
$this->_left = $field_left;
|
|
|
47 |
|
|
|
48 |
return true;
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
function show_fixed(&$driver) {
|
|
|
52 |
$font = $this->get_css_property(CSS_FONT);
|
|
|
53 |
|
|
|
54 |
$this->words[0] = sprintf('%d', $driver->current_page);
|
|
|
55 |
|
|
|
56 |
$field_width = $this->width;
|
|
|
57 |
$field_left = $this->_left;
|
|
|
58 |
|
|
|
59 |
if ($font->size->getPoints() > 0) {
|
|
|
60 |
$value_width = $driver->stringwidth($this->words[0],
|
|
|
61 |
$this->_get_font_name($driver, 0),
|
|
|
62 |
$this->encodings[0],
|
|
|
63 |
$font->size->getPoints());
|
|
|
64 |
if (is_null($value_width)) { return null; };
|
|
|
65 |
} else {
|
|
|
66 |
$value_width = 0;
|
|
|
67 |
};
|
|
|
68 |
$this->width = $value_width;
|
|
|
69 |
$this->_left += ($field_width - $value_width) / 2;
|
|
|
70 |
|
|
|
71 |
if (is_null(TextBoxString::show_fixed($driver))) {
|
|
|
72 |
return null;
|
|
|
73 |
};
|
|
|
74 |
|
|
|
75 |
$this->width = $field_width;
|
|
|
76 |
$this->_left = $field_left;
|
|
|
77 |
|
|
|
78 |
return true;
|
|
|
79 |
}
|
|
|
80 |
}
|
|
|
81 |
?>
|