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

Source for file Heading.php

Documentation is available at Heading.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: Heading.php 145 2007-03-04 12:43:08Z nmarkgraf $
  22.  */
  23. require_once 'OpenDocumentPHP/content/body/text/Paragraph.php';
  24. /**
  25.  * Heading class extends 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 - 02.08.2007
  34.  */
  35. class Heading extends Paragraph {
  36.     /**
  37.      * Set element to 'text:h'.
  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:h');
  44.     }
  45.     /* ------------- */
  46.     /* Heading Level */
  47.     /* ------------- */
  48.     /**
  49.      * Set heading level ('text:outline-level') attribute.
  50.      * 
  51.      * @access         public
  52.      * @since         0.5.0 - 08.02.2007
  53.      * @param         int $level A positive integer for the new heading level.
  54.      */
  55.     function setHeadingLevel($level{
  56.         $ret false;        
  57.         $level = (int) $level;
  58.         if (Validator::isPositiveInteger($level)) {
  59.                 $this->setAttributeNS(self :: TEXT'text:outline-level'$level);
  60.                 $ret true;    
  61.         }
  62.         return $ret;
  63.     }
  64.     /**
  65.      * Retrieve heading level ('text:outline-level') attribute.
  66.      * 
  67.      * @access         public
  68.      * @since         0.5.0 - 08.02.2007
  69.      * @return        int The heading/outline level as a positive integer.
  70.      */
  71.     function getHeadingLevel({
  72.         $ret 1;
  73.         $tmp $this->getAttributeNS(self :: TEXT'outline-level');
  74.         if ($tmp !== false{
  75.             $ret = (int) tmp;
  76.         }
  77.         return $ret;
  78.     }
  79.     /* ----------------- */
  80.     /* Heading Numbering */
  81.     /* ----------------- */
  82.     /**
  83.      * 
  84.      * @access         public
  85.      * @since         0.5.0 - 08.02.2007
  86.      */
  87.     function setRestartNumbering({
  88.         $this->setAttributeNS(self :: TEXT'text:restart-numbering''true');
  89.     }
  90.     /**
  91.      * 
  92.      * @access         public
  93.      * @since         0.5.0 - 08.02.2007
  94.      */
  95.     function unSetRestartNumbering({
  96.         $this->setAttributeNS(self :: TEXT'text:restart-numbering''false');
  97.     }
  98.     /**
  99.      * 
  100.      * @access         public
  101.      * @since         0.5.0 - 08.02.2007
  102.      */
  103.     function getRestartNumbering({
  104.         $ret false;
  105.         $tmp $this->getAttributeNS(self :: TEXT'restart-numbering');
  106.         if ($tmp !== false || $tmp != 'false'{
  107.             $ret true;
  108.         }
  109.         return $ret;
  110.     }
  111.     /* ----------- */
  112.     /* Start Value */
  113.     /* ----------- */
  114.     /**
  115.      * 
  116.      * @access         public
  117.      * @since         0.5.0 - 08.02.2007
  118.      */
  119.     function setStartValue($startValue{
  120.         $ret false;
  121.         $startValue = (int) $startValue;
  122.         if (is_integer($startValue)) {
  123.             if ($startValue >= 0{
  124.                 $this->setAttributeNS(self :: TEXT'text:start-value'$startValue);
  125.                 $ret true;
  126.             }
  127.         }
  128.         return $ret;
  129.     }
  130.     /**
  131.      * 
  132.      * @access         public
  133.      * @since         0.5.0 - 08.02.2007
  134.      */
  135.     function getStartValue({
  136.         $ret false;
  137.         $tmp $this->getAttributeNS(self :: TEXT'start-value');
  138.         if ($tmp !== false{
  139.             $ret = (int) tmp;
  140.         }
  141.         return $ret;
  142.     }
  143.     /* ------------------------ */
  144.     /* Supress Heading Numering */
  145.     /* ------------------------ */
  146.     /**
  147.      * Supress Header Numbering.
  148.      * 
  149.      * It is sometimes desired to have a specific heading which should not be numbered.
  150.      * 
  151.      * @access         public
  152.      * @since         0.5.0 - 08.02.2007
  153.      */
  154.     function setIsListHeader({
  155.         $this->setAttributeNS(self :: TEXT'text:is-list-header''true');
  156.     }
  157.     /**
  158.      * 
  159.      * @access         public
  160.      * @since         0.5.0 - 08.02.2007
  161.      */
  162.     function unSetIsListHeader({
  163.         $this->setAttributeNS(self :: TEXT'text:is-list-header''false');
  164.     }
  165.     /**
  166.      * 
  167.      * @access         public
  168.      * @since         0.5.0 - 08.02.2007
  169.      */
  170.     function getIsListHeader({
  171.         $ret false;
  172.         $tmp $this->getAttributeNS(self :: TEXT'is-list-header');
  173.         if ($tmp !== false || $tmp != 'false'{
  174.             $ret true;
  175.         }
  176.         return $ret;
  177.     }
  178.     /* ------------------------ */
  179.     /* Formatted Heading Number */
  180.     /* ------------------------ */
  181. }
  182. ?>

Documentation generated on Tue, 12 Jun 2007 09:59:58 +0200 by phpDocumentor 1.3.2