1<?php 2 3/** 4 * webtrees: online genealogy 5 * Copyright (C) 2022 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 <https://www.gnu.org/licenses/>. 16 */ 17 18declare(strict_types=1); 19 20namespace Fisharebest\Webtrees\Report; 21 22/** 23 * Class ReportBaseTextbox 24 */ 25class ReportBaseTextbox extends ReportBaseElement 26{ 27 /** 28 * Array of elements in the TextBox 29 * 30 * @var array<ReportBaseElement|string> 31 */ 32 public array $elements = []; 33 34 // Background color in HTML code 35 public string $bgcolor; 36 37 // Whether to paint the background 38 public bool $fill; 39 40 // Position the left corner of this box on the page(expressed in points). The default is the current position. 41 public float $left; 42 43 // Position the top corner of this box on the page(expressed in points). the default is the current position 44 public float $top; 45 46 // After this box is finished rendering, should the next section of text start immediately after 47 // this box or should it start on a new line under this box. 0 = no new line, 1 = force new line. 48 public bool $newline; 49 50 public bool $pagecheck; 51 52 public bool $border; 53 54 // Style of rendering 55 // D or empty string: Draw (default). 56 // F: Fill. 57 // DF or FD: Draw and fill. 58 // CEO: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path). 59 // CNZ: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path). 60 public string $style; 61 62 // The starting height of this cell. If the text wraps the height will automatically be adjusted 63 public float $height; 64 65 // Setting the width to 0 will make it the width from the current location to the right margin 66 public float $width; 67 68 // Use cell padding or not 69 public bool $padding; 70 71 // Resets this box last height after it’s done 72 public bool $reseth; 73 74 /** 75 * TextBox - Element - Base 76 * 77 * @param float $width Text box width 78 * @param float $height Text box height 79 * @param bool $border 80 * @param string $bgcolor Background color code in HTML 81 * @param bool $newline 82 * @param float $left 83 * @param float $top 84 * @param bool $pagecheck 85 * @param string $style 86 * @param bool $fill 87 * @param bool $padding 88 * @param bool $reseth 89 */ 90 public function __construct( 91 float $width, 92 float $height, 93 bool $border, 94 string $bgcolor, 95 bool $newline, 96 float $left, 97 float $top, 98 bool $pagecheck, 99 string $style, 100 bool $fill, 101 bool $padding, 102 bool $reseth 103 ) { 104 $this->border = $border; 105 $this->bgcolor = $bgcolor; 106 $this->fill = $fill; 107 $this->height = $height; 108 $this->left = $left; 109 $this->newline = $newline; 110 $this->pagecheck = $pagecheck; 111 $this->style = $style; 112 $this->top = $top; 113 $this->width = $width; 114 $this->padding = $padding; 115 $this->reseth = $reseth; 116 } 117 118 /** 119 * Add an element to the TextBox 120 * 121 * @param ReportBaseElement|string $element 122 * 123 * @return void 124 */ 125 public function addElement($element): void 126 { 127 $this->elements[] = $element; 128 } 129} 130