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

Source for file Heading.php

Documentation is available at Heading.php

  1. <?php
  2.  
  3. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  4.  
  5. /*
  6.  * Created on 19. Jan. 2007 by Norman Markgraf (nmarkgraf(at)user.sourceforge.net)
  7.  */
  8.  
  9. /**
  10.  * Paragraph class file.
  11.  * 
  12.  * PHP versions 5
  13.  *   
  14.  * LICENSE:
  15.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  16.  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  17.  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  18.  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  19.  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  20.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  21.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  22.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  23.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  25.  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26.  *
  27.  * This software consists of voluntary contributions made by many individuals
  28.  * and is licensed under the GPL. For more information please see
  29.  * <http://opendocumentphp.org>.
  30.  * 
  31.  * $Id: Heading.php 250 2007-07-31 08:52:06Z nmarkgraf $
  32.  * 
  33.  * @category    File Formats
  34.  * @package     OpenDocumentPHP
  35.  * @subpackage  content_body_text
  36.  * @author      Norman Markgraf (nmarkgraf(at)user.sourceforge.net)
  37.  * @copyright   Copyright in 2006, 2007 by The OpenDocumentPHP Team
  38.  * @license     http://www.gnu.org/licenses/gpl.html GNU General Public License 2.0.
  39.  * @version     SVN: $Id: Heading.php 250 2007-07-31 08:52:06Z nmarkgraf $
  40.  * @link        http://opendocumentphp.org
  41.  * @since       0.5.0 - 08. Feb. 2007
  42.  */
  43.  
  44. /**
  45.  * 
  46.  */
  47. require_once 'OpenDocumentPHP/content/body/text/Paragraph.php';
  48.  
  49. /**
  50.  * Heading class extends Paragraph class.
  51.  *  
  52.  * @category    File Formats
  53.  * @package     OpenDocumentPHP
  54.  * @subpackage  content_body_text
  55.  * @author      Norman Markgraf (nmarkgraf(at)user.sourceforge.net)
  56.  * @copyright   Copyright in 2006, 2007 by The OpenDocumentPHP Team
  57.  * @license     http://www.gnu.org/licenses/gpl.html GNU General Public License 2.0.
  58.  * @version     Release: @package_version@
  59.  * @link        http://opendocumentphp.org
  60.  * @since         0.5.0 - 08. Feb. 2007
  61.  */
  62. class Heading extends Paragraph 
  63. {
  64.     /**
  65.      * Constructor method.
  66.      * 
  67.      * @since       0.5.2 - 26. Feb. 2007
  68.      */
  69.     function __construct($elem=null
  70.     {         
  71.         if (is_null($elem)) {
  72.            parent::__construct('text:h'''self::TEXT);
  73.         else {
  74.            parent::__construct($elem);         
  75.         }   
  76.     }
  77.  
  78.     /* ------------- */
  79.     /* Heading Level */
  80.     /* ------------- */
  81.     /**
  82.      * Set heading level ('text:outline-level') attribute.
  83.      * 
  84.      * @access         public
  85.      * @since         0.5.0 - 08. Feb. 2007
  86.      * @param         int $level A positive integer for the new heading level.
  87.      */
  88.     function setHeadingLevel($level
  89.     {
  90.         $ret false;        
  91.         $level = (int) $level;
  92.         if (Validator::isPositiveInteger($level)) {
  93.                 $this->setAttributeNS(self :: TEXT'text:outline-level'$level);
  94.                 $ret true;    
  95.         }
  96.         return $ret;
  97.     }
  98.     
  99.     /**
  100.      * Retrieve heading level ('text:outline-level') attribute.
  101.      * 
  102.      * @access         public
  103.      * @since         0.5.0 - 08. Feb. 2007
  104.      * @return        int The heading/outline level as a positive integer.
  105.      */
  106.     function getHeadingLevel(
  107.     {
  108.         $ret 1;
  109.         $tmp $this->getAttributeNS(self :: TEXT'outline-level');
  110.         if ($tmp !== false{
  111.             $ret = (int) tmp;
  112.         }
  113.         return $ret;
  114.     }
  115.     
  116.     /* ----------------- */
  117.     /* Heading Numbering */
  118.     /* ----------------- */
  119.     /**
  120.      * 
  121.      * @access         public
  122.      * @since         0.5.0 - 08. Feb. 2007
  123.      */
  124.     function setRestartNumbering(
  125.     {
  126.         $this->setAttributeNS(self :: TEXT'text:restart-numbering''true');
  127.     }
  128.     
  129.     /**
  130.      * 
  131.      * @access         public
  132.      * @since         0.5.0 - 08. Feb. 2007
  133.      */
  134.     function unSetRestartNumbering(
  135.     {
  136.         $this->setAttributeNS(self :: TEXT'text:restart-numbering''false');
  137.     }
  138.     
  139.     /**
  140.      * 
  141.      * @access         public
  142.      * @since         0.5.0 - 08. Feb. 2007
  143.      */
  144.     function getRestartNumbering(
  145.     {
  146.         $ret false;
  147.         $tmp $this->getAttributeNS(self :: TEXT'restart-numbering');
  148.         if ($tmp !== false || $tmp != 'false'{
  149.             $ret true;
  150.         }
  151.         return $ret;
  152.     }
  153.     
  154.     /* ----------- */
  155.     /* Start Value */
  156.     /* ----------- */
  157.     /**
  158.      * 
  159.      * @access         public
  160.      * @since         0.5.0 - 08. Feb. 2007
  161.      * @todo        Use Validate class here.
  162.      */
  163.     function setStartValue($startValue
  164.     {
  165.         $ret false;
  166.         $startValue = (int) $startValue;
  167.         if (is_integer($startValue)) {
  168.             if ($startValue >= 0{
  169.                 $this->setAttributeNS(self :: TEXT'text:start-value'$startValue);
  170.                 $ret true;
  171.             }
  172.         }
  173.         return $ret;
  174.     }
  175.     
  176.     /**
  177.      * 
  178.      * @access         public
  179.      * @since         0.5.0 - 08. Feb. 2007
  180.      */
  181.     function getStartValue(
  182.     {
  183.         $ret false;
  184.         $tmp $this->getAttributeNS(self :: TEXT'start-value');
  185.         if ($tmp !== false{
  186.             $ret = (int) tmp;
  187.         }
  188.         return $ret;
  189.     }
  190.     
  191.     /* ------------------------ */
  192.     /* Supress Heading Numering */
  193.     /* ------------------------ */
  194.     /**
  195.      * Supress Header Numbering.
  196.      * 
  197.      * It is sometimes desired to have a specific heading which should not be numbered.
  198.      * 
  199.      * @access         public
  200.      * @since         0.5.0 - 08. Feb. 2007
  201.      */
  202.     function setIsListHeader(
  203.     {
  204.         $this->setAttributeNS(self :: TEXT'text:is-list-header''true');
  205.     }
  206.     
  207.     /**
  208.      * 
  209.      * @access         public
  210.      * @since         0.5.0 - 08. Feb. 2007
  211.      */
  212.     function unSetIsListHeader(
  213.     {
  214.         $this->setAttributeNS(self :: TEXT'text:is-list-header''false');
  215.     }
  216.     
  217.     /**
  218.      * 
  219.      * @access         public
  220.      * @since         0.5.0 - 08. Feb. 2007
  221.      */
  222.     function getIsListHeader(
  223.     {
  224.         $ret false;
  225.         $tmp $this->getAttributeNS(self :: TEXT'is-list-header');
  226.         if ($tmp !== false || $tmp != 'false'{
  227.             $ret true;
  228.         }
  229.         return $ret;
  230.     }
  231.     /* ------------------------ */
  232.     /* Formatted Heading Number */
  233.     /* ------------------------ */
  234. }
  235. ?>

Documentation generated on Wed, 18 Jun 2008 06:29:08 +0200 by phpDocumentor 1.3.2