xref: /webtrees/app/Report/ReportBaseCell.php (revision 9b5dd26610226f1dfba1845a48c6980d11ca6bda)
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 ReportBaseCell
20 */
21class ReportBaseCell extends ReportBaseElement {
22	/**
23	 * Allows to center or align the text. Possible values are:<ul><li>left or empty string: left align</li><li>center: center align</li><li>right: right align</li><li>justify: justification (default value when $ishtml=false)</li></ul>
24	 *
25	 * @var string
26	 */
27	public $align = '';
28	/**
29	 * Whether or not a border should be printed around this box. 0 = no border, 1 = border. Default is 0.
30	 * Or a string containing some or all of the following characters (in any order):<ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul>
31	 *
32	 * @var mixed
33	 */
34	public $border;
35	/**
36	 * Border color in HTML code
37	 *
38	 * @var string
39	 */
40	public $bocolor;
41	/**
42	 * The HTML color code to fill the background of this cell.
43	 *
44	 * @var string
45	 */
46	public $bgcolor;
47	/**
48	 * Indicates if the cell background must be painted (1) or transparent (0). Default value: 1.
49	 * If no background color is set then it will not be painted
50	 *
51	 * @var int
52	 */
53	public $fill;
54	/**
55	 * Cell height DEFAULT 0 (expressed in points)
56	 * The starting height of this cell. If the text wraps the height will automatically be adjusted.
57	 *
58	 * @var int
59	 */
60	public $height;
61	/**
62	 * Left position in user units (X-position). Default is the current position
63	 *
64	 * @var mixed
65	 */
66	public $left;
67	/**
68	 * Indicates where the current position should go after the call. Possible values are:<ul><li>0: to the right [DEFAULT]</li><li>1: to the beginning of the next line</li><li>2: below</li></ul>
69	 *
70	 * @var int
71	 */
72	public $newline;
73	/**
74	 * The name of the Style that should be used to render the text.
75	 *
76	 * @var string
77	 */
78	public $styleName;
79	/**
80	 * Stretch carachter mode: <ul><li>0 = disabled (default)</li><li>1 = horizontal scaling only if necessary</li><li>2 = forced horizontal scaling</li><li>3 = character spacing only if necessary</li><li>4 = forced character spacing</li></ul>
81	 *
82	 * @var int
83	 */
84	public $stretch;
85	/**
86	 * Text color in HTML code
87	 *
88	 * @var string
89	 */
90	public $tcolor;
91	/**
92	 * Top position in user units (Y-position). Default is the current position
93	 *
94	 * @var mixed
95	 */
96	public $top;
97	/**
98	 * URL address
99	 *
100	 * @var string
101	 */
102	public $url;
103	/**
104	 * Cell width DEFAULT 0 (expressed in points)
105	 * Setting the width to 0 will make it the width from the current location to the right margin.
106	 *
107	 * @var int
108	 */
109	public $width;
110
111	/** @var int Unknown */
112	public $reseth;
113
114	/**
115	 * CELL - Element
116	 *
117	 * @param int    $width   cell width (expressed in points)
118	 * @param int    $height  cell height (expressed in points)
119	 * @param mixed  $border  Border style
120	 * @param string $align   Text alignement
121	 * @param string $bgcolor Background color code
122	 * @param string $style   The name of the text style
123	 * @param int    $ln      Indicates where the current position should go after the call
124	 * @param mixed  $top     Y-position
125	 * @param mixed  $left    X-position
126	 * @param int    $fill    Indicates if the cell background must be painted (1) or transparent (0). Default value: 0.
127	 * @param int $stretch Stretch carachter mode
128	 * @param string $bocolor Border color
129	 * @param string $tcolor  Text color
130	 * @param        $reseth
131	 */
132	public function __construct(
133		$width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth
134	) {
135		$this->align     = $align;
136		$this->border    = $border;
137		$this->bgcolor   = $bgcolor;
138		$this->bocolor   = $bocolor;
139		$this->fill      = $fill;
140		$this->height    = $height;
141		$this->left      = $left;
142		$this->newline   = $ln;
143		$this->styleName = $style;
144		$this->text      = '';
145		$this->tcolor    = $tcolor;
146		$this->top       = $top;
147		$this->url       = '';
148		$this->stretch   = $stretch;
149		$this->width     = $width;
150		$this->reseth    = $reseth;
151
152		return 0;
153	}
154
155	/**
156	 * Get the cell height
157	 *
158	 * @param $renderer
159	 *
160	 * @return float
161	 */
162	public function getHeight($renderer) {
163		return $this->height;
164	}
165
166	/**
167	 * Sets the current cells URL
168	 *
169	 * @param string $url The URL address to save
170	 *
171	 * @return int
172	 */
173	public function setUrl($url) {
174		$this->url = $url;
175
176		return 0;
177	}
178
179	/**
180	 * Get the cell width
181	 *
182	 * @param $renderer
183	 *
184	 * @return float
185	 */
186	public function getWidth($renderer) {
187		return $this->width;
188	}
189}
190