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