1<?php 2 3/** 4 * webtrees: online genealogy 5 * Copyright (C) 2019 webtrees development team 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17declare(strict_types=1); 18 19namespace Fisharebest\Webtrees\Report; 20 21/** 22 * Class ReportBaseTextbox 23 */ 24class ReportBaseTextbox extends ReportBaseElement 25{ 26 /** 27 * Array of elements in the TextBox 28 * 29 * @var ReportBaseElement[]|string[] 30 */ 31 public $elements = []; 32 33 /** 34 * Background color in HTML code 35 * 36 * @var string 37 */ 38 public $bgcolor; 39 /** 40 * Whether or not paint the background 41 * 42 * @var bool 43 */ 44 public $fill; 45 46 /** 47 * Position the left corner of this box on the page(expressed in points). The default is the current position. 48 * 49 * @var float 50 */ 51 public $left; 52 /** 53 * Position the top corner of this box on the page(expressed in points). the default is the current position 54 * 55 * @var float 56 */ 57 public $top; 58 /** 59 * After this box is finished rendering, should the next section of text start immediately after the this box or should it start on a new line under this box. 0 = no new line, 1 = force new line. Default is 0 60 * 61 * @var bool 62 */ 63 public $newline; 64 65 /** @var bool Unused? */ 66 public $pagecheck; 67 68 /** @var bool Whether to print a border */ 69 public $border; 70 71 /** 72 * Style of rendering 73 * 74 * <ul> 75 * <li>D or empty string: Draw (default).</li> 76 * <li>F: Fill.</li> 77 * <li>DF or FD: Draw and fill.</li> 78 * <li>CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).</li> 79 *<li>CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).</li> 80 * </ul> 81 * 82 * @var string 83 */ 84 public $style; 85 86 /** 87 * @var array Border style of rectangle. Array with keys among the following: 88 * <ul> 89 * <li>all: Line style of all borders. Array like for {@link SetLineStyle SetLineStyle}.</li> 90 * <li>L, T, R, B or combinations: Line style of left, top, right or bottom border. Array like for {@link SetLineStyle SetLineStyle}.</li> 91 * </ul> 92 * Not yet in use 93 * var $borderstyle; 94 */ 95 96 /** 97 * The starting height of this cell. If the text wraps the height will automatically be adjusted 98 * 99 * @var float 100 */ 101 public $height; 102 /** 103 * Setting the width to 0 will make it the width from the current location to the right margin 104 * 105 * @var float 106 */ 107 public $width; 108 /** 109 * Use cell padding or not 110 * 111 * @var bool 112 */ 113 public $padding; 114 /** 115 * Resets this box last height after it’s done 116 */ 117 public $reseth; 118 119 /** 120 * TextBox - Element - Base 121 * 122 * @param float $width Text box width 123 * @param float $height Text box height 124 * @param bool $border 125 * @param string $bgcolor Background color code in HTML 126 * @param bool $newline 127 * @param float $left 128 * @param float $top 129 * @param bool $pagecheck 130 * @param string $style 131 * @param bool $fill 132 * @param bool $padding 133 * @param bool $reseth 134 */ 135 public function __construct($width, $height, $border, $bgcolor, $newline, $left, $top, $pagecheck, $style, $fill, $padding, $reseth) 136 { 137 $this->border = $border; 138 $this->bgcolor = $bgcolor; 139 $this->fill = $fill; 140 $this->height = $height; 141 $this->left = $left; 142 $this->newline = $newline; 143 $this->pagecheck = $pagecheck; 144 $this->style = $style; 145 $this->top = $top; 146 $this->width = $width; 147 $this->padding = $padding; 148 $this->reseth = $reseth; 149 } 150 151 /** 152 * Add an element to the TextBox 153 * 154 * @param ReportBaseElement|string $element 155 * 156 * @return void 157 */ 158 public function addElement($element) 159 { 160 $this->elements[] = $element; 161 } 162} 163