positioner.cls.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * @package dompdf
  4. * @link http://dompdf.github.com/
  5. * @author Benj Carson <benjcarson@digitaljunkies.ca>
  6. * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
  7. */
  8. /**
  9. * Base Positioner class
  10. *
  11. * Defines postioner interface
  12. *
  13. * @access private
  14. * @package dompdf
  15. */
  16. abstract class Positioner {
  17. /**
  18. * @var Frame_Decorator
  19. */
  20. protected $_frame;
  21. //........................................................................
  22. function __construct(Frame_Decorator $frame) {
  23. $this->_frame = $frame;
  24. }
  25. /**
  26. * Class destructor
  27. */
  28. function __destruct() {
  29. clear_object($this);
  30. }
  31. //........................................................................
  32. abstract function position();
  33. function move($offset_x, $offset_y, $ignore_self = false) {
  34. list($x, $y) = $this->_frame->get_position();
  35. if ( !$ignore_self ) {
  36. $this->_frame->set_position($x + $offset_x, $y + $offset_y);
  37. }
  38. foreach($this->_frame->get_children() as $child) {
  39. $child->move($offset_x, $offset_y);
  40. }
  41. }
  42. }