table_row_frame_reflower.cls.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. /**
  3. * DOMPDF - PHP5 HTML to PDF renderer
  4. *
  5. * File: $RCSfile: table_row_frame_reflower.cls.php,v $
  6. * Created on: 2004-06-17
  7. *
  8. * Copyright (c) 2004 - Benj Carson <benjcarson@digitaljunkies.ca>
  9. *
  10. * This library is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU Lesser General Public
  12. * License as published by the Free Software Foundation; either
  13. * version 2.1 of the License, or (at your option) any later version.
  14. *
  15. * This library is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * Lesser General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Lesser General Public License
  21. * along with this library in the file LICENSE.LGPL; if not, write to the
  22. * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  23. * 02111-1307 USA
  24. *
  25. * Alternatively, you may distribute this software under the terms of the
  26. * PHP License, version 3.0 or later. A copy of this license should have
  27. * been distributed with this file in the file LICENSE.PHP . If this is not
  28. * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
  29. *
  30. * The latest version of DOMPDF might be available at:
  31. * http://www.dompdf.com/
  32. *
  33. * @link http://www.dompdf.com/
  34. * @copyright 2004 Benj Carson
  35. * @author Benj Carson <benjcarson@digitaljunkies.ca>
  36. * @package dompdf
  37. */
  38. /* $Id: table_row_frame_reflower.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
  39. /**
  40. * Reflows table rows
  41. *
  42. * @access private
  43. * @package dompdf
  44. */
  45. class Table_Row_Frame_Reflower extends Frame_Reflower {
  46. function __construct(Table_Row_Frame_Decorator $frame) {
  47. parent::__construct($frame);
  48. }
  49. //........................................................................
  50. function reflow() {
  51. $page = $this->_frame->get_root();
  52. if ( $page->is_full() )
  53. return;
  54. $this->_frame->position();
  55. $style = $this->_frame->get_style();
  56. $cb = $this->_frame->get_containing_block();
  57. foreach ($this->_frame->get_children() as $child) {
  58. if ( $page->is_full() )
  59. return;
  60. $child->set_containing_block($cb);
  61. $child->reflow();
  62. }
  63. if ( $page->is_full() )
  64. return;
  65. $table = Table_Frame_Decorator::find_parent_table($this->_frame);
  66. $cellmap = $table->get_cellmap();
  67. $style->width = $cellmap->get_frame_width($this->_frame);
  68. $style->height = $cellmap->get_frame_height($this->_frame);
  69. $this->_frame->set_position($cellmap->get_frame_position($this->_frame));
  70. }
  71. //........................................................................
  72. function get_min_max_width() {
  73. throw new DOMPDF_Exception("Min/max width is undefined for table rows");
  74. }
  75. }