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