xref: /webtrees/app/Report/ReportBaseTextbox.php (revision fcfa147e10aaa6c7ff580c29bd6e5b88666befc1)
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 */
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 ReportBaseElement[]|string[]
31     */
32    public $elements = [];
33
34    /**
35     *  Background color in HTML code
36     *
37     * @var string
38     */
39    public $bgcolor;
40    /**
41     * Whether or not paint the background
42     *
43     * @var bool
44     */
45    public $fill;
46
47    /**
48     * Position the left corner of this box on the page(expressed in points). The default is the current position.
49     *
50     * @var float
51     */
52    public $left;
53    /**
54     * Position the top corner of this box on the page(expressed in points). the default is the current position
55     *
56     * @var float
57     */
58    public $top;
59    /**
60     * 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
61     *
62     * @var bool
63     */
64    public $newline;
65
66    /** @var bool Unused? */
67    public $pagecheck;
68
69    /** @var bool Whether to print a border */
70    public $border;
71
72    /**
73     * Style of rendering
74     *
75     * <ul>
76     * <li>D or empty string: Draw (default).</li>
77     * <li>F: Fill.</li>
78     * <li>DF or FD: Draw and fill.</li>
79     * <li>CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).</li>
80     *<li>CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).</li>
81     * </ul>
82     *
83     * @var string
84     */
85    public $style;
86
87    /**
88     * @var array Border style of rectangle. Array with keys among the following:
89     * <ul>
90     * <li>all: Line style of all borders. Array like for {@link SetLineStyle SetLineStyle}.</li>
91     * <li>L, T, R, B or combinations: Line style of left, top, right or bottom border. Array like for {@link SetLineStyle SetLineStyle}.</li>
92     * </ul>
93     * Not yet in use
94     * var $borderstyle;
95     */
96
97    /**
98     * The starting height of this cell. If the text wraps the height will automatically be adjusted
99     *
100     * @var float
101     */
102    public $height;
103    /**
104     * Setting the width to 0 will make it the width from the current location to the right margin
105     *
106     * @var float
107     */
108    public $width;
109    /**
110     * Use cell padding or not
111     *
112     * @var bool
113     */
114    public $padding;
115    /**
116     * Resets this box last height after it’s done
117     */
118    public $reseth;
119
120    /**
121     * TextBox - Element - Base
122     *
123     * @param float  $width   Text box width
124     * @param float  $height  Text box height
125     * @param bool   $border
126     * @param string $bgcolor Background color code in HTML
127     * @param bool   $newline
128     * @param float  $left
129     * @param float  $top
130     * @param bool   $pagecheck
131     * @param string $style
132     * @param bool   $fill
133     * @param bool   $padding
134     * @param bool   $reseth
135     */
136    public function __construct($width, $height, $border, $bgcolor, $newline, $left, $top, $pagecheck, $style, $fill, $padding, $reseth)
137    {
138        $this->border    = $border;
139        $this->bgcolor   = $bgcolor;
140        $this->fill      = $fill;
141        $this->height    = $height;
142        $this->left      = $left;
143        $this->newline   = $newline;
144        $this->pagecheck = $pagecheck;
145        $this->style     = $style;
146        $this->top       = $top;
147        $this->width     = $width;
148        $this->padding   = $padding;
149        $this->reseth    = $reseth;
150    }
151
152    /**
153     * Add an element to the TextBox
154     *
155     * @param ReportBaseElement|string $element
156     *
157     * @return void
158     */
159    public function addElement($element)
160    {
161        $this->elements[] = $element;
162    }
163}
164