1<?php 2/** 3 * webtrees: online genealogy 4 * Copyright (C) 2018 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 /** 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 /** @var int Unknown */ 113 public $reseth; 114 115 /** 116 * CELL - Element 117 * 118 * @param int $width cell width (expressed in points) 119 * @param int $height cell height (expressed in points) 120 * @param mixed $border Border style 121 * @param string $align Text alignement 122 * @param string $bgcolor Background color code 123 * @param string $style The name of the text style 124 * @param int $ln Indicates where the current position should go after the call 125 * @param mixed $top Y-position 126 * @param mixed $left X-position 127 * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. 128 * @param int $stretch Stretch carachter mode 129 * @param string $bocolor Border color 130 * @param string $tcolor Text color 131 * @param $reseth 132 */ 133 public function __construct($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 { 164 return $this->height; 165 } 166 167 /** 168 * Sets the current cells URL 169 * 170 * @param string $url The URL address to save 171 * 172 * @return int 173 */ 174 public function setUrl($url) 175 { 176 $this->url = $url; 177 178 return 0; 179 } 180 181 /** 182 * Get the cell width 183 * 184 * @param $renderer 185 * 186 * @return float 187 */ 188 public function getWidth($renderer) 189 { 190 return $this->width; 191 } 192} 193