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