1<?php
2
3require_once DOKU_PLUGIN.'odt/ODT/elements/ODTStateElement.php';
4
5/**
6 * ODTElementParagraph:
7 * Class for handling the paragraph element.
8 *
9 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
10 * @author  LarsDW223
11 */
12class ODTElementParagraph extends ODTStateElement
13{
14    /**
15     * Constructor.
16     */
17    public function __construct($style_name=NULL) {
18        parent::__construct();
19        $this->setClass ('paragraph');
20        if ($style_name != NULL) {
21            $this->setStyleName ($style_name);
22        }
23    }
24
25    /**
26     * Return the elements name.
27     *
28     * @return string The ODT XML element name.
29     */
30    public function getElementName () {
31        return ('text:p');
32    }
33
34    /**
35     * Return string with encoded opening tag.
36     *
37     * @return string The ODT XML code to open this element.
38     */
39    public function getOpeningTag () {
40        return '<text:p text:style-name="'.$this->getStyleName().'">';
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 '</text:p>';
50    }
51
52    /**
53     * Are we in a paragraph or not?
54     * As a paragraph we are of course.
55     *
56     * @return boolean
57     */
58    public function getInParagraph() {
59        return true;
60    }
61
62    /**
63     * Determine and set the parent for this element.
64     * As a paragraph 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