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