xref: /webtrees/app/Report/ReportBaseTextbox.php (revision 1062a1429914c995339f502856821457aa975a5a)
1a25f0a04SGreg Roach<?php
2a25f0a04SGreg Roach/**
3a25f0a04SGreg Roach * webtrees: online genealogy
4*1062a142SGreg Roach * Copyright (C) 2018 webtrees development team
5a25f0a04SGreg Roach * This program is free software: you can redistribute it and/or modify
6a25f0a04SGreg Roach * it under the terms of the GNU General Public License as published by
7a25f0a04SGreg Roach * the Free Software Foundation, either version 3 of the License, or
8a25f0a04SGreg Roach * (at your option) any later version.
9a25f0a04SGreg Roach * This program is distributed in the hope that it will be useful,
10a25f0a04SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
11a25f0a04SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12a25f0a04SGreg Roach * GNU General Public License for more details.
13a25f0a04SGreg Roach * You should have received a copy of the GNU General Public License
14a25f0a04SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
15a25f0a04SGreg Roach */
1676692c8bSGreg Roachnamespace Fisharebest\Webtrees\Report;
17a25f0a04SGreg Roach
18a25f0a04SGreg Roach/**
19a25f0a04SGreg Roach * Class ReportBaseTextbox
20a25f0a04SGreg Roach */
21a25f0a04SGreg Roachclass ReportBaseTextbox extends ReportBaseElement {
22a25f0a04SGreg Roach	/**
23a25f0a04SGreg Roach	 * Array of elements in the TextBox
24a25f0a04SGreg Roach	 *
25a25f0a04SGreg Roach	 * @var array
26a25f0a04SGreg Roach	 */
2713abd6f3SGreg Roach	public $elements = [];
28a25f0a04SGreg Roach
29a25f0a04SGreg Roach	/**
30a25f0a04SGreg Roach	 *  Background color in HTML code
31a25f0a04SGreg Roach	 *
32a25f0a04SGreg Roach	 * @var string
33a25f0a04SGreg Roach	 */
34a25f0a04SGreg Roach	public $bgcolor;
35a25f0a04SGreg Roach	/**
36a25f0a04SGreg Roach	 * Whether or not paint the background
37a25f0a04SGreg Roach	 *
38cbc1590aSGreg Roach	 * @var bool
39a25f0a04SGreg Roach	 */
40a25f0a04SGreg Roach	public $fill;
41a25f0a04SGreg Roach
42a25f0a04SGreg Roach	/**
43a25f0a04SGreg Roach	 * Position the left corner of this box on the page(expressed in points). The default is the current position.
44a25f0a04SGreg Roach	 *
45a25f0a04SGreg Roach	 * @var mixed
46a25f0a04SGreg Roach	 */
47a25f0a04SGreg Roach	public $left;
48a25f0a04SGreg Roach	/**
49a25f0a04SGreg Roach	 * Position the top corner of this box on the page(expressed in points). the default is the current position
50a25f0a04SGreg Roach	 *
51a25f0a04SGreg Roach	 * @var mixed
52a25f0a04SGreg Roach	 */
53a25f0a04SGreg Roach	public $top;
54a25f0a04SGreg Roach	/**
55a25f0a04SGreg Roach	 * After this box is finished rendering, should the next section of text start immediately after the this box or should it start on a new line under this box. 0 = no new line, 1 = force new line. Default is 0
56a25f0a04SGreg Roach	 *
57cbc1590aSGreg Roach	 * @var bool
58a25f0a04SGreg Roach	 */
59a25f0a04SGreg Roach	public $newline;
60a25f0a04SGreg Roach
6176692c8bSGreg Roach	/** @var bool Unused? */
62a25f0a04SGreg Roach	public $pagecheck;
63a25f0a04SGreg Roach
6476692c8bSGreg Roach	/** @var bool Whether to print a border */
65a25f0a04SGreg Roach	public $border;
6676692c8bSGreg Roach
67a25f0a04SGreg Roach	/**
68a25f0a04SGreg Roach	 * Style of rendering
69a25f0a04SGreg Roach	 *
70a25f0a04SGreg Roach	 * <ul>
71a25f0a04SGreg Roach	 * <li>D or empty string: Draw (default).</li>
72a25f0a04SGreg Roach	 * <li>F: Fill.</li>
73a25f0a04SGreg Roach	 * <li>DF or FD: Draw and fill.</li>
74a25f0a04SGreg Roach	 * <li>CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).</li>
75a25f0a04SGreg Roach	 *<li>CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).</li>
76a25f0a04SGreg Roach	 * </ul>
77a25f0a04SGreg Roach	 *
78a25f0a04SGreg Roach	 * @var string
79a25f0a04SGreg Roach	 */
80a25f0a04SGreg Roach	public $style;
81a25f0a04SGreg Roach
82a25f0a04SGreg Roach	/**
83cbc1590aSGreg Roach	 * @var array Border style of rectangle. Array with keys among the following:
84a25f0a04SGreg Roach	 * <ul>
85a25f0a04SGreg Roach	 * <li>all: Line style of all borders. Array like for {@link SetLineStyle SetLineStyle}.</li>
86a25f0a04SGreg Roach	 * <li>L, T, R, B or combinations: Line style of left, top, right or bottom border. Array like for {@link SetLineStyle SetLineStyle}.</li>
87a25f0a04SGreg Roach	 * </ul>
88a25f0a04SGreg Roach	 * Not yet in use
89a25f0a04SGreg Roach	 * var $borderstyle;
90a25f0a04SGreg Roach	 */
91a25f0a04SGreg Roach
92a25f0a04SGreg Roach	/**
93a25f0a04SGreg Roach	 * The starting height of this cell. If the text wraps the height will automatically be adjusted
94a25f0a04SGreg Roach	 *
95a25f0a04SGreg Roach	 * @var float
96a25f0a04SGreg Roach	 */
97a25f0a04SGreg Roach	public $height;
98a25f0a04SGreg Roach	/**
99a25f0a04SGreg Roach	 * Setting the width to 0 will make it the width from the current location to the right margin
100a25f0a04SGreg Roach	 *
101a25f0a04SGreg Roach	 * @var float
102a25f0a04SGreg Roach	 */
103a25f0a04SGreg Roach	public $width;
104a25f0a04SGreg Roach	/**
105a25f0a04SGreg Roach	 * Use cell padding or not
106a25f0a04SGreg Roach	 *
107cbc1590aSGreg Roach	 * @var bool
108a25f0a04SGreg Roach	 */
109a25f0a04SGreg Roach	public $padding;
110a25f0a04SGreg Roach	/**
111a25f0a04SGreg Roach	 * Resets this box last height after it’s done
112a25f0a04SGreg Roach	 */
113a25f0a04SGreg Roach	public $reseth;
114a25f0a04SGreg Roach
115a25f0a04SGreg Roach	/**
116a25f0a04SGreg Roach	 * TextBox - Element - Base
117a25f0a04SGreg Roach	 *
118a25f0a04SGreg Roach	 * @param float  $width   Text box width
119a25f0a04SGreg Roach	 * @param float  $height  Text box height
120cbc1590aSGreg Roach	 * @param bool   $border
121a25f0a04SGreg Roach	 * @param string $bgcolor Background color code in HTML
122cbc1590aSGreg Roach	 * @param bool   $newline
123a25f0a04SGreg Roach	 * @param mixed  $left
124a25f0a04SGreg Roach	 * @param mixed  $top
125cbc1590aSGreg Roach	 * @param bool   $pagecheck
126a25f0a04SGreg Roach	 * @param string $style
127cbc1590aSGreg Roach	 * @param bool   $fill
128cbc1590aSGreg Roach	 * @param bool   $padding
129cbc1590aSGreg Roach	 * @param bool   $reseth
130a25f0a04SGreg Roach	 */
131e2d2f0ebSGreg Roach	public function __construct(
132a25f0a04SGreg Roach		$width, $height, $border, $bgcolor, $newline, $left, $top, $pagecheck, $style, $fill, $padding, $reseth
133a25f0a04SGreg Roach	) {
134a25f0a04SGreg Roach		$this->border    = $border;
135a25f0a04SGreg Roach		$this->bgcolor   = $bgcolor;
136a25f0a04SGreg Roach		$this->fill      = $fill;
137a25f0a04SGreg Roach		$this->height    = $height;
138a25f0a04SGreg Roach		$this->left      = $left;
139a25f0a04SGreg Roach		$this->newline   = $newline;
140a25f0a04SGreg Roach		$this->pagecheck = $pagecheck;
141a25f0a04SGreg Roach		$this->style     = $style;
142a25f0a04SGreg Roach		$this->top       = $top;
143a25f0a04SGreg Roach		$this->width     = $width;
144a25f0a04SGreg Roach		$this->padding   = $padding;
145a25f0a04SGreg Roach		$this->reseth    = $reseth;
146a25f0a04SGreg Roach
147a25f0a04SGreg Roach		return 0;
148a25f0a04SGreg Roach	}
149a25f0a04SGreg Roach
150a25f0a04SGreg Roach	/**
151a25f0a04SGreg Roach	 * Add an element to the TextBox
152a25f0a04SGreg Roach	 *
153a25f0a04SGreg Roach	 * @param object|string $element
154a25f0a04SGreg Roach	 */
155ffd703eaSGreg Roach	public function addElement($element) {
156a25f0a04SGreg Roach		$this->elements[] = $element;
157a25f0a04SGreg Roach	}
158a25f0a04SGreg Roach}
159