PageRenderTime 36ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/library/Zend/Pdf/ElementFactory/Proxy.php

https://bitbucket.org/hieronim1981/tunethemusic
PHP | 234 lines | 78 code | 21 blank | 135 comment | 0 complexity | 68c389fdde7acfc876e97625c8dc7245 MD5 | raw file
  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-2012 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 24593 2012-01-05 20:35:02Z matthew $
  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-2012 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. * Get factory
  55. *
  56. * @return Zend_Pdf_ElementFactory_Interface
  57. */
  58. public function getFactory()
  59. {
  60. return $this->_factory->getFactory();
  61. }
  62. /**
  63. * Close factory and clean-up resources
  64. *
  65. * @internal
  66. */
  67. public function close()
  68. {
  69. // Do nothing
  70. }
  71. /**
  72. * Get source factory object
  73. *
  74. * @return Zend_Pdf_ElementFactory
  75. */
  76. public function resolve()
  77. {
  78. return $this->_factory->resolve();
  79. }
  80. /**
  81. * Get factory ID
  82. *
  83. * @return integer
  84. */
  85. public function getId()
  86. {
  87. return $this->_factory->getId();
  88. }
  89. /**
  90. * Set object counter
  91. *
  92. * @param integer $objCount
  93. */
  94. public function setObjectCount($objCount)
  95. {
  96. $this->_factory->setObjectCount($objCount);
  97. }
  98. /**
  99. * Get object counter
  100. *
  101. * @return integer
  102. */
  103. public function getObjectCount()
  104. {
  105. return $this->_factory->getObjectCount();
  106. }
  107. /**
  108. * Attach factory to the current;
  109. *
  110. * @param Zend_Pdf_ElementFactory_Interface $factory
  111. */
  112. public function attach(Zend_Pdf_ElementFactory_Interface $factory)
  113. {
  114. $this->_factory->attach($factory);
  115. }
  116. /**
  117. * Calculate object enumeration shift.
  118. *
  119. * @internal
  120. * @param Zend_Pdf_ElementFactory_Interface $factory
  121. * @return integer
  122. */
  123. public function calculateShift(Zend_Pdf_ElementFactory_Interface $factory)
  124. {
  125. return $this->_factory->calculateShift($factory);
  126. }
  127. /**
  128. * Clean enumeration shift cache.
  129. * Has to be used after PDF render operation to let followed updates be correct.
  130. *
  131. * @param Zend_Pdf_ElementFactory_Interface $factory
  132. * @return integer
  133. */
  134. public function cleanEnumerationShiftCache()
  135. {
  136. return $this->_factory->cleanEnumerationShiftCache();
  137. }
  138. /**
  139. * Retrive object enumeration shift.
  140. *
  141. * @param Zend_Pdf_ElementFactory_Interface $factory
  142. * @return integer
  143. * @throws Zend_Pdf_Exception
  144. */
  145. public function getEnumerationShift(Zend_Pdf_ElementFactory_Interface $factory)
  146. {
  147. return $this->_factory->getEnumerationShift($factory);
  148. }
  149. /**
  150. * Mark object as modified in context of current factory.
  151. *
  152. * @param Zend_Pdf_Element_Object $obj
  153. * @throws Zend_Pdf_Exception
  154. */
  155. public function markAsModified(Zend_Pdf_Element_Object $obj)
  156. {
  157. $this->_factory->markAsModified($obj);
  158. }
  159. /**
  160. * Remove object in context of current factory.
  161. *
  162. * @param Zend_Pdf_Element_Object $obj
  163. * @throws Zend_Pdf_Exception
  164. */
  165. public function remove(Zend_Pdf_Element_Object $obj)
  166. {
  167. $this->_factory->remove($obj);
  168. }
  169. /**
  170. * Generate new Zend_Pdf_Element_Object
  171. *
  172. * @todo Reusage of the freed object. It's not a support of new feature, but only improvement.
  173. *
  174. * @param Zend_Pdf_Element $objectValue
  175. * @return Zend_Pdf_Element_Object
  176. */
  177. public function newObject(Zend_Pdf_Element $objectValue)
  178. {
  179. return $this->_factory->newObject($objectValue);
  180. }
  181. /**
  182. * Generate new Zend_Pdf_Element_Object_Stream
  183. *
  184. * @todo Reusage of the freed object. It's not a support of new feature, but only improvement.
  185. *
  186. * @param mixed $objectValue
  187. * @return Zend_Pdf_Element_Object_Stream
  188. */
  189. public function newStreamObject($streamValue)
  190. {
  191. return $this->_factory->newStreamObject($streamValue);
  192. }
  193. /**
  194. * Enumerate modified objects.
  195. * Returns array of Zend_Pdf_UpdateInfoContainer
  196. *
  197. * @param Zend_Pdf_ElementFactory $rootFactory
  198. * @return array
  199. */
  200. public function listModifiedObjects($rootFactory = null)
  201. {
  202. return $this->_factory->listModifiedObjects($rootFactory);
  203. }
  204. /**
  205. * Check if PDF file was modified
  206. *
  207. * @return boolean
  208. */
  209. public function isModified()
  210. {
  211. return $this->_factory->isModified();
  212. }
  213. }