source: sandbox/filemanager/tp/dompdf/include/table_cell_frame_decorator.cls.php @ 1575

Revision 1575, 4.1 KB checked in by amuller, 14 years ago (diff)

Ticket #597 - Implentação, melhorias do modulo gerenciador de arquivos

Line 
1<?php
2/**
3 * DOMPDF - PHP5 HTML to PDF renderer
4 *
5 * File: $RCSfile: table_cell_frame_decorator.cls.php,v $
6 * Created on: 2004-07-29
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 Benj Carson
35 * @author Benj Carson <benjcarson@digitaljunkies.ca>
36 * @package dompdf
37 * @version 0.5.1
38 */
39
40/* $Id: table_cell_frame_decorator.cls.php,v 1.5 2006/07/07 21:31:04 benjcarson Exp $ */
41
42/**
43 * Decorates table cells for layout
44 *
45 * @access private
46 * @package dompdf
47 */
48class Table_Cell_Frame_Decorator extends Block_Frame_Decorator {
49 
50  protected $_resolved_borders;
51  protected $_content_height;
52 
53  //........................................................................
54
55  function __construct(Frame $frame, DOMPDF $dompdf) {
56    parent::__construct($frame, $dompdf);
57    $this->_resolved_borders = array();
58    $this->_content_height = 0;   
59  }
60
61  //........................................................................
62
63  function reset() {
64    parent::reset();
65    $this->_resolved_borders = array();
66    $this->_content_height = 0;
67    $this->_frame->reset();   
68  }
69 
70  function get_content_height() {
71    return $this->_content_height;
72  }
73
74  function set_content_height($height) {
75    $this->_content_height = $height;
76  }
77 
78  function set_cell_height($height) {
79    $style = $this->get_style();
80    $v_space = $style->length_in_pt(array($style->margin_top,
81                                          $style->padding_top,
82                                          $style->border_top_width,
83                                          $style->border_bottom_width,
84                                          $style->padding_bottom,
85                                          $style->margin_bottom),
86                                    $style->width);
87
88    $new_height = $height - $v_space;   
89    $style->height = $new_height;
90
91    if ( $new_height > $this->_content_height ) {
92      // Adjust our vertical alignment
93      $valign = $style->vertical_align;
94
95      switch ($valign) {
96
97      default:
98      case "baseline":
99        // FIXME: this isn't right
100       
101      case "top":
102        // Don't need to do anything
103        return;
104
105      case "middle":
106        $delta = ($new_height - $this->_content_height) / 2;
107        break;
108
109      case "bottom":
110        $delta = $new_height - $this->_content_height;
111        break;
112
113      }
114   
115      // Move our children
116      foreach ( $this->get_lines() as $i => $line ) {
117        foreach ( $line["frames"] as $frame )
118          $frame->set_position( null, $frame->get_position("y") + $delta );
119      }
120   }
121       
122  }
123
124  function set_resolved_border($side, $border_spec) {   
125    $this->_resolved_borders[$side] = $border_spec;
126  }
127
128  //........................................................................
129
130  function get_resolved_border($side) {
131    return $this->_resolved_borders[$side];
132  }
133
134  function get_resolved_borders() { return $this->_resolved_borders; }
135}
136?>
Note: See TracBrowser for help on using the repository browser.