[3019] | 1 | <?php |
---|
| 2 | /** |
---|
| 3 | * DOMPDF - PHP5 HTML to PDF renderer |
---|
| 4 | * |
---|
| 5 | * File: $RCSfile: table_row_group_frame_decorator.cls.php,v $ |
---|
| 6 | * Created on: 2004-06-02 |
---|
| 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.digitaljunkies.ca/dompdf |
---|
| 32 | * |
---|
| 33 | * @link http://www.digitaljunkies.ca/dompdf |
---|
| 34 | * @copyright 2004-6 Benj Carson |
---|
| 35 | * @author Benj Carson <benjcarson@digitaljunkies.ca> |
---|
| 36 | * @package dompdf |
---|
| 37 | */ |
---|
| 38 | |
---|
| 39 | /* $Id */ |
---|
| 40 | |
---|
| 41 | /** |
---|
| 42 | * Table row group decorator |
---|
| 43 | * |
---|
| 44 | * Overrides split() method for tbody, thead & tfoot elements |
---|
| 45 | * |
---|
| 46 | * @access private |
---|
| 47 | * @package dompdf |
---|
| 48 | */ |
---|
| 49 | class Table_Row_Group_Frame_Decorator extends Frame_Decorator { |
---|
| 50 | |
---|
| 51 | /** |
---|
| 52 | * Class constructor |
---|
| 53 | * |
---|
| 54 | * @param Frame $frame Frame to decorate |
---|
| 55 | * @param DOMPDF $dompdf Current dompdf instance |
---|
| 56 | */ |
---|
| 57 | function __construct(Frame $frame, DOMPDF $dompdf) { |
---|
| 58 | parent::__construct($frame, $dompdf); |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | /** |
---|
| 62 | * Override split() to remove all child rows and this element from the cellmap |
---|
| 63 | * |
---|
| 64 | * @param Frame $child |
---|
| 65 | */ |
---|
| 66 | function split($child = null) { |
---|
| 67 | |
---|
| 68 | if ( is_null($child) ) { |
---|
| 69 | parent::split(); |
---|
| 70 | return; |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | |
---|
| 74 | // Remove child & all subsequent rows from the cellmap |
---|
| 75 | $cellmap = $this->get_parent()->get_cellmap(); |
---|
| 76 | $iter = $child; |
---|
| 77 | |
---|
| 78 | while ( $iter ) { |
---|
| 79 | $cellmap->remove_row($iter); |
---|
| 80 | $iter = $iter->get_next_sibling(); |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | // If we are splitting at the first child remove the |
---|
| 84 | // table-row-group from the cellmap as well |
---|
| 85 | if ( $child === $this->get_first_child() ) { |
---|
| 86 | $cellmap->remove_row_group($this); |
---|
| 87 | parent::split(); |
---|
| 88 | return; |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | $cellmap->update_row_group($this, $child->get_prev_sibling()); |
---|
| 92 | parent::split($child); |
---|
| 93 | |
---|
| 94 | } |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | ?> |
---|