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 162 2007-03-19 10:37:22Z nmarkgraf $
  24.  */
  25. require_once 'OpenDocumentPHP/styles/DefaultStyle.php';
  26. require_once 'OpenDocumentPHP/util/Validator.php';
  27. /**
  28.  * Styles class.
  29.  * 
  30.  * @author         Norman Markgraf (nmarkgraf(at)user.sourceforge.net)
  31.  * @copyright     Copyright in 2006, 2007 by The OpenDocumentPHP Team
  32.  * @license     http://www.gnu.org/licenses/gpl.html GNU General Public License 2.0.
  33.  * @version        $Revision: 162 $
  34.  * @package        OpenDocumentPHP
  35.  * @since         0.5.0 - 08.02.2007
  36.  */
  37. class Style extends DefaultStyle {
  38.     /**
  39.      * Set element to 'style:style'.
  40.      * 
  41.      * @access         protected
  42.      * @since         0.5.0 - 08.02.2007
  43.      * @deprecated  0.5.2 - 19.03.2007 No longer needed!
  44.      */
  45.     protected function __setRoot({
  46.         $this->root $this->domFragment->createElementNS(self :: STYLE'style:style');
  47.     }
  48.     /* ---------- */
  49.     /* Style Name */
  50.     /* ---------- */
  51.     /**
  52.      * 
  53.      * 
  54.      * @access        public
  55.      * @since         0.5.0 - 08.02.2007
  56.      */
  57.     function setStyleName($name{
  58.         $this->putStyleAttribute('name'$name);
  59.     }
  60.     /**
  61.      * 
  62.      * 
  63.      * @access        public
  64.      * @since         0.5.0 - 08.02.2007
  65.      */
  66.     function getStyleName({
  67.         return $this->getStyleAttribute('name');
  68.     }
  69.     /* ------------ */
  70.     /* Display Name */
  71.     /* ------------ */
  72.     /**
  73.      * 
  74.      * 
  75.      * @access        public
  76.      * @since         0.5.0 - 08.02.2007
  77.      */
  78.     function setDisplayName($name{
  79.         $this->putStyleAttribute('display-name'$name);
  80.     }
  81.     /**
  82.      * 
  83.      * 
  84.      * @access        public
  85.      * @since         0.5.0 - 08.02.2007
  86.      */
  87.     function getDisplayName({
  88.         return $this->getStyleAttribute('display-name');
  89.     }
  90.     /* ----------------- */
  91.     /* Parent Style Name */
  92.     /* ----------------- */
  93.     /**
  94.      * 
  95.      * 
  96.      * @access        public
  97.      * @since         0.5.0 - 08.02.2007
  98.      */
  99.     function setParentStyleName($name{
  100.         $this->putStyleAttribute('parent-style-name'$name);
  101.     }
  102.     /**
  103.      * 
  104.      * 
  105.      * @access        public
  106.      * @since         0.5.0 - 08.02.2007
  107.      */
  108.     function getParentStyleName({
  109.         return $this->getStyleAttribute('parent-style-name');
  110.     }
  111.     /* --------------- */
  112.     /* Next Style Name */
  113.     /* --------------- */
  114.     /**
  115.      * 
  116.      * 
  117.      * @access        public
  118.      * @since         0.5.0 - 08.02.2007
  119.      */
  120.     function setNextStyleName($name{
  121.         $this->putStyleAttribute('next-style-name'$name);
  122.     }
  123.     /**
  124.      * 
  125.      * 
  126.      * @access        public
  127.      * @since         0.5.0 - 08.02.2007
  128.      */
  129.     function getNextStyleName({
  130.         return $this->getStyleAttribute('next-style-name');
  131.     }
  132.     /* --------------- */
  133.     /* List Style Name */
  134.     /* --------------- */
  135.     /**
  136.      * @todo We need a set/getListStyleName() function here. It should match:
  137.      *     <define name="style-style-attlist" combine="interleave">
  138.        *         <optional>
  139.        *             <attribute name="style:list-style-name">
  140.        *                 <choice>
  141.        *                     <ref name="styleName"/>
  142.        *                     <empty/>
  143.        *                 </choice>
  144.        *             </attribute>
  145.        *         </optional>
  146.        *     </define>
  147.        */
  148.     /* ---------------- */
  149.     /* Master Page Name */
  150.     /* ---------------- */
  151.     /**
  152.      * 
  153.      * 
  154.      * @access        public
  155.      * @since         0.5.0 - 08.02.2007
  156.      */
  157.     function setMasterPageName($name{
  158.         $this->putStyleAttribute('master-page-name'$name);
  159.     }
  160.     /**
  161.      * 
  162.      * 
  163.      * @access        public
  164.      * @since         0.5.0 - 08.02.2007
  165.      */
  166.     function getMasterPageName({
  167.         return $this->getStyleAttribute('master-page-name');
  168.     }
  169.     /* -------------------- */
  170.     /* Automatically Update */
  171.     /* -------------------- */
  172.     /**
  173.      * @todo We need a set/getAutoUpdate function here, that matches:
  174.      *  <define name="style-style-attlist" combine="interleave">
  175.        *         <optional>
  176.        *             <attribute name="style:auto-update" a:defaultValue="false">
  177.      *                 <ref name="boolean"/>
  178.        *             </attribute>
  179.        *         </optional>
  180.      *  </define>
  181.      * 
  182.      */
  183.     /* ------------- */
  184.     /* DataStyleName */
  185.     /* ------------- */
  186.     /**
  187.      * Set the value of the 'style:data-style-name' attribute.
  188.      *   
  189.      * @access        public
  190.      * @since         0.5.0 - 08.02.2007
  191.      * @param        string $value The new data style name.
  192.      */
  193.     function setDataStyleName($value{
  194.         if (Validator :: checkStyleNameRef($value)) {
  195.             $this->putStyleAttribute('data-style-name'$value);
  196.         }
  197.     }
  198.     /**
  199.      * Retrieve the value of the 'style:data-style-name' attribute.
  200.      * 
  201.      * @return        string Value of the 'style:data-style-name' attribute.
  202.      * @access        public
  203.      * @since         0.5.0 - 08.02.2007
  204.      */
  205.     function getDataStyleName({
  206.         return $this->getStyleAttribute('data-style-name');
  207.     }
  208.     /* ----- */
  209.     /* Class */
  210.     /* ----- */
  211.     /**
  212.      * 
  213.      * 
  214.      * @access        public
  215.      * @since         0.5.0 - 08.02.2007
  216.      */
  217.     function setClass($name{
  218.         $this->putStyleAttribute('class'$name);
  219.     }
  220.     /**
  221.      *
  222.      *  
  223.      * @access        public
  224.      * @since         0.5.0 - 08.02.2007
  225.      */
  226.     function getClass({
  227.         return $this->getStyleAttribute('class');
  228.     }
  229.     /* ------------------- */
  230.     /* DefaultOutlineLevel */
  231.     /* ------------------- */
  232.     /**
  233.      * Set the 'style:default-outline-level' attribute.
  234.      * 
  235.      * @access        public
  236.      * @since         0.5.0 - 08.02.2007
  237.      * @param        int $value The new default outline level.
  238.      */
  239.     function setDefaultOutlineLevel($value{
  240.         if (Validator :: isPositiveInteger($value)) {
  241.             $this->putStyleAttribute('default-outline-level'$value);
  242.         }
  243.     }
  244.     /**
  245.      * Retrieve the value of the 'style:default-outline-level' attribute.
  246.      * 
  247.      * @todo         Make the return type to be an integer not a string.
  248.      * @access        public
  249.      * @since         0.5.0 - 08.02.2007
  250.      * @return         string The value of the 'style:default-outline-level' attribute.
  251.      */
  252.     function getDefaultOutlineLevel({
  253.         $tmp $this->getStyleAttribute('default-outline-level');
  254.         return $tmp;
  255.     }
  256. }
  257. ?>

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