xref: /webtrees/app/Report/ReportBaseCell.php (revision b78374c50ebb252fee5fd5a0776cef82b73f2bf3)
1<?php
2namespace Fisharebest\Webtrees;
3
4/**
5 * webtrees: online genealogy
6 * Copyright (C) 2015 webtrees development team
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * Class ReportBaseCell
21 */
22class ReportBaseCell extends ReportBaseElement {
23	/**
24	 * 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>
25	 *
26	 * @var string
27	 */
28	public $align = "";
29	/**
30	 * Whether or not a border should be printed around this box. 0 = no border, 1 = border. Default is 0.
31	 * 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>
32	 *
33	 * @var mixed
34	 */
35	public $border;
36	/**
37	 * Border color in HTML code
38	 *
39	 * @var string
40	 */
41	public $bocolor;
42	/**
43	 * The HTML color code to fill the background of this cell.
44	 *
45	 * @var string
46	 */
47	public $bgcolor;
48	/**
49	 * Indicates if the cell background must be painted (1) or transparent (0). Default value: 1.
50	 * If no background color is set then it will not be painted
51	 *
52	 * @var int
53	 */
54	public $fill;
55	/**
56	 * Cell height DEFAULT 0 (expressed in points)
57	 * The starting height of this cell. If the text wraps the height will automatically be adjusted.
58	 *
59	 * @var int
60	 */
61	public $height;
62	/**
63	 * Left position in user units (X-position). Default is the current position
64	 *
65	 * @var mixed
66	 */
67	public $left;
68	/**
69	 * 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>
70	 *
71	 * @var int
72	 */
73	public $newline;
74	/**
75	 * The name of the Style that should be used to render the text.
76	 *
77	 * @var string
78	 */
79	public $styleName;
80	/**
81	 * 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>
82	 *
83	 * @var int
84	 */
85	public $stretch;
86	/**
87	 * Text color in HTML code
88	 *
89	 * @var string
90	 */
91	public $tcolor;
92	/**
93	 * Top position in user units (Y-position). Default is the current position
94	 *
95	 * @var mixed
96	 */
97	public $top;
98	/**
99	 * URL address
100	 *
101	 * @var string
102	 */
103	public $url;
104	/**
105	 * Cell width DEFAULT 0 (expressed in points)
106	 * Setting the width to 0 will make it the width from the current location to the right margin.
107	 *
108	 * @var int
109	 */
110	public $width;
111
112	public $reseth;
113
114	/**
115	 * CELL - Element
116	 *
117	 * @param integer $width   cell width (expressed in points)
118	 * @param integer $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 integer $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 integer $fill    Indicates if the cell background must be painted (1) or transparent (0). Default value: 0.
127	 * @param integer $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	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 integer
172	 */
173	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	function getWidth($renderer) {
187		return $this->width;
188	}
189}
190