1a25f0a04SGreg Roach<?php 23976b470SGreg Roach 3a25f0a04SGreg Roach/** 4a25f0a04SGreg Roach * webtrees: online genealogy 58fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team 6a25f0a04SGreg Roach * This program is free software: you can redistribute it and/or modify 7a25f0a04SGreg Roach * it under the terms of the GNU General Public License as published by 8a25f0a04SGreg Roach * the Free Software Foundation, either version 3 of the License, or 9a25f0a04SGreg Roach * (at your option) any later version. 10a25f0a04SGreg Roach * This program is distributed in the hope that it will be useful, 11a25f0a04SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 12a25f0a04SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13a25f0a04SGreg Roach * GNU General Public License for more details. 14a25f0a04SGreg Roach * You should have received a copy of the GNU General Public License 15a25f0a04SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 16a25f0a04SGreg Roach */ 17fcfa147eSGreg Roach 18e7f56f2aSGreg Roachdeclare(strict_types=1); 19e7f56f2aSGreg Roach 2076692c8bSGreg Roachnamespace Fisharebest\Webtrees\Report; 21a25f0a04SGreg Roach 22a25f0a04SGreg Roach/** 23a25f0a04SGreg Roach * Class ReportBaseCell 24a25f0a04SGreg Roach */ 25c1010edaSGreg Roachclass ReportBaseCell extends ReportBaseElement 26c1010edaSGreg Roach{ 27a25f0a04SGreg Roach /** 28a25f0a04SGreg Roach * 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> 29a25f0a04SGreg Roach * 30a25f0a04SGreg Roach * @var string 31a25f0a04SGreg Roach */ 327a6ee1acSGreg Roach public $align = ''; 33a25f0a04SGreg Roach /** 34a25f0a04SGreg Roach * Whether or not a border should be printed around this box. 0 = no border, 1 = border. Default is 0. 35a25f0a04SGreg Roach * 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> 36a25f0a04SGreg Roach * 37a25f0a04SGreg Roach * @var mixed 38a25f0a04SGreg Roach */ 39a25f0a04SGreg Roach public $border; 40a25f0a04SGreg Roach /** 41a25f0a04SGreg Roach * Border color in HTML code 42a25f0a04SGreg Roach * 43a25f0a04SGreg Roach * @var string 44a25f0a04SGreg Roach */ 45a25f0a04SGreg Roach public $bocolor; 46a25f0a04SGreg Roach /** 47a25f0a04SGreg Roach * The HTML color code to fill the background of this cell. 48a25f0a04SGreg Roach * 49a25f0a04SGreg Roach * @var string 50a25f0a04SGreg Roach */ 51a25f0a04SGreg Roach public $bgcolor; 52a25f0a04SGreg Roach /** 53a25f0a04SGreg Roach * Indicates if the cell background must be painted (1) or transparent (0). Default value: 1. 54a25f0a04SGreg Roach * If no background color is set then it will not be painted 55a25f0a04SGreg Roach * 56a25f0a04SGreg Roach * @var int 57a25f0a04SGreg Roach */ 58a25f0a04SGreg Roach public $fill; 59a25f0a04SGreg Roach /** 60a25f0a04SGreg Roach * Cell height DEFAULT 0 (expressed in points) 61a25f0a04SGreg Roach * The starting height of this cell. If the text wraps the height will automatically be adjusted. 62a25f0a04SGreg Roach * 638a4ee39cSGreg Roach * @var float 64a25f0a04SGreg Roach */ 65a25f0a04SGreg Roach public $height; 66a25f0a04SGreg Roach /** 67a25f0a04SGreg Roach * Left position in user units (X-position). Default is the current position 68a25f0a04SGreg Roach * 69a25f0a04SGreg Roach * @var mixed 70a25f0a04SGreg Roach */ 71a25f0a04SGreg Roach public $left; 72a25f0a04SGreg Roach /** 73a25f0a04SGreg Roach * 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> 74a25f0a04SGreg Roach * 75a25f0a04SGreg Roach * @var int 76a25f0a04SGreg Roach */ 77a25f0a04SGreg Roach public $newline; 78a25f0a04SGreg Roach /** 79a25f0a04SGreg Roach * The name of the Style that should be used to render the text. 80a25f0a04SGreg Roach * 81a25f0a04SGreg Roach * @var string 82a25f0a04SGreg Roach */ 83a25f0a04SGreg Roach public $styleName; 84a25f0a04SGreg Roach /** 85a25f0a04SGreg Roach * 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> 86a25f0a04SGreg Roach * 87a25f0a04SGreg Roach * @var int 88a25f0a04SGreg Roach */ 89a25f0a04SGreg Roach public $stretch; 90a25f0a04SGreg Roach /** 91a25f0a04SGreg Roach * Text color in HTML code 92a25f0a04SGreg Roach * 93a25f0a04SGreg Roach * @var string 94a25f0a04SGreg Roach */ 95a25f0a04SGreg Roach public $tcolor; 96a25f0a04SGreg Roach /** 97a25f0a04SGreg Roach * Top position in user units (Y-position). Default is the current position 98a25f0a04SGreg Roach * 99a25f0a04SGreg Roach * @var mixed 100a25f0a04SGreg Roach */ 101a25f0a04SGreg Roach public $top; 102a25f0a04SGreg Roach /** 103a25f0a04SGreg Roach * URL address 104a25f0a04SGreg Roach * 105a25f0a04SGreg Roach * @var string 106a25f0a04SGreg Roach */ 107a25f0a04SGreg Roach public $url; 108a25f0a04SGreg Roach /** 109a25f0a04SGreg Roach * Cell width DEFAULT 0 (expressed in points) 110a25f0a04SGreg Roach * Setting the width to 0 will make it the width from the current location to the right margin. 111a25f0a04SGreg Roach * 1128a4ee39cSGreg Roach * @var float 113a25f0a04SGreg Roach */ 114a25f0a04SGreg Roach public $width; 115a25f0a04SGreg Roach 1168a4ee39cSGreg Roach /** @var bool */ 117a25f0a04SGreg Roach public $reseth; 118a25f0a04SGreg Roach 119a25f0a04SGreg Roach /** 120a25f0a04SGreg Roach * CELL - Element 121a25f0a04SGreg Roach * 122cbc1590aSGreg Roach * @param int $width cell width (expressed in points) 123cbc1590aSGreg Roach * @param int $height cell height (expressed in points) 124a25f0a04SGreg Roach * @param mixed $border Border style 125a25f0a04SGreg Roach * @param string $align Text alignement 126a25f0a04SGreg Roach * @param string $bgcolor Background color code 127a25f0a04SGreg Roach * @param string $style The name of the text style 128cbc1590aSGreg Roach * @param int $ln Indicates where the current position should go after the call 129a25f0a04SGreg Roach * @param mixed $top Y-position 130a25f0a04SGreg Roach * @param mixed $left X-position 131cbc1590aSGreg Roach * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. 132cbc1590aSGreg Roach * @param int $stretch Stretch carachter mode 133a25f0a04SGreg Roach * @param string $bocolor Border color 134a25f0a04SGreg Roach * @param string $tcolor Text color 1358a4ee39cSGreg Roach * @param bool $reseth 136a25f0a04SGreg Roach */ 137*b6f35a76SGreg Roach public function __construct( 138*b6f35a76SGreg Roach $width, 139*b6f35a76SGreg Roach $height, 140*b6f35a76SGreg Roach $border, 141*b6f35a76SGreg Roach $align, 142*b6f35a76SGreg Roach string $bgcolor, 143*b6f35a76SGreg Roach string $style, 144*b6f35a76SGreg Roach int $ln, 145*b6f35a76SGreg Roach $top, 146*b6f35a76SGreg Roach $left, 147*b6f35a76SGreg Roach int $fill, 148*b6f35a76SGreg Roach int $stretch, 149*b6f35a76SGreg Roach string $bocolor, 150*b6f35a76SGreg Roach string $tcolor, 151*b6f35a76SGreg Roach bool $reseth 152*b6f35a76SGreg Roach ) { 153a25f0a04SGreg Roach $this->align = $align; 154a25f0a04SGreg Roach $this->border = $border; 155a25f0a04SGreg Roach $this->bgcolor = $bgcolor; 156a25f0a04SGreg Roach $this->bocolor = $bocolor; 157a25f0a04SGreg Roach $this->fill = $fill; 158a25f0a04SGreg Roach $this->height = $height; 159a25f0a04SGreg Roach $this->left = $left; 160a25f0a04SGreg Roach $this->newline = $ln; 161a25f0a04SGreg Roach $this->styleName = $style; 1627a6ee1acSGreg Roach $this->text = ''; 163a25f0a04SGreg Roach $this->tcolor = $tcolor; 164a25f0a04SGreg Roach $this->top = $top; 1657a6ee1acSGreg Roach $this->url = ''; 166a25f0a04SGreg Roach $this->stretch = $stretch; 167a25f0a04SGreg Roach $this->width = $width; 168a25f0a04SGreg Roach $this->reseth = $reseth; 169a25f0a04SGreg Roach } 170a25f0a04SGreg Roach 171a25f0a04SGreg Roach /** 172a25f0a04SGreg Roach * Get the cell height 173a25f0a04SGreg Roach * 174*b6f35a76SGreg Roach * @param HtmlRenderer|PdfRenderer $renderer 175a25f0a04SGreg Roach * 176a25f0a04SGreg Roach * @return float 177a25f0a04SGreg Roach */ 1788f53f488SRico Sonntag public function getHeight($renderer): float 179c1010edaSGreg Roach { 180a25f0a04SGreg Roach return $this->height; 181a25f0a04SGreg Roach } 182a25f0a04SGreg Roach 183a25f0a04SGreg Roach /** 184a25f0a04SGreg Roach * Sets the current cells URL 185a25f0a04SGreg Roach * 186a25f0a04SGreg Roach * @param string $url The URL address to save 187a25f0a04SGreg Roach * 188589feda3SGreg Roach * @return void 189a25f0a04SGreg Roach */ 190*b6f35a76SGreg Roach public function setUrl($url): void 191c1010edaSGreg Roach { 192a25f0a04SGreg Roach $this->url = $url; 193a25f0a04SGreg Roach } 194a25f0a04SGreg Roach 195a25f0a04SGreg Roach /** 196a25f0a04SGreg Roach * Get the cell width 197a25f0a04SGreg Roach * 198*b6f35a76SGreg Roach * @param HtmlRenderer|PdfRenderer $renderer 199a25f0a04SGreg Roach * 2008ba2e626SGreg Roach * @return float|array 201a25f0a04SGreg Roach */ 2028ba2e626SGreg Roach public function getWidth($renderer) 203c1010edaSGreg Roach { 204a25f0a04SGreg Roach return $this->width; 205a25f0a04SGreg Roach } 206a25f0a04SGreg Roach} 207