web/lib/Zend/Pdf/ElementFactory/Proxy.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     1 <?php
       
     2 /**
       
     3  * Zend Framework
       
     4  *
       
     5  * LICENSE
       
     6  *
       
     7  * This source file is subject to the new BSD license that is bundled
       
     8  * with this package in the file LICENSE.txt.
       
     9  * It is also available through the world-wide-web at this URL:
       
    10  * http://framework.zend.com/license/new-bsd
       
    11  * If you did not receive a copy of the license and are unable to
       
    12  * obtain it through the world-wide-web, please send an email
       
    13  * to license@zend.com so we can send you a copy immediately.
       
    14  *
       
    15  * @category   Zend
       
    16  * @package    Zend_Pdf
       
    17  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    18  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    19  * @version    $Id: Proxy.php 22797 2010-08-06 15:02:12Z alexander $
       
    20  */
       
    21 
       
    22 /** Zend_Pdf_ElementFactory_Interface */
       
    23 require_once 'Zend/Pdf/ElementFactory/Interface.php';
       
    24 
       
    25 /**
       
    26  * PDF element factory interface.
       
    27  * Responsibility is to log PDF changes
       
    28  *
       
    29  * @package    Zend_Pdf
       
    30  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    31  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    32  */
       
    33 class Zend_Pdf_ElementFactory_Proxy implements Zend_Pdf_ElementFactory_Interface
       
    34 {
       
    35     /**
       
    36      * Factory object
       
    37      *
       
    38      * @var Zend_Pdf_ElementFactory_Interface
       
    39      */
       
    40     private $_factory;
       
    41 
       
    42 
       
    43     /**
       
    44      * Object constructor
       
    45      *
       
    46      * @param Zend_Pdf_ElementFactory_Interface $factory
       
    47      */
       
    48     public function __construct(Zend_Pdf_ElementFactory_Interface $factory)
       
    49     {
       
    50         $this->_factory = $factory;
       
    51     }
       
    52 
       
    53     public function __destruct()
       
    54     {
       
    55         $this->_factory->close();
       
    56         $this->_factory = null;
       
    57     }
       
    58 
       
    59     /**
       
    60      * Get factory
       
    61      *
       
    62      * @return Zend_Pdf_ElementFactory_Interface
       
    63      */
       
    64     public function getFactory()
       
    65     {
       
    66         return $this->_factory->getFactory();
       
    67     }
       
    68 
       
    69     /**
       
    70      * Close factory and clean-up resources
       
    71      *
       
    72      * @internal
       
    73      */
       
    74     public function close()
       
    75     {
       
    76         // Do nothing
       
    77     }
       
    78 
       
    79     /**
       
    80      * Get source factory object
       
    81      *
       
    82      * @return Zend_Pdf_ElementFactory
       
    83      */
       
    84     public function resolve()
       
    85     {
       
    86         return $this->_factory->resolve();
       
    87     }
       
    88 
       
    89     /**
       
    90      * Get factory ID
       
    91      *
       
    92      * @return integer
       
    93      */
       
    94     public function getId()
       
    95     {
       
    96         return $this->_factory->getId();
       
    97     }
       
    98 
       
    99     /**
       
   100      * Set object counter
       
   101      *
       
   102      * @param integer $objCount
       
   103      */
       
   104     public function setObjectCount($objCount)
       
   105     {
       
   106         $this->_factory->setObjectCount($objCount);
       
   107     }
       
   108 
       
   109     /**
       
   110      * Get object counter
       
   111      *
       
   112      * @return integer
       
   113      */
       
   114     public function getObjectCount()
       
   115     {
       
   116         return $this->_factory->getObjectCount();
       
   117     }
       
   118 
       
   119     /**
       
   120      * Attach factory to the current;
       
   121      *
       
   122      * @param Zend_Pdf_ElementFactory_Interface $factory
       
   123      */
       
   124     public function attach(Zend_Pdf_ElementFactory_Interface $factory)
       
   125     {
       
   126         $this->_factory->attach($factory);
       
   127     }
       
   128 
       
   129     /**
       
   130      * Calculate object enumeration shift.
       
   131      *
       
   132      * @internal
       
   133      * @param Zend_Pdf_ElementFactory_Interface $factory
       
   134      * @return integer
       
   135      */
       
   136     public function calculateShift(Zend_Pdf_ElementFactory_Interface $factory)
       
   137     {
       
   138         return $this->_factory->calculateShift($factory);
       
   139     }
       
   140 
       
   141     /**
       
   142      * Clean enumeration shift cache.
       
   143      * Has to be used after PDF render operation to let followed updates be correct.
       
   144      *
       
   145      * @param Zend_Pdf_ElementFactory_Interface $factory
       
   146      * @return integer
       
   147      */
       
   148     public function cleanEnumerationShiftCache()
       
   149     {
       
   150         return $this->_factory->cleanEnumerationShiftCache();
       
   151     }
       
   152 
       
   153     /**
       
   154      * Retrive object enumeration shift.
       
   155      *
       
   156      * @param Zend_Pdf_ElementFactory_Interface $factory
       
   157      * @return integer
       
   158      * @throws Zend_Pdf_Exception
       
   159      */
       
   160     public function getEnumerationShift(Zend_Pdf_ElementFactory_Interface $factory)
       
   161     {
       
   162         return $this->_factory->getEnumerationShift($factory);
       
   163     }
       
   164 
       
   165     /**
       
   166      * Mark object as modified in context of current factory.
       
   167      *
       
   168      * @param Zend_Pdf_Element_Object $obj
       
   169      * @throws Zend_Pdf_Exception
       
   170      */
       
   171     public function markAsModified(Zend_Pdf_Element_Object $obj)
       
   172     {
       
   173         $this->_factory->markAsModified($obj);
       
   174     }
       
   175 
       
   176     /**
       
   177      * Remove object in context of current factory.
       
   178      *
       
   179      * @param Zend_Pdf_Element_Object $obj
       
   180      * @throws Zend_Pdf_Exception
       
   181      */
       
   182     public function remove(Zend_Pdf_Element_Object $obj)
       
   183     {
       
   184         $this->_factory->remove($obj);
       
   185     }
       
   186 
       
   187     /**
       
   188      * Generate new Zend_Pdf_Element_Object
       
   189      *
       
   190      * @todo Reusage of the freed object. It's not a support of new feature, but only improvement.
       
   191      *
       
   192      * @param Zend_Pdf_Element $objectValue
       
   193      * @return Zend_Pdf_Element_Object
       
   194      */
       
   195     public function newObject(Zend_Pdf_Element $objectValue)
       
   196     {
       
   197         return $this->_factory->newObject($objectValue);
       
   198     }
       
   199 
       
   200     /**
       
   201      * Generate new Zend_Pdf_Element_Object_Stream
       
   202      *
       
   203      * @todo Reusage of the freed object. It's not a support of new feature, but only improvement.
       
   204      *
       
   205      * @param mixed $objectValue
       
   206      * @return Zend_Pdf_Element_Object_Stream
       
   207      */
       
   208     public function newStreamObject($streamValue)
       
   209     {
       
   210         return $this->_factory->newStreamObject($streamValue);
       
   211     }
       
   212 
       
   213     /**
       
   214      * Enumerate modified objects.
       
   215      * Returns array of Zend_Pdf_UpdateInfoContainer
       
   216      *
       
   217      * @param Zend_Pdf_ElementFactory $rootFactory
       
   218      * @return array
       
   219      */
       
   220     public function listModifiedObjects($rootFactory = null)
       
   221     {
       
   222         return $this->_factory->listModifiedObjects($rootFactory);
       
   223     }
       
   224 
       
   225     /**
       
   226      * Check if PDF file was modified
       
   227      *
       
   228      * @return boolean
       
   229      */
       
   230     public function isModified()
       
   231     {
       
   232         return $this->_factory->isModified();
       
   233     }
       
   234 }