File indexing completed on 2025-01-19 05:21:21

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Pdf
0017  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0018  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0019  * @version    $Id$
0020  */
0021 
0022 /** Zend_Pdf_ElementFactory_Interface */
0023 // require_once 'Zend/Pdf/ElementFactory/Interface.php';
0024 
0025 /**
0026  * PDF element factory interface.
0027  * Responsibility is to log PDF changes
0028  *
0029  * @package    Zend_Pdf
0030  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0031  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0032  */
0033 class Zend_Pdf_ElementFactory_Proxy implements Zend_Pdf_ElementFactory_Interface
0034 {
0035     /**
0036      * Factory object
0037      *
0038      * @var Zend_Pdf_ElementFactory_Interface
0039      */
0040     private $_factory;
0041 
0042 
0043     /**
0044      * Object constructor
0045      *
0046      * @param Zend_Pdf_ElementFactory_Interface $factory
0047      */
0048     public function __construct(Zend_Pdf_ElementFactory_Interface $factory)
0049     {
0050         $this->_factory = $factory;
0051     }
0052 
0053     public function __destruct()
0054     {
0055         $this->_factory->close();
0056         $this->_factory = null;
0057     }
0058 
0059     /**
0060      * Get factory
0061      *
0062      * @return Zend_Pdf_ElementFactory_Interface
0063      */
0064     public function getFactory()
0065     {
0066         return $this->_factory->getFactory();
0067     }
0068 
0069     /**
0070      * Close factory and clean-up resources
0071      *
0072      * @internal
0073      */
0074     public function close()
0075     {
0076         // Do nothing
0077     }
0078 
0079     /**
0080      * Get source factory object
0081      *
0082      * @return Zend_Pdf_ElementFactory
0083      */
0084     public function resolve()
0085     {
0086         return $this->_factory->resolve();
0087     }
0088 
0089     /**
0090      * Get factory ID
0091      *
0092      * @return integer
0093      */
0094     public function getId()
0095     {
0096         return $this->_factory->getId();
0097     }
0098 
0099     /**
0100      * Set object counter
0101      *
0102      * @param integer $objCount
0103      */
0104     public function setObjectCount($objCount)
0105     {
0106         $this->_factory->setObjectCount($objCount);
0107     }
0108 
0109     /**
0110      * Get object counter
0111      *
0112      * @return integer
0113      */
0114     public function getObjectCount()
0115     {
0116         return $this->_factory->getObjectCount();
0117     }
0118 
0119     /**
0120      * Attach factory to the current;
0121      *
0122      * @param Zend_Pdf_ElementFactory_Interface $factory
0123      */
0124     public function attach(Zend_Pdf_ElementFactory_Interface $factory)
0125     {
0126         $this->_factory->attach($factory);
0127     }
0128 
0129     /**
0130      * Calculate object enumeration shift.
0131      *
0132      * @internal
0133      * @param Zend_Pdf_ElementFactory_Interface $factory
0134      * @return integer
0135      */
0136     public function calculateShift(Zend_Pdf_ElementFactory_Interface $factory)
0137     {
0138         return $this->_factory->calculateShift($factory);
0139     }
0140 
0141     /**
0142      * Clean enumeration shift cache.
0143      * Has to be used after PDF render operation to let followed updates be correct.
0144      *
0145      * @param Zend_Pdf_ElementFactory_Interface $factory
0146      * @return integer
0147      */
0148     public function cleanEnumerationShiftCache()
0149     {
0150         return $this->_factory->cleanEnumerationShiftCache();
0151     }
0152 
0153     /**
0154      * Retrive object enumeration shift.
0155      *
0156      * @param Zend_Pdf_ElementFactory_Interface $factory
0157      * @return integer
0158      * @throws Zend_Pdf_Exception
0159      */
0160     public function getEnumerationShift(Zend_Pdf_ElementFactory_Interface $factory)
0161     {
0162         return $this->_factory->getEnumerationShift($factory);
0163     }
0164 
0165     /**
0166      * Mark object as modified in context of current factory.
0167      *
0168      * @param Zend_Pdf_Element_Object $obj
0169      * @throws Zend_Pdf_Exception
0170      */
0171     public function markAsModified(Zend_Pdf_Element_Object $obj)
0172     {
0173         $this->_factory->markAsModified($obj);
0174     }
0175 
0176     /**
0177      * Remove object in context of current factory.
0178      *
0179      * @param Zend_Pdf_Element_Object $obj
0180      * @throws Zend_Pdf_Exception
0181      */
0182     public function remove(Zend_Pdf_Element_Object $obj)
0183     {
0184         $this->_factory->remove($obj);
0185     }
0186 
0187     /**
0188      * Generate new Zend_Pdf_Element_Object
0189      *
0190      * @todo Reusage of the freed object. It's not a support of new feature, but only improvement.
0191      *
0192      * @param Zend_Pdf_Element $objectValue
0193      * @return Zend_Pdf_Element_Object
0194      */
0195     public function newObject(Zend_Pdf_Element $objectValue)
0196     {
0197         return $this->_factory->newObject($objectValue);
0198     }
0199 
0200     /**
0201      * Generate new Zend_Pdf_Element_Object_Stream
0202      *
0203      * @todo Reusage of the freed object. It's not a support of new feature, but only improvement.
0204      *
0205      * @param mixed $objectValue
0206      * @return Zend_Pdf_Element_Object_Stream
0207      */
0208     public function newStreamObject($streamValue)
0209     {
0210         return $this->_factory->newStreamObject($streamValue);
0211     }
0212 
0213     /**
0214      * Enumerate modified objects.
0215      * Returns array of Zend_Pdf_UpdateInfoContainer
0216      *
0217      * @param Zend_Pdf_ElementFactory $rootFactory
0218      * @return array
0219      */
0220     public function listModifiedObjects($rootFactory = null)
0221     {
0222         return $this->_factory->listModifiedObjects($rootFactory);
0223     }
0224 
0225     /**
0226      * Check if PDF file was modified
0227      *
0228      * @return boolean
0229      */
0230     public function isModified()
0231     {
0232         return $this->_factory->isModified();
0233     }
0234 }