diff options
| author | Greg Roach <fisharebest@gmail.com> | 2015-02-01 00:01:36 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2015-02-02 17:34:31 +0000 |
| commit | a25f0a04682c4c39c1947220c90af4118c713952 (patch) | |
| tree | f7e9c2c630a50dd3e5dd76ce501dff4b1d8d4c26 /app/Report/ReportBaseText.php | |
| parent | 4d2a5476ceb1c11dc1fd146bfb0be077baa5fb01 (diff) | |
| download | webtrees-a25f0a04682c4c39c1947220c90af4118c713952.tar.gz webtrees-a25f0a04682c4c39c1947220c90af4118c713952.tar.bz2 webtrees-a25f0a04682c4c39c1947220c90af4118c713952.zip | |
Refactor classes to use namespaces, as per PSR-4. Replace GPL2 with GPL3.
Diffstat (limited to 'app/Report/ReportBaseText.php')
| -rw-r--r-- | app/Report/ReportBaseText.php | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/app/Report/ReportBaseText.php b/app/Report/ReportBaseText.php new file mode 100644 index 0000000000..c78b173c85 --- /dev/null +++ b/app/Report/ReportBaseText.php @@ -0,0 +1,86 @@ +<?php +namespace Webtrees; + +/** + * webtrees: online genealogy + * Copyright (C) 2015 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/** + * Class ReportBaseText + */ +class ReportBaseText extends ReportBaseElement { + /** + * Text color in HTML code + * + * @var string + */ + public $color; + /** + * Style name + * + * @var string + */ + public $styleName; + /** + * Remaining width of a cel + * + * @var integer User unit (points) + */ + public $wrapWidthRemaining; + /** + * Original width of a cell + * + * @var integer User unit (points) + */ + public $wrapWidthCell; + + /** + * Create a Text class - Base + * + * @param string $style The name of the text style + * @param string $color HTML color code + */ + function __construct($style, $color) { + $this->text = ''; + $this->color = $color; + $this->wrapWidthRemaining = 0; + $this->styleName = $style; + + return 0; + } + + /** + * @param $wrapwidth + * @param $cellwidth + * + * @return mixed + */ + function setWrapWidth($wrapwidth, $cellwidth) { + $this->wrapWidthCell = $cellwidth; + if (strpos($this->text, "\n") !== false) { + $this->wrapWidthRemaining = $cellwidth; + } else { + $this->wrapWidthRemaining = $wrapwidth; + } + + return $this->wrapWidthRemaining; + } + + /** + * @return string + */ + function getStyleName() { + return $this->styleName; + } +} |
