OpenDocumentPHP
[ class tree: OpenDocumentPHP ] [ index: OpenDocumentPHP ] [ all elements ]

Source for file Paragraph.php

Documentation is available at Paragraph.php

  1. <?php
  2. /*
  3.  * Created on 19.01.2007 by Norman Markgraf (nmarkgraf(at)user.sourceforge.net)
  4.  *
  5.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  6.  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  7.  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  8.  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  9.  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  10.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  11.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  12.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  13.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  14.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  15.  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  16.  *
  17.  * This software consists of voluntary contributions made by many individuals
  18.  * and is licensed under the GPL. For more information please see
  19.  * <http://opendocumentphp.org>.
  20.  * 
  21.  * $Id: Paragraph.php 145 2007-03-04 12:43:08Z nmarkgraf $
  22.  */
  23. require_once 'OpenDocumentPHP/util/ElementFragment.php';
  24. /**
  25.  * Paragraph class.
  26.  * 
  27.  * @author         Norman Markgraf (nmarkgraf(at)user.sourceforge.net)
  28.  * @copyright     Copyright in 2006, 2007 by The OpenDocumentPHP Team
  29.  * @license     http://www.gnu.org/licenses/gpl.html GNU General Public License 2.0.
  30.  * @version        $Revision: 145 $
  31.  * @package        OpenDocumentPHP
  32.  * @subpackage  content_body_text
  33.  * @since         0.5.0 - 08.02.2007
  34.  */
  35. class Paragraph extends ElementFragment {
  36.     /**
  37.      * Set element to 'text:p'.
  38.      * 
  39.      * @access         protected
  40.      * @since         0.5.0 - 08.02.2007
  41.      */
  42.     protected function __setRoot({
  43.         $this->root = $this->domFragment->createElementNS(self :: TEXT'text:p');
  44.     }
  45.     /* -- */
  46.     /* ID */
  47.     /* -- */
  48.     /**
  49.      * 
  50.      * @access         public
  51.      * @since         0.5.0 - 08.02.2007
  52.      */
  53.     function setId($id{
  54.         $this->setAttributeNS(self :: TEXT'text:id'$id);
  55.     }
  56.     /**
  57.      * 
  58.      * @access         public
  59.      * @since         0.5.0 - 08.02.2007
  60.      */
  61.     function getId({
  62.         return $this->getAttributeNS(self :: TEXT'id');
  63.     }
  64.     /* ---------- */
  65.     /* Style Name */
  66.     /* ---------- */
  67.     /**
  68.      * 
  69.      * @access         public
  70.      * @since         0.5.0 - 08.02.2007
  71.      */
  72.     function setStyleName($name{
  73.         $this->setAttributeNS(self :: TEXT'text:style-name'$name);
  74.     }
  75.     /**
  76.      * 
  77.      * @access         public
  78.      * @since         0.5.0 - 08.02.2007
  79.      */
  80.     function getStyleName({
  81.         return $this->getAttributeNS(self :: TEXT'style-name');
  82.     }
  83.     /* ---------- */
  84.     /* Class Name */
  85.     /* ---------- */
  86.     /**
  87.      * 
  88.      * @access         public
  89.      * @since         0.5.0 - 08.02.2007
  90.      */
  91.     function setClassNames($names{
  92.         $this->setAttributeNS(self :: TEXT'text:class-names'$names);
  93.     }
  94.     /**
  95.      * 
  96.      * @access         public
  97.      * @since         0.5.0 - 08.02.2007
  98.      */
  99.     function getClassNames({
  100.         return $this->getAttributeNS(self :: TEXT'class-names');
  101.     }
  102.     /* --------------- */
  103.     /* Cond Style Name */
  104.     /* --------------- */
  105.     /**
  106.      * 
  107.      * @access         public
  108.      * @since         0.5.0 - 08.02.2007
  109.      */
  110.     function setCondStyleName($name{
  111.         $this->setAttributeNS(self :: TEXT'text:cond-style-name'$name);
  112.     }
  113.     /**
  114.      * 
  115.      * @access         public
  116.      * @since         0.5.0 - 08.02.2007
  117.      */
  118.     function getCondStyleName({
  119.         return $this->getAttributeNS(self :: TEXT'cond-style-name');
  120.     }
  121.     /* ------ */
  122.     /* append */
  123.     /* ------ */
  124.     /**
  125.      * Append a text node or a DOMElement as a child to the current paragraph node.
  126.      * 
  127.      * @access         public
  128.      * @since         0.5.0 - 08.02.2007
  129.      * @param         mixed $content Eigther a text (as a string) or a child node
  130.      *                                 (as a DOMElement) which will be appended to the
  131.      *                              current paragraph node.
  132.      */
  133.     function append($content{
  134.         if (is_string($content)) {
  135.             $this->append($this->domFragment->createTextNode($content));
  136.         else {
  137.             $this->root->appendChild($content);
  138.         }
  139.     }
  140. }
  141. ?>

Documentation generated on Tue, 12 Jun 2007 10:00:33 +0200 by phpDocumentor 1.3.2