1<?php
2
3require_once DOKU_PLUGIN.'odt/ODT/elements/ODTStateElement.php';
4
5/**
6 * ODTElementTextBox:
7 * Class for handling the text box element.
8 *
9 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
10 * @author  LarsDW223
11 */
12class ODTElementTextBox extends ODTStateElement
13{
14    protected $attributes = NULL;
15
16    /**
17     * Constructor.
18     */
19    public function __construct() {
20        parent::__construct();
21        $this->setClass ('text-box');
22    }
23
24    /**
25     * Return the elements name.
26     *
27     * @return string The ODT XML element name.
28     */
29    public function getElementName () {
30        return ('draw:text-box');
31    }
32
33    /**
34     * Return string with encoded opening tag.
35     *
36     * @return string The ODT XML code to open this element.
37     */
38    public function getOpeningTag () {
39        $encoded =  '<draw:text-box '.$this->getAttributes().'>';
40        return $encoded;
41    }
42
43    /**
44     * Return string with encoded closing tag.
45     *
46     * @return string The ODT XML code to close this element.
47     */
48    public function getClosingTag () {
49        return '</draw:text-box>';
50    }
51
52    /**
53     * Are we in a paragraph or not?
54     * As a text box we are not.
55     *
56     * @return boolean
57     */
58    public function getInParagraph() {
59        return false;
60    }
61
62    /**
63     * Determine and set the parent for this element.
64     * As a text box the previous element is our parent.
65     *
66     * @param ODTStateElement $previous
67     */
68    public function determineParent(ODTStateElement $previous) {
69        $this->setParent($previous);
70    }
71
72    /**
73     * Set text box attributes
74     *
75     * @param array $value
76     */
77    public function setAttributes($value) {
78        $this->attributes = $value;
79    }
80
81    /**
82     * Get text box attributes
83     *
84     * @return array
85     */
86    public function getAttributes() {
87        return $this->attributes;
88    }
89}
90