2
0

Proxy.php 5.0 KB

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