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

Source for file Style.php

Documentation is available at Style.php

  1. <?php
  2. /*
  3.  * Created on 21.01.2007 by Norman Markgraf (nmarkgraf(at)user.sourceforge.net)
  4.  *
  5.  * PHP versions 5.2 or better.
  6.  *
  7.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  8.  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  9.  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  10.  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  11.  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  12.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  13.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  14.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  15.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  16.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  17.  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  18.  *
  19.  * This software consists of voluntary contributions made by many individuals
  20.  * and is licensed under the GPL. For more information please see
  21.  * <http://opendocumentphp.org>.
  22.  * 
  23.  * $Id: Style.php 256 2007-08-01 14:16:10Z nmarkgraf $
  24.  */
  25.  
  26. /**
  27.  * 
  28.  */
  29. require_once 'OpenDocumentPHP/styles/DefaultStyle.php';
  30. require_once 'OpenDocumentPHP/util/Validator.php';
  31.  
  32. /**
  33.  * Styles class.
  34.  * 
  35.  * @author         Norman Markgraf (nmarkgraf(at)user.sourceforge.net)
  36.  * @copyright     Copyright in 2006, 2007 by The OpenDocumentPHP Team
  37.  * @license     http://www.gnu.org/licenses/gpl.html GNU General Public License 2.0.
  38.  * @version        $Revision: 256 $
  39.  * @package        OpenDocumentPHP
  40.  * @since         0.5.0 - 08.02.2007
  41.  */
  42. class Style extends DefaultStyle {
  43.  
  44.     /**
  45.      * Constructor method.
  46.      * 
  47.      * @since       0.5.2 - 30. Feb. 2007
  48.      */
  49.     function __construct($elem=null$value=null$namespace=null
  50.     {         
  51.         if (is_null($elem)) {        
  52.             parent::__construct('style:style'''self::STYLE);
  53.         else {
  54.             if ($elem instanceof DOMElement{
  55.                 parent::__construct($elem);
  56.             else {
  57.                 parent::__construct($elem$value$namespace);         
  58.             }            
  59.         }   
  60.     }
  61.  
  62.     /* ---------- */
  63.     /* Style Name */
  64.     /* ---------- */
  65.     /**
  66.      * 
  67.      * 
  68.      * @access        public
  69.      * @since         0.5.0 - 08.02.2007
  70.      */
  71.     function setStyleName($name{
  72.         $this->putStyleAttribute('name'$name);
  73.     }
  74.     /**
  75.      * 
  76.      * 
  77.      * @access        public
  78.      * @since         0.5.0 - 08.02.2007
  79.      */
  80.     function getStyleName({
  81.         return $this->getStyleAttribute('name');
  82.     }
  83.     /* ------------ */
  84.     /* Display Name */
  85.     /* ------------ */
  86.     /**
  87.      * 
  88.      * 
  89.      * @access        public
  90.      * @since         0.5.0 - 08.02.2007
  91.      */
  92.     function setDisplayName($name{
  93.         $this->putStyleAttribute('display-name'$name);
  94.     }
  95.     /**
  96.      * 
  97.      * 
  98.      * @access        public
  99.      * @since         0.5.0 - 08.02.2007
  100.      */
  101.     function getDisplayName({
  102.         return $this->getStyleAttribute('display-name');
  103.     }
  104.     /* ----------------- */
  105.     /* Parent Style Name */
  106.     /* ----------------- */
  107.     /**
  108.      * 
  109.      * 
  110.      * @access        public
  111.      * @since         0.5.0 - 08.02.2007
  112.      */
  113.     function setParentStyleName($name{
  114.         $this->putStyleAttribute('parent-style-name'$name);
  115.     }
  116.     /**
  117.      * 
  118.      * 
  119.      * @access        public
  120.      * @since         0.5.0 - 08.02.2007
  121.      */
  122.     function getParentStyleName({
  123.         return $this->getStyleAttribute('parent-style-name');
  124.     }
  125.     /* --------------- */
  126.     /* Next Style Name */
  127.     /* --------------- */
  128.     /**
  129.      * 
  130.      * 
  131.      * @access        public
  132.      * @since         0.5.0 - 08.02.2007
  133.      */
  134.     function setNextStyleName($name{
  135.         $this->putStyleAttribute('next-style-name'$name);
  136.     }
  137.     /**
  138.      * 
  139.      * 
  140.      * @access        public
  141.      * @since         0.5.0 - 08.02.2007
  142.      */
  143.     function getNextStyleName({
  144.         return $this->getStyleAttribute('next-style-name');
  145.     }
  146.     /* --------------- */
  147.     /* List Style Name */
  148.     /* --------------- */
  149.     /**
  150.      * @todo We need a set/getListStyleName() function here. It should match:
  151.      *     <define name="style-style-attlist" combine="interleave">
  152.        *         <optional>
  153.        *             <attribute name="style:list-style-name">
  154.        *                 <choice>
  155.        *                     <ref name="styleName"/>
  156.        *                     <empty/>
  157.        *                 </choice>
  158.        *             </attribute>
  159.        *         </optional>
  160.        *     </define>
  161.        */
  162.     /* ---------------- */
  163.     /* Master Page Name */
  164.     /* ---------------- */
  165.     /**
  166.      * 
  167.      * 
  168.      * @access        public
  169.      * @since         0.5.0 - 08.02.2007
  170.      */
  171.     function setMasterPageName($name{
  172.         $this->putStyleAttribute('master-page-name'$name);
  173.     }
  174.     /**
  175.      * 
  176.      * 
  177.      * @access        public
  178.      * @since         0.5.0 - 08.02.2007
  179.      */
  180.     function getMasterPageName({
  181.         return $this->getStyleAttribute('master-page-name');
  182.     }
  183.     /* -------------------- */
  184.     /* Automatically Update */
  185.     /* -------------------- */
  186.     /**
  187.      * @todo We need a set/getAutoUpdate function here, that matches:
  188.      *  <define name="style-style-attlist" combine="interleave">
  189.        *         <optional>
  190.        *             <attribute name="style:auto-update" a:defaultValue="false">
  191.      *                 <ref name="boolean"/>
  192.        *             </attribute>
  193.        *         </optional>
  194.      *  </define>
  195.      * 
  196.      */
  197.     /* ------------- */
  198.     /* DataStyleName */
  199.     /* ------------- */
  200.     /**
  201.      * Set the value of the 'style:data-style-name' attribute.
  202.      *   
  203.      * @access        public
  204.      * @since         0.5.0 - 08.02.2007
  205.      * @param        string $value The new data style name.
  206.      */
  207.     function setDataStyleName($value{
  208.         if (Validator :: checkStyleNameRef($value)) {
  209.             $this->putStyleAttribute('data-style-name'$value);
  210.         }
  211.     }
  212.     /**
  213.      * Retrieve the value of the 'style:data-style-name' attribute.
  214.      * 
  215.      * @return        string Value of the 'style:data-style-name' attribute.
  216.      * @access        public
  217.      * @since         0.5.0 - 08.02.2007
  218.      */
  219.     function getDataStyleName({
  220.         return $this->getStyleAttribute('data-style-name');
  221.     }
  222.     /* ----- */
  223.     /* Class */
  224.     /* ----- */
  225.     /**
  226.      * 
  227.      * 
  228.      * @access        public
  229.      * @since         0.5.0 - 08.02.2007
  230.      */
  231.     function setClass($name{
  232.         $this->putStyleAttribute('class'$name);
  233.     }
  234.     /**
  235.      *
  236.      *  
  237.      * @access        public
  238.      * @since         0.5.0 - 08.02.2007
  239.      */
  240.     function getClass({
  241.         return $this->getStyleAttribute('class');
  242.     }
  243.     /* ------------------- */
  244.     /* DefaultOutlineLevel */
  245.     /* ------------------- */
  246.     /**
  247.      * Set the 'style:default-outline-level' attribute.
  248.      * 
  249.      * @access        public
  250.      * @since         0.5.0 - 08.02.2007
  251.      * @param        int $value The new default outline level.
  252.      */
  253.     function setDefaultOutlineLevel($value{
  254.         if (Validator :: isPositiveInteger($value)) {
  255.             $this->putStyleAttribute('default-outline-level'$value);
  256.         }
  257.     }
  258.     /**
  259.      * Retrieve the value of the 'style:default-outline-level' attribute.
  260.      * 
  261.      * @todo         Make the return type to be an integer not a string.
  262.      * @access        public
  263.      * @since         0.5.0 - 08.02.2007
  264.      * @return         string The value of the 'style:default-outline-level' attribute.
  265.      */
  266.     function getDefaultOutlineLevel({
  267.         $tmp $this->getStyleAttribute('default-outline-level');
  268.         return $tmp;
  269.     }
  270. }
  271. ?>

Documentation generated on Wed, 18 Jun 2008 06:32:09 +0200 by phpDocumentor 1.3.2