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

Revision 1575, 2.7 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: list_bullet_positioner.cls.php,v $
6 * Created on: 2004-06-23
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: list_bullet_positioner.cls.php,v 1.3 2006/07/07 21:31:03 benjcarson Exp $ */
41
42/**
43 * Positions list bullets
44 *
45 * @access private
46 * @package dompdf
47 */
48class List_Bullet_Positioner extends Positioner {
49
50  function __construct(Frame_Decorator $frame) { parent::__construct($frame); }
51 
52  //........................................................................
53
54  function position() {
55   
56    // Bullets & friends are positioned an absolute distance to the left of
57    // the content edge of their parent element
58    $cb = $this->_frame->get_containing_block();
59    $style = $this->_frame->get_style();
60   
61    // Note: this differs from most frames in that we must position
62    // ourselves after determining our width
63    $x = $cb["x"] - $this->_frame->get_width();
64
65    $p = $this->_frame->find_block_parent();
66
67    $y = $p->get_current_line("y");
68
69    // This is a bit of a hack...
70    $n = $this->_frame->get_next_sibling();
71    if ( $n ) {
72      $style = $n->get_style();
73      $y += $style->length_in_pt( array($style->margin_top, $style->padding_top),
74                                  $n->get_containing_block("w") );
75    }
76   
77    $this->_frame->set_position($x, $y);
78   
79  }
80}
81?>
Note: See TracBrowser for help on using the repository browser.