1a25f0a04SGreg Roach<?php 23976b470SGreg Roach 3a25f0a04SGreg Roach/** 4a25f0a04SGreg Roach * webtrees: online genealogy 5*d11be702SGreg Roach * Copyright (C) 2023 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 1589f7189bSGreg Roach * along with this program. If not, see <https://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 ReportBaseTextbox 24a25f0a04SGreg Roach */ 25c1010edaSGreg Roachclass ReportBaseTextbox extends ReportBaseElement 26c1010edaSGreg Roach{ 27a25f0a04SGreg Roach /** 28a25f0a04SGreg Roach * Array of elements in the TextBox 29a25f0a04SGreg Roach * 3077bab461SGreg Roach * @var array<ReportBaseElement|string> 31a25f0a04SGreg Roach */ 3277bab461SGreg Roach public array $elements = []; 33a25f0a04SGreg Roach 3477bab461SGreg Roach // Background color in HTML code 3577bab461SGreg Roach public string $bgcolor; 36a25f0a04SGreg Roach 3777bab461SGreg Roach // Whether to paint the background 3877bab461SGreg Roach public bool $fill; 39a25f0a04SGreg Roach 4077bab461SGreg Roach // Position the left corner of this box on the page(expressed in points). The default is the current position. 4177bab461SGreg Roach public float $left; 42a25f0a04SGreg Roach 4377bab461SGreg Roach // Position the top corner of this box on the page(expressed in points). the default is the current position 4477bab461SGreg Roach public float $top; 4576692c8bSGreg Roach 4677bab461SGreg Roach // After this box is finished rendering, should the next section of text start immediately after 4777bab461SGreg Roach // this box or should it start on a new line under this box. 0 = no new line, 1 = force new line. 4877bab461SGreg Roach public bool $newline; 49a25f0a04SGreg Roach 5077bab461SGreg Roach public bool $pagecheck; 5177bab461SGreg Roach 5277bab461SGreg Roach public bool $border; 5377bab461SGreg Roach 5477bab461SGreg Roach // Style of rendering 5577bab461SGreg Roach // D or empty string: Draw (default). 5677bab461SGreg Roach // F: Fill. 5777bab461SGreg Roach // DF or FD: Draw and fill. 5877bab461SGreg Roach // CEO: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path). 5977bab461SGreg Roach // CNZ: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path). 6077bab461SGreg Roach public string $style; 6177bab461SGreg Roach 6277bab461SGreg Roach // The starting height of this cell. If the text wraps the height will automatically be adjusted 6377bab461SGreg Roach public float $height; 6477bab461SGreg Roach 6577bab461SGreg Roach // Setting the width to 0 will make it the width from the current location to the right margin 6677bab461SGreg Roach public float $width; 6777bab461SGreg Roach 6877bab461SGreg Roach // Use cell padding or not 6977bab461SGreg Roach public bool $padding; 7077bab461SGreg Roach 7177bab461SGreg Roach // Resets this box last height after it’s done 7277bab461SGreg Roach public bool $reseth; 73a25f0a04SGreg Roach 74a25f0a04SGreg Roach /** 75a25f0a04SGreg Roach * TextBox - Element - Base 76a25f0a04SGreg Roach * 77a25f0a04SGreg Roach * @param float $width Text box width 78a25f0a04SGreg Roach * @param float $height Text box height 79cbc1590aSGreg Roach * @param bool $border 80a25f0a04SGreg Roach * @param string $bgcolor Background color code in HTML 81cbc1590aSGreg Roach * @param bool $newline 829dd0ac28SGreg Roach * @param float $left 839dd0ac28SGreg Roach * @param float $top 84cbc1590aSGreg Roach * @param bool $pagecheck 85a25f0a04SGreg Roach * @param string $style 86cbc1590aSGreg Roach * @param bool $fill 87cbc1590aSGreg Roach * @param bool $padding 88cbc1590aSGreg Roach * @param bool $reseth 89a25f0a04SGreg Roach */ 900947a64aSGreg Roach public function __construct( 910947a64aSGreg Roach float $width, 920947a64aSGreg Roach float $height, 930947a64aSGreg Roach bool $border, 940947a64aSGreg Roach string $bgcolor, 950947a64aSGreg Roach bool $newline, 960947a64aSGreg Roach float $left, 970947a64aSGreg Roach float $top, 980947a64aSGreg Roach bool $pagecheck, 990947a64aSGreg Roach string $style, 1000947a64aSGreg Roach bool $fill, 1010947a64aSGreg Roach bool $padding, 1020947a64aSGreg Roach bool $reseth 1030947a64aSGreg Roach ) { 104a25f0a04SGreg Roach $this->border = $border; 105a25f0a04SGreg Roach $this->bgcolor = $bgcolor; 106a25f0a04SGreg Roach $this->fill = $fill; 107a25f0a04SGreg Roach $this->height = $height; 108a25f0a04SGreg Roach $this->left = $left; 109a25f0a04SGreg Roach $this->newline = $newline; 110a25f0a04SGreg Roach $this->pagecheck = $pagecheck; 111a25f0a04SGreg Roach $this->style = $style; 112a25f0a04SGreg Roach $this->top = $top; 113a25f0a04SGreg Roach $this->width = $width; 114a25f0a04SGreg Roach $this->padding = $padding; 115a25f0a04SGreg Roach $this->reseth = $reseth; 116a25f0a04SGreg Roach } 117a25f0a04SGreg Roach 118a25f0a04SGreg Roach /** 119a25f0a04SGreg Roach * Add an element to the TextBox 120a25f0a04SGreg Roach * 1219dd0ac28SGreg Roach * @param ReportBaseElement|string $element 12218d7a90dSGreg Roach * 12318d7a90dSGreg Roach * @return void 124a25f0a04SGreg Roach */ 125b6f35a76SGreg Roach public function addElement($element): void 126c1010edaSGreg Roach { 127a25f0a04SGreg Roach $this->elements[] = $element; 128a25f0a04SGreg Roach } 129a25f0a04SGreg Roach} 130