Proxy.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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-2009 Zend Technologies USA Inc. (http://www.zend.com)
  18. * @license http://framework.zend.com/license/new-bsd New BSD License
  19. * @version $Id$
  20. */
  21. /** Zend_Pdf_ElementFactory_Interface */
  22. require_once 'Zend/Pdf/ElementFactory/Interface.php';
  23. /**
  24. * PDF element factory interface.
  25. * Responsibility is to log PDF changes
  26. *
  27. * @package Zend_Pdf
  28. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  29. * @license http://framework.zend.com/license/new-bsd New BSD License
  30. */
  31. class Zend_Pdf_ElementFactory_Proxy implements Zend_Pdf_ElementFactory_Interface
  32. {
  33. /**
  34. * Factory object
  35. *
  36. * @var Zend_Pdf_ElementFactory_Interface
  37. */
  38. private $_factory;
  39. /**
  40. * Object constructor
  41. *
  42. * @param Zend_Pdf_ElementFactory_Interface $factory
  43. */
  44. public function __construct(Zend_Pdf_ElementFactory_Interface $factory)
  45. {
  46. $this->_factory = $factory;
  47. }
  48. public function __destruct()
  49. {
  50. $this->_factory->close();
  51. $this->_factory = null;
  52. }
  53. /**
  54. * Close factory and clean-up resources
  55. *
  56. * @internal
  57. */
  58. public function close()
  59. {
  60. // Do nothing
  61. }
  62. /**
  63. * Get source factory object
  64. *
  65. * @return Zend_Pdf_ElementFactory
  66. */
  67. public function resolve()
  68. {
  69. return $this->_factory->resolve();
  70. }
  71. /**
  72. * Get factory ID
  73. *
  74. * @return integer
  75. */
  76. public function getId()
  77. {
  78. return $this->_factory->getId();
  79. }
  80. /**
  81. * Set object counter
  82. *
  83. * @param integer $objCount
  84. */
  85. public function setObjectCount($objCount)
  86. {
  87. $this->_factory->setObjectCount($objCount);
  88. }
  89. /**
  90. * Get object counter
  91. *
  92. * @return integer
  93. */
  94. public function getObjectCount()
  95. {
  96. return $this->_factory->getObjectCount();
  97. }
  98. /**
  99. * Attach factory to the current;
  100. *
  101. * @param Zend_Pdf_ElementFactory_Interface $factory
  102. */
  103. public function attach(Zend_Pdf_ElementFactory_Interface $factory)
  104. {
  105. $this->_factory->attach($factory);
  106. }
  107. /**
  108. * Calculate object enumeration shift.
  109. *
  110. * @internal
  111. * @param Zend_Pdf_ElementFactory_Interface $factory
  112. * @return integer
  113. */
  114. public function calculateShift(Zend_Pdf_ElementFactory_Interface $factory)
  115. {
  116. return $this->_factory->calculateShift($factory);
  117. }
  118. /**
  119. * Retrive object enumeration shift.
  120. *
  121. * @param Zend_Pdf_ElementFactory_Interface $factory
  122. * @return integer
  123. * @throws Zend_Pdf_Exception
  124. */
  125. public function getEnumerationShift(Zend_Pdf_ElementFactory_Interface $factory)
  126. {
  127. return $this->_factory->getEnumerationShift($factory);
  128. }
  129. /**
  130. * Mark object as modified in context of current factory.
  131. *
  132. * @param Zend_Pdf_Element_Object $obj
  133. * @throws Zend_Pdf_Exception
  134. */
  135. public function markAsModified(Zend_Pdf_Element_Object $obj)
  136. {
  137. $this->_factory->markAsModified($obj);
  138. }
  139. /**
  140. * Remove object in context of current factory.
  141. *
  142. * @param Zend_Pdf_Element_Object $obj
  143. * @throws Zend_Pdf_Exception
  144. */
  145. public function remove(Zend_Pdf_Element_Object $obj)
  146. {
  147. $this->_factory->remove($obj);
  148. }
  149. /**
  150. * Generate new Zend_Pdf_Element_Object
  151. *
  152. * @todo Reusage of the freed object. It's not a support of new feature, but only improvement.
  153. *
  154. * @param Zend_Pdf_Element $objectValue
  155. * @return Zend_Pdf_Element_Object
  156. */
  157. public function newObject(Zend_Pdf_Element $objectValue)
  158. {
  159. return $this->_factory->newObject($objectValue);
  160. }
  161. /**
  162. * Generate new Zend_Pdf_Element_Object_Stream
  163. *
  164. * @todo Reusage of the freed object. It's not a support of new feature, but only improvement.
  165. *
  166. * @param mixed $objectValue
  167. * @return Zend_Pdf_Element_Object_Stream
  168. */
  169. public function newStreamObject($streamValue)
  170. {
  171. return $this->_factory->newStreamObject($streamValue);
  172. }
  173. /**
  174. * Enumerate modified objects.
  175. * Returns array of Zend_Pdf_UpdateInfoContainer
  176. *
  177. * @param Zend_Pdf_ElementFactory $rootFactory
  178. * @return array
  179. */
  180. public function listModifiedObjects($rootFactory = null)
  181. {
  182. return $this->_factory->listModifiedObjects($rootFactory);
  183. }
  184. /**
  185. * Check if PDF file was modified
  186. *
  187. * @return boolean
  188. */
  189. public function isModified()
  190. {
  191. return $this->_factory->isModified();
  192. }
  193. }