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