), we'll have an only one item in the parent's
- * line box - whitespace; in this case we'll need to additionally offset current y coordinate by the font size,
- * as whitespace alone does not affect the Y-coordinate.
- */
- if ($parent->line_box_empty()) {
- /**
- * There's no elements in the parent line box at all (e.g in the following situation:
- *
.. some text here...
); thus, as we're initiating
- * a new line, we need to offset current Y coordinate by the font-size value.
- */
-
- // Note that _current_y should be modified before 'close_line' call, as it checks for
- // left-floating boxes, causing an issues if line bottom will be placed below
- // float while line top is above float bottom margin
- $font = $this->getCSSProperty(CSS_FONT);
- $fs = $font->size;
- $parent->_current_y = min($this->get_bottom(),
- $parent->_current_y - $font->line_height->apply($fs->getPoints()));
-
- $parent->close_line($context, true);
- } else {
- /**
- * There's at least 1 non-whitespace element in the parent line box, we do not need to use whitespace
- * height; the bottom of the line box is defined by the non-whitespace elements. Top of the new line
- * should be equal to that value.
- */
- $parent->close_line($context, true);
- };
-
- /**
- * We need to explicitly extend the parent's height, to make it contain the generated line,
- * as we don't know if it have any children _after_ this BR box. If we will not do it,
- * the following code will be rendred incorrectly:
- *
...some text...
- */
- $parent->extend_height($parent->_current_y);
- }
-
- /**
- * Render the BR element; as BR element is non-visual, we do nothing here.
- *
- * @param OutputDriver $driver Current output device driver object.
- *
- * @return boolean true in case the box was successfully rendered
- */
- function show(&$driver) {
- return true;
- }
-
- /**
- * As BR element generated a line break, it means that a new line box will be started
- * (thus, any whitespaces immediately following the BR tag should not be rendered).
- * To indicate this, we reset the linebox_started flag to 'false' value.
- *
- * @param boolean $linebox_started Flag indicating that a new line box have just started and it already contains
- * some inline elements
- * @param boolean $previous_whitespace Flag indicating that a previous inline element was an whitespace element.
- *
- * @see GenericFormattedBox::reflow_whitespace()
- */
- function reflow_whitespace(&$linebox_started, &$previous_whitespace) {
- $linebox_started = false;
- }
-
- function get_height() {
- return 0;
- }
-
- function get_width() {
- return 0;
- }
-
- /**
- * BRBox may be placed inside InlineBox (white-space: pre)
- */
- function get_ascender() {
- return 0;
- }
-
- function get_descender() {
- return 0;
- }
-
- function isLineBreak() {
- return true;
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.button.php b/thirdparty/html2ps_pdf/box.button.php
deleted file mode 100644
index 2889181a1..000000000
--- a/thirdparty/html2ps_pdf/box.button.php
+++ /dev/null
@@ -1,149 +0,0 @@
-InlineControlBox();
- }
-
- /**
- * Create a new button element from the DOM tree element
- *
- * @param DOMElement $root pointer to the DOM tree element corresponding to the button.
- *
- * @return ButtonBox new button element
- */
- function &create(&$root, &$pipeline) {
- /**
- * Button text is defined by its 'value' attrubute;
- * if this attribute is not specified, we should provide some
- * appropriate defaults depending on the exact button type:
- * reset, submit or generic button.
- *
- * Default button text values are specified in config file config.inc.php.
- *
- * @see config.inc.php
- * @see DEFAULT_SUBMIT_TEXT
- * @see DEFAULT_RESET_TEXT
- * @see DEFAULT_BUTTON_TEXT
- */
- if ($root->has_attribute("value")) {
- $text = $root->get_attribute("value");
- } else {
- $text = DEFAULT_BUTTON_TEXT;
- };
-
- $box =& new ButtonBox();
- $box->readCSS($pipeline->getCurrentCSSState());
-
- /**
- * If button width is not constrained, then we'll add some space around the button text
- */
- $text = " ".$text." ";
-
- $box->_setup($text, $pipeline);
-
- return $box;
- }
-
- function _setup($text, &$pipeline) {
- /**
- * Contents of the text box are somewhat similar to the inline box:
- * a sequence of the text and whitespace boxes; we generate this sequence using
- * the InlineBox, then copy contents of the created inline box to our button.
- *
- * @todo probably, create_from_text() function should be extracted to the common parent
- * of inline boxes.
- */
- $ibox = InlineBox::create_from_text($text, WHITESPACE_PRE, $pipeline);
-
- $size = count($ibox->content);
- for ($i=0; $i<$size; $i++) {
- $this->add_child($ibox->content[$i]);
- };
-
- /**
- * Button height includes vertical padding (e.g. the following two buttons
- *
- *
- * are render by browsers with the same height!), so we'll need to adjust the
- * height constraint, subtracting the vertical padding value from the constraint
- * height value.
- */
- $hc = $this->get_height_constraint();
- if (!is_null($hc->constant)) {
- $hc->constant[0] -= $this->get_padding_top() + $this->get_padding_bottom();
- };
- $this->put_height_constraint($hc);
- }
-
- /**
- * Render the form field corresponding to this button
- * (Will be overridden by subclasses; they may render more specific button types)
- *
- * @param OutputDriver $driver The output driver object
- */
- function _render_field(&$driver) {
- $driver->field_pushbutton($this->get_left_padding(),
- $this->get_top_padding(),
- $this->get_width() + $this->get_padding_left() + $this->get_padding_right(),
- $this->get_height() + $this->get_padding_top() + $this->get_padding_bottom());
- }
-
- /**
- * Render the button using the specified output driver
- *
- * @param OutputDriver $driver The output driver object
- *
- * @return boolean flag indicating an error (null value) or success (true)
- */
- function show(&$driver) {
- /**
- * Set the baseline of a button box so that the button text will be aligned with
- * the line box baseline
- */
- $this->default_baseline = $this->content[0]->baseline + $this->get_extra_top();
- $this->baseline = $this->content[0]->baseline + $this->get_extra_top();
-
-
- /**
- * Render the interactive button (if requested and possible)
- */
- if ($GLOBALS['g_config']['renderforms']) {
- $status = GenericContainerBox::show($driver);
- $this->_render_field($driver);
- } else {
- $status = GenericContainerBox::show($driver);
- };
-
- return $status;
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.button.reset.php b/thirdparty/html2ps_pdf/box.button.reset.php
deleted file mode 100644
index 00ad801dc..000000000
--- a/thirdparty/html2ps_pdf/box.button.reset.php
+++ /dev/null
@@ -1,36 +0,0 @@
-ButtonBox($text);
- }
-
- function &create(&$root, &$pipeline) {
- if ($root->has_attribute("value")) {
- $text = $root->get_attribute("value");
- } else {
- $text = DEFAULT_RESET_TEXT;
- };
-
- $box =& new ButtonResetBox($text);
- $box->readCSS($pipeline->getCurrentCSSState());
-
- return $box;
- }
-
- function readCSS(&$state) {
- parent::readCSS($state);
-
- $this->_readCSS($state,
- array(CSS_HTML2PS_FORM_ACTION));
- }
-
- function _render_field(&$driver) {
- $driver->field_pushbuttonreset($this->get_left_padding(),
- $this->get_top_padding(),
- $this->get_width() + $this->get_padding_left() + $this->get_padding_right(),
- $this->get_height() + $this->get_padding_top() + $this->get_padding_bottom());
- }
-}
-
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.button.submit.php b/thirdparty/html2ps_pdf/box.button.submit.php
deleted file mode 100644
index 595955c53..000000000
--- a/thirdparty/html2ps_pdf/box.button.submit.php
+++ /dev/null
@@ -1,91 +0,0 @@
-ButtonBox();
- $this->_action_url = $action;
- $this->_field_name = $field;
- $this->_value = $value;
- }
-
- /**
- * Create input box using DOM tree data
- *
- * @param Object $root DOM tree node corresponding to the box being created
- * @param Pipeline $pipeline reference to current pipeline object (unused)
- *
- * @return input box
- */
- function &create(&$root, &$pipeline) {
- /**
- * If no "value" attribute is specified, display the default button text.
- * Note the difference between displayed text and actual field value!
- */
- if ($root->has_attribute("value")) {
- $text = $root->get_attribute("value");
- } else {
- $text = DEFAULT_SUBMIT_TEXT;
- };
-
- $field = $root->get_attribute('name');
- $value = $root->get_attribute('value');
-
- $css_state =& $pipeline->getCurrentCSSState();
- $box =& new ButtonSubmitBox($field, $value, $css_state->getProperty(CSS_HTML2PS_FORM_ACTION));
- $box->readCSS($css_state);
- $box->_setup($text, $pipeline);
-
- return $box;
- }
-
- /**
- * Render interactive field using the driver-specific capabilities;
- * button is rendered as a rectangle defined by margin and padding areas (note that unlike most other boxes,
- * borders are _outside_ the box, so we may treat
- *
- * @param OutputDriver $driver reference to current output driver object
- */
- function _render_field(&$driver) {
- $driver->field_pushbuttonsubmit($this->get_left_padding() - $this->get_margin_left(),
- $this->get_top_padding() + $this->get_margin_top(),
- $this->get_width() + $this->get_padding_left() + $this->get_padding_right() + $this->get_margin_left() + $this->get_margin_right(),
- $this->get_height() + $this->get_padding_top() + $this->get_padding_bottom() + $this->get_margin_top() + $this->get_margin_bottom(),
- $this->_field_name,
- $this->_value,
- $this->_action_url);
- }
-}
-
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.checkbutton.php b/thirdparty/html2ps_pdf/box.checkbutton.php
deleted file mode 100644
index 7bb816078..000000000
--- a/thirdparty/html2ps_pdf/box.checkbutton.php
+++ /dev/null
@@ -1,239 +0,0 @@
-
- * elements
- */
-
-/**
- * @package HTML2PS
- * @subpackage Document
- *
- * The CheckBox class desribes the layour of HTML checkboxes (they have HTML2PS-specific
- * '-checkbox' value of 'display' property)
- *
- * Checkboxes have fixed size, which can be configured using CHECKBOX_SIZE constant
- * in config.inc.php file. If "checked" attribute is present (whatever its value is),
- * a small cross is drawn inside the checkbox.
- *
- * @see CHECKBOX_SIZE
- *
- * @todo add "disabled" state
- */
-class CheckBox extends GenericFormattedBox {
- /**
- * @var Boolean Flag indicating whether the check mark should be drawn
- * @access private
- */
- var $_checked;
-
- /**
- * @var String name of the corresponding form field
- * @access private
- */
- var $_name;
-
- /**
- * Notes: leading and trailing spaces are removed; if value is not specified,
- * checkbox is not rendered as ineractive control
- *
- * @var String value to be posted from ineractive form for this checkbox
- * @access private
- */
- var $_value;
-
- /**
- * Create a new checkbutton element using DOM tree element to initialize
- * it.
- *
- * @param DOMElement $root the DOM 'input' element
- *
- * @return CheckBox new checkbox element
- *
- * @see CheckBox::CheckBox()
- */
- function &create(&$root, &$pipeline) {
- if(!class_exists('G')){
- $realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
- $docuroot = explode( '/', $realdocuroot );
- array_pop( $docuroot );
- $pathhome = implode( '/', $docuroot ) . '/';
- array_pop( $docuroot );
- $pathTrunk = implode( '/', $docuroot ) . '/';
- require_once($pathTrunk.'gulliver/system/class.g.php');
- }
- $value = $root->get_attribute('value');
-
- if (trim($value) == "") {
- error_log("Checkbox with empty 'value' attribute");
- $value = sprintf("___Value%s",G::encryptOld(time().rand()));
- };
-
- $box =& new CheckBox($root->has_attribute('checked'),
- $root->get_attribute('name'),
- $value);
- $box->readCSS($pipeline->getCurrentCSSState());
- return $box;
- }
-
- /**
- * Create a new checkbox element with the given state
- *
- * @param $checked flag inidicating if this box should be checked
- *
- * @see CheckBox::create()
- */
- function CheckBox($checked, $name, $value) {
- $this->GenericFormattedBox();
-
- $this->_checked = $checked;
- $this->_name = trim($name);
- $this->_value = trim($value);
- }
-
- /**
- * Returns the width of the checkbox; not that max/min width does not
- * make sense for the checkbuttons, as their width is always constant.
- *
- * @param FlowContext Context object describing current flow parameters (unused)
- *
- * @return int width of the checkbox
- *
- * @see CheckBox::get_max_width
- */
- function get_min_width(&$context) {
- return $this->width;
- }
-
- /**
- * Returns the width of the checkbox; not that max/min width does not
- * make sense for the checkbuttons, as their width is always constant.
- *
- * @param FlowContext Context object describing current flow parameters (unused)
- *
- * @return int width of the checkbox
- *
- * @see CheckBox::get_min_width
- */
- function get_max_width(&$context) {
- return $this->width;
- }
-
- /**
- * Layout current checkbox element. Note that most CSS properties do not apply to the
- * checkboxes; i.e. margin/padding values are ignored, checkboxes always aligned to
- * to bottom of current line, etc.
- *
- * @param GenericContainerBox $parent
- * @param FlowContext $context Context object describing current flow parameters
- *
- * @return Boolean flag indicating the error/success state; 'null' value in case of critical error
- */
- function reflow(&$parent, &$context) {
- GenericFormattedBox::reflow($parent, $context);
-
- /**
- * Check box size is constant (defined in config.inc.php) and is never affected
- * neither by CSS nor HTML.
- *
- * @see CHECKBOX_SIZE
- */
- $this->default_baseline = units2pt(CHECKBOX_SIZE);
- $this->height = units2pt(CHECKBOX_SIZE);
- $this->width = units2pt(CHECKBOX_SIZE);
-
- // set default baseline
- $this->baseline = $this->default_baseline;
-
-// // Vertical-align
-// $this->_apply_vertical_align($parent);
-
- /**
- * append to parent line box
- */
- $parent->append_line($this);
-
- /**
- * Determine coordinates of upper-left margin corner
- */
- $this->guess_corner($parent);
-
- /**
- * Offset parent current X coordinate
- */
- $parent->_current_x += $this->get_full_width();
-
- /**
- * Extend parents height to fit the checkbox
- */
- $parent->extend_height($this->get_bottom_margin());
- }
-
- /**
- * Render the checkbox using the specified output driver
- *
- * @param OutputDriver $driver The output device driver object
- */
- function show(&$driver) {
- /**
- * Get the coordinates of the check mark
- */
- $x = ($this->get_left() + $this->get_right()) / 2;
- $y = ($this->get_top() + $this->get_bottom()) / 2;
-
- /**
- * Calculate checkmark size; it looks nice when it takes
- * 1/3 of the box size
- */
- $size = $this->get_width() / 3;
-
- /**
- * Draw the box
- */
- $driver->setrgbcolor(0,0,0);
- $driver->setlinewidth(0.25);
- $driver->moveto($x - $size, $y + $size);
- $driver->lineto($x + $size, $y + $size);
- $driver->lineto($x + $size, $y - $size);
- $driver->lineto($x - $size, $y - $size);
- $driver->closepath();
- $driver->stroke();
-
- /**
- * Render the interactive button (if requested and possible)
- * Also, field should be rendered only if name is not empty
- */
- global $g_config;
- if ($g_config['renderforms'] && $this->_name != "" && $this->_value != "") {
- $driver->field_checkbox($x - $size,
- $y + $size,
- 2*$size,
- 2*$size,
- $this->_name,
- $this->_value,
- $this->_checked);
- } else {
- /**
- * Draw check mark if needed
- */
- if ($this->_checked) {
- $check_size = $this->get_width() / 6;
-
- $driver->moveto($x - $check_size, $y + $check_size);
- $driver->lineto($x + $check_size, $y - $check_size);
- $driver->stroke();
-
- $driver->moveto($x + $check_size, $y + $check_size);
- $driver->lineto($x - $check_size, $y - $check_size);
- $driver->stroke();
- }
- };
-
- return true;
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.container.php b/thirdparty/html2ps_pdf/box.container.php
deleted file mode 100644
index 92f230567..000000000
--- a/thirdparty/html2ps_pdf/box.container.php
+++ /dev/null
@@ -1,1103 +0,0 @@
-text
float
word". In
- * this case, the floating DIV should be rendered below the "text word" line;
- * thus, we need to keep a list of deferred floating elements and render them
- * when current line box closes.
- *
- * @var Array A list of floats which should be flown after current line box ends;
- * @access private
- */
- var $_deferred_floats;
-
- /**
- * @var float Current output X value inside the current element
- * @access public
- */
- var $_current_x;
-
- /**
- * @var float Current output Y value inside the current element
- * @access public
- */
- var $_current_y;
-
- function destroy() {
- for ($i=0, $size = count($this->content); $i < $size; $i++) {
- $this->content[$i]->destroy();
- };
- unset($this->content);
-
- parent::destroy();
- }
-
- /**
- * Render current container box using the specified output method.
- *
- * @param OutputDriver $driver The output driver object
- *
- * @return Boolean flag indicating the success or 'null' value in case of critical rendering
- * error
- */
- function show(&$driver) {
- GenericFormattedBox::show($driver);
-
- $overflow = $this->getCSSProperty(CSS_OVERFLOW);
-
- /**
- * Sometimes the content may overflow container boxes. This situation arise, for example,
- * for relative-positioned child boxes, boxes having constrained height and in some
- * other cases. If the container box does not have CSS 'overflow' property
- * set to 'visible' value, the content should be visually clipped using container box
- * padding area.
- */
- if ($overflow !== OVERFLOW_VISIBLE) {
- $driver->save();
- $this->_setupClip($driver);
- };
-
- /**
- * Render child elements
- */
- for ($i=0, $size = count($this->content); $i < $size; $i++) {
- $child =& $this->content[$i];
-
- /**
- * We'll check the visibility property here
- * Reason: all boxes (except the top-level one) are contained in some other box,
- * so every box will pass this check. The alternative is to add this check into every
- * box class show member.
- *
- * The only exception of absolute positioned block boxes which are drawn separately;
- * their show method is called explicitly; the similar check should be performed there
- */
- if ($child->isVisibleInFlow()) {
- /**
- * To reduce the drawing overhead, we'll check if some part if current child element
- * belongs to current output page. If not, there will be no reason to draw this
- * child this time.
- *
- * @see OutputDriver::contains()
- *
- * @todo In rare cases the element content may be placed outside the element itself;
- * in such situantion content may be visible on the page, while element is not.
- * This situation should be resolved somehow.
- */
- if ($driver->contains($child)) {
- if (is_null($child->show($driver))) {
- return null;
- };
- };
- };
- }
-
- /**
- * Restore previous clipping mode, if it have been modified for non-'overflow: visible'
- * box.
- */
- if ($overflow !== OVERFLOW_VISIBLE) {
- $driver->restore();
- };
-
- return true;
- }
-
- /**
- * Render current fixed-positioned container box using the specified output method. Unlike
- * the 'show' method, there's no check if current page viewport contains current element, as
- * fixed-positioned may be drawn on the page margins, outside the viewport.
- *
- * @param OutputDriver $driver The output driver object
- *
- * @return Boolean flag indicating the success or 'null' value in case of critical rendering
- * error
- *
- * @see GenericContainerBox::show()
- *
- * @todo the 'show' and 'show_fixed' method code are almost the same except the child element
- * method called in the inner loop; also, no check is done if current viewport contains this element,
- * thus sllowinf printing data on page margins, where no data should be printed normally
- * I suppose some more generic method containing the common code should be made.
- */
- function show_fixed(&$driver) {
- GenericFormattedBox::show($driver);
-
- $overflow = $this->getCSSProperty(CSS_OVERFLOW);
-
- /**
- * Sometimes the content may overflow container boxes. This situation arise, for example,
- * for relative-positioned child boxes, boxes having constrained height and in some
- * other cases. If the container box does not have CSS 'overflow' property
- * set to 'visible' value, the content should be visually clipped using container box
- * padding area.
- */
- if ($overflow !== OVERFLOW_VISIBLE) {
- // Save graphics state (of course, BEFORE the clipping area will be set)
- $driver->save();
- $this->_setupClip($driver);
- };
-
- /**
- * Render child elements
- */
- $size = count($this->content);
- for ($i=0; $i < $size; $i++) {
- /**
- * We'll check the visibility property here
- * Reason: all boxes (except the top-level one) are contained in some other box,
- * so every box will pass this check. The alternative is to add this check into every
- * box class show member.
- *
- * The only exception of absolute positioned block boxes which are drawn separately;
- * their show method is called explicitly; the similar check should be performed there
- */
- $child =& $this->content[$i];
- if ($child->getCSSProperty(CSS_VISIBILITY) === VISIBILITY_VISIBLE) {
- // Fixed-positioned blocks are displayed separately;
- // If we call them now, they will be drawn twice
- if ($child->getCSSProperty(CSS_POSITION) != POSITION_FIXED) {
- if (is_null($child->show_fixed($driver))) {
- return null;
- };
- };
- };
- }
-
- /**
- * Restore previous clipping mode, if it have been modified for non-'overflow: visible'
- * box.
- */
- if ($overflow !== OVERFLOW_VISIBLE) {
- $driver->restore();
- };
-
- return true;
- }
-
- function _find(&$box) {
- $size = count($this->content);
- for ($i=0; $i<$size; $i++) {
- if ($this->content[$i]->uid == $box->uid) {
- return $i;
- };
- }
- return null;
- }
-
- // Inserts new child box at the specified (zero-based) offset; 0 stands for first child
- //
- // @param $index index to insert child at
- // @param $box child to be inserted
- //
- function insert_child($index, &$box) {
- $box->parent =& $this;
-
- // Offset the content array
- for ($i = count($this->content)-1; $i>= $index; $i--) {
- $this->content[$i+1] =& $this->content[$i];
- };
-
- $this->content[$index] =& $box;
- }
-
- function insertBefore(&$what, &$where) {
- if ($where) {
- $index = $this->_find($where);
-
- if (is_null($index)) {
- return null;
- };
-
- $this->insert_child($index, $what);
- } else {
- // If 'where' is not specified, 'what' should become the last child
- $this->add_child($what);
- };
-
- return $what;
- }
-
- function add_child(&$box) {
- // In general, this function is called like following:
- // $box->add_child(create_pdf_box(...))
- // As create_pdf_box _may_ return null value (for example, for an empty text node),
- // we should process the case of $box == null here
- if ($box) {
- $box->parent =& $this;
- $this->content[] =& $box;
- };
- }
-
- // Get first child of current box which actually will be drawn
- // on the page. So, whitespace and null boxes will be ignored
- //
- // See description of is_null for null box definition.
- // (not only NullBox is treated as null box)
- //
- // @return reference to the first visible child of current box
- function &get_first() {
- $size = count($this->content);
- for ($i=0; $i<$size; $i++) {
- if (!is_whitespace($this->content[$i]) &&
- !$this->content[$i]->is_null()) {
- return $this->content[$i];
- };
- };
-
- // We use this construct to avoid notice messages in PHP 4.4 and PHP 5
- $dummy = null;
- return $dummy;
- }
-
- // Get first text or image child of current box which actually will be drawn
- // on the page.
- //
- // See description of is_null for null box definition.
- // (not only NullBox is treated as null box)
- //
- // @return reference to the first visible child of current box
- function &get_first_data() {
- $size = count($this->content);
- for ($i=0; $i<$size; $i++) {
- if (!is_whitespace($this->content[$i]) && !$this->content[$i]->is_null()) {
- if (is_container($this->content[$i])) {
- $data =& $this->content[$i]->get_first_data();
- if (!is_null($data)) { return $data; };
- } else {
- return $this->content[$i];
- };
- };
- };
-
- // We use this construct to avoid notice messages in PHP 4.4 and PHP 5
- $dummy = null;
- return $dummy;
- }
-
- // Get last child of current box which actually will be drawn
- // on the page. So, whitespace and null boxes will be ignored
- //
- // See description of is_null for null box definition.
- // (not only NullBox is treated as null box)
- //
- // @return reference to the last visible child of current box
- function &get_last() {
- for ($i=count($this->content)-1; $i>=0; $i--) {
- if (!is_whitespace($this->content[$i]) && !$this->content[$i]->is_null()) {
- return $this->content[$i];
- };
- };
-
- // We use this construct to avoid notice messages in PHP 4.4 and PHP 5
- $dummy = null;
- return $dummy;
- }
-
- function offset_if_first(&$box, $dx, $dy) {
- if ($this->is_first($box)) {
- // The top-level box (page box) should never be offset
- if ($this->parent) {
- if (!$this->parent->offset_if_first($box, $dx, $dy)) {
- $this->offset($dx, $dy);
- return true;
- };
- };
- };
- return false;
- }
-
- function offset($dx, $dy) {
- parent::offset($dx, $dy);
-
- $this->_current_x += $dx;
- $this->_current_y += $dy;
-
- // Offset contents
- $size = count($this->content);
- for ($i=0; $i < $size; $i++) {
- $this->content[$i]->offset($dx, $dy);
- }
- }
-
- function GenericContainerBox() {
- $this->GenericFormattedBox();
-
- // By default, box does not have any content
- $this->content = array();
-
- // Initialize line box
- $this->_line = array();
-
- // Initialize floats-related stuff
- $this->_deferred_floats = array();
-
- $this->_additional_text_indent = 0;
-
- // Current-point
- $this->_current_x = 0;
- $this->_current_y = 0;
-
- // Initialize floating children array
- $this->_floats = array();
- }
-
- function add_deferred_float(&$float) {
- $this->_deferred_floats[] =& $float;
- }
-
- /**
- * Create the child nodes of current container object using the parsed HTML data
- *
- * @param mixed $root node corresponding to the current container object
- */
- function create_content(&$root, &$pipeline) {
- // Initialize content
- $child = $root->first_child();
- while ($child) {
- $box_child =& create_pdf_box($child, $pipeline);
- $this->add_child($box_child);
- $child = $child->next_sibling();
- };
- }
-
- // Content-handling functions
-
- function is_container() {
- return true;
- }
-
- // Get total height of this box content (including floats, if any)
- // Note that floats can be contained inside children, so we'll need to use
- // this function recusively
- function get_real_full_height() {
- $content_size = count($this->content);
-
- $overflow = $this->getCSSProperty(CSS_OVERFLOW);
-
- // Treat items with overflow: hidden specifically,
- // as floats flown out of this boxes will not be visible
- if ($overflow == OVERFLOW_HIDDEN) {
- return $this->get_full_height();
- };
-
- // Check if this object is totally empty
- $first = $this->get_first();
- if (is_null($first)) {
- return 0;
- };
-
- // Initialize the vertical extent taken by content using the
- // very first child
- $max_top = $first->get_top_margin();
- $min_bottom = $first->get_bottom_margin();
-
- for ($i=0; $i<$content_size; $i++) {
- if (!$this->content[$i]->is_null()) {
- // Check if top margin of current child is to the up
- // of vertical extent top margin
- $max_top = max($max_top, $this->content[$i]->get_top_margin());
-
- /**
- * Check if current child bottom margin will extend
- * the vertical space OR if it contains floats extending
- * this, unless this child have overflow: hidden, because this
- * will prevent additional content to be visible
- */
- if (!$this->content[$i]->is_container()) {
- $min_bottom = min($min_bottom,
- $this->content[$i]->get_bottom_margin());
- } else {
- $content_overflow = $this->content[$i]->getCSSProperty(CSS_OVERFLOW);
-
- if ($content_overflow == OVERFLOW_HIDDEN) {
- $min_bottom = min($min_bottom,
- $this->content[$i]->get_bottom_margin());
- } else {
- $min_bottom = min($min_bottom,
- $this->content[$i]->get_bottom_margin(),
- $this->content[$i]->get_top_margin() -
- $this->content[$i]->get_real_full_height());
- };
- };
- };
- }
-
- return max(0, $max_top - $min_bottom) + $this->_get_vert_extra();
- }
-
- // LINE-LENGTH RELATED FUNCTIONS
-
- function _line_length() {
- $sum = 0;
- $size = count($this->_line);
-
- for ($i=0; $i < $size; $i++) {
- // Note that the line length should include the inline boxes margin/padding
- // as inline boxes are not directly included to the parent line box,
- // we'll need to check the parent of current line box element,
- // and, if it is an inline box, AND this element is last or first contained element
- // add correcponsing padding value
- $element =& $this->_line[$i];
-
- if (isset($element->wrapped) && !is_null($element->wrapped)) {
- if ($i==0) {
- $sum += $element->get_full_width() - $element->getWrappedWidth();
- } else {
- $sum += $element->getWrappedWidthAndHyphen();
- };
- } else {
- $sum += $element->get_full_width();
- };
-
- if ($element->parent) {
- $first = $element->parent->get_first();
- $last = $element->parent->get_last();
-
- if (!is_null($first) && $first->uid === $element->uid) {
- $sum += $element->parent->get_extra_line_left();
- }
-
- if (!is_null($last) && $last->uid === $element->uid) {
- $sum += $element->parent->get_extra_line_right();
- }
- };
- }
-
- if ($this->_first_line) {
- $ti = $this->getCSSProperty(CSS_TEXT_INDENT);
- $sum += $ti->calculate($this);
- $sum += $this->_additional_text_indent;
- };
-
- return $sum;
- }
-
- function _line_length_delta(&$context) {
- return max($this->get_available_width($context) - $this->_line_length(),0);
- }
-
- /**
- * Get the last box in current line box
- */
- function &last_in_line() {
- $size = count($this->_line);
- if ($size < 1) {
- $dummy = null;
- return $dummy;
- };
-
- return $this->_line[$size-1];
- }
-
- // WIDTH
-
- function get_min_width_natural(&$context) {
- $content_size = count($this->content);
-
- /**
- * If box does not have any context, its minimal width is determined by extra horizontal space:
- * padding, border width and margins
- */
- if ($content_size == 0) {
- $min_width = $this->_get_hor_extra();
- return $min_width;
- };
-
- /**
- * If we're in 'nowrap' mode, minimal and maximal width will be equal
- */
- $white_space = $this->getCSSProperty(CSS_WHITE_SPACE);
- $pseudo_nowrap = $this->getCSSProperty(CSS_HTML2PS_NOWRAP);
- if ($white_space == WHITESPACE_NOWRAP ||
- $pseudo_nowrap == NOWRAP_NOWRAP) {
- $min_width = $this->get_min_nowrap_width($context);
- return $min_width;
- }
-
- /**
- * We need to add text indent size to the width of the first item
- */
- $start_index = 0;
- while ($start_index < $content_size &&
- $this->content[$start_index]->out_of_flow()) {
- $start_index++;
- };
-
- if ($start_index < $content_size) {
- $ti = $this->getCSSProperty(CSS_TEXT_INDENT);
- $minw =
- $ti->calculate($this) +
- $this->content[$start_index]->get_min_width_natural($context);
- } else {
- $minw = 0;
- };
-
- for ($i=$start_index; $i<$content_size; $i++) {
- $item =& $this->content[$i];
- if (!$item->out_of_flow()) {
- $minw = max($minw, $item->get_min_width($context));
- };
- }
-
- /**
- * Apply width constraint to min width. Return maximal value
- */
- $wc = $this->getCSSProperty(CSS_WIDTH);
- $containing_block =& $this->_get_containing_block();
-
- $min_width = $minw;
- return $min_width;
- }
-
- function get_min_width(&$context) {
- $strategy = new StrategyWidthMin();
- return $strategy->apply($this, $context);
- }
-
- function get_min_nowrap_width(&$context) {
- $strategy = new StrategyWidthMinNowrap();
- return $strategy->apply($this, $context);
- }
-
- // Note:
apply($this, $context);
- }
-
- function get_max_width(&$context, $limit=10E6) {
- $strategy = new StrategyWidthMax($limit);
- return $strategy->apply($this, $context);
- }
-
- function close_line(&$context, $lastline = false) {
- // Align line-box using 'text-align' property
- $size = count($this->_line);
-
- if ($size > 0) {
- $last_item =& $this->_line[$size-1];
- if (is_whitespace($last_item)) {
- $last_item->width = 0;
- $last_item->height = 0;
- };
- };
-
- // Note that text-align should not be applied to the block boxes!
- // As block boxes will be alone in the line-box, we can check
- // if the very first box in the line is inline; if not - no justification should be made
- //
- if ($size > 0) {
- if (is_inline($this->_line[0])) {
- $cb = CSSTextAlign::value2pdf($this->getCSSProperty(CSS_TEXT_ALIGN));
- $cb($this, $context, $lastline);
- } else {
- // Nevertheless, CENTER tag and P/DIV with ALIGN attribute set should affect the
- // position of non-inline children.
- $cb = CSSPseudoAlign::value2pdf($this->getCSSProperty(CSS_HTML2PS_ALIGN));
- $cb($this, $context, $lastline);
- };
- };
-
- // Apply vertical align to all of the line content
- // first, we need to aling all baseline-aligned boxes to determine the basic line-box height, top and bottom edges
- // then, SUP and SUP positioned boxes (as they can extend the top and bottom edges, but not affected themselves)
- // then, MIDDLE, BOTTOM and TOP positioned boxes in the given order
- //
- $baselined = array();
- $baseline = 0;
- $height = 0;
- for ($i=0; $i < $size; $i++) {
- $vertical_align = $this->_line[$i]->getCSSProperty(CSS_VERTICAL_ALIGN);
-
- if ($vertical_align == VA_BASELINE) {
- // Add current baseline-aligned item to the baseline
- //
- $baselined[] =& $this->_line[$i];
-
- $baseline = max($baseline,
- $this->_line[$i]->default_baseline);
- };
- };
-
- $size_baselined = count($baselined);
- for ($i=0; $i < $size_baselined; $i++) {
- $baselined[$i]->baseline = $baseline;
-
- $height = max($height,
- $baselined[$i]->get_full_height() + $baselined[$i]->getBaselineOffset(),
- $baselined[$i]->get_ascender() + $baselined[$i]->get_descender());
-
- };
-
- // SUB vertical align
- //
- for ($i=0; $i < $size; $i++) {
- $vertical_align = $this->_line[$i]->getCSSProperty(CSS_VERTICAL_ALIGN);
- if ($vertical_align == VA_SUB) {
- $this->_line[$i]->baseline =
- $baseline + $this->_line[$i]->get_full_height()/2;
- };
- }
-
- // SUPER vertical align
- //
- for ($i=0; $i < $size; $i++) {
- $vertical_align = $this->_line[$i]->getCSSProperty(CSS_VERTICAL_ALIGN);
- if ($vertical_align == VA_SUPER) {
- $this->_line[$i]->baseline = $this->_line[$i]->get_full_height()/2;
- };
- }
-
- // MIDDLE vertical align
- //
- $middle = 0;
- for ($i=0; $i < $size; $i++) {
- $vertical_align = $this->_line[$i]->getCSSProperty(CSS_VERTICAL_ALIGN);
- if ($vertical_align == VA_MIDDLE) {
- $middle = max($middle, $this->_line[$i]->get_full_height() / 2);
- };
- };
-
- if ($middle * 2 > $height) {
- // Offset already aligned items
- //
- for ($i=0; $i < $size; $i++) {
- $this->_line[$i]->baseline += ($middle - $height/2);
- };
- $height = $middle * 2;
- };
-
- for ($i=0; $i < $size; $i++) {
- $vertical_align = $this->_line[$i]->getCSSProperty(CSS_VERTICAL_ALIGN);
- if ($vertical_align == VA_MIDDLE) {
- $this->_line[$i]->baseline = $this->_line[$i]->default_baseline + ($height/2 - $this->_line[$i]->get_full_height()/2);
- };
- }
-
- // BOTTOM vertical align
- //
- $bottom = 0;
- for ($i=0; $i < $size; $i++) {
- $vertical_align = $this->_line[$i]->getCSSProperty(CSS_VERTICAL_ALIGN);
- if ($vertical_align == VA_BOTTOM) {
- $bottom = max($bottom, $this->_line[$i]->get_full_height());
- };
- };
-
- if ($bottom > $height) {
- // Offset already aligned items
- //
- for ($i=0; $i < $size; $i++) {
- $this->_line[$i]->baseline += ($bottom - $height);
- };
- $height = $bottom;
- };
-
- for ($i=0; $i < $size; $i++) {
- $vertical_align = $this->_line[$i]->getCSSProperty(CSS_VERTICAL_ALIGN);
- if ($vertical_align == VA_BOTTOM) {
- $this->_line[$i]->baseline = $this->_line[$i]->default_baseline + $height - $this->_line[$i]->get_full_height();
- };
- }
-
- // TOP vertical align
- //
- $bottom = 0;
- for ($i=0; $i < $size; $i++) {
- $vertical_align = $this->_line[$i]->getCSSProperty(CSS_VERTICAL_ALIGN);
- if ($vertical_align == VA_TOP) {
- $bottom = max($bottom, $this->_line[$i]->get_full_height());
- };
- };
-
- if ($bottom > $height) {
- $height = $bottom;
- };
-
- for ($i=0; $i < $size; $i++) {
- $vertical_align = $this->_line[$i]->getCSSProperty(CSS_VERTICAL_ALIGN);
- if ($vertical_align == VA_TOP) {
- $this->_line[$i]->baseline = $this->_line[$i]->default_baseline;
- };
- }
-
- // Calculate the bottom Y coordinate of last line box
- //
- $line_bottom = $this->_current_y;
- foreach ($this->_line AS $line_element) {
- // This line is required; say, we have sequence of text and image inside the container,
- // AND image have greater baseline than text; in out case, text will be offset to the bottom
- // of the page and we lose the gap between text and container bottom edge, unless we'll re-extend
- // containier height
-
- // Note that we're using the colapsed margin value to get the Y coordinate to extend height to,
- // as bottom margin may be collapsed with parent
-
- $effective_bottom =
- $line_element->get_top() -
- $line_element->get_height();
-
- $this->extend_height($effective_bottom);
- $line_bottom = min($effective_bottom, $line_bottom);
- }
-
- $this->extend_height($line_bottom);
-
- // Clear the line box
- $this->_line = array();
-
- // Reset current X coordinate to the far left
- $this->_current_x = $this->get_left();
-
- // Extend Y coordinate
- $this->_current_y = $line_bottom;
-
- // Render the deferred floats
- for ($i = 0, $size = count($this->_deferred_floats); $i < $size; $i++) {
- $this->_deferred_floats[$i]->reflow_static_float($this, $context);
- };
- // Clear deferred float list
- $this->_deferred_floats = array();
-
- // modify the current-x value, so that next inline box will not intersect any floating boxes
- $this->_current_x = $context->float_left_x($this->_current_x, $this->_current_y);
-
- $this->_first_line = false;
- }
-
- function append_line(&$item) {
- $this->_line[] =& $item;
- }
-
- // Line box should be treated as empty in following cases:
- // 1. It is really empty (so, it contains 0 boxes)
- // 2. It contains only whitespace boxes
- function line_box_empty() {
- $size = count($this->_line);
- if ($size == 0) { return true; }
-
- // Scan line box
- for ($i=0; $i<$size; $i++) {
- if (!is_whitespace($this->_line[$i]) &&
- !$this->_line[$i]->is_null()) { return false; };
- }
-
- // No non-whitespace boxes were found
- return true;
- }
-
- function reflow_anchors(&$viewport, &$anchors) {
- GenericFormattedBox::reflow_anchors($viewport, $anchors);
-
- $size = count($this->content);
- for ($i=0; $i<$size; $i++) {
- $this->content[$i]->reflow_anchors($viewport, $anchors);
- }
- }
-
- function fitFloats(&$context) {
- $float_bottom = $context->float_bottom();
- if (!is_null($float_bottom)) {
- $this->extend_height($float_bottom);
- };
-
- $float_right = $context->float_right();
- if (!is_null($float_right)) {
- $this->extend_width($float_right);
- };
- }
-
- function reflow_content(&$context) {
- $text_indent = $this->getCSSProperty(CSS_TEXT_INDENT);
-
- $this->close_line($context);
-
- $this->_first_line = true;
-
- // If first child is inline - apply text-indent
- $first = $this->get_first();
- if (!is_null($first)) {
- if (is_inline($first)) {
- $this->_current_x += $text_indent->calculate($this);
- $this->_current_x += $this->_additional_text_indent;
- };
- };
-
- $this->height = 0;
- // Reset current Y value
- $this->_current_y = $this->get_top();
-
- $size = count($this->content);
- for ($i=0; $i < $size; $i++) {
- $child =& $this->content[$i];
- $child->reflow($this, $context);
- };
-
- $this->close_line($context, true);
- }
-
- function reflow_inline() {
- $size = count($this->content);
- for ($i=0; $i<$size; $i++) {
- $this->content[$i]->reflow_inline();
- };
- }
-
- function reflow_text(&$viewport) {
- $size = count($this->content);
- for ($i=0; $i<$size; $i++) {
- if (is_null($this->content[$i]->reflow_text($viewport))) {
- return null;
- };
- }
- return true;
- }
-
- /**
- * Position/size current box as floating one
- */
- function reflow_static_float(&$parent, &$context) {
- // Defer the float rendering till the next line box
- if (!$parent->line_box_empty()) {
- $parent->add_deferred_float($this);
- return;
- };
-
- // Calculate margin values if they have been set as a percentage
- $this->_calc_percentage_margins($parent);
- $this->_calc_percentage_padding($parent);
-
- // Calculate width value if it have been set as a percentage
- $this->_calc_percentage_width($parent, $context);
-
- // Calculate margins and/or width is 'auto' values have been specified
- $this->_calc_auto_width_margins($parent);
-
- // Determine the actual width of the floating box
- // Note that get_max_width returns both content and extra width
- $this->put_full_width($this->get_max_width_natural($context, $this->parent->get_width()));
-
- // We need to call this function before determining the horizontal coordinate
- // as after vertical offset the additional space to the left may apperar
- $y = $this->apply_clear($parent->_current_y, $context);
-
- // determine the position of top-left floating box corner
- if ($this->getCSSProperty(CSS_FLOAT) === FLOAT_RIGHT) {
- $context->float_right_xy($parent, $this->get_full_width(), $x, $y);
- $x -= $this->get_full_width();
- } else {
- $context->float_left_xy($parent, $this->get_full_width(), $x, $y);
- };
-
- // Note that $x and $y contain just a free space corner coordinate;
- // If our float has a margin/padding space, we'll need to offset ot a little;
- // Remember that float margins are never collapsed!
- $this->moveto($x + $this->get_extra_left(), $y - $this->get_extra_top());
-
- // Reflow contents.
- // Note that floating box creates a new float flow context for it children.
-
- $context->push_floats();
-
- // Floating box create a separate margin collapsing context
- $context->push_collapsed_margin(0);
-
- $this->reflow_content($context);
-
- $context->pop_collapsed_margin();
-
- // Floats and boxes with overflow: hidden
- // should completely enclose its child floats
- $this->fitFloats($context);
-
- // restore old float flow context
- $context->pop_floats();
-
- // Add this box to the list of floats in current context
- $context->add_float($this);
-
- // Now fix the value of _current_x for the parent box; it is required
- // in the following case:
- // some text
- // in such situation floating image is flown immediately, but it the close_line call have been made before,
- // so _current_x value of container box will be still equal to ots left content edge; by calling float_left_x again,
- // we'll force "some text" to be offset to the right
- $parent->_current_x = $context->float_left_x($parent->_current_x, $parent->_current_y);
- }
-
- function reflow_whitespace(&$linebox_started, &$previous_whitespace) {
- $previous_whitespace = false;
- $linebox_started = false;
-
- $size = count($this->content);
- for ($i=0; $i<$size; $i++) {
- $child =& $this->content[$i];
-
- $child->reflow_whitespace($linebox_started, $previous_whitespace);
- };
-
- // remove the last whitespace in block box
- $this->remove_last_whitespace();
-
- // Non-inline box have terminated; we may be sure that line box will be closed
- // at this moment and new line box after this will be generated
- if (!is_inline($this)) {
- $linebox_started = false;
- };
-
- return;
- }
-
- function remove_last_whitespace() {
- if (count($this->content) == 0) {
- return;
- };
-
- $i = count($this->content)-1;
- $last = $this->content[$i];
- while ($i >= 0 && is_whitespace($this->content[$i])) {
- $this->remove($this->content[$i]);
-
- $i --;
- if ($i >= 0) {
- $last = $this->content[$i];
- };
- };
-
- if ($i >= 0) {
- if (is_container($this->content[$i])) {
- $this->content[$i]->remove_last_whitespace();
- };
- };
- }
-
- function remove(&$box) {
- $size = count($this->content);
- for ($i=0; $i<$size; $i++) {
- if ($this->content[$i]->uid === $box->uid) {
- $this->content[$i] = NullBox::create();
- };
- };
-
- return;
- }
-
- function is_first(&$box) {
- $first =& $this->get_first();
-
- // Check if there's no first box at all
- //
- if (is_null($first)) { return false; };
-
- return $first->uid == $box->uid;
- }
-
- function is_null() {
- $size = count($this->content);
- for ($i=0; $i<$size; $i++) {
- if (!$this->content[$i]->is_null()) { return false; };
- };
- return true;
- }
-
- // Calculate the available widths - e.g. content width minus space occupied by floats;
- // as floats may not fill the whole height of this box, this value depends on Y-coordinate.
- // We use current_Y in calculations
- //
- function get_available_width(&$context) {
- $left_float_width = $context->float_left_x($this->get_left(), $this->_current_y) - $this->get_left();
- $right_float_width = $this->get_right() - $context->float_right_x($this->get_right(), $this->_current_y);
- return $this->get_width() - $left_float_width - $right_float_width;
- }
-
- function pre_reflow_images() {
- $size = count($this->content);
- for ($i=0; $i<$size; $i++) {
- $this->content[$i]->pre_reflow_images();
- };
- }
-
- function _setupClip(&$driver) {
- if (!is_null($this->parent)) {
- $this->parent->_setupClip($driver);
- };
-
- $overflow = $this->getCSSProperty(CSS_OVERFLOW);
- if ($overflow !== OVERFLOW_VISIBLE) {
- $driver->moveto( $this->get_left_border() , $this->get_top_border());
- $driver->lineto( $this->get_right_border(), $this->get_top_border());
- $driver->lineto( $this->get_right_border(), $this->get_bottom_border());
- $driver->lineto( $this->get_left_border() , $this->get_bottom_border());
- $driver->closepath();
- $driver->clip();
- };
- }
-
- /**
- * DOMish functions
- */
- function &get_element_by_id($id) {
- if (isset($GLOBALS['__html_box_id_map'])) {
- return $GLOBALS['__html_box_id_map'][$id];
- } else {
- $dummy = null;
- return $dummy;
- };
- }
-
- /*
- * this is just a fake at the moment
- */
- function get_body() {
- return $this;
- }
-
- function getChildNodes() {
- return $this->content;
- }
-}
-
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.field.pageno.php b/thirdparty/html2ps_pdf/box.field.pageno.php
deleted file mode 100644
index 5896a9a6b..000000000
--- a/thirdparty/html2ps_pdf/box.field.pageno.php
+++ /dev/null
@@ -1,81 +0,0 @@
-TextBoxString("", "iso-8859-1");
- }
-
- function from_box(&$box) {
- $field = new BoxTextFieldPageNo;
-
- $field->copy_style($box);
-
- $field->words = array("000");
- $field->encodings = array("iso-8859-1");
- $field->_left = $box->_left;
- $field->_top = $box->_top;
- $field->baseline = $box->baseline;
-
- return $field;
- }
-
- function show(&$viewport) {
- $font = $this->getCSSProperty(CSS_FONT);
-
- $this->words[0] = sprintf("%d", $viewport->current_page);
-
- $field_width = $this->width;
- $field_left = $this->_left;
-
- if ($font->size->getPoints() > 0) {
- $value_width = $viewport->stringwidth($this->words[0],
- $this->_get_font_name($viewport,0),
- $this->encodings[0],
- $font->size->getPoints());
- if (is_null($value_width)) { return null; };
- } else {
- $value_width = 0;
- };
- $this->width = $value_width;
- $this->_left += ($field_width - $value_width) / 2;
-
- if (is_null(TextBoxString::show($viewport))) {
- return null;
- };
-
- $this->width = $field_width;
- $this->_left = $field_left;
-
- return true;
- }
-
- function show_fixed(&$viewport) {
- $font = $this->getCSSProperty(CSS_FONT);
-
- $this->words[0] = sprintf("%d", $viewport->current_page);
-
- $field_width = $this->width;
- $field_left = $this->_left;
-
- if ($font->size->getPoints() > 0) {
- $value_width = $viewport->stringwidth($this->words[0],
- $this->_get_font_name($viewport, 0),
- $this->encodings[0],
- $font->size->getPoints());
- if (is_null($value_width)) { return null; };
- } else {
- $value_width = 0;
- };
- $this->width = $value_width;
- $this->_left += ($field_width - $value_width) / 2;
-
- if (is_null(TextBoxString::show_fixed($viewport))) {
- return null;
- };
-
- $this->width = $field_width;
- $this->_left = $field_left;
-
- return true;
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.field.pages.php b/thirdparty/html2ps_pdf/box.field.pages.php
deleted file mode 100644
index 17c280a7c..000000000
--- a/thirdparty/html2ps_pdf/box.field.pages.php
+++ /dev/null
@@ -1,89 +0,0 @@
-TextBoxString("", "iso-8859-1");
- }
-
- function from_box(&$box) {
- $field = new BoxTextFieldPages;
-
- $field->copy_style($box);
-
- $field->words = array("000");
- $field->encodings = array("iso-8859-1");
- $field->_left = $box->_left;
- $field->_top = $box->_top;
- $field->baseline = $box->baseline;
-
- return $field;
- }
-
- function show(&$viewport) {
- $font = $this->getCSSProperty(CSS_FONT);
-
- $this->words[0] = sprintf("%d", $viewport->expected_pages);
-
- $field_width = $this->width;
- $field_left = $this->_left;
-
- if ($font->size->getPoints() > 0) {
- $value_width = $viewport->stringwidth($this->words[0],
- $this->_get_font_name($viewport, 0),
- $this->encodings[0],
- $font->size->getPoints());
- if (is_null($value_width)) {
- return null;
- };
- } else {
- $value_width = 0;
- };
- $this->width = $value_width;
- $this->_left += ($field_width - $value_width) / 2;
-
- if (is_null(TextBoxString::show($viewport))) {
- return null;
- };
-
- $this->width = $field_width;
- $this->_left = $field_left;
-
- return true;
- }
-
- function show_fixed(&$viewport) {
- $font = $this->getCSSProperty(CSS_FONT);
-
- $this->words[0] = sprintf("%d", $viewport->expected_pages);
-
- $field_width = $this->width;
- $field_left = $this->_left;
-
- if ($font->size->getPoints() > 0) {
- $value_width = $viewport->stringwidth($this->words[0],
- $this->_get_font_name($viewport, 0),
- $this->encodings[0],
- $font->size->getPoints());
- if (is_null($value_width)) {
- return null;
- };
- } else {
- $value_width = 0;
- };
- $this->width = $value_width;
- $this->_left += ($field_width - $value_width) / 2;
-
- if (is_null(TextBoxString::show_fixed($viewport))) {
- return null;
- };
-
- $this->width = $field_width;
- $this->_left = $field_left;
-
- return true;
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.form.php b/thirdparty/html2ps_pdf/box.form.php
deleted file mode 100644
index 5875a909a..000000000
--- a/thirdparty/html2ps_pdf/box.form.php
+++ /dev/null
@@ -1,40 +0,0 @@
-new_form($this->_name);
- };
- return parent::show($driver);
- }
-
- function &create(&$root, &$pipeline) {
- if ($root->has_attribute('name')) {
- $name = $root->get_attribute('name');
- } elseif ($root->has_attribute('id')) {
- $name = $root->get_attribute('id');
- } else {
- $name = "";
- };
-
- $box = new FormBox($name);
- $box->readCSS($pipeline->getCurrentCSSState());
- $box->create_content($root, $pipeline);
- return $box;
- }
-
- function FormBox($name) {
- $this->BlockBox();
-
- $this->_name = $name;
- }
-}
-
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.frame.php b/thirdparty/html2ps_pdf/box.frame.php
deleted file mode 100644
index d671ba628..000000000
--- a/thirdparty/html2ps_pdf/box.frame.php
+++ /dev/null
@@ -1,304 +0,0 @@
-readCSS($pipeline->getCurrentCSSState());
- return $box;
- }
-
- function reflow(&$parent, &$context) {
- // If frame contains no boxes (for example, the src link is broken)
- // we just return - no further processing will be done
- if (count($this->content) == 0) { return; };
-
- // First box contained in a frame should always fill all its height
- $this->content[0]->put_full_height($this->get_height());
-
- $hc = new HCConstraint(array($this->get_height(), false),
- array($this->get_height(), false),
- array($this->get_height(), false));
- $this->content[0]->put_height_constraint($hc);
-
- $context->push_collapsed_margin(0);
- $context->push_container_uid($this->uid);
-
- $this->reflow_content($context);
-
- $context->pop_collapsed_margin();
- $context->pop_container_uid();
- }
-
- /**
- * Reflow absolutely positioned block box. Note that according to CSS 2.1
- * the only types of boxes which could be absolutely positioned are
- * 'block' and 'table'
- *
- * @param FlowContext $context A flow context object containing the additional layout data.
- *
- * @link http://www.w3.org/TR/CSS21/visuren.html#dis-pos-flo CSS 2.1: Relationships between 'display', 'position', and 'float'
- */
- function reflow_absolute(&$context) {
- GenericFormattedBox::reflow($this->parent, $context);
-
- $position_strategy =& new StrategyPositionAbsolute();
- $position_strategy->apply($this);
-
- /**
- * As sometimes left/right values may not be set, we need to use the "fit" width here.
- * If box have a width constraint, 'get_max_width' will return constrained value;
- * othersise, an intrictic width will be returned.
- *
- * Note that get_max_width returns width _including_ external space line margins, borders and padding;
- * as we're setting the "internal" - content width, we must subtract "extra" space width from the
- * value received
- *
- * @see GenericContainerBox::get_max_width()
- */
-
- $this->put_width($this->get_max_width($context) - $this->_get_hor_extra());
-
- /**
- * Update the width, as it should be calculated based upon containing block width, not real parent.
- * After this we should remove width constraints or we may encounter problem
- * in future when we'll try to call get_..._width functions for this box
- *
- * @todo Update the family of get_..._width function so that they would apply constraint
- * using the containing block width, not "real" parent width
- */
- $wc = $this->getCSSProperty(CSS_WIDTH);
-
- $containing_block =& $this->_get_containing_block();
- $this->put_width($wc->apply($this->get_width(),
- $containing_block['right'] - $containing_block['left']));
- $this->setCSSProperty(CSS_WIDTH, new WCNone());
-
- /**
- * Layout element's children
- */
- $this->reflow_content($context);
-
- /**
- * As absolute-positioned box generated new flow contexy, extend the height to fit all floats
- */
- $this->fitFloats($context);
-
- /**
- * If element have been positioned using 'right' or 'bottom' property,
- * we need to offset it, as we assumed it had zero width and height at
- * the moment we placed it
- */
- $right = $this->getCSSProperty(CSS_RIGHT);
- $left = $this->getCSSProperty(CSS_LEFT);
- if ($left->isAuto() && !$right->isAuto()) {
- $this->offset(-$this->get_width(), 0);
- };
-
- $bottom = $this->getCSSProperty(CSS_BOTTOM);
- $top = $this->getCSSProperty(CSS_TOP);
- if ($top->isAuto() && !$bottom->isAuto()) {
- $this->offset(0, $this->get_height());
- };
- }
-
- function FrameBox(&$root, &$pipeline) {
- $css_state =& $pipeline->getCurrentCSSState();
-
- // Inherit 'border' CSS value from parent (FRAMESET tag), if current FRAME
- // has no FRAMEBORDER attribute, and FRAMESET has one
- $parent = $root->parent();
- if (!$root->has_attribute('frameborder') &&
- $parent->has_attribute('frameborder')) {
- $parent_border = $css_state->getPropertyOnLevel(CSS_BORDER, CSS_PROPERTY_LEVEL_PARENT);
- $css_state->setProperty(CSS_BORDER, $parent_border->copy());
- }
-
- $this->GenericContainerBox($root);
-
- // If NO src attribute specified, just return.
- if (!$root->has_attribute('src')) { return; };
-
- // Determine the fullly qualified URL of the frame content
- $src = $root->get_attribute('src');
- $url = $pipeline->guess_url($src);
- $data = $pipeline->fetch($url);
-
- /**
- * If framed page could not be fetched return immediately
- */
- if (is_null($data)) { return; };
-
- /**
- * Render only iframes containing HTML only
- *
- * Note that content-type header may contain additional information after the ';' sign
- */
- $content_type = $data->get_additional_data('Content-Type');
- $content_type_array = explode(';', $content_type);
- if ($content_type_array[0] != "text/html") { return; };
-
- $html = $data->get_content();
-
- // Remove control symbols if any
- $html = preg_replace('/[\x00-\x07]/', "", $html);
- $converter = Converter::create();
- $html = $converter->to_utf8($html, $data->detect_encoding());
- $html = html2xhtml($html);
- $tree = TreeBuilder::build($html);
-
- // Save current stylesheet, as each frame may load its own stylesheets
- //
- $pipeline->pushCSS();
- $css =& $pipeline->getCurrentCSS();
- $css->scan_styles($tree, $pipeline);
-
- $frame_root = traverse_dom_tree_pdf($tree);
- $box_child =& create_pdf_box($frame_root, $pipeline);
- $this->add_child($box_child);
-
- // Restore old stylesheet
- //
- $pipeline->popCSS();
-
- $pipeline->pop_base_url();
- }
-
- /**
- * Note that if both top and bottom are 'auto', box will use vertical coordinate
- * calculated using guess_corder in 'reflow' method which could be used if this
- * box had 'position: static'
- */
- function _positionAbsoluteVertically($containing_block) {
- $bottom = $this->getCSSProperty(CSS_BOTTOM);
- $top = $this->getCSSProperty(CSS_TOP);
-
- if (!$top->isAuto()) {
- if ($top->isPercentage()) {
- $top_value = ($containing_block['top'] - $containing_block['bottom']) / 100 * $top->getPercentage();
- } else {
- $top_value = $top->getPoints();
- };
- $this->put_top($containing_block['top'] - $top_value - $this->get_extra_top());
- } elseif (!$bottom->isAuto()) {
- if ($bottom->isPercentage()) {
- $bottom_value = ($containing_block['top'] - $containing_block['bottom']) / 100 * $bottom->getPercentage();
- } else {
- $bottom_value = $bottom->getPoints();
- };
- $this->put_top($containing_block['bottom'] + $bottom_value + $this->get_extra_bottom());
- };
- }
-
- /**
- * Note that if both 'left' and 'right' are 'auto', box will use
- * horizontal coordinate calculated using guess_corder in 'reflow'
- * method which could be used if this box had 'position: static'
- */
- function _positionAbsoluteHorizontally($containing_block) {
- $left = $this->getCSSProperty(CSS_LEFT);
- $right = $this->getCSSProperty(CSS_RIGHT);
-
- if (!$left->isAuto()) {
- if ($left->isPercentage()) {
- $left_value = ($containing_block['right'] - $containing_block['left']) / 100 * $left->getPercentage();
- } else {
- $left_value = $left->getPoints();
- };
- $this->put_left($containing_block['left'] + $left_value + $this->get_extra_left());
- } elseif (!$right->isAuto()) {
- if ($right->isPercentage()) {
- $right_value = ($containing_block['right'] - $containing_block['left']) / 100 * $right->getPercentage();
- } else {
- $right_value = $right->getPoints();
- };
- $this->put_left($containing_block['right'] - $right_value - $this->get_extra_right());
- };
- }
-}
-
-class FramesetBox extends GenericContainerBox {
- var $rows;
- var $cols;
-
- function &create(&$root, &$pipeline) {
- $box =& new FramesetBox($root, $pipeline);
- $box->readCSS($pipeline->getCurrentCSSState());
- return $box;
- }
-
- function FramesetBox(&$root, $pipeline) {
- $this->GenericContainerBox($root);
- $this->create_content($root, $pipeline);
-
- // Now determine the frame layout inside the frameset
- $this->rows = $root->has_attribute('rows') ? $root->get_attribute('rows') : "100%";
- $this->cols = $root->has_attribute('cols') ? $root->get_attribute('cols') : "100%";
- }
-
- function reflow(&$parent, &$context) {
- $viewport =& $context->get_viewport();
-
- // Frameset always fill all available space in viewport
- $this->put_left($viewport->get_left() + $this->get_extra_left());
- $this->put_top($viewport->get_top() - $this->get_extra_top());
-
- $this->put_full_width($viewport->get_width());
- $this->setCSSProperty(CSS_WIDTH, new WCConstant($viewport->get_width()));
-
- $this->put_full_height($viewport->get_height());
- $this->put_height_constraint(new WCConstant($viewport->get_height()));
-
- // Parse layout-control values
- $rows = guess_lengths($this->rows, $this->get_height());
- $cols = guess_lengths($this->cols, $this->get_width());
-
- // Now reflow all frames in frameset
- $cur_col = 0;
- $cur_row = 0;
- for ($i=0; $i < count($this->content); $i++) {
- // Had we run out of cols/rows?
- if ($cur_row >= count($rows)) {
- // In valid HTML we never should get here, but someone can provide less frame cells
- // than frames. Extra frames will not be rendered at all
- return;
- }
-
- $frame =& $this->content[$i];
-
- /**
- * Depending on the source HTML, FramesetBox may contain some non-frame boxes;
- * we'll just ignore them
- */
- if (!is_a($frame, "FramesetBox") &&
- !is_a($frame, "FrameBox")) {
- continue;
- };
-
- // Guess frame size and position
- $frame->put_left($this->get_left() + array_sum(array_slice($cols, 0, $cur_col)) + $frame->get_extra_left());
- $frame->put_top($this->get_top() - array_sum(array_slice($rows, 0, $cur_row)) - $frame->get_extra_top());
-
- $frame->put_full_width($cols[$cur_col]);
- $frame->setCSSProperty(CSS_WIDTH, new WCConstant($frame->get_width()));
-
- $frame->put_full_height($rows[$cur_row]);
- $frame->put_height_constraint(new WCConstant($frame->get_height()));
-
- // Reflow frame contents
- $context->push_viewport(FlowViewport::create($frame));
- $frame->reflow($this, $context);
- $context->pop_viewport();
-
- // Move to the next frame position
- // Next columns
- $cur_col ++;
- if ($cur_col >= count($cols)) {
- // Next row
- $cur_col = 0;
- $cur_row ++;
- }
- }
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.generic.formatted.php b/thirdparty/html2ps_pdf/box.generic.formatted.php
deleted file mode 100644
index 0da232aeb..000000000
--- a/thirdparty/html2ps_pdf/box.generic.formatted.php
+++ /dev/null
@@ -1,1039 +0,0 @@
-getCSSProperty(CSS_BORDER);
- $padding = $current_box->getCSSProperty(CSS_PADDING);
- if ($border->top->get_width() > 0 ||
- $padding->top->value > 0) {
- return 0;
- };
-
- while (!is_null($current_box) &&
- $current_box->isBlockLevel()) {
- $margin = $current_box->getCSSProperty(CSS_MARGIN);
- $border = $current_box->getCSSProperty(CSS_BORDER);
- $padding = $current_box->getCSSProperty(CSS_PADDING);
-
- $top_margin = $margin->top->value;
-
- if ($top_margin >= 0) {
- $positive_margin = max($positive_margin, $top_margin);
- } else {
- $negative_margin = min($negative_margin, $top_margin);
- };
-
- if ($border->top->get_width() > 0 ||
- $padding->top->value > 0) {
- $current_box = null;
- } else {
- $current_box = $current_box->get_first();
- };
- };
-
- return $positive_margin /*- $negative_margin*/;
- }
-
- function _get_collapsable_top_margin_external() {
- $positive_margin = 0;
- $negative_margin = 0;
-
- $current_box = $this;
- while (!is_null($current_box) &&
- $current_box->isBlockLevel()) {
- $margin = $current_box->getCSSProperty(CSS_MARGIN);
- $border = $current_box->getCSSProperty(CSS_BORDER);
- $padding = $current_box->getCSSProperty(CSS_PADDING);
-
- $top_margin = $margin->top->value;
-
- if ($top_margin >= 0) {
- $positive_margin = max($positive_margin, $top_margin);
- } else {
- $negative_margin = min($negative_margin, $top_margin);
- };
-
- if ($border->top->get_width() > 0 ||
- $padding->top->value > 0) {
- $current_box = null;
- } else {
- $current_box = $current_box->get_first();
- };
- };
-
- return $positive_margin + $negative_margin;
- }
-
- function _get_collapsable_bottom_margin_external() {
- $positive_margin = 0;
- $negative_margin = 0;
-
- $current_box = $this;
- while (!is_null($current_box) &&
- $current_box->isBlockLevel()) {
- $margin = $current_box->getCSSProperty(CSS_MARGIN);
- $border = $current_box->getCSSProperty(CSS_BORDER);
- $padding = $current_box->getCSSProperty(CSS_PADDING);
-
- $bottom_margin = $margin->bottom->value;
-
- if ($bottom_margin >= 0) {
- $positive_margin = max($positive_margin, $bottom_margin);
- } else {
- $negative_margin = min($negative_margin, $bottom_margin);
- };
-
- if ($border->bottom->get_width() > 0 ||
- $padding->bottom->value > 0) {
- $current_box = null;
- } else {
- $current_box = $current_box->get_last();
- };
- };
-
- return $positive_margin + $negative_margin;
- }
-
- function collapse_margin_bottom(&$parent, &$context) {
- /**
- * Now, if there's a parent for this box, we extend its height to fit current box.
- * If parent generated new flow context (like table cell or floating box), its content
- * area should include the current box bottom margin (bottom margin does not colllapse).
- * See CSS 2.1 for more detailed explanations.
- *
- * @see FlowContext::container_uid()
- *
- * @link http://www.w3.org/TR/CSS21/visudet.html#Computing_widths_and_margins CSS 2.1 8.3.1 Calculating widths and margins
- */
- $parent_border = $parent->getCSSProperty(CSS_BORDER);
- $parent_padding = $parent->getCSSProperty(CSS_PADDING);
-
- /**
- * The bottom margin of an in-flow block-level element with a
- * 'height' of 'auto' and 'min-height' less than the element's
- * used height and 'max-height' greater than the element's used
- * height is adjoining to its last in-flow block-level child's
- * bottom margin if the element has NO BOTTOM PADDING OR BORDER.
- */
-
- $last =& $parent->get_last();
- if (!is_null($last) &&
- $last->uid == $this->uid && // This element is a last in-flow block level element AND
- $parent->uid != $context->container_uid() && // Parent element did not generate new flow context (like table-cell) AND
- $parent_border->bottom->get_width() == 0 && // Parent have NO bottom border AND
- $parent_padding->bottom->value == 0) { // Parent have NO bottom padding AND
- $parent->extend_height($this->get_bottom_border());
- } else {
- // Otherwise (in particular, if this box is not last), bottom
- // margin of the current box will be contained inside the current box
- $parent->extend_height($this->get_bottom_margin());
- }
-
- $cm = $context->get_collapsed_margin();
- $context->pop_collapsed_margin();
- $context->pop_collapsed_margin();
-
- /**
- * shift current parent 'watermark' to the current box margin edge;
- * all content now will be drawn below this mark (with a small exception
- * of elements having negative vertical margins, of course).
- */
- if ($parent_border->bottom->get_width() > 0 ||
- $parent_padding->bottom->value > 0) {
- $context->push_collapsed_margin( 0 );
- return $this->get_bottom_border() - $cm;
- } else {
- $collapsable = $this->_get_collapsable_bottom_margin_external();
- $context->push_collapsed_margin( $collapsable );
-
- return $this->get_bottom_border();
- };
- }
-
- function collapse_margin(&$parent, &$context) {
- // Do margin collapsing
-
- // Margin collapsing is done as follows:
- // 1. If previous sibling was an inline element (so, parent line box was not empty),
- // then no collapsing will take part
- // 2. If NO previous element exists at all, then collapse current box top margin
- // with parent's collapsed top margin.
- // 2.1. If parent element was float, no collapsing should be
- // 3. If there's previous block element, collapse current box top margin
- // with previous elemenent's collapsed bottom margin
-
- // Check if current parent line box contains inline elements only. In this case the only
- // margin will be current box margin
-
- if (!$parent->line_box_empty()) {
- // Case (1). Previous element was inline element; no collapsing
-
- $parent->close_line($context);
-
- $vmargin = $this->_get_collapsable_top_margin_external();
- } else {
- $parent_first = $this->parent->get_first();
-
- if (is_null($parent_first) || // Unfortunately, we sometimes get null as a value of $parent_first; this should be checked
- $parent_first->uid == $this->uid) {
- // Case (2). No previous block element at all; Collapse with parent margins
- $collapsable = $this->_get_collapsable_top_margin_external();
- $collapsed = $context->get_collapsed_margin();
-
- $vmargin = max(0, $collapsable - $collapsed);
-
- } else {
- // Case (3). There's a previous block element
-
- $collapsable = $this->_get_collapsable_top_margin_external();
- $collapsed = $context->get_collapsed_margin();
-
- // In this case, base position is a bottom border of the previous element
- // $vmargin - offset from a base position - should be at least $collapsed
- // (value of collapsed bottom margins from the previous element and its
- // children). If current element have $collapsable - collapsed top margin
- // (from itself and children too) greater that this value, we should
- // offset it further to the bottom
-
- $vmargin = max($collapsable, $collapsed);
- };
- };
-
- // Determine the base Y coordinate of box margin edge
- $y = $parent->_current_y - $vmargin;
-
- $internal_margin = $this->_get_collapsable_top_margin_internal();
- $context->push_collapsed_margin($internal_margin);
-
- return $y;
- }
-
- function GenericFormattedBox() {
- $this->GenericBox();
-
- // Layout data
- $this->baseline = 0;
- $this->parent = null;
- }
-
- function readCSS(&$state) {
- parent::readCSS($state);
-
- $this->_readCSS($state,
- array(CSS_OVERFLOW,
- CSS_PAGE_BREAK_AFTER,
- CSS_PAGE_BREAK_BEFORE,
- CSS_PAGE_BREAK_INSIDE,
- CSS_ORPHANS,
- CSS_WIDOWS,
- CSS_POSITION,
- CSS_TEXT_ALIGN,
- CSS_WHITE_SPACE,
- CSS_CLEAR,
- CSS_CONTENT,
- CSS_HTML2PS_PSEUDOELEMENTS,
- CSS_FLOAT,
- CSS_Z_INDEX,
- CSS_HTML2PS_ALIGN,
- CSS_HTML2PS_NOWRAP,
- CSS_DIRECTION,
- CSS_PAGE));
-
- $this->_readCSSLengths($state,
- array(CSS_BACKGROUND,
- CSS_BORDER,
- CSS_BOTTOM,
- CSS_TOP,
- CSS_LEFT,
- CSS_RIGHT,
- CSS_MARGIN,
- CSS_PADDING,
- CSS_TEXT_INDENT,
- CSS_HTML2PS_COMPOSITE_WIDTH,
- CSS_HEIGHT,
- CSS_MIN_HEIGHT,
- CSS_MAX_HEIGHT,
- CSS_LETTER_SPACING
- ));
-
- /**
- * CSS 2.1, p 8.5.2:
- *
- * If an element's border color is not specified with a border
- * property, user agents must use the value of the element's
- * 'color' property as the computed value for the border color.
- */
- $border =& $this->getCSSProperty(CSS_BORDER);
- $color =& $this->getCSSProperty(CSS_COLOR);
-
- if ($border->top->isDefaultColor()) {
- $border->top->setColor($color);
- };
-
- if ($border->right->isDefaultColor()) {
- $border->right->setColor($color);
- };
-
- if ($border->bottom->isDefaultColor()) {
- $border->bottom->setColor($color);
- };
-
- if ($border->left->isDefaultColor()) {
- $border->left->setColor($color);
- };
-
- $this->setCSSProperty(CSS_BORDER, $border);
-
- $this->_height_constraint =& HCConstraint::create($this);
- $this->height = 0;
-
- // 'width'
- $wc =& $this->getCSSProperty(CSS_WIDTH);
- $this->width = $wc->apply(0,0);
-
- // 'PSEUDO-CSS' properties
-
- // '-localalign'
- switch ($state->getProperty(CSS_HTML2PS_LOCALALIGN)) {
- case LA_LEFT:
- break;
- case LA_RIGHT:
- $margin =& $this->getCSSProperty(CSS_MARGIN);
- $margin->left->auto = true;
- $this->setCSSProperty(CSS_MARGIN, $margin);
- break;
- case LA_CENTER:
- $margin =& $this->getCSSProperty(CSS_MARGIN);
- $margin->left->auto = true;
- $margin->right->auto = true;
- $this->setCSSProperty(CSS_MARGIN, $margin);
- break;
- };
- }
-
- function _calc_percentage_margins(&$parent) {
- $margin = $this->getCSSProperty(CSS_MARGIN);
- $containing_block =& $this->_get_containing_block();
- $margin->calcPercentages($containing_block['right'] - $containing_block['left']);
- $this->setCSSProperty(CSS_MARGIN, $margin);
- }
-
- function _calc_percentage_padding(&$parent) {
- $padding = $this->getCSSProperty(CSS_PADDING);
- $containing_block =& $this->_get_containing_block();
- $padding->calcPercentages($containing_block['right'] - $containing_block['left']);
- $this->setCSSProperty(CSS_PADDING, $padding);
- }
-
- function apply_clear($y, &$context) {
- return LayoutVertical::apply_clear($this, $y, $context);
- }
-
-
- /**
- * CSS 2.1:
- * 10.2 Content width: the 'width' property
- * Values have the following meanings:
- * Specifies a percentage width. The percentage is calculated with respect to the width of the generated box's containing block.
- *
- * If the containing block's width depends on this element's width,
- * then the resulting layout is undefined in CSS 2.1.
- */
- function _calc_percentage_width(&$parent, &$context) {
- $wc = $this->getCSSProperty(CSS_WIDTH);
- if ($wc->isFraction()) {
- $containing_block =& $this->_get_containing_block();
-
- // Calculate actual width
- $width = $wc->apply($this->width, $containing_block['right'] - $containing_block['left']);
-
- // Assign calculated width
- $this->put_width($width);
-
- // Remove any width constraint
- $this->setCSSProperty(CSS_WIDTH, new WCConstant($width));
- }
- }
-
- function _calc_auto_width_margins(&$parent) {
- $float = $this->getCSSProperty(CSS_FLOAT);
-
- if ($float !== FLOAT_NONE) {
- $this->_calc_auto_width_margins_float($parent);
- } else {
- $this->_calc_auto_width_margins_normal($parent);
- }
- }
-
- // 'auto' margin value became 0, 'auto' width is 'shrink-to-fit'
- function _calc_auto_width_margins_float(&$parent) {
- // If 'width' is set to 'auto' the used value is the "shrink-to-fit" width
- // TODO
- if (false) {
- // Calculation of the shrink-to-fit width is similar to calculating the
- // width of a table cell using the automatic table layout
- // algorithm. Roughly: calculate the preferred width by formatting the
- // content without breaking lines other than where explicit line breaks
- // occur, and also calculate the preferred minimum width, e.g., by trying
- // all possible line breaks. CSS 2.1 does not define the exact
- // algorithm. Thirdly, find the available width: in this case, this is
- // the width of the containing block minus minus the used values of
- // 'margin-left', 'border-left-width', 'padding-left', 'padding-right',
- // 'border-right-width', 'margin-right', and the widths of any relevant
- // scroll bars.
-
- // Then the shrink-to-fit width is: min(max(preferred minimum width, available width), preferred width).
-
- // Store used value
- };
-
- // If 'margin-left', or 'margin-right' are computed as 'auto', their used value is '0'.
- $margin = $this->getCSSProperty(CSS_MARGIN);
- if ($margin->left->auto) { $margin->left->value = 0; }
- if ($margin->right->auto) { $margin->right->value = 0; }
- $this->setCSSProperty(CSS_MARGIN, $margin);
-
- $this->width = $this->get_width();
- }
-
- // 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containing block
- function _calc_auto_width_margins_normal(&$parent) {
- // get the containing block width
- $containing_block =& $this->_get_containing_block();
- $parent_width = $containing_block['right'] - $containing_block['left'];
-
- // If 'width' is set to 'auto', any other 'auto' values become '0' and 'width' follows from the resulting equality.
-
- // If both 'margin-left' and 'margin-right' are 'auto', their used values are equal.
- // This horizontally centers the element with respect to the edges of the containing block.
-
- $margin = $this->getCSSProperty(CSS_MARGIN);
- if ($margin->left->auto && $margin->right->auto) {
- $margin_value = ($parent_width - $this->get_full_width()) / 2;
- $margin->left->value = $margin_value;
- $margin->right->value = $margin_value;
- } else {
- // If there is exactly one value specified as 'auto', its used value follows from the equality.
- if ($margin->left->auto) {
- $margin->left->value = $parent_width - $this->get_full_width();
- } elseif ($margin->right->auto) {
- $margin->right->value = $parent_width - $this->get_full_width();
- };
- };
- $this->setCSSProperty(CSS_MARGIN, $margin);
-
- $this->width = $this->get_width();
- }
-
- function get_descender() {
- return 0;
- }
-
- function get_ascender() {
- return 0;
- }
-
- function _get_vert_extra() {
- return
- $this->get_extra_top() +
- $this->get_extra_bottom();
- }
-
- function _get_hor_extra() {
- return
- $this->get_extra_left() +
- $this->get_extra_right();
- }
-
- // Width:
- // 'get-min-width' stub
- function get_min_width(&$context) {
- die("OOPS! Unoverridden get_min_width called in class ".get_class($this)." inside ".get_class($this->parent));
- }
-
- function get_preferred_width(&$context) {
- return $this->get_max_width($context);
- }
-
- function get_preferred_minimum_width(&$context) {
- return $this->get_min_width($context);
- }
-
- // 'get-max-width' stub
- function get_max_width(&$context) {
- die("OOPS! Unoverridden get_max_width called in class ".get_class($this)." inside ".get_class($this->parent));
- }
-
- function get_max_width_natural(&$context) {
- return $this->get_max_width($context);
- }
-
- function get_full_width() {
- return $this->get_width() + $this->_get_hor_extra();
- }
-
- function put_full_width($value) {
- // Calculate value of additional horizontal space consumed by margins and padding
- $this->width = $value - $this->_get_hor_extra();
- }
-
- function &_get_containing_block() {
- $position = $this->getCSSProperty(CSS_POSITION);
-
- switch ($position) {
- case POSITION_ABSOLUTE:
- $containing_block =& $this->_get_containing_block_absolute();
- return $containing_block;
- case POSITION_FIXED:
- $containing_block =& $this->_get_containing_block_fixed();
- return $containing_block;
- case POSITION_STATIC:
- case POSITION_RELATIVE:
- $containing_block =& $this->_get_containing_block_static();
- return $containing_block;
- default:
- die(sprintf('Unexpected position enum value: %d', $position));
- };
- }
-
- function &_get_containing_block_fixed() {
- $media = $GLOBALS['g_media'];
-
- $containing_block = array();
- $containing_block['left'] = mm2pt($media->margins['left']);
- $containing_block['right'] = mm2pt($media->margins['left'] + $media->real_width());
- $containing_block['top'] = mm2pt($media->margins['bottom'] + $media->real_height());
- $containing_block['bottom'] = mm2pt($media->margins['bottom']);
-
- return $containing_block;
- }
-
- // Get the position and size of containing block for current
- // ABSOLUTE POSITIONED element. It is assumed that this function
- // is called for ABSOLUTE positioned boxes ONLY
- //
- // @return associative array with 'top', 'bottom', 'right' and 'left'
- // indices in data space describing the position of containing block
- //
- function &_get_containing_block_absolute() {
- $parent =& $this->parent;
-
- // No containing block at all...
- // How could we get here?
- if (is_null($parent)) {
- trigger_error("No containing block found for absolute-positioned element",
- E_USER_ERROR);
- };
-
- // CSS 2.1:
- // If the element has 'position: absolute', the containing block is established by the
- // nearest ancestor with a 'position' of 'absolute', 'relative' or 'fixed', in the following way:
- // - In the case that the ancestor is inline-level, the containing block depends on
- // the 'direction' property of the ancestor:
- // 1. If the 'direction' is 'ltr', the top and left of the containing block are the top and left
- // content edges of the first box generated by the ancestor, and the bottom and right are the
- // bottom and right content edges of the last box of the ancestor.
- // 2. If the 'direction' is 'rtl', the top and right are the top and right edges of the first
- // box generated by the ancestor, and the bottom and left are the bottom and left content
- // edges of the last box of the ancestor.
- // - Otherwise, the containing block is formed by the padding edge of the ancestor.
- // TODO: inline-level ancestors
- while ((!is_null($parent->parent)) &&
- ($parent->getCSSProperty(CSS_POSITION) === POSITION_STATIC)) {
- $parent =& $parent->parent;
- }
-
- // Note that initial containg block (containig BODY element) will be formed by BODY margin edge,
- // unlike other blocks which are formed by padding edges
-
- if ($parent->parent) {
- // Normal containing block
- $containing_block = array();
- $containing_block['left'] = $parent->get_left_padding();
- $containing_block['right'] = $parent->get_right_padding();
- $containing_block['top'] = $parent->get_top_padding();
- $containing_block['bottom'] = $parent->get_bottom_padding();
- } else {
- // Initial containing block
- $containing_block = array();
- $containing_block['left'] = $parent->get_left_margin();
- $containing_block['right'] = $parent->get_right_margin();
- $containing_block['top'] = $parent->get_top_margin();
- $containing_block['bottom'] = $parent->get_bottom_margin();
- };
-
- return $containing_block;
- }
-
- function &_get_containing_block_static() {
- $parent =& $this->parent;
-
- // No containing block at all...
- // How could we get here?
-
- if (is_null($parent)) {
- die("No containing block found for static-positioned element");
- };
-
- while (!is_null($parent->parent) &&
- !$parent->isBlockLevel() &&
- !$parent->isCell()) {
- $parent =& $parent->parent;
- };
-
- // Note that initial containg block (containing BODY element)
- // will be formed by BODY margin edge,
- // unlike other blocks which are formed by content edges
-
- $containing_block = array();
- $containing_block['left'] = $parent->get_left();
- $containing_block['right'] = $parent->get_right();
- $containing_block['top'] = $parent->get_top();
- $containing_block['bottom'] = $parent->get_bottom();
-
- return $containing_block;
- }
-
- // Height constraint
- function get_height_constraint() {
- return $this->_height_constraint;
- }
-
- function put_height_constraint(&$wc) {
- $this->_height_constraint = $wc;
- }
-
- // Extends the box height to cover the given Y coordinate
- // If box height is already big enough, no changes will be made
- //
- // @param $y_coord Y coordinate should be covered by the box
- //
- function extend_height($y_coord) {
- $this->put_height(max($this->get_height(), $this->get_top() - $y_coord));
- }
-
- function extend_width($x_coord) {
- $this->put_width(max($this->get_width(), $x_coord - $this->get_left()));
- }
-
- function get_extra_bottom() {
- $border = $this->getCSSProperty(CSS_BORDER);
- return
- $this->get_margin_bottom() +
- $border->bottom->get_width() +
- $this->get_padding_bottom();
- }
-
- function get_extra_left() {
- $border = $this->getCSSProperty(CSS_BORDER);
-
- $left_border = $border->left;
-
- return
- $this->get_margin_left() +
- $left_border->get_width() +
- $this->get_padding_left();
- }
-
- function get_extra_right() {
- $border = $this->getCSSProperty(CSS_BORDER);
- $right_border = $border->right;
- return
- $this->get_margin_right() +
- $right_border->get_width() +
- $this->get_padding_right();
- }
-
- function get_extra_top() {
- $border = $this->getCSSProperty(CSS_BORDER);
- return
- $this->get_margin_top() +
- $border->top->get_width() +
- $this->get_padding_top();
- }
-
- function get_extra_line_left() { return 0; }
- function get_extra_line_right() { return 0; }
-
- function get_margin_bottom() {
- $margin = $this->getCSSProperty(CSS_MARGIN);
- return $margin->bottom->value;
- }
-
- function get_margin_left() {
- $margin = $this->getCSSProperty(CSS_MARGIN);
- return $margin->left->value;
- }
-
- function get_margin_right() {
- $margin = $this->getCSSProperty(CSS_MARGIN);
- return $margin->right->value;
- }
-
- function get_margin_top() {
- $margin = $this->getCSSProperty(CSS_MARGIN);
- return $margin->top->value;
- }
-
- function get_padding_right() {
- $padding = $this->getCSSProperty(CSS_PADDING);
- return $padding->right->value;
- }
-
- function get_padding_left() {
- $padding = $this->getCSSProperty(CSS_PADDING);
- return $padding->left->value;
- }
-
- function get_padding_top() {
- $padding = $this->getCSSProperty(CSS_PADDING);
- return $padding->top->value;
- }
-
- function get_border_top_width() {
- return $this->border->top->width;
- }
-
- function get_padding_bottom() {
- $padding = $this->getCSSProperty(CSS_PADDING);
- return $padding->bottom->value;
- }
-
- function get_left_border() {
- $padding = $this->getCSSProperty(CSS_PADDING);
- $border = $this->getCSSProperty(CSS_BORDER);
-
- return
- $this->get_left() -
- $padding->left->value -
- $border->left->get_width();
- }
-
- function get_right_border() {
- $padding = $this->getCSSProperty(CSS_PADDING);
- $border = $this->getCSSProperty(CSS_BORDER);
-
- return
- $this->get_left() +
- $this->get_width() +
- $padding->right->value +
- $border->right->get_width();
- }
-
- function get_top_border() {
- $border = $this->getCSSProperty(CSS_BORDER);
-
- return
- $this->get_top_padding() +
- $border->top->get_width();
- }
-
- function get_bottom_border() {
- $border = $this->getCSSProperty(CSS_BORDER);
- return
- $this->get_bottom_padding() -
- $border->bottom->get_width();
- }
-
- function get_left_padding() {
- $padding = $this->getCSSProperty(CSS_PADDING);
- return $this->get_left() - $padding->left->value;
- }
-
- function get_right_padding() {
- $padding = $this->getCSSProperty(CSS_PADDING);
- return $this->get_left() + $this->get_width() + $padding->right->value;
- }
-
- function get_top_padding() {
- $padding = $this->getCSSProperty(CSS_PADDING);
-
- return
- $this->get_top() +
- $padding->top->value;
- }
-
- function get_bottom_padding() {
- $padding = $this->getCSSProperty(CSS_PADDING);
- return $this->get_bottom() - $padding->bottom->value;
- }
-
- function get_left_margin() {
- return
- $this->get_left() -
- $this->get_extra_left();
- }
-
- function get_right_margin() {
- return
- $this->get_right() +
- $this->get_extra_right();
- }
-
- function get_bottom_margin() {
- return
- $this->get_bottom() -
- $this->get_extra_bottom();
- }
-
- function get_top_margin() {
- $margin = $this->getCSSProperty(CSS_MARGIN);
-
- return
- $this->get_top_border() +
- $margin->top->value;
- }
-
- // Geometry
- function contains_point_margin($x, $y) {
- // Actually, we treat a small area around the float as "inside" float;
- // it will help us to prevent incorrectly positioning float due the rounding errors
- $eps = 0.1;
- return
- $this->get_left_margin()-$eps <= $x &&
- $this->get_right_margin()+$eps >= $x &&
- $this->get_top_margin()+$eps >= $y &&
- $this->get_bottom_margin() < $y;
- }
-
- function get_width() {
- $wc = $this->getCSSProperty(CSS_WIDTH);
-
- if ($this->parent) {
- return $wc->apply($this->width, $this->parent->width);
- } else {
- return $wc->apply($this->width, $this->width);
- }
- }
-
- // Unlike real/constrained width, or min/max width,
- // expandable width shows the size current box CAN be expanded;
- // it is pretty obvious that width-constrained boxes will never be expanded;
- // any other box can be expanded up to its parent _expandable_ width -
- // as parent can be expanded too.
- //
- function get_expandable_width() {
- $wc = $this->getCSSProperty(CSS_WIDTH);
- if ($wc->isNull() && $this->parent) {
- return $this->parent->get_expandable_width();
- } else {
- return $this->get_width();
- };
- }
-
- function put_width($value) {
- // TODO: constraints
- $this->width = $value;
- }
-
- function get_height() {
- if ($this->_height_constraint->applicable($this)) {
- return $this->_height_constraint->apply($this->height, $this);
- } else {
- return $this->height;
- };
- }
-
- function get_height_padded() {
- return $this->get_height() + $this->get_padding_top() + $this->get_padding_bottom();
- }
-
- function put_height($value) {
- if ($this->_height_constraint->applicable($this)) {
- $this->height = $this->_height_constraint->apply($value, $this);
- } else {
- $this->height = $value;
- };
- }
-
- function put_full_height($value) {
- $this->put_height($value - $this->_get_vert_extra());
- }
-
- // Returns total height of current element:
- // top padding + top margin + content + bottom padding + bottom margin + top border + bottom border
- function get_full_height() {
- return $this->get_height() +
- $this->get_extra_top() +
- $this->get_extra_bottom();
- }
-
- function get_real_full_height() {
- return $this->get_full_height();
- }
-
- function out_of_flow() {
- $position = $this->getCSSProperty(CSS_POSITION);
- $display = $this->getCSSProperty(CSS_DISPLAY);
-
- return
- $position == POSITION_ABSOLUTE ||
- $position == POSITION_FIXED ||
- $display == 'none';
- }
-
- function moveto($x, $y) { $this->offset($x - $this->get_left(), $y - $this->get_top()); }
-
- function show(&$viewport) {
- $border = $this->getCSSProperty(CSS_BORDER);
- $background = $this->getCSSProperty(CSS_BACKGROUND);
-
- // Draw border of the box
- $border->show($viewport, $this);
-
- // Render background of the box
- $background->show($viewport, $this);
-
- parent::show($viewport);
-
- return true;
- }
-
- function show_fixed(&$viewport) {
- return $this->show($viewport);
- }
-
- function is_null() {
- return false;
- }
-
- function line_break_allowed() {
- $white_space = $this->getCSSProperty(CSS_WHITE_SPACE);
- $nowrap = $this->getCSSProperty(CSS_HTML2PS_NOWRAP);
-
- return
- ($white_space === WHITESPACE_NORMAL ||
- $white_space === WHITESPACE_PRE_WRAP ||
- $white_space === WHITESPACE_PRE_LINE) &&
- $nowrap === NOWRAP_NORMAL;
- }
-
- function get_left_background() { return $this->get_left_padding(); }
- function get_right_background() { return $this->get_right_padding(); }
- function get_top_background() { return $this->get_top_padding(); }
- function get_bottom_background() { return $this->get_bottom_padding(); }
-
- function isVisibleInFlow() {
- $visibility = $this->getCSSProperty(CSS_VISIBILITY);
- $position = $this->getCSSProperty(CSS_POSITION);
-
- return
- $visibility === VISIBILITY_VISIBLE &&
- $position !== POSITION_FIXED;
- }
-
- function reflow_footnote(&$parent, &$context) {
- $this->reflow_static($parent, $context);
- }
-
- /**
- * The 'top' and 'bottom' properties move relatively positioned
- * element(s) up or down without changing their size. 'top' moves
- * the boxes down, and 'bottom' moves them up. Since boxes are not
- * split or stretched as a result of 'top' or 'bottom', the computed
- * values are always: top = -bottom. If both are 'auto', their
- * computed values are both '0'. If one of them is 'auto', it
- * becomes the negative of the other. If neither is 'auto', 'bottom'
- * is ignored (i.e., the computed value of 'bottom' will be minus
- * the value of 'top').
- */
- function offsetRelative() {
- /**
- * Note that percentage positioning values are ignored for
- * relative positioning
- */
-
- /**
- * Check if 'top' value is percentage
- */
- $top = $this->getCSSProperty(CSS_TOP);
- if ($top->isNormal()) {
- $top_value = $top->getPoints();
- } elseif ($top->isPercentage()) {
- $containing_block = $this->_get_containing_block();
- $containing_block_height = $containing_block['top'] - $containing_block['bottom'];
- $top_value = $containing_block_height * $top->getPercentage() / 100;
- } elseif ($top->isAuto()) {
- $top_value = null;
- }
-
- /**
- * Check if 'bottom' value is percentage
- */
- $bottom = $this->getCSSProperty(CSS_BOTTOM);
- if ($bottom->isNormal()) {
- $bottom_value = $bottom->getPoints();
- } elseif ($bottom->isPercentage()) {
- $containing_block = $this->_get_containing_block();
- $containing_block_height = $containing_block['top'] - $containing_block['bottom'];
- $bottom_value = $containing_block_height * $bottom->getPercentage() / 100;
- } elseif ($bottom->isAuto()) {
- $bottom_value = null;
- }
-
- /**
- * Calculate vertical offset for relative positioned box
- */
- if (!is_null($top_value)) {
- $vertical_offset = -$top_value;
- } elseif (!is_null($bottom_value)) {
- $vertical_offset = $bottom_value;
- } else {
- $vertical_offset = 0;
- };
-
- /**
- * Check if 'left' value is percentage
- */
- $left = $this->getCSSProperty(CSS_LEFT);
- if ($left->isNormal()) {
- $left_value = $left->getPoints();
- } elseif ($left->isPercentage()) {
- $containing_block = $this->_get_containing_block();
- $containing_block_width = $containing_block['right'] - $containing_block['left'];
- $left_value = $containing_block_width * $left->getPercentage() / 100;
- } elseif ($left->isAuto()) {
- $left_value = null;
- }
-
- /**
- * Check if 'right' value is percentage
- */
- $right = $this->getCSSProperty(CSS_RIGHT);
- if ($right->isNormal()) {
- $right_value = $right->getPoints();
- } elseif ($right->isPercentage()) {
- $containing_block = $this->_get_containing_block();
- $containing_block_width = $containing_block['right'] - $containing_block['left'];
- $right_value = $containing_block_width * $right->getPercentage() / 100;
- } elseif ($right->isAuto()) {
- $right_value = null;
- }
-
- /**
- * Calculate vertical offset for relative positioned box
- */
- if (!is_null($left_value)) {
- $horizontal_offset = $left_value;
- } elseif (!is_null($right_value)) {
- $horizontal_offset = -$right_value;
- } else {
- $horizontal_offset = 0;
- };
-
- $this->offset($horizontal_offset,
- $vertical_offset);
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.generic.inline.php b/thirdparty/html2ps_pdf/box.generic.inline.php
deleted file mode 100644
index 2d1924246..000000000
--- a/thirdparty/html2ps_pdf/box.generic.inline.php
+++ /dev/null
@@ -1,112 +0,0 @@
-GenericContainerBox();
- }
-
- // @todo this code is duplicated in box.block.php
- //
- function reflow(&$parent, &$context) {
- switch ($this->getCSSProperty(CSS_POSITION)) {
- case POSITION_STATIC:
- return $this->reflow_static($parent, $context);
-
- case POSITION_RELATIVE:
- /**
- * CSS 2.1:
- * Once a box has been laid out according to the normal flow or floated, it may be shifted relative
- * to this position. This is called relative positioning. Offsetting a box (B1) in this way has no
- * effect on the box (B2) that follows: B2 is given a position as if B1 were not offset and B2 is
- * not re-positioned after B1's offset is applied. This implies that relative positioning may cause boxes
- * to overlap. However, if relative positioning causes an 'overflow:auto' box to have overflow, the UA must
- * allow the user to access this content, which, through the creation of scrollbars, may affect layout.
- *
- * @link http://www.w3.org/TR/CSS21/visuren.html#x28 CSS 2.1 Relative positioning
- */
-
- $this->reflow_static($parent, $context);
- $this->offsetRelative();
- return;
- }
- }
-
- // Checks if current inline box should cause a line break inside the parent box
- //
- // @param $parent reference to a parent box
- // @param $content flow context
- // @return true if line break occurred; false otherwise
- //
- function maybe_line_break(&$parent, &$context) {
- if (!$parent->line_break_allowed()) {
- return false;
- };
-
- // Calculate the x-coordinate of this box right edge
- $right_x = $this->get_full_width() + $parent->_current_x;
-
- $need_break = false;
-
- // Check for right-floating boxes
- // If upper-right corner of this inline box is inside of some float, wrap the line
- if ($context->point_in_floats($right_x, $parent->_current_y)) {
- $need_break = true;
- };
-
- // No floats; check if we had run out the right edge of container
- // TODO: nobr-before, nobr-after
-
- if (($right_x > $parent->get_right() + EPSILON)) {
- // Now check if parent line box contains any other boxes;
- // if not, we should draw this box unless we have a floating box to the left
-
- $first = $parent->get_first();
-
- // FIXME: what's this? This condition is invariant!
- $text_indent = $parent->getCSSProperty(CSS_TEXT_INDENT);
- $indent_offset = ($first->uid == $this->uid || 1) ? $text_indent->calculate($parent) : 0;
-
- if ($parent->_current_x > $parent->get_left() + $indent_offset + EPSILON) {
- $need_break = true;
- };
- }
-
- // As close-line will not change the current-Y parent coordinate if no
- // items were in the line box, we need to offset this explicitly in this case
- //
- if ($parent->line_box_empty() && $need_break) {
- $parent->_current_y -= $this->get_height();
- };
-
- if ($need_break) {
- $parent->close_line($context);
-
- // Check if parent inline boxes have left padding/margins and add them to current_x
- $element = $this->parent;
- while (!is_null($element) && is_a($element,"GenericInlineBox")) {
- $parent->_current_x += $element->get_extra_left();
- $element = $element->parent;
- };
- };
-
- return $need_break;
- }
-
- function get_ascender() {
- $first =& $this->get_first();
- if (is_null($first)) { return 0; };
- return $first->get_ascender();
- }
-
- function get_baseline() {
- $first =& $this->get_first();
- if (is_null($first)) { return 0; };
- return $first->get_baseline();
- }
-
- function get_descender() {
- $first =& $this->get_first();
- if (is_null($first)) { return 0; };
- return $first->get_descender();
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.generic.php b/thirdparty/html2ps_pdf/box.generic.php
deleted file mode 100644
index ff746d218..000000000
--- a/thirdparty/html2ps_pdf/box.generic.php
+++ /dev/null
@@ -1,454 +0,0 @@
-_cache = array();
- $this->_css = array();
- $this->_cached_base_font_size = null;
-
- $this->_left = 0;
- $this->_top = 0;
-
- $this->_parent = null;
-
- $this->baseline = 0;
- $this->default_baseline = 0;
-
- /**
- * Assign an unique box identifier
- */
- $GLOBALS['g_box_uid']++;
- $this->uid = $GLOBALS['g_box_uid'];
- }
-
- function destroy() {
- unset($this->_cache);
- unset($this->_css);
- unset($this->_left);
- unset($this->_top);
- unset($this->_parent);
- unset($this->baseline);
- unset($this->default_baseline);
- }
-
- /**
- * see getProperty for optimization description
- */
- function setCSSProperty($code, $value) {
- static $cache = array();
- if (!isset($cache[$code])) {
- $cache[$code] =& CSS::get_handler($code);
- };
-
- $cache[$code]->replace_array($value, $this->_css);
- }
-
- /**
- * Optimization: this function is called very often,
- * so even a slight overhead for CSS::get_handler call
- * accumulates in a significiant processing delay.
- */
- function &getCSSProperty($code) {
- static $cache = array();
- if (!isset($cache[$code])) {
- $cache[$code] =& CSS::get_handler($code);
- };
-
- $value =& $cache[$code]->get($this->_css);
- return $value;
- }
-
- function show_postponed(&$driver) {
- $this->show($driver);
- }
-
- function copy_style(&$box) {
- // TODO: object references
- $this->_css = $box->_css;
- }
-
- /**
- * Optimization: _readCSSLength is usually called several times
- * while initializing box object. $base_font_size cound be calculated
- * only once and stored in a static variable.
- */
- function _readCSSLengths($state, $property_list) {
- if (is_null($this->_cached_base_font_size)) {
- $font =& $this->getCSSProperty(CSS_FONT);
- $this->_cached_base_font_size = $font->size->getPoints();
- };
-
- foreach ($property_list as $property) {
- $value =& $state->getProperty($property);
-
- if ($value === CSS_PROPERTY_INHERIT) {
- $value =& $state->getInheritedProperty($property);
- };
-
- if (is_object($value)) {
- $value =& $value->copy();
- $value->doInherit($state);
- $value->units2pt($this->_cached_base_font_size);
- };
-
- $this->setCSSProperty($property, $value);
- }
- }
-
- function _readCSS($state, $property_list) {
- foreach ($property_list as $property) {
- $value = $state->getProperty($property);
-
- // Note that order is important; composite object-value could be inherited and
- // object itself could contain subvalues with 'inherit' value
-
- if ($value === CSS_PROPERTY_INHERIT) {
- $value = $state->getInheritedProperty($property);
- };
-
- if (is_object($value)) {
- $value = $value->copy();
- $value->doInherit($state);
- };
-
- $this->setCSSProperty($property, $value);
- }
- }
-
- function readCSS(&$state) {
- /**
- * Determine font size to be used in this box (required for em/ex units)
- */
- $value = $state->getProperty(CSS_FONT);
- if ($value === CSS_PROPERTY_INHERIT) {
- $value = $state->getInheritedProperty(CSS_FONT);
- };
- $base_font_size = $state->getBaseFontSize();
-
- if (is_object($value)) {
- $value = $value->copy();
- $value->doInherit($state);
- $value->units2pt($base_font_size);
- };
-
- $this->setCSSProperty(CSS_FONT, $value);
-
- /**
- * Continue working with other properties
- */
-
- $this->_readCSS($state,
- array(CSS_COLOR,
- CSS_DISPLAY,
- CSS_VISIBILITY));
-
- $this->_readCSSLengths($state,
- array(CSS_VERTICAL_ALIGN));
-
- // '-html2ps-link-destination'
- global $g_config;
- if ($g_config["renderlinks"]) {
- $this->_readCSS($state,
- array(CSS_HTML2PS_LINK_DESTINATION));
- };
-
- // Save ID attribute value
- $id = $state->getProperty(CSS_HTML2PS_LINK_DESTINATION);
- if (!empty($id)) {
- if (!isset($GLOBALS['__html_box_id_map'][$id])) {
- $GLOBALS['__html_box_id_map'][$id] =& $this;
- };
- };
- }
-
- function show(&$driver) {
- // If debugging mode is on, draw the box outline
- global $g_config;
- if ($g_config['debugbox']) {
- // Copy the border object of current box
- $driver->setlinewidth(0.1);
- $driver->setrgbcolor(0,0,0);
- $driver->rect($this->get_left(), $this->get_top(), $this->get_width(), -$this->get_height());
- $driver->stroke();
- }
-
- // Set current text color
- // Note that text color is used not only for text drawing (for example, list item markers
- // are drawn with text color)
- $color = $this->getCSSProperty(CSS_COLOR);
- $color->apply($driver);
- }
-
- /**
- * Render box having position: fixed or contained in such box
- * (Default behaviour)
- */
- function show_fixed(&$driver) {
- return $this->show($driver);
- }
-
- function pre_reflow_images() {}
-
- function offset($dx, $dy) {
- $this->_left += $dx;
- $this->_top += $dy;
- }
-
- // Calculate the content upper-left corner position in curent flow
- function guess_corner(&$parent) {
- $this->put_left($parent->_current_x + $this->get_extra_left());
- $this->put_top($parent->_current_y - $this->get_extra_top());
- }
-
- function put_left($value) {
- $this->_left = $value;
- }
-
- function put_top($value) {
- $this->_top = $value + $this->getBaselineOffset();
- }
-
- /**
- * Get Y coordinate of the top content area edge
- */
- function get_top() {
- return
- $this->_top -
- $this->getBaselineOffset();
- }
-
- function get_right() {
- return $this->get_left() + $this->get_width();
- }
-
- function get_left() {
- return $this->_left;
- }
-
- function get_bottom() {
- return $this->get_top() - $this->get_height();
- }
-
- function getBaselineOffset() {
- return $this->baseline - $this->default_baseline;
- }
-
- function reflow_anchors(&$driver, &$anchors) {
- if ($this->is_null()) {
- return;
- };
-
- $link_destination = $this->getCSSProperty(CSS_HTML2PS_LINK_DESTINATION);
-
- if ($link_destination !== "") {
-
- /**
- * Y=0 designates the bottom edge of the first page (without margins)
- * Y axis is oriented to the bottom.
- *
- * Here we calculate the offset from the bottom edge of first page PRINTABLE AREA
- * to the bottom edge of the current box
- */
- $y2 = $this->get_bottom() - mm2pt($driver->media->margins['bottom']);
-
- /**
- * Now let's calculate the number of the page corresponding to this offset.
- * Note that $y2>0 for the first page and $y2<0 on all subsequent pages
- */
- $page_fraction = $y2 / mm2pt($driver->media->real_height());
-
- /**
- * After the last operation we've got the "page fraction" between
- * bottom of the first page and box bottom edge;
- *
- * it will be equal to:
- * 1 for the top of the first page,
- * 0 for the bottom of the first page
- * -Epsilon for the top of the first page
- * -1 for the bottom of the second page
- * -n+1 for the bottom of the N-th page.
- */
- $page_fraction2 = -$page_fraction+1;
-
- /**
- * Here:
- * 0 for the top of the first page,
- * 1 for the bottom of the first page
- * 1+Epsilon for the top of the first page
- * 2 for the bottom of the second page
- * n for the bottom of the N-th page.
- *
- * Keeping in mind said above, we may calculate the real page number,
- * rounding it UP after calculation. The reason of rounding UP is simple:
- * pages are numbered starting at 1.
- */
- $page = ceil($page_fraction2);
-
- /**
- * Now let's calculate the coordinates on this particular page
- *
- * X coordinate calculation is pretty straight forward (and, actually, unused, as it would be
- * a bad idea to scroll PDF horiaontally).
- */
- $x = $this->get_left();
-
- /**
- * Y coordinate should be calculated relatively to the bottom page edge
- */
- $y = mm2pt($driver->media->real_height()) * ($page - $page_fraction2) + mm2pt($driver->media->margins['bottom']);
-
- $anchors[$link_destination] = new Anchor($link_destination,
- $page,
- $x,
- $y);
- };
- }
-
- function reflow(&$parent, &$context) {}
-
- function reflow_inline() { }
-
- function out_of_flow() {
- return false;
- }
-
- function get_bottom_margin() { return $this->get_bottom(); }
-
- function get_top_margin() {
- return $this->get_top();
- }
-
- function get_full_height() { return $this->get_height(); }
- function get_width() { return $this->width; }
-
- function get_full_width() {
- return $this->width;
- }
-
- function get_height() {
- return $this->height;
- }
-
- function get_baseline() {
- return $this->baseline;
- }
-
- function is_container() { return false; }
-
- function isVisibleInFlow() { return true; }
-
- function reflow_text() { return true; }
-
- /**
- * Note that linebox is started by any non-whitespace inline element; all whitespace elements before
- * that moment should be ignored.
- *
- * @param boolean $linebox_started Flag indicating that a new line box have just started and it already contains
- * some inline elements
- * @param boolean $previous_whitespace Flag indicating that a previous inline element was an whitespace element.
- */
- function reflow_whitespace(&$linebox_started, &$previous_whitespace) {
- return;
- }
-
- function is_null() {
- return false;
- }
-
- function isCell() {
- return false;
- }
-
- function isTableRow() {
- return false;
- }
-
- function isTableSection() {
- return false;
- }
-
- // CSS 2.1:
- // 9.2.1 Block-level elements and block boxes
- // Block-level elements are those elements of the source document that are formatted visually as blocks
- // (e.g., paragraphs). Several values of the 'display' property make an element block-level:
- // 'block', 'list-item', 'compact' and 'run-in' (part of the time; see compact and run-in boxes), and 'table'.
- //
- function isBlockLevel() {
- return false;
- }
-
- function hasAbsolutePositionedParent() {
- if (is_null($this->parent)) {
- return false;
- };
-
- return
- $this->parent->getCSSProperty(CSS_POSITION) == POSITION_ABSOLUTE ||
- $this->parent->hasAbsolutePositionedParent();
- }
-
- function hasFixedPositionedParent() {
- if (is_null($this->parent)) {
- return false;
- };
-
- return
- $this->parent->getCSSProperty(CSS_POSITION) == POSITION_FIXED ||
- $this->parent->hasFixedPositionedParent();
- }
-
- /**
- * Box can be expanded if it has no width constrains and
- * all it parents has no width constraints
- */
- function mayBeExpanded() {
- $wc = $this->getCSSProperty(CSS_WIDTH);
- if (!$wc->isNull()) { return false; };
-
- if ($this->getCSSProperty(CSS_FLOAT) <> FLOAT_NONE) {
- return true;
- };
-
- if ($this->getCSSProperty(CSS_POSITION) <> POSITION_STATIC &&
- $this->getCSSProperty(CSS_POSITION) <> POSITION_RELATIVE) {
- return true;
- };
-
- if (is_null($this->parent)) {
- return true;
- };
-
- return $this->parent->mayBeExpanded();
- }
-
- function isLineBreak() {
- return false;
- }
-
- function get_min_width_natural($context) {
- return $this->get_min_width($context);
- }
-
- function is_note_call() {
- return isset($this->note_call);
- }
-
- /* DOM compatibility */
- function &get_parent_node() {
- return $this->parent;
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.iframe.php b/thirdparty/html2ps_pdf/box.iframe.php
deleted file mode 100644
index 9664693c7..000000000
--- a/thirdparty/html2ps_pdf/box.iframe.php
+++ /dev/null
@@ -1,76 +0,0 @@
-readCSS($pipeline->getCurrentCSSState());
- return $box;
- }
-
- // Note that IFRAME width is NOT determined by its content, thus we need to override 'get_min_width' and
- // 'get_max_width'; they should return the constrained frame width.
- function get_min_width(&$context) {
- return $this->get_max_width($context);
- }
-
- function get_max_width(&$context) {
- return $this->get_width();
- }
-
- function IFrameBox(&$root, $pipeline) {
- $this->InlineBlockBox();
-
- // If NO src attribute specified, just return.
- if (!$root->has_attribute('src') ||
- trim($root->get_attribute('src')) == '') {
- return;
- };
-
- // Determine the fullly qualified URL of the frame content
- $src = $root->get_attribute('src');
- $url = $pipeline->guess_url($src);
- $data = $pipeline->fetch($url);
-
- /**
- * If framed page could not be fetched return immediately
- */
- if (is_null($data)) { return; };
-
- /**
- * Render only iframes containing HTML only
- *
- * Note that content-type header may contain additional information after the ';' sign
- */
- $content_type = $data->get_additional_data('Content-Type');
- $content_type_array = explode(';', $content_type);
- if ($content_type_array[0] != "text/html") { return; };
-
- $html = $data->get_content();
-
- // Remove control symbols if any
- $html = preg_replace('/[\x00-\x07]/', "", $html);
- $converter = Converter::create();
- $html = $converter->to_utf8($html, $data->detect_encoding());
- $html = html2xhtml($html);
- $tree = TreeBuilder::build($html);
-
- // Save current stylesheet, as each frame may load its own stylesheets
- //
- $pipeline->pushCSS();
- $css =& $pipeline->getCurrentCSS();
- $css->scan_styles($tree, $pipeline);
-
- $frame_root = traverse_dom_tree_pdf($tree);
- $box_child =& create_pdf_box($frame_root, $pipeline);
- $this->add_child($box_child);
-
- // Restore old stylesheet
- //
- $pipeline->popCSS();
-
- $pipeline->pop_base_url();
- }
-}
-
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.img.php b/thirdparty/html2ps_pdf/box.img.php
deleted file mode 100644
index 2c43bd9a9..000000000
--- a/thirdparty/html2ps_pdf/box.img.php
+++ /dev/null
@@ -1,347 +0,0 @@
-GenericInlineBox();
- }
-
- function get_max_width_natural(&$context) {
- return $this->get_full_width($context);
- }
-
- function get_min_width(&$context) {
- return $this->get_full_width();
- }
-
- function get_max_width(&$context) {
- return $this->get_full_width();
- }
-
- function is_null() {
- return false;
- }
-
- function pre_reflow_images() {
- switch ($this->scale) {
- case SCALE_WIDTH:
- // Only 'width' attribute given
- $size =
- $this->src_width/$this->src_height*
- $this->get_width();
-
- $this->put_height($size);
-
- // Update baseline according to constrained image height
- $this->default_baseline = $this->get_full_height();
- break;
- case SCALE_HEIGHT:
- // Only 'height' attribute given
- $size =
- $this->src_height/$this->src_width*
- $this->get_height();
-
- $this->put_width($size);
- $this->setCSSProperty(CSS_WIDTH, new WCConstant($size));
-
- $this->default_baseline = $this->get_full_height();
- break;
- };
- }
-
- function readCSS(&$state) {
- parent::readCSS($state);
-
- // '-html2ps-link-target'
- global $g_config;
- if ($g_config["renderlinks"]) {
- $this->_readCSS($state,
- array(CSS_HTML2PS_LINK_TARGET));
- };
- }
-
- function reflow_static(&$parent, &$context) {
- $this->pre_reflow_images();
-
- GenericFormattedBox::reflow($parent, $context);
-
- // Check if we need a line break here
- $this->maybe_line_break($parent, $context);
-
- // set default baseline
- $this->baseline = $this->default_baseline;
-
- // append to parent line box
- $parent->append_line($this);
-
- // Move box to the parent current point
- $this->guess_corner($parent);
-
- // Move parent's X coordinate
- $parent->_current_x += $this->get_full_width();
-
- // Extend parent height
- $parent->extend_height($this->get_bottom_margin());
- }
-
- function _get_font_name(&$driver, $subword_index) {
- if (isset($this->_cache[CACHE_TYPEFACE][$subword_index])) {
- return $this->_cache[CACHE_TYPEFACE][$subword_index];
- };
-
- $font_resolver =& $driver->get_font_resolver();
-
- $font = $this->getCSSProperty(CSS_FONT);
- $typeface = $font_resolver->getTypefaceName($font->family,
- $font->weight,
- $font->style,
- 'iso-8859-1');
-
- $this->_cache[CACHE_TYPEFACE][$subword_index] = $typeface;
-
- return $typeface;
- }
-
- function reflow_text(&$driver) {
- // In XHTML images are treated as a common inline elements; they are affected by line-height and font-size
- global $g_config;
- if ($g_config['mode'] == 'xhtml') {
- /**
- * A simple assumption is made: fonts used for different encodings
- * have equal ascender/descender values (while they have the same
- * typeface, style and weight).
- */
- $font_name = $this->_get_font_name($driver, 0);
-
- /**
- * Get font vertical metrics
- */
- $ascender = $driver->font_ascender($font_name, 'iso-8859-1');
- if (is_null($ascender)) {
- error_log("ImgBox::reflow_text: cannot get font ascender");
- return null;
- };
-
- $descender = $driver->font_descender($font_name, 'iso-8859-1');
- if (is_null($descender)) {
- error_log("ImgBox::reflow_text: cannot get font descender");
- return null;
- };
-
- /**
- * Setup box size
- */
- $font = $this->getCSSProperty(CSS_FONT_SIZE);
- $font_size = $font->getPoints();
-
- $this->ascender = $ascender * $font_size;
- $this->descender = $descender * $font_size;
- } else {
- $this->ascender = $this->get_height();
- $this->descender = 0;
- };
-
- return true;
- }
-
- // Image boxes are regular inline boxes; whitespaces after images should be rendered
- //
- function reflow_whitespace(&$linebox_started, &$previous_whitespace) {
- $linebox_started = true;
- $previous_whitespace = false;
- return;
- }
-
- function show_fixed(&$driver) {
- return $this->show($driver);
- }
-}
-
-class BrokenImgBox extends GenericImgBox {
- var $alt;
-
- function BrokenImgBox($width, $height, $alt) {
- $this->scale = SCALE_NONE;
- $this->encoding = DEFAULT_ENCODING;
-
- // Call parent constructor
- $this->GenericImgBox();
-
- $this->alt = $alt;
- }
-
- function show(&$driver) {
- $driver->save();
-
- // draw generic box
- GenericFormattedBox::show($driver);
-
- $driver->setlinewidth(0.1);
- $driver->moveto($this->get_left(), $this->get_top());
- $driver->lineto($this->get_right(), $this->get_top());
- $driver->lineto($this->get_right(), $this->get_bottom());
- $driver->lineto($this->get_left(), $this->get_bottom());
- $driver->closepath();
- $driver->stroke();
-
- $driver->moveto($this->get_left(), $this->get_top());
- $driver->lineto($this->get_right(), $this->get_top());
- $driver->lineto($this->get_right(), $this->get_bottom());
- $driver->lineto($this->get_left(), $this->get_bottom());
- $driver->closepath();
- $driver->clip();
-
- // Output text with the selected font
- $size = pt2pt(BROKEN_IMAGE_ALT_SIZE_PT);
-
- $status = $driver->setfont("Times-Roman", "iso-8859-1", $size);
- if (is_null($status)) {
- return null;
- };
-
- $driver->show_xy($this->alt,
- $this->get_left() + $this->width/2 - $driver->stringwidth($this->alt,
- "Times-Roman",
- "iso-8859-1",
- $size)/2,
- $this->get_top() - $this->height/2 - $size/2);
-
- $driver->restore();
-
- $strategy =& new StrategyLinkRenderingNormal();
- $strategy->apply($this, $driver);
-
- return true;
- }
-}
-
-class ImgBox extends GenericImgBox {
- function &create(&$root, &$pipeline) {
- // Open image referenced by HTML tag
- // Some crazy HTML writers add leading and trailing spaces to SRC attribute value - we need to remove them
- //
- $url_autofix = new AutofixUrl();
- $src = $url_autofix->apply(trim($root->get_attribute("src")));
-
- $image_url = $pipeline->guess_url($src);
- $src_img = Image::get($image_url, $pipeline);
-
- if (is_null($src_img)) {
- // image could not be opened, use ALT attribute
-
- if ($root->has_attribute('width')) {
- $width = px2pt($root->get_attribute('width'));
- } else {
- $width = px2pt(BROKEN_IMAGE_DEFAULT_SIZE_PX);
- };
-
- if ($root->has_attribute('height')) {
- $height = px2pt($root->get_attribute('height'));
- } else {
- $height = px2pt(BROKEN_IMAGE_DEFAULT_SIZE_PX);
- };
-
- $alt = $root->get_attribute('alt');
-
- $box =& new BrokenImgBox($width, $height, $alt);
-
- $box->readCSS($pipeline->getCurrentCSSState());
-
- $box->put_width($width);
- $box->put_height($height);
-
- $box->default_baseline = $box->get_full_height();
-
- $box->src_height = $box->get_height();
- $box->src_width = $box->get_width();
-
- return $box;
- } else {
- $box =& new ImgBox($src_img);
-
- $box->readCSS($pipeline->getCurrentCSSState());
-
- $box->_setupSize();
-
- return $box;
- }
- }
-
- function _setupSize() {
- $this->put_width(px2pt(imagesx($this->image)));
- $this->put_height(px2pt(imagesy($this->image)));
- $this->default_baseline = $this->get_full_height();
-
- $this->src_height = imagesx($this->image);
- $this->src_width = imagesy($this->image);
-
- $wc = $this->getCSSProperty(CSS_WIDTH);
- $hc = $this->get_height_constraint();
-
- // Proportional scaling
- if ($hc->is_null() && !$wc->isNull()) {
- $this->scale = SCALE_WIDTH;
-
- // Only 'width' attribute given
- $size =
- $this->src_width/$this->src_height*
- $this->get_width();
-
- $this->put_height($size);
-
- // Update baseline according to constrained image height
- $this->default_baseline = $this->get_full_height();
-
- } elseif (!$hc->is_null() && $wc->isNull()) {
- $this->scale = SCALE_HEIGHT;
-
- // Only 'height' attribute given
- $size =
- $this->src_height/$this->src_width*
- $this->get_height();
-
- $this->put_width($size);
- $this->setCSSProperty(CSS_WIDTH, new WCConstant($size));
-
- $this->default_baseline = $this->get_full_height();
- };
- }
-
- function ImgBox($img) {
- $this->encoding = DEFAULT_ENCODING;
- $this->scale = SCALE_NONE;
-
- // Call parent constructor
- $this->GenericImgBox();
-
- // Store image for further processing
- $this->image = $img;
- }
-
- function show(&$driver) {
- // draw generic box
- GenericFormattedBox::show($driver);
-
- // Check if "designer" set the height or width of this image to zero; in this there will be no reason
- // in drawing the image at all
- //
- if ($this->get_width() < EPSILON ||
- $this->get_height() < EPSILON) {
- return true;
- };
-
- $driver->image_scaled($this->image,
- $this->get_left(), $this->get_bottom(),
- $this->get_width() / imagesx($this->image), $this->get_height() / imagesy($this->image));
-
- $strategy =& new StrategyLinkRenderingNormal();
- $strategy->apply($this, $driver);
-
- return true;
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.inline.control.php b/thirdparty/html2ps_pdf/box.inline.control.php
deleted file mode 100644
index 63c033a05..000000000
--- a/thirdparty/html2ps_pdf/box.inline.control.php
+++ /dev/null
@@ -1,69 +0,0 @@
-get_max_width($context, $limit);
- }
-
- function get_max_width(&$context, $limit = 10E6) {
- return
- GenericContainerBox::get_max_width($context, $limit) -
- $this->_get_hor_extra();
- }
-
- function show(&$viewport) {
- // Now set the baseline of a button box to align it vertically when flowing isude the
- // text line
- $this->default_baseline = $this->content[0]->baseline + $this->get_extra_top();
- $this->baseline = $this->content[0]->baseline + $this->get_extra_top();
-
- return GenericContainerBox::show($viewport);
- }
-
- function line_break_allowed() { return false; }
-
- function reflow_static(&$parent, &$context) {
- GenericFormattedBox::reflow($parent, $context);
-
- // Determine the box width
- $this->_calc_percentage_width($parent, $context);
-
- $this->put_full_width($this->get_min_width($context, $parent->get_width()));
- $this->setCSSProperty(CSS_WIDTH, new WCNone());
-
- // Check if we need a line break here
- $this->maybe_line_break($parent, $context);
-
- // append to parent line box
- $parent->append_line($this);
-
- // Determine coordinates of upper-left _margin_ corner
- $this->guess_corner($parent);
-
- $this->reflow_content($context);
-
- /**
- * After text content have been reflown, we may determine the baseline of the control item itself;
- *
- * As there will be some extra whitespace on the top of the control box, we must add this whitespace
- * to the calculated baseline value, so text before and after control item will be aligned
- * with the text inside the box.
- */
- $this->default_baseline = $this->content[0]->baseline + $this->get_extra_top();
- $this->baseline = $this->content[0]->baseline + $this->get_extra_top();
-
- // center the button text vertically inside the button
- $text =& $this->content[0];
- $delta = ($text->get_top() - $text->get_height()/2) - ($this->get_top() - $this->get_height()/2);
- $text->offset(0,-$delta);
-
- // Offset parent current X coordinate
- $parent->_current_x += $this->get_full_width();
-
- // Extends parents height
- $parent->extend_height($this->get_bottom_margin());
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.inline.php b/thirdparty/html2ps_pdf/box.inline.php
deleted file mode 100644
index c9eeebcbc..000000000
--- a/thirdparty/html2ps_pdf/box.inline.php
+++ /dev/null
@@ -1,498 +0,0 @@
-top = $this->top;
- $box->right = $this->right;
- $box->bottom = $this->bottom;
- $box->left = $this->left;
- return $box;
- }
-
- function offset($dx, $dy) {
- $this->top += $dy;
- $this->bottom += $dy;
- $this->left += $dx;
- $this->right += $dx;
- }
-
- function create(&$box) {
- $lbox = new LineBox;
- $lbox->top = $box->get_top();
- $lbox->right = $box->get_right();
- $lbox->bottom = $box->get_bottom();
- $lbox->left = $box->get_left();
-
- // $lbox->bottom = $box->get_top() - $box->get_baseline() - $box->get_descender();
- // $lbox->top = $box->get_top() - $box->get_baseline() + $box->get_ascender();
- return $lbox;
- }
-
- function extend(&$box) {
- $base = $box->get_top() - $box->get_baseline();
-
- $this->top = max($this->top, $base + $box->get_ascender());
- $this->right = max($this->right, $box->get_right());
- $this->bottom = min($this->bottom, $base - $box->get_descender());
-
- // Left edge of the line box should never be modified
- }
-
- function fake_box(&$box) {
- // Create the fake box object
-
- $fake_state = new CSSState(CSS::get());
- $fake_state->pushState();
-
- $fake = null;
- $fake_box = new BlockBox($fake);
- $fake_box->readCSS($fake_state);
-
- // Setup fake box size
- $fake_box->put_left($this->left);
- $fake_box->put_width($this->right - $this->left);
- $fake_box->put_top($this->top - $box->baseline);
- $fake_box->put_height($this->top - $this->bottom);
-
- // Setup padding value
- $fake_box->setCSSProperty(CSS_PADDING, $box->getCSSProperty(CSS_PADDING));
-
- // Setup fake box border and background
- $fake_box->setCSSProperty(CSS_BACKGROUND, $box->getCSSProperty(CSS_BACKGROUND));
- $fake_box->setCSSProperty(CSS_BORDER, $box->getCSSProperty(CSS_BORDER));
-
- return $fake_box;
- }
-}
-
-class InlineBox extends GenericInlineBox {
- var $_lines;
-
- function InlineBox() {
- // Call parent's constructor
- $this->GenericInlineBox();
-
- // Clear the list of line boxes inside this box
- $this->_lines = array();
- }
-
- function &create(&$root, &$pipeline) {
- // Create contents of this inline box
- if ($root->node_type() == XML_TEXT_NODE) {
- $css_state =& $pipeline->getCurrentCSSState();
- return InlineBox::create_from_text($root->content,
- $css_state->getProperty(CSS_WHITE_SPACE),
- $pipeline);
-
- } else {
- $box =& new InlineBox();
-
- $css_state =& $pipeline->getCurrentCSSState();
-
- $box->readCSS($css_state);
-
- // Initialize content
- $child = $root->first_child();
- while ($child) {
- $child_box =& create_pdf_box($child, $pipeline);
- $box->add_child($child_box);
- $child = $child->next_sibling();
- };
-
- // Add fake whitespace box with zero size for the anchor spans
- // We need this, as "reflow" functions will automatically remove empty inline boxes from the
- // document tree
- //
- if ($box->is_null()) {
- $css_state->pushState();
- $css_state->setProperty(CSS_FONT_SIZE, Value::fromData(0.01, UNIT_PT));
-
- $whitespace = WhitespaceBox::create($pipeline);
- $whitespace->readCSS($css_state);
-
- $box->add_child($whitespace);
-
- $css_state->popState();
- };
- }
-
- return $box;
- }
-
- function &create_from_text($text, $white_space, &$pipeline) {
- $box =& new InlineBox();
- $box->readCSS($pipeline->getCurrentCSSState());
-
- // Apply/inherit text-related CSS properties
- $css_state =& $pipeline->getCurrentCSSState();
- $css_state->pushDefaultTextState();
-
- require_once(HTML2PS_DIR.'inline.content.builder.factory.php');
- $inline_content_builder =& InlineContentBuilderFactory::get($white_space);
- $inline_content_builder->build($box, $text, $pipeline);
-
- // Clear the CSS stack
- $css_state->popState();
-
- return $box;
- }
-
- function get_line_box_count() {
- return count($this->_lines);
- }
-
- // Inherited from GenericFormattedBox
-
- function process_word($raw_content, &$pipeline) {
- if ($raw_content === '') {
- return false;
- }
-
- $ptr = 0;
- $word = '';
- $hyphens = array();
- $encoding = 'iso-8859-1';
-
- $manager_encoding =& ManagerEncoding::get();
- $text_box =& TextBox::create_empty($pipeline);
-
- $len = strlen($raw_content);
- while ($ptr < $len) {
- $char = $manager_encoding->getNextUTF8Char($raw_content, $ptr);
-
- // Check if current char is a soft hyphen character. It it is,
- // remove it from the word (as it should not be drawn normally)
- // and store its location
- if ($char == SYMBOL_SHY) {
- $hyphens[] = strlen($word);
- } else {
- $mapping = $manager_encoding->getMapping($char);
-
- /**
- * If this character is not found in predefined encoding vectors,
- * we'll use "Custom" encoding and add single-character TextBox
- *
- * @TODO: handle characters without known glyph names
- */
- if (is_null($mapping)) {
- /**
- * No mapping to default encoding vectors found for this character
- */
-
- /**
- * Add last word
- */
- if ($word !== '') {
- $text_box->add_subword($word, $encoding, $hyphens);
- };
-
- /**
- * Add current symbol
- */
- $custom_char = $manager_encoding->addCustomChar(utf8_to_code($char));
- $text_box->add_subword($custom_char, $manager_encoding->getCustomEncodingName(), $hyphens);
-
- $word = '';
- } else {
- if (isset($mapping[$encoding])) {
- $word .= $mapping[$encoding];
- } else {
- // This condition prevents empty text boxes from appearing; say, if word starts with a national
- // character, an () - text box with no letters will be generated, in rare case causing a random line
- // wraps, if container is narrow
- if ($word !== '') {
- $text_box->add_subword($word, $encoding, $hyphens);
- };
-
- reset($mapping);
- list($encoding, $add) = each($mapping);
-
- $word = $mapping[$encoding];
- $hyphens = array();
- };
- };
- };
- };
-
- if ($word !== '') {
- $text_box->add_subword($word, $encoding, $hyphens);
- };
-
- $this->add_child($text_box);
- return true;
- }
-
- function show(&$driver) {
- if ($this->getCSSProperty(CSS_POSITION) == POSITION_RELATIVE) {
- // Postpone
- return true;
- };
-
- return $this->_show($driver);
- }
-
- function show_postponed(&$driver) {
- return $this->_show($driver);
- }
-
- function _show(&$driver) {
- // Show line boxes background and borders
- $size = $this->getLineBoxCount();
- for ($i=0; $i<$size; $i++) {
- $line_box = $this->getLineBox($i);
- $fake_box = $line_box->fake_box($this);
-
- $background = $this->getCSSProperty(CSS_BACKGROUND);
- $border = $this->getCSSProperty(CSS_BORDER);
-
- $background->show($driver, $fake_box);
- $border->show($driver, $fake_box);
- };
-
- // Show content
- $size = count($this->content);
- for ($i=0; $i < $size; $i++) {
- if (is_null($this->content[$i]->show($driver))) {
- return null;
- };
- }
-
- return true;
- }
-
- // Initialize next line box inside this inline
- //
- // Adds the next element to _lines array inside the current object and initializes it with the
- // $box parameters
- //
- // @param $box child box which will be first in this line box
- // @param $line_no number of line box
- //
- function init_line(&$box, &$line_no) {
- $line_box = LineBox::create($box);
- $this->_lines[$line_no] = $line_box;
- }
-
- // Extends the existing line box to include the given child
- // OR starts new line box, if current child is to the left of the box right edge
- // (which should not happen white the line box is filled)
- //
- // @param $box child box which will be first in this line box
- // @param $line_no number of line box
- //
- function extend_line(&$box, $line_no) {
- if (!isset($this->_lines[$line_no])) {
- // New line box started
- $this->init_line($box, $line_no);
-
- return $line_no;
- };
-
- // Check if this box starts a new line
- if ($box->get_left() < $this->_lines[$line_no]->right) {
- $line_no++;
- $this->init_line($box, $line_no);
- return $line_no;
- };
-
- $this->_lines[$line_no]->extend($box);
-
- return $line_no;
- }
-
- function merge_line(&$box, $line_no) {
- $start_line = 0;
-
- if ($line_no > 0 && count($box->_lines) > 0) {
- if ($this->_lines[$line_no-1]->right + EPSILON > $box->_lines[0]->left) {
- $this->_lines[$line_no-1]->right = max($box->_lines[0]->right, $this->_lines[$line_no-1]->right);
- $this->_lines[$line_no-1]->top = max($box->_lines[0]->top, $this->_lines[$line_no-1]->top);
- $this->_lines[$line_no-1]->bottom = min($box->_lines[0]->bottom, $this->_lines[$line_no-1]->bottom);
- $start_line = 1;
- };
- };
-
- $size = count($box->_lines);
- for ($i=$start_line; $i<$size; $i++) {
- $this->_lines[] = $box->_lines[$i]->copy();
- };
-
- return count($this->_lines);
- }
-
- function reflow_static(&$parent, &$context) {
- GenericFormattedBox::reflow($parent, $context);
-
- // Note that inline boxes (actually SPANS)
- // are never added to the parent's line boxes
-
- // Move current box to the parent's current coordinates
- // Note that span box will start at the far left of the parent, NOT on its current X!
- // Also, note that inline box can have margins, padding and borders!
-
- $this->put_left($parent->get_left());
- $this->put_top($parent->get_top() - $this->get_extra_top());
-
- // first line of the SPAN will be offset to its parent current-x
- // PLUS the left padding of current span!
- $parent->_current_x += $this->get_extra_left();
- $this->_current_x = $parent->_current_x;
-
- // Note that the same operation IS NOT applied to parent current-y!
- // The padding space is just extended to the top possibly OVERLAPPING the above boxes.
-
- $this->width = 0;
-
- // Reflow contents
- $size = count($this->content);
- for ($i=0; $i<$size; $i++) {
- $child =& $this->content[$i];
-
- // Add current element into _parent_ line box and reflow it
- $child->reflow($parent, $context);
-
- // In general, if inline box centained whitespace box only,
- // it could be removed during reflow function call;
- // let's check it and skip to next child
- //
- // if no children left AT ALL (so this box is empty), just exit
-
- // Track the real height of the inline box; it will be used by other functions
- // (say, functions calculating content height)
-
- $this->extend_height($child->get_bottom_margin());
- };
-
- // Apply right extra space value (padding + border + margin)
- $parent->_current_x += $this->get_extra_right();
-
- // Margins of inline boxes are not collapsed
-
- if ($this->get_first_data()) {
- $context->pop_collapsed_margin();
- $context->push_collapsed_margin( 0 );
- };
- }
-
- function reflow_inline() {
- $line_no = 0;
- $size = count($this->content);
- for ($i=0; $i<$size; $i++) {
- $child =& $this->content[$i];
-
- $child->reflow_inline();
-
- if (!$child->is_null()) {
- if (is_a($child,'InlineBox')) {
- $line_no = $this->merge_line($child, $line_no);
- } else {
- $line_no = $this->extend_line($child, $line_no);
- };
- };
- };
- }
-
- function reflow_whitespace(&$linebox_started, &$previous_whitespace) {
- /**
- * Anchors could have no content at all (like ).
- * We should not remove such anchors, as this will break internal links
- * in the document.
- */
- $dest = $this->getCSSProperty(CSS_HTML2PS_LINK_DESTINATION);
- if ($dest != '') { return; };
-
- $size = count($this->content);
- for ($i=0; $i<$size; $i++) {
- $child =& $this->content[$i];
- $child->reflow_whitespace($linebox_started, $previous_whitespace);
- };
-
- if ($this->is_null()) {
- $this->parent->remove($this);
- };
- }
-
- function get_extra_line_left() {
- return $this->get_extra_left() + ($this->parent ? $this->parent->get_extra_line_left() : 0);
- }
-
- function get_extra_line_right() {
- return $this->get_extra_right() + ($this->parent ? $this->parent->get_extra_line_right() : 0);
- }
-
- /**
- * As "nowrap" properties applied to block-level boxes only, we may use simplified version of
- * 'get_min_width' here
- */
- function get_min_width(&$context) {
- if (isset($this->_cache[CACHE_MIN_WIDTH])) {
- return $this->_cache[CACHE_MIN_WIDTH];
- }
-
- $content_size = count($this->content);
-
- /**
- * If box does not have any content, its minimal width is determined by extra horizontal space
- */
- if ($content_size == 0) {
- return $this->_get_hor_extra();
- };
-
- $minw = $this->content[0]->get_min_width($context);
-
- for ($i=1; $i<$content_size; $i++) {
- $item = $this->content[$i];
- if (!$item->out_of_flow()) {
- $minw = max($minw, $item->get_min_width($context));
- };
- }
-
- // Apply width constraint to min width. Return maximal value
- $wc = $this->getCSSProperty(CSS_WIDTH);
- $min_width = max($minw, $wc->apply($minw, $this->parent->get_width())) + $this->_get_hor_extra();
-
- $this->_cache[CACHE_MIN_WIDTH] = $min_width;
- return $min_width;
- }
-
- // Restore default behaviour, as this class is a ContainerBox descendant
- function get_max_width_natural(&$context, $limit=10E6) {
- return $this->get_max_width($context, $limit);
- }
-
- function offset($dx, $dy) {
- $size = count($this->_lines);
- for ($i=0; $i<$size; $i++) {
- $this->_lines[$i]->offset($dx, $dy);
- };
- GenericInlineBox::offset($dx, $dy);
- }
-
- /**
- * Deprecated
- */
- function getLineBoxCount() {
- return $this->get_line_box_count();
- }
-
- function &getLineBox($index) {
- $line_box =& $this->_lines[$index];
- return $line_box;
- }
-};
-
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.inline.simple.php b/thirdparty/html2ps_pdf/box.inline.simple.php
deleted file mode 100644
index 3a328dbd0..000000000
--- a/thirdparty/html2ps_pdf/box.inline.simple.php
+++ /dev/null
@@ -1,48 +0,0 @@
-GenericBox();
- }
-
- function readCSS(&$state) {
- parent::readCSS($state);
-
- $this->_readCSS($state,
- array(CSS_TEXT_DECORATION,
- CSS_TEXT_TRANSFORM));
-
- // '-html2ps-link-target'
- global $g_config;
- if ($g_config["renderlinks"]) {
- $this->_readCSS($state,
- array(CSS_HTML2PS_LINK_TARGET));
- };
- }
-
- function get_extra_left() {
- return 0;
- }
-
- function get_extra_top() {
- return 0;
- }
-
- function get_extra_right() {
- return 0;
- }
-
- function get_extra_bottom() {
- return 0;
- }
-
- function show(&$driver) {
- parent::show($driver);
-
- $strategy =& new StrategyLinkRenderingNormal();
- $strategy->apply($this, $driver);
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.input.img.php b/thirdparty/html2ps_pdf/box.input.img.php
deleted file mode 100644
index 166d6cfa3..000000000
--- a/thirdparty/html2ps_pdf/box.input.img.php
+++ /dev/null
@@ -1,128 +0,0 @@
-BrokenImgBox($width, $height, $alt);
-
- $this->_field_name = $field;
- $this->_field_value = $value;
- $this->set_action_url($action_url);
- }
-
- function readCSS(&$state) {
- parent::readCSS($state);
-
- $this->_readCSS($state,
- array(CSS_HTML2PS_FORM_ACTION));
- }
-
- function set_action_url($action_url) {
- $this->_action_url = $action_url;
- }
-
- function show(&$driver) {
- $status = parent::show($driver);
-
- global $g_config;
- if ($g_config['renderforms']) {
- $driver->field_pushbuttonimage($this->get_left_padding(),
- $this->get_top_padding(),
- $this->get_width() + $this->get_padding_left() + $this->get_padding_right(),
- $this->get_height() + $this->get_padding_top() + $this->get_padding_bottom(),
- $this->_field_name,
- $this->_field_value,
- $this->_action_url);
- };
-
- return $status;
- }
-}
-
-class ButtonImageBox extends ImgBox {
- var $_field_name;
- var $_field_value;
- var $_action_url;
-
- function ButtonImageBox($img, $field, $value, $action_url) {
- $this->ImgBox($img);
-
- $this->_field_name = $field;
- $this->_field_value = $value;
- $this->set_action_url($action_url);
- }
-
- function readCSS(&$state) {
- parent::readCSS($state);
-
- $this->_readCSS($state,
- array(CSS_HTML2PS_FORM_ACTION));
- }
-
- function set_action_url($action_url) {
- $this->_action_url = $action_url;
- }
-
- function show(&$driver) {
- $status = parent::show($driver);
-
- global $g_config;
- if ($g_config['renderforms']) {
- $driver->field_pushbuttonimage($this->get_left_padding(),
- $this->get_top_padding(),
- $this->get_width() + $this->get_padding_left() + $this->get_padding_right(),
- $this->get_height() + $this->get_padding_top() + $this->get_padding_bottom(),
- $this->_field_name,
- $this->_field_value,
- $this->_action_url);
- };
-
- return $status;
- }
-
- function &create(&$root, &$pipeline) {
- $name = $root->get_attribute('name');
- $value = $root->get_attribute('value');
-
- $url_autofix = new AutofixUrl();
- $src = $url_autofix->apply(trim($root->get_attribute("src")));
-
- $src_img = Image::get($pipeline->guess_url($src), $pipeline);
- if (is_null($src_img)) {
- error_log(sprintf("Cannot open image at '%s'", $src));
-
- if ($root->has_attribute('width')) {
- $width = px2pt($root->get_attribute('width'));
- } else {
- $width = px2pt(BROKEN_IMAGE_DEFAULT_SIZE_PX);
- };
-
- if ($root->has_attribute('height')) {
- $height = px2pt($root->get_attribute('height'));
- } else {
- $height = px2pt(BROKEN_IMAGE_DEFAULT_SIZE_PX);
- };
-
- $alt = $root->get_attribute('alt');
-
- $css_state =& $pipeline->getCurrentCSSState();
- $box =& new ButtonBrokenImagebox($width, $height, $alt, $name, $value,
- $css_state->getProperty(CSS_HTML2PS_FORM_ACTION));
- $box->readCSS($css_state);
- return $box;
- };
-
- $css_state =& $pipeline->getCurrentCSSState();
- $box =& new ButtonImageBox($src_img, $name, $value,
- $css_state->getProperty(CSS_HTML2PS_FORM_ACTION));
- $box->readCSS($css_state);
- $box->_setupSize();
-
- return $box;
- }
-}
-
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.input.password.php b/thirdparty/html2ps_pdf/box.input.password.php
deleted file mode 100644
index a6d51d8a9..000000000
--- a/thirdparty/html2ps_pdf/box.input.password.php
+++ /dev/null
@@ -1,66 +0,0 @@
-has_attribute('value')) {
- $text = str_repeat("*",strlen($root->get_attribute("value")));
- } else {
- $text = "";
- };
-
- /**
- * Input field name
- */
- $name = $root->get_attribute('name');
-
- $box =& new PasswordInputBox($text, $root->get_attribute("value"), $name);
- $box->readCSS($pipeline->getCurrentCSSState());
-
- $ibox = InlineBox::create_from_text(" ", WHITESPACE_PRE, $pipeline);
- for ($i=0, $size = count($ibox->content); $i<$size; $i++) {
- $box->add_child($ibox->content[$i]);
- };
-
- return $box;
- }
-
- function show(&$driver) {
- // Now set the baseline of a button box to align it vertically when flowing isude the
- // text line
- $this->default_baseline = $this->content[0]->baseline + $this->get_extra_top();
- $this->baseline = $this->content[0]->baseline + $this->get_extra_top();
-
- /**
- * If we're rendering the interactive form, the field content should not be rendered
- */
- global $g_config;
- if ($g_config['renderforms']) {
- /**
- * Render background/borders only
- */
- $status = GenericFormattedBox::show($driver);
-
- /**
- * @todo encoding name?
- * @todo font name?
- * @todo check if font is embedded for PDFLIB
- */
- $driver->field_password($this->get_left_padding(),
- $this->get_top_padding(),
- $this->get_width() + $this->get_padding_left() + $this->get_padding_right(),
- $this->get_height() + $this->get_padding_top() + $this->get_padding_bottom(),
- $this->_value,
- $this->_field_name);
- } else {
- /**
- * Render everything, including content
- */
- $status = GenericContainerBox::show($driver);
- }
-
- return $status;
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.input.text.php b/thirdparty/html2ps_pdf/box.input.text.php
deleted file mode 100644
index be22da5f1..000000000
--- a/thirdparty/html2ps_pdf/box.input.text.php
+++ /dev/null
@@ -1,103 +0,0 @@
-InlineBox();
-
- $this->_value = $value;
- $this->_field_name = $name;
- }
-
- function &create(&$root, &$pipeline) {
- // Text to be displayed
- if ($root->has_attribute('value')) {
- $text = trim($root->get_attribute("value"));
- } else {
- $text = "";
- };
-
- /**
- * Input field name
- */
- $name = $root->get_attribute('name');
-
- $box =& new TextInputBox($root->get_attribute("value"), $name);
- $box->readCSS($pipeline->getCurrentCSSState());
-
- /**
- * Contents of the text box are somewhat similar to the inline box:
- * a sequence of the text and whitespace boxes; we generate this sequence using
- * the InlineBox, then copy contents of the created inline box to our button.
- *
- * @todo probably, create_from_text() function should be extracted to the common parent
- * of inline boxes.
- */
- $ibox = InlineBox::create_from_text($text, WHITESPACE_PRE, $pipeline);
-
- for ($i=0, $size = count($ibox->content); $i<$size; $i++) {
- $box->add_child($ibox->content[$i]);
- };
-
- return $box;
- }
-
- function get_height() {
- $normal_height = parent::get_height();
-
- $hc = $this->get_height_constraint();
- if ($hc->is_null()) {
- return $normal_height;
- } else {
- return $normal_height - $this->_get_vert_extra();
- };
- }
-
- function show(&$driver) {
- // Now set the baseline of a button box to align it vertically when flowing isude the
- // text line
-
- $this->default_baseline = $this->content[0]->baseline + $this->get_extra_top();
- $this->baseline = $this->content[0]->baseline + $this->get_extra_top();
-
- /**
- * If we're rendering the interactive form, the field content should not be rendered
- */
- global $g_config;
- if ($g_config['renderforms']) {
- /**
- * Render background/borders only
- */
- $status = GenericFormattedBox::show($driver);
-
- /**
- * @todo encoding name?
- * @todo font name?
- * @todo check if font is embedded for PDFLIB
- */
- $driver->field_text($this->get_left_padding(),
- $this->get_top_padding(),
- $this->get_width() + $this->get_padding_left() + $this->get_padding_right(),
- $this->get_height(),
- $this->_value,
- $this->_field_name);
- } else {
- /**
- * Render everything, including content
- */
- $status = GenericContainerBox::show($driver);
- }
-
- return $status;
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.input.textarea.php b/thirdparty/html2ps_pdf/box.input.textarea.php
deleted file mode 100644
index 3dea041c4..000000000
--- a/thirdparty/html2ps_pdf/box.input.textarea.php
+++ /dev/null
@@ -1,74 +0,0 @@
-InlineBlockBox();
-
- $this->set_value($value);
- $this->_field_name = $name;
- }
-
- function &create(&$root, &$pipeline) {
- $value = $root->get_content();
- $name = $root->get_attribute('name');
-
- $box = new TextAreaInputBox($value, $name);
- $box->readCSS($pipeline->getCurrentCSSState());
- $box->create_content($root, $pipeline);
-
- return $box;
- }
-
- function get_height() {
- $normal_height = parent::get_height();
- return $normal_height - $this->_get_vert_extra();
- }
-
- function get_min_width(&$context) {
- return $this->get_max_width($context);
- }
-
- function get_max_width(&$context) {
- return $this->get_width();
- }
-
- function get_value() {
- return $this->_value;
- }
-
- function get_width() {
- $normal_width = parent::get_width();
- return $normal_width - $this->_get_hor_extra();
- }
-
- function set_value($value) {
- $this->_value = $value;
- }
-
- function show(&$driver) {
- /**
- * If we're rendering the interactive form, the field content should not be rendered
- */
- global $g_config;
- if ($g_config['renderforms']) {
- $status = GenericFormattedBox::show($driver);
-
- $driver->field_multiline_text($this->get_left_padding(),
- $this->get_top_padding(),
- $this->get_width() + $this->get_padding_left() + $this->get_padding_right(),
- $this->get_height() + $this->get_padding_top() + $this->get_padding_bottom(),
- $this->_value,
- $this->_field_name);
- } else {
- $status = GenericContainerBox::show($driver);
- }
-
- return $status;
- }
-}
-
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.legend.php b/thirdparty/html2ps_pdf/box.legend.php
deleted file mode 100644
index 9e221fbf6..000000000
--- a/thirdparty/html2ps_pdf/box.legend.php
+++ /dev/null
@@ -1,57 +0,0 @@
-readCSS($pipeline->getCurrentCSSState());
- $box->create_content($root, $pipeline);
-
- return $box;
- }
-
- function LegendBox(&$root) {
- // Call parent constructor
- $this->GenericContainerBox();
-
- $this->_current_x = 0;
- $this->_current_y = 0;
- }
-
- // Flow-control
- function reflow(&$parent, &$context) {
- GenericFormattedBox::reflow($parent, $context);
-
- // Determine upper-left _content_ corner position of current box
- $this->put_left($parent->get_left_padding());
- $this->put_top($parent->get_top_padding());
-
- // Legends will not wrap
- $this->put_full_width($this->get_max_width($context));
-
- // Reflow contents
- $this->reflow_content($context);
-
- // Adjust legend position
- $height = $this->get_full_height();
- $this->offset(units2pt(LEGEND_HORIZONTAL_OFFSET) + $this->get_extra_left(),
- $height/2);
- // Adjust parent position
- $parent->offset(0, -$height/2);
- // Adjust parent content position
- for ($i=0; $icontent); $i++) {
- if ($parent->content[$i]->uid != $this->uid) {
- $parent->content[$i]->offset(0, -$height/2);
- }
- }
- $parent->_current_y -= $height/2;
-
- $parent->extend_height($this->get_bottom_margin());
- }
-
- function show(&$driver) {
- // draw generic box
- return GenericContainerBox::show($driver);
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.list-item.php b/thirdparty/html2ps_pdf/box.list-item.php
deleted file mode 100644
index 4279960b6..000000000
--- a/thirdparty/html2ps_pdf/box.list-item.php
+++ /dev/null
@@ -1,224 +0,0 @@
-readCSS($pipeline->getCurrentCSSState());
-
- /**
- * Create text box containing item number
- */
- $css_state =& $pipeline->getCurrentCSSState();
- $css_state->pushState();
- $css_state->setProperty(CSS_COLOR, CSSColor::parse('transparent'));
-
- $list_style = $css_state->getProperty(CSS_LIST_STYLE);
- $box->str_number_box = TextBox::create(CSSListStyleType::format_number($list_style->type,
- $css_state->getProperty(CSS_HTML2PS_LIST_COUNTER)).". ",
- 'iso-8859-1',
- $pipeline);
- $box->str_number_box->baseline = $box->str_number_box->default_baseline;
-
- $css_state->popState();
-
- /**
- * Create nested items
- */
- $box->create_content($root, $pipeline);
-
- return $box;
- }
-
- function readCSS(&$state) {
- parent::readCSS($state);
-
- $this->_readCSS($state,
- array(CSS_LIST_STYLE));
-
- // Pseudo-CSS properties
- // '-list-counter'
-
- // increase counter value
- $value = $state->getProperty(CSS_HTML2PS_LIST_COUNTER) + 1;
- $state->setProperty(CSS_HTML2PS_LIST_COUNTER, $value);
- $state->setPropertyOnLevel(CSS_HTML2PS_LIST_COUNTER, CSS_PROPERTY_LEVEL_PARENT, $value);
-
- // open the marker image if specified
- $list_style = $this->getCSSProperty(CSS_LIST_STYLE);
-
- if (!$list_style->image->is_default()) {
- $this->marker_image = new ImgBox($list_style->image->_image);
- $state->pushDefaultState();
- $this->marker_image->readCSS($state);
- $state->popState();
- $this->marker_image->_setupSize();
- } else {
- $this->marker_image = null;
- };
- }
-
- function ListItemBox(&$root, &$pipeline) {
- // Call parent constructor
- $this->BlockBox($root);
- }
-
- function reflow(&$parent, &$context) {
- $list_style = $this->getCSSProperty(CSS_LIST_STYLE);
-
- // If list-style-position is inside, we'll need to move marker box inside the
- // list-item box and offset all content by its size;
- if ($list_style->position === LSP_INSIDE) {
- // Add marker box width to text-indent value
- $this->_additional_text_indent = $this->get_marker_box_width();
- };
-
- // Procees with normal block box flow algorithm
- BlockBox::reflow($parent, $context);
- }
-
- function reflow_text(&$driver) {
- if (is_null($this->str_number_box->reflow_text($driver))) {
- return null;
- };
-
- return GenericContainerBox::reflow_text($driver);
- }
-
- function show(&$viewport) {
- // draw generic block box
- if (is_null(BlockBox::show($viewport))) {
- return null;
- };
-
- // Draw marker
- /**
- * Determine the marker box base X coordinate
- * If possible, the marker box should be drawn immediately to the left of the first word in this
- * box; this means that marker should be tied to the first text box, not to the left
- * edge of the list block box
- */
- $child = $this->get_first_data();
- if (is_null($child)) {
- $x = $this->get_left();
-
- $list_style = $this->getCSSProperty(CSS_LIST_STYLE);
-
- // If list-style-position is inside, we'll need to move marker box inside the
- // list-item box and offset all content by its size;
- if ($list_style->position === LSP_INSIDE) {
- $x += $this->get_marker_box_width();
- };
- } else {
- $x = $child->get_left();
- };
-
- // Determine the base Y coordinate of marker box
- $element = $this->get_first_data();
-
- if ($element) {
- $y = $element->get_top() - $element->default_baseline;
- } else {
- $y = $this->get_top();
- }
-
- if (!is_null($this->marker_image)) {
- $this->mb_image($viewport, $x, $y);
- } else {
- $list_style = $this->getCSSProperty(CSS_LIST_STYLE);
-
- switch ($list_style->type) {
- case LST_NONE:
- // No marker at all
- break;
- case LST_DISC:
- $this->mb_disc($viewport, $x, $y);
- break;
- case LST_CIRCLE:
- $this->mb_circle($viewport, $x, $y);
- break;
- case LST_SQUARE:
- $this->mb_square($viewport, $x, $y);
- break;
- default:
- $this->mb_string($viewport, $x, $y);
- break;
- }
- };
-
- return true;
- }
-
- function get_marker_box_width() {
- $list_style = $this->getCSSProperty(CSS_LIST_STYLE);
-
- switch ($list_style->type) {
- case LST_NONE:
- // no marker box will be rendered at all
- return 0;
- case LST_DISC:
- case LST_CIRCLE:
- case LST_SQUARE:
- // simple graphic marker
- $font = $this->getCSSProperty(CSS_FONT);
- return $font->size->getPoints();
- default:
- // string marker. Return the width of the marker text
- return $this->str_number_box->get_full_width();
- };
- }
-
- function mb_string(&$viewport, $x, $y) {
- $this->str_number_box->put_top($y + $this->str_number_box->default_baseline);
- $this->str_number_box->put_left($x - $this->str_number_box->get_full_width());
-
- $this->str_number_box->show($viewport);
- }
-
- function mb_disc(&$viewport, $x, $y) {
- $color = $this->getCSSProperty(CSS_COLOR);
- $color->apply($viewport);
-
- $font = $this->getCSSProperty(CSS_FONT);
-
- $viewport->circle( $x - $font->size->getPoints()*0.5, $y + $font->size->getPoints()*0.4*HEIGHT_KOEFF, $font->size->getPoints() * BULLET_SIZE_KOEFF);
- $viewport->fill();
- }
-
- function mb_circle(&$viewport, $x, $y) {
- $color = $this->getCSSProperty(CSS_COLOR);
- $color->apply($viewport);
-
- $viewport->setlinewidth(0.1);
-
- $font = $this->getCSSProperty(CSS_FONT);
- $viewport->circle( $x - $font->size->getPoints()*0.5, $y + $font->size->getPoints()*0.4*HEIGHT_KOEFF, $font->size->getPoints() * BULLET_SIZE_KOEFF);
- $viewport->stroke();
- }
-
- function mb_square(&$viewport, $x, $y) {
- $color = $this->getCSSProperty(CSS_COLOR);
- $color->apply($viewport);
-
- $font = $this->getCSSProperty(CSS_FONT);
- $viewport->rect($x - $font->size->getPoints()*0.512, $y + $font->size->getPoints()*0.3*HEIGHT_KOEFF, $font->size->getPoints() * 0.25, $font->size->getPoints() * 0.25);
- $viewport->fill();
- }
-
- function mb_image(&$viewport, $x, $y) {
- $font = $this->getCSSProperty(CSS_FONT);
-
- $imagebox =& $this->marker_image;
- $imagebox->moveto($x - $font->size->getPoints()*0.5 - $imagebox->get_width()/2,
- $y + $font->size->getPoints()*0.4*HEIGHT_KOEFF + $imagebox->get_height()/2);
- $imagebox->show($viewport);
- }
-
- function isBlockLevel() {
- return true;
- }
-}
-
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.note-call.class.php b/thirdparty/html2ps_pdf/box.note-call.class.php
deleted file mode 100644
index 8d460b18e..000000000
--- a/thirdparty/html2ps_pdf/box.note-call.class.php
+++ /dev/null
@@ -1,199 +0,0 @@
-_note_call_box->offset($dx, $dy);
- }
-
- function BoxNoteCall(&$content, &$pipeline) {
- $this->GenericInlineBox();
-
- $this->_note_content =& $content;
-
- $this->copy_style($content);
- $this->put_height_constraint(new HCConstraint(null, null, null));
-
- /**
- * Prepare ::note-call box
- */
-
- $this->_note_call_box = InlineBox::create_from_text(CSSListStyleType::format_number(LST_DECIMAL, 99),
- WHITESPACE_NORMAL,
- $pipeline);
-
- $this->_note_call_box->copy_style($content);
- $this->_note_call_box->content[0]->copy_style($content);
-
- $font = $this->_note_call_box->content[0]->getCSSProperty(CSS_FONT);
- $font = $font->copy();
- $font->size->scale(0.75);
- $this->_note_call_box->content[0]->setCSSProperty(CSS_FONT, $font);
-
- $this->_note_call_box->content[0]->setCSSProperty(CSS_VERTICAL_ALIGN, VA_SUPER);
- $this->_note_call_box->content[0]->setCSSProperty(CSS_LINE_HEIGHT, CSS::getDefaultValue(CSS_LINE_HEIGHT));
-
- /**
- * Prepare ::marker box
- */
-
- $this->_note_marker_box = InlineBox::create_from_text(CSSListStyleType::format_number(LST_DECIMAL, 99),
- WHITESPACE_NORMAL,
- $pipeline);
-
- $this->_note_marker_box->copy_style($content);
- $this->_note_marker_box->content[0]->copy_style($content);
-
- $font = $this->_note_marker_box->content[0]->getCSSProperty(CSS_FONT);
- $font = $font->copy();
- $font->size->scale(0.5);
- $this->_note_marker_box->content[0]->setCSSProperty(CSS_FONT, $font);
-
- $margin = $this->_note_marker_box->content[0]->getCSSProperty(CSS_MARGIN);
- $margin = $margin->copy();
- $margin->right = Value::fromData(FOOTNOTE_MARKER_MARGIN, UNIT_PT);
- $this->_note_marker_box->content[0]->setCSSProperty(CSS_MARGIN, $margin);
-
-
- $this->_note_marker_box->content[0]->setCSSProperty(CSS_VERTICAL_ALIGN, VA_SUPER);
- $this->_note_marker_box->content[0]->setCSSProperty(CSS_LINE_HEIGHT, CSS::getDefaultValue(CSS_LINE_HEIGHT));
- }
-
- function &create(&$content, &$pipeline) {
- $box = new BoxNoteCall($content, $pipeline);
-
- return $box;
- }
-
- function reflow(&$parent, &$context) {
- $parent->append_line($this->_note_call_box);
-
- $body = $parent;
- while ($body->parent) {
- $body = $body->parent;
- };
-
- /**
- * Reflow note content
- */
- $this->put_full_height(1000);
- $this->put_full_width($body->get_width());
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- $this->_note_content->reflow($this, $context);
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- $this->_note_marker_box->reflow($this, $context);
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- $this->_note_call_box->reflow($this, $context);
- // This prevents note-call box from affecting line height
- $this->_note_call_box->put_full_height(0);
-
- /**
- * Reflow note-call itself
- */
- $this->put_full_height(0);
- $this->put_full_width(0);
- $this->guess_corner($parent);
- $parent->_current_x += $this->_note_call_box->content[0]->get_width();
- $this->_note_call_box->put_full_width($this->_note_call_box->content[0]->get_width());
-
- $this->_note_call_box->moveto($this->get_left(), $this->get_top());
-
-// $last =& $parent->last_in_line();
-// $last->note_call = true;
-
- return true;
- }
-
- function reflow_whitespace(&$linebox_started, &$previous_whitespace) {
- $ls = false;
- $pw = false;
- $this->_note_content->reflow_whitespace($ls, $pw);
- }
-
- function reflow_text(&$driver) {
- $this->_note_content->reflow_text($driver);
- $this->_note_marker_box->reflow_text($driver);
- $this->_note_call_box->reflow_text($driver);
- return true;
- }
-
- function _getFootnoteHeight(&$driver) {
- if ($driver->getFootnoteCount() == 0) {
- $footnote_height =
- $this->_note_content->get_full_height() +
- FOOTNOTE_LINE_TOP_GAP +
- FOOTNOTE_LINE_BOTTOM_GAP;
- } else {
- $footnote_height =
- $this->_note_content->get_full_height() +
- FOOTNOTE_GAP;
- };
-
- return $footnote_height;
- }
-
- function show(&$driver) {
- $footnote_height = $this->_getFootnoteHeight($driver);
- if (!$driver->willContain($this, $footnote_height)) {
- return true;
- };
-
- $driver->setFootnoteAreaHeight($driver->getFootnoteAreaHeight() + $footnote_height);
- $driver->setFootnoteCount($driver->getFootnoteCount() + 1);
-
- /**
- * Prepare box containing note number
- */
- $this->_note_number = $driver->getFootnoteCount();
-
- /**
- * Render reference number
- */
- $this->_note_call_box->content[0]->words[0] = CSSListStyleType::format_number(LST_DECIMAL,
- $this->_note_number);
- $this->_note_call_box->show_fixed($driver);
-
- return true;
- }
-
- function show_footnote(&$driver, $x, $y) {
- /**
- * Render note reference number
- */
- $this->_note_marker_box->content[0]->words[0] = CSSListStyleType::format_number(LST_DECIMAL,
- $this->_note_number);
- $this->_note_marker_box->moveto($x, $y);
- $this->_note_marker_box->show_fixed($driver);
-
- /**
- * Render note content
- */
- $this->_note_content->moveto($x + $this->_note_marker_box->content[0]->get_width()*0.75,
- $y);
- $this->_note_content->show_fixed($driver);
-
-
- return $y - $this->_note_content->get_full_height();
- }
-}
-
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.null.php b/thirdparty/html2ps_pdf/box.null.php
deleted file mode 100644
index c3728063e..000000000
--- a/thirdparty/html2ps_pdf/box.null.php
+++ /dev/null
@@ -1,36 +0,0 @@
-GenericInlineBox();
- }
-
- function &create() {
- $box =& new NullBox;
-
- $css_state = new CSSState(CSS::get());
- $css_state->pushState();
- $box->readCSS($css_state);
-
- return $box;
- }
-
- function show(&$viewport) {
- return true;
- }
-
- function reflow_static(&$parent, &$context) {
- // Move current "box" to parent current coordinates. It is REQUIRED,
- // as some other routines uses box coordinates.
- $this->put_left($parent->get_left());
- $this->put_top($parent->get_top());
- }
-
- function is_null() { return true; }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.page.margin.class.php b/thirdparty/html2ps_pdf/box.page.margin.class.php
deleted file mode 100644
index 71218da65..000000000
--- a/thirdparty/html2ps_pdf/box.page.margin.class.php
+++ /dev/null
@@ -1,476 +0,0 @@
-getSelector()) {
- case CSS_MARGIN_BOX_SELECTOR_TOP:
- $box =& new BoxPageMarginTop($pipeline, $at_rule);
- break;
- case CSS_MARGIN_BOX_SELECTOR_TOP_LEFT_CORNER:
- $box =& new BoxPageMarginTopLeftCorner($pipeline, $at_rule);
- break;
- case CSS_MARGIN_BOX_SELECTOR_TOP_LEFT:
- $box =& new BoxPageMarginTopLeft($pipeline, $at_rule);
- break;
- case CSS_MARGIN_BOX_SELECTOR_TOP_CENTER:
- $box =& new BoxPageMarginTopCenter($pipeline, $at_rule);
- break;
- case CSS_MARGIN_BOX_SELECTOR_TOP_RIGHT:
- $box =& new BoxPageMarginTopRight($pipeline, $at_rule);
- break;
- case CSS_MARGIN_BOX_SELECTOR_TOP_RIGHT_CORNER:
- $box =& new BoxPageMarginTopRightCorner($pipeline, $at_rule);
- break;
- case CSS_MARGIN_BOX_SELECTOR_BOTTOM:
- $box =& new BoxPageMarginBottom($pipeline, $at_rule);
- break;
- case CSS_MARGIN_BOX_SELECTOR_BOTTOM_LEFT_CORNER:
- $box =& new BoxPageMarginBottomLeftCorner($pipeline, $at_rule);
- break;
- case CSS_MARGIN_BOX_SELECTOR_BOTTOM_LEFT:
- $box =& new BoxPageMarginBottomLeft($pipeline, $at_rule);
- break;
- case CSS_MARGIN_BOX_SELECTOR_BOTTOM_CENTER:
- $box =& new BoxPageMarginBottomCenter($pipeline, $at_rule);
- break;
- case CSS_MARGIN_BOX_SELECTOR_BOTTOM_RIGHT:
- $box =& new BoxPageMarginBottomRight($pipeline, $at_rule);
- break;
- case CSS_MARGIN_BOX_SELECTOR_BOTTOM_RIGHT_CORNER:
- $box =& new BoxPageMarginBottomRightCorner($pipeline, $at_rule);
- break;
- case CSS_MARGIN_BOX_SELECTOR_LEFT_TOP:
- $box =& new BoxPageMarginLeftTop($pipeline, $at_rule);
- break;
- case CSS_MARGIN_BOX_SELECTOR_LEFT_MIDDLE:
- $box =& new BoxPageMarginLeftMiddle($pipeline, $at_rule);
- break;
- case CSS_MARGIN_BOX_SELECTOR_LEFT_BOTTOM:
- $box =& new BoxPageMarginLeftBottom($pipeline, $at_rule);
- break;
- case CSS_MARGIN_BOX_SELECTOR_RIGHT_TOP:
- $box =& new BoxPageMarginRightTop($pipeline, $at_rule);
- break;
- case CSS_MARGIN_BOX_SELECTOR_RIGHT_MIDDLE:
- $box =& new BoxPageMarginRightMiddle($pipeline, $at_rule);
- break;
- case CSS_MARGIN_BOX_SELECTOR_RIGHT_BOTTOM:
- $box =& new BoxPageMarginRightBottom($pipeline, $at_rule);
- break;
- default:
- trigger_error("Unknown selector type", E_USER_ERROR);
- };
-
- return $box;
- }
-
- function BoxPageMargin(&$pipeline, $at_rule) {
- $state =& $pipeline->getCurrentCSSState();
- $state->pushDefaultState();
-
- $root = null;
- $at_rule->css->apply($root, $state, $pipeline);
-
- $this->GenericContainerBox();
- $this->readCSS($state);
-
- $state->pushDefaultstate();
-
- /**
- * Check whether 'content' or '-html2ps-html-content' properties had been defined
- * (if both properties are defined, -html2ps-html-content takes precedence)
- */
- $raw_html_content =& $at_rule->getCSSProperty(CSS_HTML2PS_HTML_CONTENT);
- $html_content = $raw_html_content->render($pipeline->get_counters());
-
- if ($html_content !== '') {
- // We should wrap html_content in DIV tag,
- // as we treat only the very first box of the resulting DOM tree as margin box content
-
- $html_content = html2xhtml("
".$html_content."
");
- $tree = TreeBuilder::build($html_content);
- $tree_root = traverse_dom_tree_pdf($tree);
- $body_box =& create_pdf_box($tree_root, $pipeline);
- $box =& $body_box->content[0];
- } else {
- $raw_content =& $at_rule->getCSSProperty(CSS_CONTENT);
- $content = $raw_content->render($pipeline->get_counters());
-
- $box =& InlineBox::create_from_text($content,
- WHITESPACE_NORMAL,
- $pipeline);
- }
- $this->add_child($box);
-
- $state->popState();
- $state->popState();
- }
-
- function get_cell_baseline() {
- return 0;
- }
-
- function reflow(&$driver, &$media, $boxes) {
- $context = new FlowContext;
- $this->_position($media, $boxes, $context);
-
- $this->setCSSProperty(CSS_WIDTH, new WCConstant($this->get_width()));
- $this->put_height_constraint(new HCConstraint(array($this->height, false),
- null,
- null));
-
- $this->reflow_content($context);
-
- /**
- * Apply vertical-align (behave like table cell)
- */
- $va = CSSVerticalAlign::value2pdf($this->getCSSProperty(CSS_VERTICAL_ALIGN));
-
- $va->apply_cell($this,$this->get_full_height(),0);
- }
-
- function show(&$driver) {
- $this->offset(0, $driver->offset);
- $this->show_fixed($driver);
- }
-
- function _calc_sizes($full_width, $left, $center, $right) {
- $context = new FlowContext;
-
- $left_width = $left->get_max_width($context);
- $center_width = $center->get_max_width($context);
- $right_width = $right->get_max_width($context);
-
- $calculated_left_width = 0;
- $calculated_center_width = 0;
- $calculated_right_width = 0;
-
- if ($center_width > 0) {
- $calculated_center_width = $full_width * $center_width / ($center_width + 2*max($left_width, $right_width));
- $calculated_left_width = ($full_width - $calculated_center_width) / 2;
- $calculated_right_width = $calculated_left_width;
- } elseif ($left_width == 0 && $right_width == 0) {
- $calculated_center_width = 0;
- $calculated_left_width = 0;
- $calculated_right_width = 0;
- } elseif ($left_width == 0) {
- $calculated_center_width = 0;
- $calculated_left_width = 0;
- $calculated_right_width = $full_width;
- } elseif ($right_width == 0) {
- $calculated_center_width = 0;
- $calculated_left_width = $full_width;
- $calculated_right_width = 0;
- } else {
- $calculated_center_width = 0;
- $calculated_left_width = $full_width * $left_width / ($left_width + $right_width);
- $calculated_right_width = $full_width - $calculated_left_width;
- };
-
- return array($calculated_left_width,
- $calculated_center_width,
- $calculated_right_width);
- }
-}
-
-class BoxPageMarginTop extends BoxPageMargin {
- function _position($media, $boxes, $context) {
- $this->put_left($this->get_extra_left() + 0);
- $this->put_top(-$this->get_extra_top() +mm2pt($media->height()));
-
- $this->put_full_width(mm2pt($media->width()));
- $this->put_full_height(mm2pt($media->margins['top']));
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- }
-}
-
-class BoxPageMarginTopLeftCorner extends BoxPageMargin {
- function _position($media, $boxes, $context) {
- $this->put_left($this->get_extra_left() + 0);
- $this->put_top(-$this->get_extra_top() +mm2pt($media->height()));
-
- $this->put_full_width(mm2pt($media->margins['left']));
- $this->put_full_height(mm2pt($media->margins['top']));
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- }
-}
-
-class BoxPageMarginTopLeft extends BoxPageMargin {
- function _position($media, $boxes, $context) {
- list($left, $center, $right) = $this->_calc_sizes(mm2pt($media->real_width()),
- $boxes[CSS_MARGIN_BOX_SELECTOR_TOP_LEFT],
- $boxes[CSS_MARGIN_BOX_SELECTOR_TOP_CENTER],
- $boxes[CSS_MARGIN_BOX_SELECTOR_TOP_RIGHT]);
-
- $this->put_left($this->get_extra_left() + mm2pt($media->margins['left']));
- $this->put_top(-$this->get_extra_top() +mm2pt($media->height()));
-
- $this->put_full_width($left);
- $this->put_full_height(mm2pt($media->margins['top']));
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- }
-}
-
-class BoxPageMarginTopCenter extends BoxPageMargin {
- function _position($media, $boxes, $context) {
- list($left, $center, $right) = $this->_calc_sizes(mm2pt($media->real_width()),
- $boxes[CSS_MARGIN_BOX_SELECTOR_TOP_LEFT],
- $boxes[CSS_MARGIN_BOX_SELECTOR_TOP_CENTER],
- $boxes[CSS_MARGIN_BOX_SELECTOR_TOP_RIGHT]);
-
- $this->put_left($this->get_extra_left() + mm2pt($media->margins['left']) + $left);
- $this->put_top(-$this->get_extra_top() +mm2pt($media->height()));
-
- $this->put_full_width($center);
- $this->put_full_height(mm2pt($media->margins['top']));
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- }
-}
-
-class BoxPageMarginTopRight extends BoxPageMargin {
- function _position($media, $boxes, $context) {
- list($left, $center, $right) = $this->_calc_sizes(mm2pt($media->real_width()),
- $boxes[CSS_MARGIN_BOX_SELECTOR_TOP_LEFT],
- $boxes[CSS_MARGIN_BOX_SELECTOR_TOP_CENTER],
- $boxes[CSS_MARGIN_BOX_SELECTOR_TOP_RIGHT]);
-
- $this->put_left($this->get_extra_left() + mm2pt($media->margins['left']) + $left + $center);
- $this->put_top(-$this->get_extra_top() +mm2pt($media->height()));
-
- $this->put_full_width($right);
- $this->put_full_height(mm2pt($media->margins['top']));
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- }
-}
-
-class BoxPageMarginTopRightCorner extends BoxPageMargin {
- function _position($media, $boxes, $context) {
- $this->put_left($this->get_extra_left() + mm2pt($media->width() - $media->margins['right']));
- $this->put_top(-$this->get_extra_top() +mm2pt($media->height()));
-
- $this->put_full_width(mm2pt($media->margins['right']));
- $this->put_full_height(mm2pt($media->margins['top']));
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- }
-}
-
-class BoxPageMarginBottomLeftCorner extends BoxPageMargin {
- function _position($media, $boxes, $context) {
- $this->put_left($this->get_extra_left() + 0);
- $this->put_top(-$this->get_extra_top() +mm2pt($media->margins['bottom']));
-
- $this->put_full_width(mm2pt($media->margins['left']));
- $this->put_full_height(mm2pt($media->margins['bottom']));
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- }
-}
-
-class BoxPageMarginBottomLeft extends BoxPageMargin {
- function _position($media, $boxes, $context) {
- list($left, $center, $right) = $this->_calc_sizes(mm2pt($media->real_width()),
- $boxes[CSS_MARGIN_BOX_SELECTOR_BOTTOM_LEFT],
- $boxes[CSS_MARGIN_BOX_SELECTOR_BOTTOM_CENTER],
- $boxes[CSS_MARGIN_BOX_SELECTOR_BOTTOM_RIGHT]);
-
- $this->put_left($this->get_extra_left() + mm2pt($media->margins['left']));
- $this->put_top(-$this->get_extra_top() +mm2pt($media->margins['bottom']));
-
- $this->put_full_width($left);
- $this->put_full_height(mm2pt($media->margins['bottom']));
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- }
-}
-
-class BoxPageMarginBottomCenter extends BoxPageMargin {
- function _position($media, $boxes, $context) {
- list($left, $center, $right) = $this->_calc_sizes(mm2pt($media->real_width()),
- $boxes[CSS_MARGIN_BOX_SELECTOR_BOTTOM_LEFT],
- $boxes[CSS_MARGIN_BOX_SELECTOR_BOTTOM_CENTER],
- $boxes[CSS_MARGIN_BOX_SELECTOR_BOTTOM_RIGHT]);
-
- $this->put_left($this->get_extra_left() + mm2pt($media->margins['left']) + $left);
- $this->put_top(-$this->get_extra_top() +mm2pt($media->margins['bottom']));
-
- $this->put_full_width($center);
- $this->put_full_height(mm2pt($media->margins['bottom']));
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- }
-}
-
-class BoxPageMarginBottomRight extends BoxPageMargin {
- function _position($media, $boxes, $context) {
- list($left, $center, $right) = $this->_calc_sizes(mm2pt($media->real_width()),
- $boxes[CSS_MARGIN_BOX_SELECTOR_BOTTOM_LEFT],
- $boxes[CSS_MARGIN_BOX_SELECTOR_BOTTOM_CENTER],
- $boxes[CSS_MARGIN_BOX_SELECTOR_BOTTOM_RIGHT]);
-
- $this->put_left($this->get_extra_left() + mm2pt($media->margins['left']) + $left + $center);
- $this->put_top(-$this->get_extra_top() +mm2pt($media->margins['bottom']));
-
- $this->put_full_width($right);
- $this->put_full_height(mm2pt($media->margins['bottom']));
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- }
-}
-
-class BoxPageMarginBottomRightCorner extends BoxPageMargin {
- function _position($media, $boxes, $context) {
- $this->put_left($this->get_extra_left() + mm2pt($media->width() - $media->margins['right']));
- $this->put_top(-$this->get_extra_top() +mm2pt($media->margins['bottom']));
-
- $this->put_full_width(mm2pt($media->margins['right']));
- $this->put_full_height(mm2pt($media->margins['top']));
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- }
-}
-
-class BoxPageMarginBottom extends BoxPageMargin {
- function _position($media, $boxes, $context) {
- $this->put_left($this->get_extra_left() + 0);
- $this->put_top(-$this->get_extra_top() +mm2pt($media->margins['bottom']));
-
- $this->put_full_width(mm2pt($media->width()));
- $this->put_full_height(mm2pt($media->margins['bottom']));
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- }
-}
-
-class BoxPageMarginLeftTop extends BoxPageMargin {
- function _position($media, $boxes, $context) {
- list($left, $center, $right) = $this->_calc_sizes(mm2pt($media->real_height()),
- $boxes[CSS_MARGIN_BOX_SELECTOR_LEFT_TOP],
- $boxes[CSS_MARGIN_BOX_SELECTOR_LEFT_MIDDLE],
- $boxes[CSS_MARGIN_BOX_SELECTOR_LEFT_BOTTOM]);
-
- $this->put_left($this->get_extra_left() + 0);
- $this->put_top(-$this->get_extra_top() +mm2pt($media->height() - $media->margins['top']));
-
- $this->put_full_height($left);
- $this->put_full_width(mm2pt($media->margins['left']));
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- }
-}
-
-class BoxPageMarginLeftMiddle extends BoxPageMargin {
- function _position($media, $boxes, $context) {
- list($left, $center, $right) = $this->_calc_sizes(mm2pt($media->real_height()),
- $boxes[CSS_MARGIN_BOX_SELECTOR_LEFT_TOP],
- $boxes[CSS_MARGIN_BOX_SELECTOR_LEFT_MIDDLE],
- $boxes[CSS_MARGIN_BOX_SELECTOR_LEFT_BOTTOM]);
- $this->put_left($this->get_extra_left() + 0);
- $this->put_top(-$this->get_extra_top() +mm2pt($media->height() - $media->margins['top']) - $left);
-
- $this->put_full_height($center);
- $this->put_full_width(mm2pt($media->margins['left']));
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- }
-}
-
-class BoxPageMarginLeftBottom extends BoxPageMargin {
- function _position($media, $boxes, $context) {
- list($left, $center, $right) = $this->_calc_sizes(mm2pt($media->real_height()),
- $boxes[CSS_MARGIN_BOX_SELECTOR_LEFT_TOP],
- $boxes[CSS_MARGIN_BOX_SELECTOR_LEFT_MIDDLE],
- $boxes[CSS_MARGIN_BOX_SELECTOR_LEFT_BOTTOM]);
-
- $this->put_left($this->get_extra_left() + 0);
- $this->put_top(-$this->get_extra_top() +mm2pt($media->height() - $media->margins['top']) - $left - $center);
-
- $this->put_full_height($right);
- $this->put_full_width(mm2pt($media->margins['left']));
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- }
-}
-
-class BoxPageMarginRightTop extends BoxPageMargin {
- function _position($media, $boxes, $context) {
- list($left, $center, $right) = $this->_calc_sizes(mm2pt($media->real_height()),
- $boxes[CSS_MARGIN_BOX_SELECTOR_RIGHT_TOP],
- $boxes[CSS_MARGIN_BOX_SELECTOR_RIGHT_MIDDLE],
- $boxes[CSS_MARGIN_BOX_SELECTOR_RIGHT_BOTTOM]);
-
- $this->put_left($this->get_extra_left() + mm2pt($media->width() - $media->margins['right']));
- $this->put_top(-$this->get_extra_top() +mm2pt($media->height() - $media->margins['top']));
-
- $this->put_full_height($left);
- $this->put_full_width(mm2pt($media->margins['right']));
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- }
-}
-
-class BoxPageMarginRightMiddle extends BoxPageMargin {
- function _position($media, $boxes, $context) {
- list($left, $center, $right) = $this->_calc_sizes(mm2pt($media->real_height()),
- $boxes[CSS_MARGIN_BOX_SELECTOR_LEFT_TOP],
- $boxes[CSS_MARGIN_BOX_SELECTOR_LEFT_MIDDLE],
- $boxes[CSS_MARGIN_BOX_SELECTOR_LEFT_BOTTOM]);
-
- $this->put_left($this->get_extra_left() + mm2pt($media->width() - $media->margins['right']));
- $this->put_top(-$this->get_extra_top() +mm2pt($media->height() - $media->margins['top']) - $left);
-
- $this->put_full_height($center);
- $this->put_full_width(mm2pt($media->margins['right']));
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- }
-}
-
-class BoxPageMarginRightBottom extends BoxPageMargin {
- function _position($media, $boxes, $context) {
- list($left, $center, $right) = $this->_calc_sizes(mm2pt($media->real_height()),
- $boxes[CSS_MARGIN_BOX_SELECTOR_LEFT_TOP],
- $boxes[CSS_MARGIN_BOX_SELECTOR_LEFT_MIDDLE],
- $boxes[CSS_MARGIN_BOX_SELECTOR_LEFT_BOTTOM]);
-
- $this->put_left($this->get_extra_left() + mm2pt($media->width() - $media->margins['right']));
- $this->put_top(-$this->get_extra_top() + mm2pt($media->height() - $media->margins['top']) - $left - $center);
-
- $this->put_full_height($right);
- $this->put_full_width(mm2pt($media->margins['right']));
-
- $this->_current_x = $this->get_left();
- $this->_current_y = $this->get_top();
- }
-}
-
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.page.php b/thirdparty/html2ps_pdf/box.page.php
deleted file mode 100644
index 72b16ff29..000000000
--- a/thirdparty/html2ps_pdf/box.page.php
+++ /dev/null
@@ -1,49 +0,0 @@
-GenericContainerBox();
- }
-
- function &create(&$pipeline, $rules) {
- $box =& new BoxPage();
-
- $state =& $pipeline->getCurrentCSSState();
- $state->pushDefaultState();
- $rules->apply($state);
- $box->readCSS($state);
- $state->popState();
-
- return $box;
- }
-
- function get_bottom_background() {
- return $this->get_bottom_margin();
- }
-
- function get_left_background() {
- return $this->get_left_margin();
- }
-
- function get_right_background() {
- return $this->get_right_margin();
- }
-
- function get_top_background() {
- return $this->get_top_margin();
- }
-
- function reflow(&$media) {
- $this->put_left(mm2pt($media->margins['left']));
- $this->put_top(mm2pt($media->height() - $media->margins['top']));
- $this->put_width(mm2pt($media->real_width()));
- $this->put_height(mm2pt($media->real_height()));
- }
-
- function show(&$driver) {
- $this->offset(0, $driver->offset);
- parent::show($driver);
- }
-}
-
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.php b/thirdparty/html2ps_pdf/box.php
deleted file mode 100644
index c9cd2e9f9..000000000
--- a/thirdparty/html2ps_pdf/box.php
+++ /dev/null
@@ -1,576 +0,0 @@
- MAX_FRAME_NESTING_LEVEL) {
- trigger_error('Frame nesting too deep',
- E_USER_ERROR);
- };
-}
-
-// Called when frame (and all nested frames, of course) processing have been completed
-//
-function dec_frame_level() {
- global $g_frame_level;
- $g_frame_level --;
-}
-
-// Calculate 'display' CSS property according to CSS 2.1 paragraph 9.7
-// "Relationships between 'display', 'position', and 'float'"
-// (The last table in that paragraph)
-//
-// @return flag indication of current box need a block box wrapper
-//
-function _fix_display_position_float(&$css_state) {
- // Specified value -> Computed value
- // inline-table -> table
- // inline, run-in, table-row-group, table-column, table-column-group, table-header-group,
- // table-footer-group, table-row, table-cell, table-caption, inline-block -> block
- // others-> same as specified
-
- $display = $css_state->getProperty(CSS_DISPLAY);
-
- switch ($display) {
- case "inline-table":
- $css_state->setProperty(CSS_DISPLAY, 'table');
- return false;
- case "inline":
- case "run-in":
- case "table-row-group":
- case "table-column":
- case "table-column-group":
- case "table-header-group":
- case "table-footer-group":
- case "table-row":
- case "table-cell":
- case "table-caption":
- case "inline-block":
- // Note that as we're using some non-standard display values, we need to add them to translation table
- $css_state->setProperty(CSS_DISPLAY, 'block');
- return false;
-
- // There are display types that cannot be directly converted to block; in this case we need to create a "wrapper" floating
- // or positioned block box and put our real box into it.
- case "-button":
- case "-button-submit":
- case "-button-reset":
- case "-button-image":
- case "-checkbox":
- case "-iframe":
- case "-image":
- case "-legend":
- case "-password":
- case "-radio":
- case "-select":
- case "-text":
- case "-textarea":
- // No change
- return true;
-
- // Display values that are not affected by "float" property
- case "-frame":
- case "-frameset":
- // 'block' is assumed here
- default:
- // No change
- return false;
- }
-}
-
-function &create_pdf_box(&$root, &$pipeline) {
- if ($root != ''){
- $valueNodeType = $root->node_type();
- } else {
- throw new Exception("ID_OUTPUT_NOT_GENERATE", 1);
- }
-
- switch ($valueNodeType) {
- case XML_DOCUMENT_NODE:
- // TODO: some magic from traverse_dom_tree
- $box =& create_document_box($root, $pipeline);
- return $box;
- case XML_ELEMENT_NODE:
- $box =& create_node_box($root, $pipeline);
- return $box;
- case XML_TEXT_NODE:
- $box =& create_text_box($root, $pipeline);
- return $box;
- default:
- die("Unsupported node type:".$root->node_type());
- }
-}
-
-function &create_document_box(&$root, &$pipeline) {
- return BlockBox::create($root, $pipeline);
-}
-
-function &create_node_box(&$root, &$pipeline) {
- // Determine CSS proerty value for current child
- $css_state =& $pipeline->getCurrentCSSState();
- $css_state->pushDefaultState();
-
- $default_css = $pipeline->getDefaultCSS();
- $default_css->apply($root, $css_state, $pipeline);
-
- // Store the default 'display' value; we'll need it later when checking for impossible tag/display combination
- $handler =& CSS::get_handler(CSS_DISPLAY);
- $default_display = $handler->get($css_state->getState());
-
- // Initially generated boxes do not require block wrappers
- // Block wrappers are required in following cases:
- // - float property is specified for non-block box which cannot be directly converted to block box
- // (a button, for example)
- // - display set to block for such box
- $need_block_wrapper = false;
-
- // TODO: some inheritance magic
-
- // Order is important. Items with most priority should be applied last
- // Tag attributes
- execute_attrs_before($root, $pipeline);
-
- // CSS stylesheet
- $css =& $pipeline->getCurrentCSS();
- $css->apply($root, $css_state, $pipeline);
-
- // values from 'style' attribute
- if ($root->has_attribute("style")) {
- parse_style_attr($root, $css_state, $pipeline);
- };
-
- _fix_tag_display($default_display, $css_state, $pipeline);
-
- execute_attrs_after_styles($root, $pipeline);
-
- // CSS 2.1:
- // 9.7 Relationships between 'display', 'position', and 'float'
- // The three properties that affect box generation and layout B
- // 'display', 'position', and 'float' B interact as follows:
- // 1. If 'display' has the value 'none', then 'position' and 'float' do not apply.
- // In this case, the element generates no box.
- $position_handler =& CSS::get_handler(CSS_POSITION);
- $float_handler =& CSS::get_handler(CSS_FLOAT);
-
- // 2. Otherwise, if 'position' has the value 'absolute' or 'fixed', the box is absolutely positioned,
- // the computed value of 'float' is 'none', and display is set according to the table below.
- // The position of the box will be determined by the 'top', 'right', 'bottom' and 'left' properties and
- // the box's containing block.
- $position = $css_state->getProperty(CSS_POSITION);
- if ($position === CSS_PROPERTY_INHERIT) {
- $position = $css_state->getInheritedProperty(CSS_POSITION);
- };
-
- if ($position === POSITION_ABSOLUTE ||
- $position === POSITION_FIXED) {
- $float_handler->replace(FLOAT_NONE, $css_state);
- $need_block_wrapper |= _fix_display_position_float($css_state);
- };
-
- // 3. Otherwise, if 'float' has a value other than 'none', the box is floated and 'display' is set
- // according to the table below.
- $float = $css_state->getProperty(CSS_FLOAT);
- if ($float != FLOAT_NONE) {
- $need_block_wrapper |= _fix_display_position_float($css_state);
- };
-
- // Process some special nodes, which should not get their 'display' values overwritten (unless
- // current display value is 'none'
- $current_display = $css_state->getProperty(CSS_DISPLAY);
-
- if ($current_display != 'none') {
- switch ($root->tagname()) {
- case 'body':
- $handler =& CSS::get_handler(CSS_DISPLAY);
- $handler->css('-body', $pipeline);
- break;
- case 'br':
- $handler =& CSS::get_handler(CSS_DISPLAY);
- $handler->css('-break', $pipeline);
- break;
- case 'img':
- $handler =& CSS::get_handler(CSS_DISPLAY);
- $need_block_wrapper |= ($handler->get($css_state->getState()) == "block");
- $handler->css('-image', $pipeline);
- break;
- };
- };
-
- // 4. Otherwise, if the element is the root element, 'display' is set according to the table below.
- // 5. Otherwise, the remaining 'display' property values apply as specified. (see _fix_display_position_float)
-
- switch($css_state->getProperty(CSS_DISPLAY)) {
- case "block":
- $box =& BlockBox::create($root, $pipeline);
- break;
- case "-break":
- $box =& BRBox::create($pipeline);
- break;
- case "-body":
- $box =& BodyBox::create($root, $pipeline);
- break;
- case "-button":
- $box =& ButtonBox::create($root, $pipeline);
- break;
- case "-button-reset":
- $box =& ButtonResetBox::create($root, $pipeline);
- break;
- case "-button-submit":
- $box =& ButtonSubmitBox::create($root, $pipeline);
- break;
- case "-button-image":
- $box =& ButtonImageBox::create($root, $pipeline);
- break;
- case "-checkbox":
- $box =& CheckBox::create($root, $pipeline);
- break;
- case "-form":
- $box =& FormBox::create($root, $pipeline);
- break;
- case "-frame":
- inc_frame_level();
- $box =& FrameBox::create($root, $pipeline);
- dec_frame_level();
- break;
- case "-frameset":
- inc_frame_level();
- $box =& FramesetBox::create($root, $pipeline);
- dec_frame_level();
- break;
- case "-iframe":
- inc_frame_level();
- $box =& IFrameBox::create($root, $pipeline);
- dec_frame_level();
- break;
- case "-textarea":
- $box =& TextAreaInputBox::create($root, $pipeline);
- break;
- case "-image":
- $box =& IMGBox::create($root, $pipeline);
- break;
- case "inline":
- $box =& InlineBox::create($root, $pipeline);
- break;
- case "inline-block":
- $box =& InlineBlockBox::create($root, $pipeline);
- break;
- case "-legend":
- $box =& LegendBox::create($root, $pipeline);
- break;
- case "list-item":
- $box =& ListItemBox::create($root, $pipeline);
- break;
- case "none":
- $box =& NullBox::create();
- break;
- case "-radio":
- $box =& RadioBox::create($root, $pipeline);
- break;
- case "-select":
- $box =& SelectBox::create($root, $pipeline);
- break;
- case "table":
- $box =& TableBox::create($root, $pipeline);
- break;
- case "table-cell":
- $box =& TableCellBox::create($root, $pipeline);
- break;
- case "table-row":
- $box =& TableRowBox::create($root, $pipeline);
- break;
- case "table-row-group":
- case "table-header-group":
- case "table-footer-group":
- $box =& TableSectionBox::create($root, $pipeline);
- break;
- case "-text":
- $box =& TextInputBox::create($root, $pipeline);
- break;
- case "-password":
- $box =& PasswordInputBox::create($root, $pipeline);
- break;
- default:
- /**
- * If 'display' value is invalid or unsupported, fall back to 'block' mode
- */
- error_log("Unsupported 'display' value: ".$css_state->getProperty(CSS_DISPLAY));
- $box =& BlockBox::create($root, $pipeline);
- break;
- }
-
- // Now check if pseudoelement should be created; in this case we'll use the "inline wrapper" box
- // containing both generated box and pseudoelements
- //
- $pseudoelements = $box->getCSSProperty(CSS_HTML2PS_PSEUDOELEMENTS);
-
- if ($pseudoelements & CSS_HTML2PS_PSEUDOELEMENTS_BEFORE) {
- // Check if :before preudoelement exists
- $before =& create_pdf_pseudoelement($root, SELECTOR_PSEUDOELEMENT_BEFORE, $pipeline);
- if (!is_null($before)) {
- $box->insert_child(0, $before);
- };
- };
-
- if ($pseudoelements & CSS_HTML2PS_PSEUDOELEMENTS_AFTER) {
- // Check if :after pseudoelement exists
- $after =& create_pdf_pseudoelement($root, SELECTOR_PSEUDOELEMENT_AFTER, $pipeline);
- if (!is_null($after)) {
- $box->add_child($after);
- };
- };
-
- // Check if this box needs a block wrapper (for example, floating button)
- // Note that to keep float/position information, we clear the CSS stack only
- // AFTER the wrapper box have been created; BUT we should clear the following CSS properties
- // to avoid the fake wrapper box actually affect the layout:
- // - margin
- // - border
- // - padding
- // - background
- //
- if ($need_block_wrapper) {
- /**
- * Clear POSITION/FLOAT properties on wrapped boxes
- */
- $box->setCSSProperty(CSS_POSITION, POSITION_STATIC);
- $box->setCSSProperty(CSS_POSITION, FLOAT_NONE);
-
- $wc = $box->getCSSProperty(CSS_WIDTH);
-
- // Note that if element width have been set as a percentage constraint and we're adding a block wrapper,
- // then we need to:
- // 1. set the same percentage width constraint to the wrapper element (will be done implicilty if we will not
- // modify the 'width' CSS handler stack
- // 2. set the wrapped element's width constraint to 100%, otherwise it will be narrower than expected
- if ($wc->isFraction()) {
- $box->setCSSProperty(CSS_WIDTH, new WCFraction(1));
- }
-
- $handler =& CSS::get_handler(CSS_MARGIN);
- $box->setCSSProperty(CSS_MARGIN, $handler->default_value());
-
- /**
- * Note: default border does not contain any fontsize-dependent
- * values, so we may safely use zero as a base font size
- */
- $border_handler =& CSS::get_handler(CSS_BORDER);
- $value = $border_handler->default_value();
- $value->units2pt(0);
- $box->setCSSProperty(CSS_BORDER, $value);
-
- $handler =& CSS::get_handler(CSS_PADDING);
- $box->setCSSProperty(CSS_PADDING, $handler->default_value());
-
- $handler =& CSS::get_handler(CSS_BACKGROUND);
- $box->setCSSProperty(CSS_BACKGROUND, $handler->default_value());
-
- // Create "clean" block box
- $wrapper =& new BlockBox();
- $wrapper->readCSS($pipeline->getCurrentCSSState());
- $wrapper->add_child($box);
-
- // Remove CSS propery values from stack
- execute_attrs_after($root, $pipeline);
-
- $css_state->popState();
-
- return $wrapper;
- } else {
- // Remove CSS propery values from stack
- execute_attrs_after($root, $pipeline);
- $css_state->popState();
-
- return $box;
- };
-}
-
-function &create_text_box(&$root, &$pipeline) {
- // Determine CSS property value for current child
- $css_state =& $pipeline->getCurrentCSSState();
- $css_state->pushDefaultTextState();
-
- /**
- * No text boxes generated by empty text nodes.
- * Note that nodes containing spaces only are NOT empty, as they may
- * correspond, for example, to whitespace between tags.
- */
- if ($root->content !== "") {
- $box =& InlineBox::create($root, $pipeline);
- } else {
- $box = null;
- }
-
- // Remove CSS property values from stack
- $css_state->popState();
-
- return $box;
-}
-
-function &create_pdf_pseudoelement($root, $pe_type, &$pipeline) {
- // Store initial values to CSS stack
- $css_state =& $pipeline->getCurrentCSSState();
- $css_state->pushDefaultState();
-
- // Initially generated boxes do not require block wrappers
- // Block wrappers are required in following cases:
- // - float property is specified for non-block box which cannot be directly converted to block box
- // (a button, for example)
- // - display set to block for such box
- $need_block_wrapper = false;
-
- $css =& $pipeline->getCurrentCSS();
- $css->apply_pseudoelement($pe_type, $root, $css_state, $pipeline);
-
- // Now, if no content found, just return
- //
- $content_obj = $css_state->getProperty(CSS_CONTENT);
- if ($content_obj === CSS_PROPERTY_INHERIT) {
- $content_obj = $css_state->getInheritedProperty(CSS_CONTENT);
- };
- $content = $content_obj->render($pipeline->get_counters());
-
- if ($content === '') {
- $css_state->popState();
-
- $dummy = null;
- return $dummy;
- };
-
- // CSS 2.1:
- // 9.7 Relationships between 'display', 'position', and 'float'
- // The three properties that affect box generation and layout B
- // 'display', 'position', and 'float' B interact as follows:
- // 1. If 'display' has the value 'none', then 'position' and 'float' do not apply.
- // In this case, the element generates no box.
-
- // 2. Otherwise, if 'position' has the value 'absolute' or 'fixed', the box is absolutely positioned,
- // the computed value of 'float' is 'none', and display is set according to the table below.
- // The position of the box will be determined by the 'top', 'right', 'bottom' and 'left' properties and
- // the box's containing block.
- $position_handler =& CSS::get_handler(CSS_POSITION);
- $float_handler =& CSS::get_handler(CSS_FLOAT);
-
- $position = $position_handler->get($css_state->getState());
- if ($position === CSS_PROPERTY_INHERIT) {
- $position = $css_state->getInheritedProperty(CSS_POSITION);
- };
-
- if ($position === POSITION_ABSOLUTE || $position === POSITION_FIXED) {
- $float_handler->replace(FLOAT_NONE);
- $need_block_wrapper |= _fix_display_position_float($css_state);
- };
-
- // 3. Otherwise, if 'float' has a value other than 'none', the box is floated and 'display' is set
- // according to the table below.
- $float = $float_handler->get($css_state->getState());
- if ($float != FLOAT_NONE) {
- $need_block_wrapper |= _fix_display_position_float($css_state);
- };
-
- // 4. Otherwise, if the element is the root element, 'display' is set according to the table below.
- // 5. Otherwise, the remaining 'display' property values apply as specified. (see _fix_display_position_float)
-
- // Note that pseudoelements may get only standard display values
- $display_handler =& CSS::get_handler(CSS_DISPLAY);
- $display = $display_handler->get($css_state->getState());
-
- switch ($display) {
- case 'block':
- $box =& BlockBox::create_from_text($content, $pipeline);
- break;
- case 'inline':
- $ws_handler =& CSS::get_handler(CSS_WHITE_SPACE);
- $box =& InlineBox::create_from_text($content,
- $ws_handler->get($css_state->getState()),
- $pipeline);
- break;
- default:
- error_log('Unsupported display value: '.$display_handler->get($css_state->getState()));
- die;
- }
-
- // Check if this box needs a block wrapper (for example, floating button)
- // Note that to keep float/position information, we clear the CSS stack only
- // AFTER the wrapper box have been created; BUT we should clear the following CSS properties
- // to avoid the fake wrapper box actually affect the layout:
- // - margin
- // - border
- // - padding
- // - background
- //
- if ($need_block_wrapper) {
- $handler =& CSS::get_handler(CSS_MARGIN);
- $handler->css("0",$pipeline);
-
- pop_border();
- push_border(default_border());
-
- pop_padding();
- push_padding(default_padding());
-
- $handler =& CSS::get_handler(CSS_BACKGROUND);
- $handler->css('transparent',$pipeline);
-
- // Create "clean" block box
- $wrapper =& new BlockBox();
- $wrapper->readCSS($pipeline->getCurrentCSSState());
- $wrapper->add_child($box);
-
- $css_state->popState();
- return $wrapper;
- } else {
- $css_state->popState();
- return $box;
- };
-}
-
-function is_inline(&$box) {
- if (is_a($box, "TextBox")) { return true; };
-
- $display = $box->getCSSProperty(CSS_DISPLAY);
-
- return
- $display === '-button' ||
- $display === '-button-reset' ||
- $display === '-button-submit' ||
- $display === '-button-image' ||
- $display === '-checkbox' ||
- $display === '-image' ||
- $display === 'inline' ||
- $display === 'inline-block' ||
- $display === 'none' ||
- $display === '-radio' ||
- $display === '-select' ||
- $display === '-text' ||
- $display === '-password';
-}
-
-function is_whitespace(&$box) {
- return
- is_a($box, "WhitespaceBox") ||
- is_a($box, "NullBox");
-}
-
-function is_container(&$box) {
- return is_a($box, "GenericContainerBox") &&
- !is_a($box, "GenericInlineBox") ||
- is_a($box, "InlineBox");
-}
-
-function is_span(&$box) {
- return is_a($box, "InlineBox");
-}
-
-function is_table_cell(&$box) {
- return is_a($box, "TableCellBox");
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.radiobutton.php b/thirdparty/html2ps_pdf/box.radiobutton.php
deleted file mode 100644
index a0b7f14ce..000000000
--- a/thirdparty/html2ps_pdf/box.radiobutton.php
+++ /dev/null
@@ -1,148 +0,0 @@
-has_attribute('checked');
-
- $value = $root->get_attribute('value');
- if (trim($value) == "") {
- error_log("Radiobutton with empty 'value' attribute");
- $value = sprintf("___Value%s",G::encryptOld(time().rand()));
- };
-
- $css_state = $pipeline->getCurrentCSSState();
-
- $box =& new RadioBox($checked, $value,
- $css_state->getProperty(CSS_HTML2PS_FORM_RADIOGROUP));
- $box->readCSS($css_state);
- return $box;
- }
-
- function RadioBox($checked, $value, $group_name) {
- // Call parent constructor
- $this->GenericBox();
-
- // Check the box state
- $this->_checked = $checked;
-
- /**
- * Store the form value for this radio button
- */
- $this->_value = trim($value);
-
- $this->_group_name = $group_name;
-
- // Setup box size:
- $this->default_baseline = units2pt(RADIOBUTTON_SIZE);
- $this->height = units2pt(RADIOBUTTON_SIZE);
- $this->width = units2pt(RADIOBUTTON_SIZE);
-
- $this->setCSSProperty(CSS_DISPLAY,'-radio');
- }
-
- // Inherited from GenericFormattedBox
- function get_min_width(&$context) {
- return $this->get_full_width($context);
- }
-
- function get_max_width(&$context) {
- return $this->get_full_width($context);
- }
-
- function get_max_width_natural(&$context) {
- return $this->get_full_width($context);
- }
-
- function reflow(&$parent, &$context) {
- GenericFormattedBox::reflow($parent, $context);
-
- // set default baseline
- $this->baseline = $this->default_baseline;
-
- // append to parent line box
- $parent->append_line($this);
-
- // Determine coordinates of upper-left _margin_ corner
- $this->guess_corner($parent);
-
- // Offset parent current X coordinate
- $parent->_current_x += $this->get_full_width();
-
- // Extends parents height
- $parent->extend_height($this->get_bottom_margin());
- }
-
- function show(&$driver) {
- // Cet check center
- $x = ($this->get_left() + $this->get_right()) / 2;
- $y = ($this->get_top() + $this->get_bottom()) / 2;
-
- // Calculate checkbox size
- $size = $this->get_width() / 3;
-
- // Draw checkbox
- $driver->setlinewidth(0.25);
- $driver->circle($x, $y, $size);
- $driver->stroke();
-
- /**
- * Render the interactive button (if requested and possible)
- * Also, if no value were specified, then this radio button should not be interactive
- */
- global $g_config;
- if ($g_config['renderforms'] && $this->_value != "") {
- $driver->field_radio($x - $size,
- $y + $size,
- 2*$size,
- 2*$size,
- $this->_group_name,
- $this->_value,
- $this->_checked);
- } else {
- // Draw checkmark if needed
- if ($this->_checked) {
- $check_size = $this->get_width() / 6;
-
- $driver->circle($x, $y, $check_size);
- $driver->fill();
- }
- };
-
- return true;
- }
-
- function get_ascender() {
- return $this->get_height();
- }
-
- function get_descender() {
- return 0;
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.select.php b/thirdparty/html2ps_pdf/box.select.php
deleted file mode 100644
index 38c5ac2d1..000000000
--- a/thirdparty/html2ps_pdf/box.select.php
+++ /dev/null
@@ -1,128 +0,0 @@
-InlineBox();
-
- $this->_name = $name;
- $this->_value = $value;
- $this->_options = $options;
- }
-
- function &create(&$root, &$pipeline) {
- $name = $root->get_attribute('name');
-
- $value = "";
- $options = array();
-
- // Get option list
- $child = $root->first_child();
- $content = "";
- $size = 0;
- while ($child) {
- if ($child->node_type() == XML_ELEMENT_NODE) {
- $size = max($size, strlen($child->get_content()));
- if (empty($content) || $child->has_attribute("selected")) {
- $content = preg_replace("/\s/"," ",$child->get_content());
- $value = trim($child->get_content());
- };
-
- if ($child->has_attribute('value')) {
- $options[] = array($child->get_attribute('value'),
- $child->get_content());
- } else {
- $options[] = array($child->get_content(),
- $child->get_content());
- };
- };
- $child = $child->next_sibling();
- };
- $content = str_pad($content, $size*SIZE_SPACE_KOEFF + SELECT_SPACE_PADDING, " ");
-
- $box =& new SelectBox($name, $value, $options);
- $box->readCSS($pipeline->getCurrentCSSState());
-
- // Add text to be rendered in non-interactive mode
- $ibox = InlineBox::create_from_text($content, WHITESPACE_PRE, $pipeline);
- for ($i=0, $size = count($ibox->content); $i<$size; $i++) {
- $box->add_child($ibox->content[$i]);
- };
-
- return $box;
- }
-
- function show(&$driver) {
- global $g_config;
- if ($g_config['renderforms']) {
- return $this->show_field($driver);
- } else {
- return $this->show_rendered($driver);
- };
- }
-
- function show_field(&$driver) {
- if (is_null(GenericFormattedBox::show($driver))) {
- return null;
- };
-
- $driver->field_select($this->get_left_padding(),
- $this->get_top_padding(),
- $this->get_width() + $this->get_padding_left() + $this->get_padding_right(),
- $this->get_height(),
- $this->_name,
- $this->_value,
- $this->_options);
- return true;
- }
-
- function show_rendered(&$driver) {
- // Now set the baseline of a button box to align it vertically when flowing isude the
- // text line
- $this->default_baseline = $this->content[0]->baseline + $this->get_extra_top();
- $this->baseline = $this->content[0]->baseline + $this->get_extra_top();
-
- if (is_null(GenericContainerBox::show($driver))) {
- return null;
- };
-
- $padding = $this->getCSSProperty(CSS_PADDING);
- $button_height = $this->get_height() + $padding->top->value + $padding->bottom->value;
-
- // Show arrow button box
- $driver->setrgbcolor(0.93, 0.93, 0.93);
- $driver->moveto($this->get_right_padding(), $this->get_top_padding());
- $driver->lineto($this->get_right_padding() - $button_height, $this->get_top_padding());
- $driver->lineto($this->get_right_padding() - $button_height, $this->get_bottom_padding());
- $driver->lineto($this->get_right_padding(), $this->get_bottom_padding());
- $driver->closepath();
- $driver->fill();
-
- // Show box boundary
- $driver->setrgbcolor(0,0,0);
- $driver->moveto($this->get_right_padding(), $this->get_top_padding());
- $driver->lineto($this->get_right_padding() - $button_height, $this->get_top_padding());
- $driver->lineto($this->get_right_padding() - $button_height, $this->get_bottom_padding());
- $driver->lineto($this->get_right_padding(), $this->get_bottom_padding());
- $driver->closepath();
- $driver->stroke();
-
- // Show arrow
- $driver->setrgbcolor(0,0,0);
- $driver->moveto($this->get_right_padding() - SELECT_BUTTON_TRIANGLE_PADDING,
- $this->get_top_padding() - SELECT_BUTTON_TRIANGLE_PADDING);
- $driver->lineto($this->get_right_padding() - $button_height + SELECT_BUTTON_TRIANGLE_PADDING,
- $this->get_top_padding() - SELECT_BUTTON_TRIANGLE_PADDING);
- $driver->lineto($this->get_right_padding() - $button_height/2, $this->get_bottom_padding() + SELECT_BUTTON_TRIANGLE_PADDING);
- $driver->closepath();
- $driver->fill();
-
- return true;
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.table.cell.fake.php b/thirdparty/html2ps_pdf/box.table.cell.fake.php
deleted file mode 100644
index 84ab13592..000000000
--- a/thirdparty/html2ps_pdf/box.table.cell.fake.php
+++ /dev/null
@@ -1,73 +0,0 @@
-getCurrentCSSState();
- $css_state->pushDefaultState();
-
- $box->readCSS($css_state);
-
- $nullbox =& new NullBox;
- $nullbox->readCSS($css_state);
- $box->add_child($nullbox);
-
- $box->readCSS($css_state);
-
- $css_state->popState();
-
- return $box;
- }
-
- function FakeTableCellBox() {
- // Required to reset any constraints initiated by CSS properties
- $this->colspan = 1;
- $this->rowspan = 1;
- $this->GenericContainerBox();
-
- $this->setCSSProperty(CSS_DISPLAY, 'table-cell');
- $this->setCSSProperty(CSS_VERTICAL_ALIGN, VA_MIDDLE);
- }
-
- function show(&$viewport) {
- return true;
- }
-
- function is_fake() {
- return true;
- }
-
- function get_width_constraint() {
- return new WCNone();
- }
-
- function get_height_constraint() {
- return new HCConstraint(null, null, null);
- }
-
- function get_height() {
- return 0;
- }
-
- function get_top_margin() {
- return 0;
- }
-
- function get_full_height() {
- return 0;
- }
-
- function get_max_width() {
- return 0;
- }
-
- function get_min_width() {
- return 0;
- }
-}
-
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.table.cell.php b/thirdparty/html2ps_pdf/box.table.cell.php
deleted file mode 100644
index a7df23a67..000000000
--- a/thirdparty/html2ps_pdf/box.table.cell.php
+++ /dev/null
@@ -1,322 +0,0 @@
-_cache[CACHE_MIN_WIDTH])) {
- return $this->_cache[CACHE_MIN_WIDTH];
- };
-
- $content_size = count($this->content);
-
- /**
- * If box does not have any context, its minimal width is determined by extra horizontal space:
- * padding, border width and margins
- */
- if ($content_size == 0) {
- $min_width = $this->_get_hor_extra();
- $this->_cache[CACHE_MIN_WIDTH] = $min_width;
- return $min_width;
- };
-
- /**
- * If we're in 'nowrap' mode, minimal and maximal width will be equal
- */
- $white_space = $this->getCSSProperty(CSS_WHITE_SPACE);
- $pseudo_nowrap = $this->getCSSProperty(CSS_HTML2PS_NOWRAP);
- if ($white_space == WHITESPACE_NOWRAP ||
- $pseudo_nowrap == NOWRAP_NOWRAP) {
- $min_width = $this->get_min_nowrap_width($context);
- $this->_cache[CACHE_MIN_WIDTH] = $min_width;
- return $min_width;
- }
-
- /**
- * We need to add text indent size to the with of the first item
- */
- $start_index = 0;
- while ($start_index < $content_size &&
- $this->content[$start_index]->out_of_flow()) {
- $start_index++;
- };
-
- if ($start_index < $content_size) {
- $ti = $this->getCSSProperty(CSS_TEXT_INDENT);
- $minw =
- $ti->calculate($this) +
- $this->content[$start_index]->get_min_width($context);
- } else {
- $minw = 0;
- };
-
- for ($i=$start_index; $i<$content_size; $i++) {
- $item =& $this->content[$i];
- if (!$item->out_of_flow()) {
- $minw = max($minw, $item->get_min_width_natural($context));
- };
- }
-
- /**
- * Apply width constraint to min width. Return maximal value
- */
- $wc = $this->getCSSProperty(CSS_WIDTH);
- $min_width = max($minw,
- $wc->apply($minw, $this->parent->get_width())) + $this->_get_hor_extra();
- $this->_cache[CACHE_MIN_WIDTH] = $min_width;
- return $min_width;
- }
-
- function readCSS(&$state) {
- parent::readCSS($state);
-
- $this->_readCSS($state,
- array(CSS_BORDER_COLLAPSE));
-
- $this->_readCSSLengths($state,
- array(CSS_HTML2PS_CELLPADDING,
- CSS_HTML2PS_CELLSPACING,
- CSS_HTML2PS_TABLE_BORDER));
- }
-
- function isCell() {
- return true;
- }
-
- function is_fake() {
- return false;
- }
-
- function &create(&$root, &$pipeline) {
- $css_state = $pipeline->getCurrentCSSState();
-
- $box =& new TableCellBox();
- $box->readCSS($css_state);
-
- // Use cellspacing / cellpadding values from the containing table
- $cellspacing = $box->getCSSProperty(CSS_HTML2PS_CELLSPACING);
- $cellpadding = $box->getCSSProperty(CSS_HTML2PS_CELLPADDING);
-
- // FIXME: I'll need to resolve that issue with COLLAPSING border model. Now borders
- // are rendered separated
-
- // if not border set explicitly, inherit value set via border attribute of TABLE tag
- $border_handler = CSS::get_handler(CSS_BORDER);
- if ($border_handler->is_default($box->getCSSProperty(CSS_BORDER))) {
- $table_border = $box->getCSSProperty(CSS_HTML2PS_TABLE_BORDER);
- $box->setCSSProperty(CSS_BORDER, $table_border);
- };
-
- $margin =& CSS::get_handler(CSS_MARGIN);
- $box->setCSSProperty(CSS_MARGIN, $margin->default_value());
-
- $h_padding =& CSS::get_handler(CSS_PADDING);
- $padding = $box->getCSSProperty(CSS_PADDING);
-
- if ($h_padding->is_default($padding)) {
- $padding->left->_units = $cellpadding;
- $padding->left->auto = false;
- $padding->left->percentage = null;
-
- $padding->right->_units = $cellpadding;
- $padding->right->auto = false;
- $padding->right->percentage = null;
-
- $padding->top->_units = $cellpadding;
- $padding->top->auto = false;
- $padding->top->percentage = null;
-
- $padding->bottom->_units = $cellpadding;
- $padding->bottom->auto = false;
- $padding->bottom->percentage = null;
-
- /**
- * Note that cellpadding/cellspacing values never use font-size based units
- * ('em' and 'ex'), so we may pass 0 as base_font_size parameter - it
- * will not be used anyway
- */
- $padding->units2pt(0);
-
- $box->setCSSProperty(CSS_PADDING, $padding);
- };
-
- if ($box->getCSSProperty(CSS_BORDER_COLLAPSE) != BORDER_COLLAPSE) {
- $margin_value = $box->getCSSProperty(CSS_MARGIN);
- if ($margin->is_default($margin_value)) {
- $length = $cellspacing->copy();
- $length->scale(0.5);
-
- $margin_value->left->_units = $length;
- $margin_value->left->auto = false;
- $margin_value->left->percentage = null;
-
- $margin_value->right->_units = $length;
- $margin_value->right->auto = false;
- $margin_value->right->percentage = null;
-
- $margin_value->top->_units = $length;
- $margin_value->top->auto = false;
- $margin_value->top->percentage = null;
-
- $margin_value->bottom->_units = $length;
- $margin_value->bottom->auto = false;
- $margin_value->bottom->percentage = null;
-
- /**
- * Note that cellpadding/cellspacing values never use font-size based units
- * ('em' and 'ex'), so we may pass 0 as base_font_size parameter - it
- * will not be used anyway
- */
- $margin_value->units2pt(0);
-
- $box->setCSSProperty(CSS_MARGIN, $margin_value);
- }
- };
-
- // Save colspan and rowspan information
- $box->colspan = max(1,(int)$root->get_attribute('colspan'));
- $box->rowspan = max(1,(int)$root->get_attribute('rowspan'));
-
- // Create content
-
- // 'vertical-align' CSS value is not inherited from the table cells
- $css_state->pushState();
-
- $handler =& CSS::get_handler(CSS_VERTICAL_ALIGN);
- $handler->replace($handler->default_value(),
- $css_state);
-
- $box->create_content($root, $pipeline);
-
- global $g_config;
- if ($g_config['mode'] == "quirks") {
- // QUIRKS MODE:
- // H1-H6 and P elements should have their top/bottom margin suppressed if they occur as the first/last table cell child
- // correspondingly; note that we cannot do it usung CSS rules, as there's no selectors for the last child.
- //
- $child = $root->first_child();
- if ($child) {
- while ($child && $child->node_type() != XML_ELEMENT_NODE) {
- $child = $child->next_sibling();
- };
-
- if ($child) {
- if (array_search(strtolower($child->tagname()), array("h1","h2","h3","h4","h5","h6","p"))) {
- $box->_suppress_first = true;
- }
- };
- };
-
- $child = $root->last_child();
- if ($child) {
- while ($child && $child->node_type() != XML_ELEMENT_NODE) {
- $child = $child->previous_sibling();
- };
-
- if ($child) {
- if (array_search(strtolower($child->tagname()), array("h1","h2","h3","h4","h5","h6","p"))) {
- $box->_suppress_last = true;
- }
- };
- };
- };
-
- // pop the default vertical-align value
- $css_state->popState();
-
- return $box;
- }
-
- function TableCellBox() {
- // Call parent constructor
- $this->GenericContainerBox();
-
- $this->_suppress_first = false;
- $this->_suppress_last = false;
-
- $this->colspan = 1;
- $this->rowspan = 1;
-
- // This value will be overwritten in table 'normalize_parent' method
- //
- $this->column = 0;
- $this->row = 0;
- }
-
- // Inherited from GenericFormattedBox
-
- function get_cell_baseline() {
- $content = $this->get_first_data();
- if (is_null($content)) {
- return 0;
- }
- return $content->baseline;
- }
-
- // Flow-control
- function reflow(&$parent, &$context) {
- GenericFormattedBox::reflow($parent, $context);
-
- global $g_config;
- $size = count($this->content);
- if ($g_config['mode'] == "quirks" && $size > 0) {
- // QUIRKS MODE:
- // H1-H6 and P elements should have their top/bottom margin suppressed if they occur as the first/last table cell child
- // correspondingly; note that we cannot do it usung CSS rules, as there's no selectors for the last child.
- //
-
- $first =& $this->get_first();
- if (!is_null($first) && $this->_suppress_first && $first->isBlockLevel()) {
- $first->margin->top->value = 0;
- $first->margin->top->percentage = null;
- };
-
- $last =& $this->get_last();
- if (!is_null($last) && $this->_suppress_last && $last->isBlockLevel()) {
- $last->margin->bottom->value = 0;
- $last->margin->bottom->percentage = null;
- };
- };
-
- // Determine upper-left _content_ corner position of current box
- $this->put_left($parent->_current_x + $this->get_extra_left());
-
- // NOTE: Table cell margin is used as a cell-spacing value
- $border = $this->getCSSProperty(CSS_BORDER);
- $padding = $this->getCSSProperty(CSS_PADDING);
- $this->put_top($parent->_current_y -
- $border->top->get_width() -
- $padding->top->value);
-
- // CSS 2.1:
- // Floats, absolutely positioned elements, inline-blocks, table-cells, and elements with 'overflow' other than
- // 'visible' establish new block formatting contexts.
- $context->push();
- $context->push_container_uid($this->uid);
-
- // Reflow cell content
- $this->reflow_content($context);
-
- // Extend the table cell height to fit all contained floats
- //
- // Determine the bottom edge corrdinate of the bottommost float
- //
- $float_bottom = $context->float_bottom();
-
- if (!is_null($float_bottom)) {
- $this->extend_height($float_bottom);
- };
-
- // Restore old context
- $context->pop_container_uid();
- $context->pop();
- }
-}
-
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.table.php b/thirdparty/html2ps_pdf/box.table.php
deleted file mode 100644
index 410ff54fd..000000000
--- a/thirdparty/html2ps_pdf/box.table.php
+++ /dev/null
@@ -1,1341 +0,0 @@
-GenericContainerBox();
-
- // List of column width constraints
- $this->cwc = array();
-
- $this->_cached_min_widths = null;
- }
-
- function readCSS(&$state) {
- parent::readCSS($state);
-
- $this->_readCSS($state,
- array(CSS_BORDER_COLLAPSE,
- CSS_TABLE_LAYOUT));
-
- $this->_readCSSLengths($state,
- array(CSS_HTML2PS_CELLPADDING,
- CSS_HTML2PS_CELLSPACING));
- }
-
- function &cell($r, $c) {
- return $this->content[$r]->content[$c];
- }
-
- function rows_count() {
- return count($this->content);
- }
-
- // NOTE: assumes that rows are already normalized!
- function cols_count() {
- return count($this->content[0]->content);
- }
-
- // FIXME: just a stub
- function append_line(&$e) {}
-
- function &create(&$root, &$pipeline) {
- $box =& new TableBox();
- $box->readCSS($pipeline->getCurrentCSSState());
-
- // This row should not inherit any table specific properties!
- // 'overflow' for example
- //
- $css_state =& $pipeline->getCurrentCSSState();
- $css_state->pushDefaultState();
-
- $row =& new TableRowBox($root);
- $row->readCSS($css_state);
-
- $box->add_child($row);
-
- $css_state->popState();
-
- // Setup cellspacing / cellpadding values
- if ($box->getCSSProperty(CSS_BORDER_COLLAPSE) == BORDER_COLLAPSE) {
- $handler =& CSS::get_handler(CSS_PADDING);
- $box->setCSSProperty(CSS_PADDING, $handler->default_value());
- };
-
- // Set text-align to 'left'; all browsers I've ever seen prevent inheriting of
- // 'text-align' property by the tables.
- // Say, in the following example the text inside the table cell will be aligned left,
- // instead of inheriting 'center' value.
- //
- //
- //
- //
TEST
- //
- //
- $handler =& CSS::get_handler(CSS_TEXT_ALIGN);
- $handler->css('left', $pipeline);
-
- // Parse table contents
- $child = $root->first_child();
- $col_index = 0;
- while ($child) {
- if ($child->node_type() === XML_ELEMENT_NODE) {
- if ($child->tagname() === 'colgroup') {
- // COLGROUP tags do not generate boxes; they contain information on the columns
- //
- $col_index = $box->parse_colgroup_tag($child, $col_index);
- } else {
- $child_box =& create_pdf_box($child, $pipeline);
- $box->add_child($child_box);
- };
- };
-
- $child = $child->next_sibling();
- };
-
- $box->normalize($pipeline);
- $box->normalize_cwc();
- $box->normalize_rhc();
- $box->normalize_parent();
-
- return $box;
- }
-
- // Parse the data in COL node;
- // currently only 'width' attribute is parsed
- //
- // @param $root reference to a COL dom node
- // @param $index index of column corresponding to this node
- function parse_col(&$root, $index) {
- if ($root->has_attribute('width')) {
- // The value if 'width' attrubute is "multi-length";
- // it means that it could be:
- // 1. absolute value (10)
- // 2. percentage value (10%)
- // 3. relative value (3* or just *)
- //
-
- // TODO: support for relative values
-
- $value = $root->get_attribute('width');
- if (is_percentage($value)) {
- $this->cwc[$index] = new WCFraction(((int)$value) / 100);
- } else {
- $this->cwc[$index] = new WCConstant(px2pt((int)$value));
- };
- };
- }
-
- // Traverse the COLGROUP node and save the column-specific information
- //
- // @param $root COLGROUP node
- // @param $start_index index of the first column in this column group
- // @return index of column after the last processed
- //
- function parse_colgroup_tag(&$root, $start_index) {
- $index = $start_index;
-
- // COLGROUP may contain zero or more COLs
- //
- $child = $root->first_child();
- while ($child) {
- if ($child->tagname() === 'col') {
- $this->parse_col($child, $index);
- $index ++;
- };
- $child = $child->next_sibling();
- };
-
- return $index;
- }
-
- function normalize_parent() {
- for ($i=0; $icontent); $i++) {
- $this->content[$i]->parent =& $this;
-
- for ($j=0; $jcontent[$i]->content); $j++) {
- $this->content[$i]->content[$j]->parent =& $this;
-
- // Set the column number for the cell to further reference
- $this->content[$i]->content[$j]->column = $j;
-
- // Set the column number for the cell to further reference
- $this->content[$i]->content[$j]->row = $i;
- }
- }
- }
-
- // Normalize row height constraints
- //
- // no return value
- //
- function normalize_rhc() {
- // Initialize the constraint array with the empty constraints
- $this->rhc = array();
- for ($i=0, $size = count($this->content); $i < $size; $i++) {
- $this->rhc[$i] = new HCConstraint(null, null, null);
- };
-
- // Scan all cells
- for ($i=0, $num_rows = count($this->content); $i < $num_rows; $i++) {
- $row =& $this->content[$i];
-
- for ($j=0, $num_cells = count($row->content); $j < $num_cells; $j++) {
- $cell = $row->content[$j];
-
- // Ignore cells with rowspans
- if ($cell->rowspan > 1) { continue; }
-
- // Put current cell width constraint as a columns with constraint
- $this->rhc[$i] = merge_height_constraint($this->rhc[$i], $cell->get_height_constraint());
-
- // Now reset the cell width constraint; cell width should be affected by ceolumn constraint only
- $hc = new HCConstraint(null, null, null);
- $cell->put_height_constraint($hc);
- };
- };
- }
-
- // Normalize column width constraints
- // Note that cwc array may be partially prefilled by a GOLGROUP/COL-generated constraints!
- //
- function normalize_cwc() {
- // Note we've called 'normalize' method prior to 'normalize_cwc',
- // so we already have all rows of equal length
- //
- for ($i=0, $num_cols = count($this->content[0]->content); $i < $num_cols; $i++) {
- // Check if there's already COL-generated constraint for this column
- //
- if (!isset($this->cwc[$i])) {
- $this->cwc[$i] = new WCNone;
- };
- }
-
- // For each column (we should have table already normalized - so lengths of all rows are equal)
- for ($i=0, $num_cols = count($this->content[0]->content); $i < $num_cols; $i++) {
-
- // For each row
- for ($j=0, $num_rows = count($this->content); $j < $num_rows; $j++) {
- $cell =& $this->content[$j]->content[$i];
-
- // Ignore cells with colspans
- if ($cell->colspan > 1) { continue; }
-
- // Put current cell width constraint as a columns with constraint
- $this->cwc[$i] = merge_width_constraint($this->cwc[$i], $cell->getCSSProperty(CSS_WIDTH));
-
- // Now reset the cell width constraint; cell width should be affected by ceolumn constraint only
- $cell->setCSSProperty(CSS_WIDTH, new WCNone);
- }
- }
-
- // Now fix the overconstrained columns; first of all, sum of all percentage-constrained
- // columns should be less or equal than 100%. If sum is greater, the last column
- // percentage is reduced in order to get 100% as a result.
- $rest = 1;
- for ($i=0, $num_cols = count($this->content[0]->content); $i < $num_cols; $i++) {
- // Get current CWC
- $wc =& $this->cwc[$i];
-
- if ($wc->isFraction()) {
- $wc->fraction = min($rest, $wc->fraction);
- $rest -= $wc->fraction;
- };
- };
-
- /**
- * Now, let's process cells spanninig several columns.
- */
-
- /**
- * Let's check if there's any colspanning cells filling the whole table width and
- * containing non-100% percentage constraint
- */
-
- // For each row
- for ($j=0; $jcontent); $j++) {
- /**
- * Check if the first cell in this row satisfies the above condition
- */
-
- $cell =& $this->content[$j]->content[0];
-
- /**
- * Note that there should be '>='; '==' is not enough, as sometimes cell is declared to span
- * more columns than there are in the table
- */
- $cell_wc = $cell->getCSSProperty(CSS_WIDTH);
- if (!$cell->is_fake() &&
- $cell_wc->isFraction() &&
- $cell->colspan >= count($this->content[$j])) {
-
- /**
- * Clear the constraint; anyway, it should be replaced with 100% in this case, as
- * this cell is the only cell in the row
- */
-
- $wc = new WCNone;
- $cell->setCSSProperty(CSS_WIDTH, $wc);
- };
- };
- }
-
- /**
- * Normalize table by adding fake cells for colspans and rowspans
- * Also, if there is any empty rows (without cells), add at least one fake cell
- */
- function normalize(&$pipeline) {
- /**
- * Fix empty rows by adding a fake cell
- */
- for ($i=0; $icontent); $i++) {
- $row =& $this->content[$i];
- if (count($row->content) == 0) {
- $this->content[$i]->add_fake_cell_before(0, $pipeline);
- };
- };
-
- /**
- * first, normalize colspans
- */
- for ($i=0; $icontent); $i++) {
- $this->content[$i]->normalize($pipeline);
- };
-
- /**
- * second, normalize rowspans
- *
- * We should scan table column-by-column searching for row-spanned cells;
- * consider the following example:
- *
- *
- *
- *
A1
- *
B1
- *
C1
- *
- *
- *
- *
A2
- *
C2
- *
- *
- *
- *
C3
- *
- *
- */
-
- $i_col = 0;
- do {
- $flag = false;
- for ($i_row=0; $i_rowcontent); $i_row++) {
- $row =& $this->content[$i_row];
- if ($i_col < count($row->content)) {
- $flag = true;
-
- // Check if this rowspan runs off the last row
- $row->content[$i_col]->rowspan = min($row->content[$i_col]->rowspan,
- count($this->content) - $i_row);
-
- if ($row->content[$i_col]->rowspan > 1) {
-
- // Note that min($i_row + $row->content[$i_col]->rowspan, count($this->content)) is
- // required, as we cannot be sure that table actually contains the number
- // of rows used in rowspan
- //
- for ($k=$i_row+1; $kcontent[$i_col]->rowspan, count($this->content)); $k++) {
-
- // Note that if rowspanned cell have a colspan, we should insert SEVERAL fake cells!
- //
- for ($cs = 0; $cs < $row->content[$i_col]->colspan; $cs++) {
- $this->content[$k]->add_fake_cell_before($i_col, $pipeline);
- };
- };
- };
- };
- };
-
- $i_col ++;
- } while ($flag);
-
- // third, make all rows equal in length by padding with fake-cells
- $length = 0;
- for ($i=0; $icontent); $i++) {
- $length = max($length, count($this->content[$i]->content));
- }
- for ($i=0; $icontent); $i++) {
- $row =& $this->content[$i];
- while ($length > count($row->content)) {
- $row->append_fake_cell($pipeline);
- }
- }
- }
-
- // Overrides default 'add_child' in GenericFormattedBox
- function add_child(&$item) {
- // Check if we're trying to add table cell to current table directly, without any table-rows
- if ($item->isCell()) {
- // Add cell to the last row
- $last_row =& $this->content[count($this->content)-1];
- $last_row->add_child($item);
-
- } elseif ($item->isTableRow()) {
- // If previous row is empty, remove it (get rid of automatically generated table row in constructor)
- if (count($this->content) > 0) {
- if (count($this->content[count($this->content)-1]->content) == 0) {
- array_pop($this->content);
- }
- };
-
- // Just add passed row
- $this->content[] =& $item;
- } elseif ($item->isTableSection()) {
- // Add table section rows to current table, then drop section box
- for ($i=0, $size = count($item->content); $i < $size; $i++) {
- $this->add_child($item->content[$i]);
- }
- };
- }
-
- // Table-specific functions
-
- // PREDICATES
- function is_constrained_column($index) {
- return !is_a($this->get_cwc($index),"wcnone");
- }
-
- // ROWSPANS
- function table_have_rowspan($x,$y) {
- return $this->content[$y]->content[$x]->rowspan;
- }
-
- function table_fit_rowspans($heights) {
- $spans = $this->get_rowspans();
-
- // Scan all cells spanning several rows
- foreach ($spans as $span) {
- $cell =& $this->content[$span->row]->content[$span->column];
-
- // now check if cell height is less than sum of spanned rows heights
- $row_heights = array_slice($heights, $span->row, $span->size);
-
- // Vertical-align current cell
- // calculate (approximate) row baseline
- $baseline = $this->content[$span->row]->get_row_baseline();
-
- // apply vertical-align
- $vertical_align = $cell->getCSSProperty(CSS_VERTICAL_ALIGN);
-
- $va_fun = CSSVerticalAlign::value2pdf($vertical_align);
- $va_fun->apply_cell($cell, array_sum($row_heights), $baseline);
-
- if (array_sum($row_heights) > $cell->get_full_height()) {
- // Make cell fill all available vertical space
- $cell->put_full_height(array_sum($row_heights));
- };
- }
- }
-
- function get_rowspans() {
- $spans = array();
-
- for ($i=0; $icontent); $i++) {
- $spans = array_merge($spans, $this->content[$i]->get_rowspans($i));
- };
-
- return $spans;
- }
-
- // ROW-RELATED
-
- /**
- * Calculate set of row heights
- *
- * At the moment (*), we have a sum of total content heights of percentage constraned rows in
- * $ch variable, and a "free" (e.g. table height - sum of all non-percentage constrained heights) height
- * in the $h variable. Obviously, percentage-constrained rows should be expanded to fill the free space
- *
- * On the other size, there should be a maximal value to expand them to; for example, if sum of
- * percentage constraints is 33%, then all these rows should fill only 1/3 of the table height,
- * whatever the content height of other rows is. In this case, other (non-constrained) rows
- * should be expanded to fill space left.
- *
- * In the latter case, if there's no non-constrained rows, the additional space should be filled by
- * "plain" rows without any constraints
- *
- * @param $minheight the minimal allowed height of the row; as we'll need to expand rows later
- * and rows containing totally empty cells will have zero height
- * @return array of row heights in media points
- */
- function _row_heights($minheight) {
- $heights = array();
- $cheights = array();
- $height = $this->get_height();
-
- // Calculate "content" and "constrained" heights of table rows
-
- for ($i=0; $icontent); $i++) {
- $heights[] = max($minheight, $this->content[$i]->row_height());
-
- // Apply row height constraint
- // we need to specify box which parent will serve as a base for height calculation;
-
- $hc = $this->get_rhc($i);
- $cheights[] = $hc->apply($heights[$i], $this->content[$i], null);
- };
-
- // Collapse "constrained" heights of percentage-constrained rows, if they're
- // taking more that available space
-
- $flags = $this->get_non_percentage_constrained_height_flags();
- $h = $height;
- $ch = 0;
- for ($i=0; $i 0) {
- $scale = $h / $ch;
-
- if ($scale < 1) {
- for ($i=0; $iget_non_constrained_height_flags();
- $h = $height;
- $ch = 0;
- for ($i=0; $i 0) {
- $scale = $h / $ch;
-
- if ($scale < 1) {
- for ($i=0; $iget_non_percentage_constrained_height_flags();
- $h = $height;
- $ch = 0;
- for ($i=0; $i 0) {
- $scale = $h / $ch;
-
- if ($scale < 1) {
- for ($i=0; $iget_top();
-
- $size = count($heights);
- for ($i=0; $i<$size; $i++) {
- $this->content[$i]->table_resize_row($heights[$i], $row_top);
- $row_top -= $heights[$i];
- }
-
- // Set table height to sum of row heights
- $this->put_height(array_sum($heights));
- }
-
- // // Calculate given table row height
- // //
- // // @param $index zero-based row index
- // // @return value of row height (in media points)
- // //
- // function table_row_height($index) {
- // // Select row
- // $row =& $this->content[$index];
-
- // // Calculate height of each cell contained in this row
- // $height = 0;
- // for ($i=0; $icontent); $i++) {
- // if ($this->table_have_rowspan($i, $index) <= 1) {
- // $height = max($height, $row->content[$i]->get_full_height());
- // }
- // }
-
- // return $height;
- // }
-
- // function get_row_baseline($index) {
- // // Get current row
- // $row =& $this->content[$index];
- // // Calculate maximal baseline for each cell contained
- // $baseline = 0;
- // for ($i = 0; $i < count($row->content); $i++) {
- // // Cell baseline is the baseline of its first line box inside this cell
- // if (count($row->content[$i]->content) > 0) {
- // $baseline = max($baseline, $row->content[$i]->content[0]->baseline);
- // };
- // };
- // return $baseline;
- // }
-
- // Width constraints
- function get_cwc($col) {
- return $this->cwc[$col];
- }
-
- // Get height constraint for the given row
- //
- // @param $row number of row (zero-based)
- //
- // @return HCConstraint object
- //
- function get_rhc($row) {
- return $this->rhc[$row];
- }
-
- // Width calculation
- //
- // Note that if table have no width constraint AND some columns are percentage constrained,
- // then the width of the table can be determined based on the minimal column width;
- // e.g. if some column have minimal width of 10px and 10% width constraint,
- // then table will have minimal width of 100px. If there's several percentage-constrained columns,
- // then we choose from the generated values the maximal one
- //
- // Of course, all of the above can be applied ONLY to table without width constraint;
- // of theres any w.c. applied to the table, it will have greater than column constraints
- //
- // We must take constrained table width into account; if there's a width constraint,
- // then we must choose the maximal value between the constrained width and sum of minimal
- // columns widths - so, expanding the constrained width in case it is not enough to fit
- // the table contents
- //
- // @param $context referene to a flow context object
- // @return minimal box width (including the padding/margin/border width! NOT content width)
- //
- function get_min_width(&$context) {
- $widths = $this->get_table_columns_min_widths($context);
- $maxw = $this->get_table_columns_max_widths($context);
-
- // Expand some columns to fit colspanning cells
- $widths = $this->_table_apply_colspans($widths, $context, 'get_min_width', $widths, $maxw);
-
- $width = array_sum($widths);
- $base_width = $width;
-
- $wc = $this->getCSSProperty(CSS_WIDTH);
- if (!$wc->isNull()) {
- // Check if constrained table width should be expanded to fit the table contents
- //
- $width = max($width, $wc->apply(0, $this->parent->get_available_width($context)));
- } else {
- // Now check if there's any percentage column width constraints (note that
- // if we've get here, than the table width is not constrained). Calculate
- // the table width basing on these values and select the maximal value
- //
- for ($i=0; $i<$this->cols_count(); $i++) {
- $cwc = $this->get_cwc($i);
-
- $width = max($width,
- min($cwc->apply_inverse($widths[$i], $base_width),
- $this->parent->get_available_width($context) - $this->_get_hor_extra()));
- };
- };
-
- return $width + $this->_get_hor_extra();
- }
-
- function get_min_width_natural(&$context) {
- return $this->get_min_width($context);
- }
-
- function get_max_width(&$context) {
- $wc = $this->getCSSProperty(CSS_WIDTH);
-
- if ($wc->isConstant()) {
- return $wc->apply(0, $this->parent->get_available_width($context));
- } else {
- $widths = $this->get_table_columns_max_widths($context);
- $minwc = $this->get_table_columns_min_widths($context);
-
- $widths = $this->_table_apply_colspans($widths, $context, 'get_max_width', $minwc, $widths);
-
- $width = array_sum($widths);
- $base_width = $width;
-
- // Now check if there's any percentage column width constraints (note that
- // if we've get here, than the table width is not constrained). Calculate
- // the table width based on these values and select the maximal value
- //
- for ($i=0; $i<$this->cols_count(); $i++) {
- $cwc = $this->get_cwc($i);
-
- $width = max($width,
- min($cwc->apply_inverse($widths[$i], $base_width),
- $this->parent->get_available_width($context) - $this->_get_hor_extra()));
- };
-
- return $width + $this->_get_hor_extra();
- }
- }
-
- function get_max_width_natural(&$context) {
- return $this->get_max_width($context);
- }
-
- function get_width() {
- $wc = $this->getCSSProperty(CSS_WIDTH);
- $pwc = $this->parent->getCSSProperty(CSS_WIDTH);
-
- if (!$this->parent->isCell() ||
- !$pwc->isNull() ||
- !$wc->isFraction()) {
- $width = $wc->apply($this->width, $this->parent->width);
- } else {
- $width = $this->width;
- };
-
- // Note that table 'padding' property for is handled differently
- // by different browsers; for example, IE 6 ignores it completely,
- // while FF 1.5 subtracts horizontal padding value from constrained
- // table width. We emulate FF behavior here
- return $width -
- $this->get_padding_left() -
- $this->get_padding_right();
- }
-
- function table_column_widths(&$context) {
- $table_layout = $this->getCSSProperty(CSS_TABLE_LAYOUT);
- switch ($table_layout) {
- case TABLE_LAYOUT_FIXED:
-// require_once(HTML2PS_DIR.'strategy.table.layout.fixed.php');
-// $strategy =& new StrategyTableLayoutFixed();
-// break;
- case TABLE_LAYOUT_AUTO:
- default:
- require_once(HTML2PS_DIR.'strategy.table.layout.auto.php');
- $strategy =& new StrategyTableLayoutAuto();
- break;
- };
-
- return $strategy->apply($this, $context);
- }
-
- // Extend some columns widths (if needed) to fit colspanned cell contents
- //
- function _table_apply_colspans($widths, &$context, $width_fun, $minwc, $maxwc) {
- $colspans = $this->get_colspans();
-
- foreach ($colspans as $colspan) {
- $cell = $this->content[$colspan->row]->content[$colspan->column];
-
- // apply colspans to the corresponsing colspanned-cell dimension
- //
- $cell_width = $cell->$width_fun($context);
-
- // Apply cell constraint width, if any AND if table width is constrained
- // if table width is not constrained, we should not do this, as current value
- // of $table->get_width is maximal width (parent width), not the actual
- // width of the table
- $wc = $this->getCSSProperty(CSS_WIDTH);
- if (!$wc->isNull()) {
- $cell_wc = $cell->getCSSProperty(CSS_WIDTH);
- $cell_width = $cell_wc->apply($cell_width, $this->get_width());
-
- // On the other side, constrained with cannot be less than cell minimal width
- $cell_width = max($cell_width, $cell->get_min_width($context));
- };
-
- // now select the pre-calculated widths of columns covered by this cell
- // select the list of resizable columns covered by this cell
- $spanned_widths = array();
- $spanned_resizable = array();
-
- for ($i=$colspan->column; $i < $colspan->column+$colspan->size; $i++) {
- $spanned_widths[] = $widths[$i];
- $spanned_resizable[] = ($minwc[$i] != $maxwc[$i]);
- }
-
- // Sometimes we may encounter the colspan over the empty columns (I mean ALL columns are empty); in this case
- // we need to make these columns reizable in order to fit colspanned cell contents
- //
- if (array_sum($spanned_widths) == 0) {
- for ($i=0; $icolumn, $colspan->size, $spanned_widths);
- };
-
- return $widths;
- }
-
- function get_table_columns_max_widths(&$context) {
- $widths = array();
-
- for ($i=0; $icontent[0]->content); $i++) {
- $widths[] = 0;
- };
-
- for ($i=0; $icontent); $i++) {
- // Calculate column widths for a current row
- $roww = $this->content[$i]->get_table_columns_max_widths($context);
- for ($j=0; $jget_cwc($i);
-
- // Newertheless, percentage constraints should not be applied IF table
- // does not have constrained width
- //
- if (!is_a($cwc,"wcfraction")) {
- $widths[$i] = $cwc->apply($widths[$i], $this->get_width());
- };
- }
-
- // TODO: colspans
-
- return $widths;
- }
-
- /**
- * Optimization: calculated widths are cached
- */
- function get_table_columns_min_widths(&$context) {
- if (!is_null($this->_cached_min_widths)) {
- return $this->_cached_min_widths;
- };
-
- $widths = array();
-
- for ($i=0; $icontent[0]->content); $i++) {
- $widths[] = 0;
- };
-
- $content_size = count($this->content);
- for ($i=0; $i<$content_size; $i++) {
- // Calculate column widths for a current row
- $roww = $this->content[$i]->get_table_columns_min_widths($context);
-
- $row_size = count($roww);
- for ($j=0; $j<$row_size; $j++) {
- $widths[$j] = max($roww[$j], $widths[$j]);
- }
- }
-
- $this->_cached_min_widths = $widths;
- return $widths;
- }
-
- function get_colspans() {
- $colspans = array();
-
- for ($i=0; $icontent); $i++) {
- $colspans = array_merge($colspans, $this->content[$i]->get_colspans($i));
- };
-
- return $colspans;
- }
-
- function check_constrained_colspan($col) {
- for ($i=0; $i<$this->rows_count(); $i++) {
- $cell =& $this->cell($i, $col);
- $cell_wc = $cell->getCSSProperty(CSS_WIDTH);
-
- if ($cell->colspan > 1 &&
- !$cell_wc->isNull()) {
- return true;
- };
- };
- return false;
- }
-
- // Tries to change minimal constrained width so that columns will fit into the given
- // table width
- //
- // Note that every width constraint have its own priority; first, the unconstrained columns are collapsed,
- // then - percentage constrained and after all - columns having fixed width
- //
- // @param $width table width
- // @param $minw array of unconstrained minimal widths
- // @param $minwc array of constrained minimal widths
- // @return list of normalized minimal constrained widths
- //
- function normalize_min_widths($width, $minw, $minwc) {
- // Check if sum of constrained widths is too big
- // Note that we compare sum of constrained width with the MAXIMAL value of table width and
- // sum of uncostrained minimal width; it will prevent from unneeded collapsing of table cells
- // if table content will expand its width anyway
- //
- $twidth = max($width, array_sum($minw));
-
- // compare with sum of minimal constrained widths
- //
- if (array_sum($minwc) > $twidth) {
- $delta = array_sum($minwc) - $twidth;
-
- // Calculate the amount of difference between minimal and constrained minimal width for each columns
- $diff = array();
- for ($i=0; $icheck_constrained_colspan($i)) {
- $diff[$i] = $minwc[$i] - $minw[$i];
- } else {
- $diff[$i] = 0;
- };
- }
-
- // If no difference is found, we can collapse no columns
- // otherwise scale some columns...
- $cwdelta = array_sum($diff);
-
- if ($cwdelta > 0) {
- for ($i=0; $icontent[$y]->content[$x]->colspan;
- }
-
- // Flow-control
- function reflow(&$parent, &$context) {
- if ($this->getCSSProperty(CSS_FLOAT) === FLOAT_NONE) {
- $status = $this->reflow_static_normal($parent, $context);
- } else {
- $status = $this->reflow_static_float($parent, $context);
- }
-
- return $status;
- }
-
- function reflow_absolute(&$context) {
- GenericFormattedBox::reflow($parent, $context);
-
- // Calculate margin values if they have been set as a percentage
- $this->_calc_percentage_margins($parent);
-
- // Calculate width value if it had been set as a percentage
- $this->_calc_percentage_width($parent, $context);
-
- $wc = $this->getCSSProperty(CSS_WIDTH);
- if (!$wc->isNull()) {
- $col_width = $this->get_table_columns_min_widths($context);
- $maxw = $this->get_table_columns_max_widths($context);
- $col_width = $this->_table_apply_colspans($col_width, $context, 'get_min_width', $col_width, $maxw);
-
- if (array_sum($col_width) > $this->get_width()) {
- $wc = new WCConstant(array_sum($col_width));
- };
- };
-
- $position_strategy =& new StrategyPositionAbsolute();
- $position_strategy->apply($this);
-
- $this->reflow_content($context);
- }
-
- /**
- * TODO: unlike block elements, table unconstrained width is determined
- * with its content, so it may be smaller than parent available width!
- */
- function reflow_static_normal(&$parent, &$context) {
- GenericFormattedBox::reflow($parent, $context);
-
- // Calculate margin values if they have been set as a percentage
- $this->_calc_percentage_margins($parent);
-
- // Calculate width value if it had been set as a percentage
- $this->_calc_percentage_width($parent, $context);
-
- $wc = $this->getCSSProperty(CSS_WIDTH);
- if (!$wc->isNull()) {
- $col_width = $this->get_table_columns_min_widths($context);
- $maxw = $this->get_table_columns_max_widths($context);
- $col_width = $this->_table_apply_colspans($col_width, $context, 'get_min_width', $col_width, $maxw);
-
- if (array_sum($col_width) > $this->get_width()) {
- $wc = new WCConstant(array_sum($col_width));
- };
- };
-
- // As table width can be deterimined by its contents, we may calculate auto values
- // only AFTER the contents have been reflown; thus, we'll offset the table
- // as a whole by a value of left margin AFTER the content reflow
-
- // Do margin collapsing
- $y = $this->collapse_margin($parent, $context);
-
- // At this moment we have top parent/child collapsed margin at the top of context object
- // margin stack
-
- $y = $this->apply_clear($y, $context);
-
- // Store calculated Y coordinate as current Y in the parent box
- $parent->_current_y = $y;
-
- // Terminate current parent line-box
- $parent->close_line($context);
-
- // And add current box to the parent's line-box (alone)
- $parent->append_line($this);
-
- // Determine upper-left _content_ corner position of current box
- // Also see note above regarding margins
- $border = $this->getCSSProperty(CSS_BORDER);
- $padding = $this->getCSSProperty(CSS_PADDING);
-
- $this->put_left($parent->_current_x +
- $border->left->get_width() +
- $padding->left->value);
-
- // Note that top margin already used above during maring collapsing
- $this->put_top($parent->_current_y - $border->top->get_width() - $padding->top->value);
-
- /**
- * By default, child block box will fill all available parent width;
- * note that actual width will be smaller because of non-zero padding, border and margins
- */
- $this->put_full_width($parent->get_available_width($context));
-
- // Reflow contents
- $this->reflow_content($context);
-
- // Update the collapsed margin value with current box bottom margin
- $margin = $this->getCSSProperty(CSS_MARGIN);
-
- $context->pop_collapsed_margin();
- $context->pop_collapsed_margin();
- $context->push_collapsed_margin($margin->bottom->value);
-
- // Calculate margins and/or width is 'auto' values have been specified
- $this->_calc_auto_width_margins($parent);
- $this->offset($margin->left->value, 0);
-
- // Extend parent's height to fit current box
- $parent->extend_height($this->get_bottom_margin());
- // Terminate parent's line box
- $parent->close_line($context);
- }
-
- // Get a list of boolean values indicating if table rows are height constrained
- //
- // @return array containing 'true' value at index I if I-th row is not height-constrained
- // and 'false' otherwise
- //
- function get_non_constrained_flags() {
- $flags = array();
-
- for ($i=0; $icontent); $i++) {
- $hc = $this->get_rhc($i);
- $flags[$i] =
- (is_null($hc->constant)) &&
- (is_null($hc->min)) &&
- (is_null($hc->max));
- };
-
- return $flags;
- }
-
- // Get a list of boolean values indicating if table rows are height constrained using percentage values
- //
- // @return array containing 'true' value at index I if I-th row is not height-constrained
- // and 'false' otherwise
- //
- function get_non_percentage_constrained_height_flags() {
- $flags = array();
-
- for ($i=0; $icontent); $i++) {
- $hc = $this->get_rhc($i);
- $flags[$i] =
- (!is_null($hc->constant) ? !$hc->constant[1] : true) &&
- (!is_null($hc->min) ? !$hc->min[1] : true) &&
- (!is_null($hc->max) ? !$hc->max[1] : true);
- };
-
- return $flags;
- }
-
- function get_non_constrained_height_flags() {
- $flags = array();
-
- for ($i=0; $icontent); $i++) {
- $hc = $this->get_rhc($i);
-
- $flags[$i] = $hc->is_null();
- };
-
- return $flags;
- }
-
- // Get a list of boolean values indicating if table columns are height constrained
- //
- // @return array containing 'true' value at index I if I-th columns is not width-constrained
- // and 'false' otherwise
- //
- function get_non_constrained_width_flags() {
- $flags = array();
-
- for ($i=0; $i<$this->cols_count(); $i++) {
- $wc = $this->get_cwc($i);
- $flags[$i] = is_a($wc,"wcnone");
- };
-
- return $flags;
- }
-
- function get_non_constant_constrained_width_flags() {
- $flags = array();
-
- for ($i=0; $i<$this->cols_count(); $i++) {
- $wc = $this->get_cwc($i);
- $flags[$i] = !is_a($wc,"WCConstant");
- };
-
- return $flags;
- }
-
- function check_if_column_image_constrained($col) {
- for ($i=0; $i<$this->rows_count(); $i++) {
- $cell =& $this->cell($i, $col);
- for ($j=0; $jcontent); $j++) {
- if (!$cell->content[$j]->is_null() &&
- !is_a($cell->content[$j], "GenericImgBox")) {
- return false;
- };
- };
- };
- return true;
- }
-
- function get_non_image_constrained_width_flags() {
- $flags = array();
-
- for ($i=0; $i<$this->cols_count(); $i++) {
- $flags[$i] = !$this->check_if_column_image_constrained($i);
- };
-
- return $flags;
- }
-
- // Get a list of boolean values indicating if table rows are NOT constant constrained
- //
- // @return array containing 'true' value at index I if I-th row is height-constrained
- // and 'false' otherwise
- //
- function get_non_constant_constrained_flags() {
- $flags = array();
-
- for ($i=0; $icontent); $i++) {
- $hc = $this->get_rhc($i);
- $flags[$i] = is_null($hc->constant);
- };
-
- return $flags;
- }
-
- function reflow_content(&$context) {
- // Reflow content
-
- // Reset current Y value
- //
- $this->_current_y = $this->get_top();
-
- // Determine the base table width
- // if width constraint exists, the actual table width will not be changed anyway
- //
- $this->put_width(min($this->get_max_width($context), $this->get_width()));
-
- // Calculate widths of table columns
- $columns = $this->table_column_widths($context);
-
- // Collapse table to minimum width (if width is not constrained)
- $real_width = array_sum($columns);
- $this->put_width($real_width);
-
- // If width is constrained, and is less than calculated, update the width constraint
- //
- // if ($this->get_width() < $real_width) {
- // // $this->put_width_constraint(new WCConstant($real_width));
- // };
-
- // Flow cells horizontally in each table row
- for ($i=0; $icontent); $i++) {
- // Row flow started
- // Reset current X coordinate to the far left of the table
- $this->_current_x = $this->get_left();
-
- // Flow each cell in the row
- $span = 0;
- for ($j=0; $jcontent[$i]->content); $j++) {
- // Skip cells covered by colspans (fake cells, anyway)
- if ($span == 0) {
- // Flow current cell
- // Any colspans here?
- $span = $this->table_have_colspan($j, $i);
-
- // Get sum of width for the current cell (or several cells in colspan)
- // In most cases, $span == 1 here (just a single cell)
- $cw = array_sum(array_slice($columns, $j, $span));
-
- // store calculated width of the current cell
- $cell =& $this->content[$i]->content[$j];
- $cell->put_full_width($cw);
- $cell->setCSSProperty(CSS_WIDTH,
- new WCConstant($cw -
- $cell->_get_hor_extra()));
-
- // TODO: check for rowspans
-
- // Flow cell
- $this->content[$i]->content[$j]->reflow($this, $context);
-
- // Offset current X value by the cell width
- $this->_current_x += $cw;
- };
-
- // Current cell have been processed or skipped
- $span = max(0, $span-1);
- }
-
- // calculate row height and do vertical align
- // $this->table_fit_row($i);
-
- // row height calculation offset current Y coordinate by the row height calculated
- // $this->_current_y -= $this->table_row_height($i);
- $this->_current_y -= $this->content[$i]->row_height();
- }
-
- // Calculate (and possibly adjust height of table rows)
- $heights = $this->_row_heights(0.1);
-
- // adjust row heights to fit cells spanning several rows
- foreach ($this->get_rowspans() as $rowspan) {
- // Get height of the cell
- $cell_height = $this->content[$rowspan->row]->content[$rowspan->column]->get_full_height();
-
- // Get calculated height of the spanned-over rows
- $cell_row_heights = array_slice($heights, $rowspan->row, $rowspan->size);
-
- // Get list of non-constrained columns
- $flags = array_slice($this->get_non_constrained_flags(), $rowspan->row, $rowspan->size);
-
- // Expand row heights (only for non-constrained columns)
- $new_heights = expand_to_with_flags($cell_height,
- $cell_row_heights,
- $flags);
-
- // Check if rows could not be expanded
- // if (array_sum($new_heights) < $cell_height-1) {
- if (array_sum($new_heights) < $cell_height - EPSILON) {
- // Get list of non-constant-constrained columns
- $flags = array_slice($this->get_non_constant_constrained_flags(), $rowspan->row, $rowspan->size);
-
- // use non-constant-constrained rows
- $new_heights = expand_to_with_flags($cell_height,
- $cell_row_heights,
- $flags);
- };
-
- // Update the rows heights
- array_splice($heights,
- $rowspan->row,
- $rowspan->size,
- $new_heights);
- }
-
- // Now expand rows to full table height
- $table_height = max($this->get_height(), array_sum($heights));
-
- // Get list of non-constrained columns
- $flags = $this->get_non_constrained_height_flags();
-
- // Expand row heights (only for non-constrained columns)
- $heights = expand_to_with_flags($table_height,
- $heights,
- $flags);
-
- // Check if rows could not be expanded
- if (array_sum($heights) < $table_height - EPSILON) {
- // Get list of non-constant-constrained columns
- $flags = $this->get_non_constant_constrained_flags();
-
- // use non-constant-constrained rows
- $heights = expand_to_with_flags($table_height,
- $heights,
- $flags);
- };
-
- // Now we calculated row heights, time to actually resize them
- $this->table_resize_rows($heights);
-
- // Update size of cells spanning several rows
- $this->table_fit_rowspans($heights);
- }
-
- function isBlockLevel() {
- return true;
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.table.row.php b/thirdparty/html2ps_pdf/box.table.row.php
deleted file mode 100644
index 80e1f2774..000000000
--- a/thirdparty/html2ps_pdf/box.table.row.php
+++ /dev/null
@@ -1,220 +0,0 @@
-readCSS($pipeline->getCurrentCSSState());
-
- $child = $root->first_child();
- while ($child) {
- $child_box =& create_pdf_box($child, $pipeline);
- $box->add_child($child_box);
-
- $child = $child->next_sibling();
- };
-
- return $box;
- }
-
- function add_child(&$item) {
- if ($item->isCell()) {
- GenericContainerBox::add_child($item);
- };
- }
-
- function TableRowBox() {
- // Call parent constructor
- $this->GenericContainerBox();
- }
-
- // Normalize colspans by adding fake cells after the "colspanned" cell
- // Say, if we've got the following row:
- //
1
2
- // we should get row containing four cells after normalization;
- // first contains "1"
- // second and third are completely empty
- // fourth contains "2"
- function normalize(&$pipeline) {
- for ($i=0, $size = count($this->content); $i < $size; $i++) {
- for ($j=1; $j<$this->content[$i]->colspan; $j++) {
- $this->add_fake_cell_after($i, $pipeline);
- // Note that add_fake_cell_after will increase the length of current row by one cell,
- // so we must increase $size variable
- $size++;
- };
- };
- }
-
- function add_fake_cell_after($index, &$pipeline) {
- array_splice($this->content, $index+1, 0, array(FakeTableCellBox::create($pipeline)));
- }
-
- function add_fake_cell_before($index, &$pipeline) {
- array_splice($this->content, $index, 0, array(FakeTableCellBox::create($pipeline)));
- }
-
- function append_fake_cell(&$pipeline) {
- $this->content[] = FakeTableCellBox::create($pipeline);
- }
-
- // Table specific
-
- function table_resize_row($height, $top) {
- // Do cell vertical-align
- // Calculate row baseline
-
- $baseline = $this->get_row_baseline();
-
- // Process cells contained in current row
- for ($i=0, $size = count($this->content); $i<$size; $i++) {
- $cell =& $this->content[$i];
-
- // Offset cell if needed
- $cell->offset(0,
- $top -
- $cell->get_top_margin());
-
- // Vertical-align cell (do not apply to rowspans)
- if ($cell->rowspan == 1) {
- $va = $cell->getCSSProperty(CSS_VERTICAL_ALIGN);
- $va_fun = CSSVerticalAlign::value2pdf($va);
- $va_fun->apply_cell($cell, $height, $baseline);
-
- // Expand cell to full row height
- $cell->put_full_height($height);
- }
- }
- }
-
- function get_row_baseline() {
- $baseline = 0;
- for ($i=0, $size = count($this->content); $i<$size; $i++) {
- $cell = $this->content[$i];
- if ($cell->rowspan == 1) {
- $baseline = max($baseline, $cell->get_cell_baseline());
- };
- }
- return $baseline;
- }
-
- function get_colspans($row_index) {
- $colspans = array();
-
- for ($i=0, $size = count($this->content); $i<$size; $i++) {
- // Check if current colspan will run off the right table edge
- if ($this->content[$i]->colspan > 1) {
- $colspan = new CellSpan;
- $colspan->row = $row_index;
- $colspan->column = $i;
- $colspan->size = $this->content[$i]->colspan;
-
- $colspans[] = $colspan;
- }
- }
-
- return $colspans;
- }
-
- function get_rowspans($row_index) {
- $spans = array();
-
- for ($i=0; $icontent); $i++) {
- if ($this->content[$i]->rowspan > 1) {
- $rowspan = new CellSpan;
- $rowspan->row = $row_index;
- $rowspan->column = $i;
- $rowspan->size = $this->content[$i]->rowspan;
- $spans[] = $rowspan;
- }
- }
-
- return $spans;
- }
-
- // Column widths
- function get_table_columns_max_widths(&$context) {
- $widths = array();
- for ($i=0; $icontent); $i++) {
- // For now, colspans are treated as zero-width; they affect
- // column widths only in parent *_fit function
- if ($this->content[$i]->colspan > 1) {
- $widths[] = 0;
- } else {
- $widths[] = $this->content[$i]->get_max_width($context);
- }
- }
-
- return $widths;
- }
-
- function get_table_columns_min_widths(&$context) {
- $widths = array();
- for ($i=0; $icontent); $i++) {
- // For now, colspans are treated as zero-width; they affect
- // column widths only in parent *_fit function
- if ($this->content[$i]->colspan > 1) {
- $widths[] = 0;
- } else {
- $widths[] = $this->content[$i]->get_min_width($context);
- };
- }
-
- return $widths;
- }
-
- function row_height() {
- // Calculate height of each cell contained in this row
- $height = 0;
- for ($i=0; $icontent); $i++) {
- if ($this->content[$i]->rowspan <= 1) {
- $height = max($height, $this->content[$i]->get_full_height());
- }
- }
-
- return $height;
- }
-
- /**
- * Note that we SHOULD owerride the show method inherited from GenericContainerBox,
- * as it MAY draw row background in case it was set via CSS rules. As row box
- * is a "fake" box and will never have reasonable size and/or position in the layout,
- * we should prevent this
- */
- function show(&$viewport) {
- // draw content
- $size = count($this->content);
-
- for ($i=0; $i < $size; $i++) {
- /**
- * We'll check the visibility property here
- * Reason: all boxes (except the top-level one) are contained in some other box,
- * so every box will pass this check. The alternative is to add this check into every
- * box class show member.
- *
- * The only exception of absolute positioned block boxes which are drawn separately;
- * their show method is called explicitly; the similar check should be performed there
- */
-
- $cell =& $this->content[$i];
- $visibility = $cell->getCSSProperty(CSS_VISIBILITY);
-
- if ($visibility === VISIBILITY_VISIBLE) {
- if (is_null($cell->show($viewport))) {
- return null;
- };
- };
- }
-
- return true;
- }
-
- function isTableRow() {
- return true;
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.table.section.php b/thirdparty/html2ps_pdf/box.table.section.php
deleted file mode 100644
index a83f95560..000000000
--- a/thirdparty/html2ps_pdf/box.table.section.php
+++ /dev/null
@@ -1,55 +0,0 @@
-getCurrentCSSState();
- $box =& new TableSectionBox();
- $box->readCSS($state);
-
- // Automatically create at least one table row
- $row = new TableRowBox();
- $row->readCSS($state);
- $box->add_child($row);
-
- // Parse table contents
- $child = $root->first_child();
- while ($child) {
- $child_box =& create_pdf_box($child, $pipeline);
- $box->add_child($child_box);
- $child = $child->next_sibling();
- };
-
- return $box;
- }
-
- function TableSectionBox() {
- $this->GenericContainerBox();
- }
-
- // Overrides default 'add_child' in GenericFormattedBox
- function add_child(&$item) {
- // Check if we're trying to add table cell to current table directly, without any table-rows
- if ($item->isCell()) {
- // Add cell to the last row
- $last_row =& $this->content[count($this->content)-1];
- $last_row->add_child($item);
-
- } elseif ($item->isTableRow()) {
- // If previous row is empty, remove it (get rid of automatically generated table row in constructor)
- if (count($this->content) > 0) {
- if (count($this->content[count($this->content)-1]->content) == 0) {
- array_pop($this->content);
- }
- };
-
- // Just add passed row
- $this->content[] =& $item;
- };
- }
-
- function isTableSection() {
- return true;
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.text.php b/thirdparty/html2ps_pdf/box.text.php
deleted file mode 100644
index 6e3bfc512..000000000
--- a/thirdparty/html2ps_pdf/box.text.php
+++ /dev/null
@@ -1,653 +0,0 @@
-SimpleInlineBox();
-
- $this->words = array();
- $this->encodings = array();
- $this->hyphens = array();
- $this->_word_widths = array();
- $this->_wrappable = array();
- $this->wrapped = null;
- $this->_widths = array();
-
- $this->font_size = 0;
- $this->ascender = 0;
- $this->descender = 0;
- $this->width = 0;
- $this->height = 0;
- }
-
- /**
- * Check if given subword contains soft hyphens and calculate
- */
- function _make_wrappable(&$driver, $base_width, $font_name, $font_size, $subword_index) {
- $hyphens = $this->hyphens[$subword_index];
- $wrappable = array();
-
- foreach ($hyphens as $hyphen) {
- $subword_wrappable_index = $hyphen;
- $subword_wrappable_width = $base_width + $driver->stringwidth(substr($this->words[$subword_index], 0, $subword_wrappable_index),
- $font_name,
- $this->encodings[$subword_index],
- $font_size);
- $subword_full_width = $subword_wrappable_width + $driver->stringwidth('-',
- $font_name,
- "iso-8859-1",
- $font_size);
-
- $wrappable[] = array($subword_index, $subword_wrappable_index, $subword_wrappable_width, $subword_full_width);
- };
- return $wrappable;
- }
-
- function get_height() {
- return $this->height;
- }
-
- function put_height($value) {
- $this->height = $value;
- }
-
- // Apply 'line-height' CSS property; modifies the default_baseline value
- // (NOT baseline, as it is calculated - and is overwritten - in the close_line
- // method of container box
- //
- // Note that underline position (or 'descender' in terms of PDFLIB) -
- // so, simple that space of text box under the baseline - is scaled too
- // when 'line-height' is applied
- //
- function _apply_line_height() {
- $height = $this->get_height();
- $under = $height - $this->default_baseline;
-
- $line_height = $this->getCSSProperty(CSS_LINE_HEIGHT);
-
- if ($height > 0) {
- $scale = $line_height->apply($this->ascender + $this->descender) / ($this->ascender + $this->descender);
- } else {
- $scale = 0;
- };
-
- // Calculate the height delta of the text box
-
- $delta = $height * ($scale-1);
- $this->put_height(($this->ascender + $this->descender)*$scale);
- $this->default_baseline = $this->default_baseline + $delta/2;
- }
-
- function _get_font_name(&$viewport, $subword_index) {
- if (isset($this->_cache[CACHE_TYPEFACE][$subword_index])) {
- return $this->_cache[CACHE_TYPEFACE][$subword_index];
- };
-
- $font_resolver =& $viewport->get_font_resolver();
-
- $font = $this->getCSSProperty(CSS_FONT);
-
- $typeface = $font_resolver->getTypefaceName($font->family,
- $font->weight,
- $font->style,
- $this->encodings[$subword_index]);
-
- $this->_cache[CACHE_TYPEFACE][$subword_index] = $typeface;
-
- return $typeface;
- }
-
- function add_subword($raw_subword, $encoding, $hyphens) {
- $text_transform = $this->getCSSProperty(CSS_TEXT_TRANSFORM);
- switch ($text_transform) {
- case CSS_TEXT_TRANSFORM_CAPITALIZE:
- $subword = ucwords($raw_subword);
- break;
- case CSS_TEXT_TRANSFORM_UPPERCASE:
- $subword = strtoupper($raw_subword);
- break;
- case CSS_TEXT_TRANSFORM_LOWERCASE:
- $subword = strtolower($raw_subword);
- break;
- case CSS_TEXT_TRANSFORM_NONE:
- $subword = $raw_subword;
- break;
- }
-
- $this->words[] = $subword;
- $this->encodings[] = $encoding;
- $this->hyphens[] = $hyphens;
- }
-
- function &create($text, $encoding, &$pipeline) {
- $box =& TextBox::create_empty($pipeline);
- $box->add_subword($text, $encoding, array());
- return $box;
- }
-
- function &create_empty(&$pipeline) {
- $box =& new TextBox();
- $css_state = $pipeline->getCurrentCSSState();
-
- $box->readCSS($css_state);
- $css_state = $pipeline->getCurrentCSSState();
-
- return $box;
- }
-
- function readCSS(&$state) {
- parent::readCSS($state);
-
- $this->_readCSSLengths($state,
- array(CSS_TEXT_INDENT,
- CSS_LETTER_SPACING));
- }
-
- // Inherited from GenericFormattedBox
- function get_descender() {
- return $this->descender;
- }
-
- function get_ascender() {
- return $this->ascender;
- }
-
- function get_baseline() {
- return $this->baseline;
- }
-
- function get_min_width_natural(&$context) {
- return $this->get_full_width();
- }
-
- function get_min_width(&$context) {
- return $this->get_full_width();
- }
-
- function get_max_width(&$context) {
- return $this->get_full_width();
- }
-
- // Checks if current inline box should cause a line break inside the parent box
- //
- // @param $parent reference to a parent box
- // @param $content flow context
- // @return true if line break occurred; false otherwise
- //
- function maybe_line_break(&$parent, &$context) {
- if (!$parent->line_break_allowed()) {
- return false;
- };
-
- $last =& $parent->last_in_line();
- if ($last) {
- // Check if last box was a note call box. Punctuation marks
- // after a note-call box should not be wrapped to new line,
- // while "plain" words may be wrapped.
- if ($last->is_note_call() && $this->is_punctuation()) {
- return false;
- };
- };
-
- // Calculate the x-coordinate of this box right edge
- $right_x = $this->get_full_width() + $parent->_current_x;
-
- $need_break = false;
-
- // Check for right-floating boxes
- // If upper-right corner of this inline box is inside of some float, wrap the line
- $float = $context->point_in_floats($right_x, $parent->_current_y);
- if ($float) {
- $need_break = true;
- };
-
- // No floats; check if we had run out the right edge of container
- // TODO: nobr-before, nobr-after
- if (($right_x > $parent->get_right()+EPSILON)) {
- // Now check if parent line box contains any other boxes;
- // if not, we should draw this box unless we have a floating box to the left
-
- $first = $parent->get_first();
-
- $ti = $this->getCSSProperty(CSS_TEXT_INDENT);
- $indent_offset = $ti->calculate($parent);
-
- if ($parent->_current_x > $parent->get_left() + $indent_offset + EPSILON) {
- $need_break = true;
- };
- }
-
- // As close-line will not change the current-Y parent coordinate if no
- // items were in the line box, we need to offset this explicitly in this case
- //
- if ($parent->line_box_empty() && $need_break) {
- $parent->_current_y -= $this->get_height();
- };
-
- if ($need_break) {
- // Check if current box contains soft hyphens and use them, breaking word into parts
- $size = count($this->_wrappable);
- if ($size > 0) {
- $width_delta = $right_x - $parent->get_right();
- if (!is_null($float)) {
- $width_delta = $right_x - $float->get_left_margin();
- };
-
- $this->_find_soft_hyphen($parent, $width_delta);
- };
-
- $parent->close_line($context);
-
- // Check if parent inline boxes have left padding/margins and add them to current_x
- $element = $this->parent;
- while (!is_null($element) && is_a($element,"GenericInlineBox")) {
- $parent->_current_x += $element->get_extra_left();
- $element = $element->parent;
- };
- };
-
- return $need_break;
- }
-
- function _find_soft_hyphen(&$parent, $width_delta) {
- /**
- * Now we search for soft hyphen closest to the right margin
- */
- $size = count($this->_wrappable);
- for ($i=$size-1; $i>=0; $i--) {
- $wrappable = $this->_wrappable[$i];
- if ($this->get_width() - $wrappable[3] > $width_delta) {
- $this->save_wrapped($wrappable, $parent, $context);
- $parent->append_line($this);
- return;
- };
- };
- }
-
- function save_wrapped($wrappable, &$parent, &$context) {
- $this->wrapped = array($wrappable,
- $parent->_current_x + $this->get_extra_left(),
- $parent->_current_y - $this->get_extra_top());
- }
-
- function reflow(&$parent, &$context) {
- // Check if we need a line break here (possilble several times in a row, if we
- // have a long word and a floating box intersecting with this word
- //
- // To prevent infinite loop, we'll use a limit of 100 sequental line feeds
- $i=0;
-
- do { $i++; } while ($this->maybe_line_break($parent, $context) && $i < 100);
-
- // Determine the baseline position and height of the text-box using line-height CSS property
- $this->_apply_line_height();
-
- // set default baseline
- $this->baseline = $this->default_baseline;
-
- // append current box to parent line box
- $parent->append_line($this);
-
- // Determine coordinates of upper-left _margin_ corner
- $this->guess_corner($parent);
-
- // Offset parent current X coordinate
- if (!is_null($this->wrapped)) {
- $parent->_current_x += $this->get_full_width() - $this->wrapped[0][2];
- } else {
- $parent->_current_x += $this->get_full_width();
- };
-
- // Extends parents height
- $parent->extend_height($this->get_bottom());
-
- // Update the value of current collapsed margin; pure text (non-span)
- // boxes always have zero margin
-
- $context->pop_collapsed_margin();
- $context->push_collapsed_margin( 0 );
- }
-
- function getWrappedWidthAndHyphen() {
- return $this->wrapped[0][3];
- }
-
- function getWrappedWidth() {
- return $this->wrapped[0][2];
- }
-
- function reflow_text(&$viewport) {
- $num_words = count($this->words);
-
- /**
- * Empty text box
- */
- if ($num_words == 0) {
- return true;
- };
-
- /**
- * A simple assumption is made: fonts used for different encodings
- * have equal ascender/descender values (while they have the same
- * typeface, style and weight).
- */
- $font_name = $this->_get_font_name($viewport, 0);
-
- /**
- * Get font vertical metrics
- */
- $ascender = $viewport->font_ascender($font_name, $this->encodings[0]);
- if (is_null($ascender)) {
- error_log("TextBox::reflow_text: cannot get font ascender");
- return null;
- };
-
- $descender = $viewport->font_descender($font_name, $this->encodings[0]);
- if (is_null($descender)) {
- error_log("TextBox::reflow_text: cannot get font descender");
- return null;
- };
-
- /**
- * Setup box size
- */
- $font = $this->getCSSProperty(CSS_FONT_SIZE);
- $font_size = $font->getPoints();
-
- // Both ascender and descender should make $font_size
- // as it is not guaranteed that $ascender + $descender == 1,
- // we should normalize the result
- $koeff = $font_size / ($ascender + $descender);
- $this->ascender = $ascender * $koeff;
- $this->descender = $descender * $koeff;
-
- $this->default_baseline = $this->ascender;
- $this->height = $this->ascender + $this->descender;
-
- /**
- * Determine box width
- */
- if ($font_size > 0) {
- $width = 0;
-
- for ($i=0; $i<$num_words; $i++) {
- $font_name = $this->_get_font_name($viewport, $i);
-
- $current_width = $viewport->stringwidth($this->words[$i],
- $font_name,
- $this->encodings[$i],
- $font_size);
- $this->_word_widths[] = $current_width;
-
- // Add information about soft hyphens
- $this->_wrappable = array_merge($this->_wrappable, $this->_make_wrappable($viewport, $width, $font_name, $font_size, $i));
-
- $width += $current_width;
- };
-
- $this->width = $width;
- } else {
- $this->width = 0;
- };
-
- $letter_spacing = $this->getCSSProperty(CSS_LETTER_SPACING);
-
- if ($letter_spacing->getPoints() != 0) {
- $this->_widths = array();
-
- for ($i=0; $i<$num_words; $i++) {
- $num_chars = strlen($this->words[$i]);
-
- for ($j=0; $j<$num_chars; $j++) {
- $this->_widths[] = $viewport->stringwidth($this->words[$i]{$j},
- $font_name,
- $this->encodings[$i],
- $font_size);
- };
-
- $this->width += $letter_spacing->getPoints()*$num_chars;
- };
- };
-
- return true;
- }
-
- function show(&$driver) {
- /**
- * Check if font-size have been set to 0; in this case we should not draw this box at all
- */
- $font_size = $this->getCSSProperty(CSS_FONT_SIZE);
- if ($font_size->getPoints() == 0) {
- return true;
- }
-
- // Check if current text box will be cut-off by the page edge
- // Get Y coordinate of the top edge of the box
- $top = $this->get_top_margin();
- // Get Y coordinate of the bottom edge of the box
- $bottom = $this->get_bottom_margin();
-
- $top_inside = $top >= $driver->getPageBottom()-EPSILON;
- $bottom_inside = $bottom >= $driver->getPageBottom()-EPSILON;
-
- if (!$top_inside && !$bottom_inside) {
- return true;
- }
-
- return $this->_showText($driver);
- }
-
- function _showText(&$driver) {
- if (!is_null($this->wrapped)) {
- return $this->_showTextWrapped($driver);
- } else {
- return $this->_showTextNormal($driver);
- };
- }
-
- function _showTextWrapped(&$driver) {
- // draw generic box
- parent::show($driver);
-
- $font_size = $this->getCSSProperty(CSS_FONT_SIZE);
-
- $decoration = $this->getCSSProperty(CSS_TEXT_DECORATION);
-
- // draw text decoration
- $driver->decoration($decoration['U'],
- $decoration['O'],
- $decoration['T']);
-
- $letter_spacing = $this->getCSSProperty(CSS_LETTER_SPACING);
-
- // Output text with the selected font
- // note that we're using $default_baseline;
- // the alignment offset - the difference between baseline and default_baseline values
- // is taken into account inside the get_top/get_bottom functions
- //
- $current_char = 0;
-
- $left = $this->wrapped[1];
- $top = $this->get_top() - $this->default_baseline;
- $num_words = count($this->words);
-
- /**
- * First part of wrapped word (before hyphen)
- */
- for ($i=0; $i<$this->wrapped[0][0]; $i++) {
- // Activate font
- $status = $driver->setfont($this->_get_font_name($driver, $i),
- $this->encodings[$i],
- $font_size->getPoints());
- if (is_null($status)) {
- error_log("TextBox::show: setfont call failed");
- return null;
- };
-
- $driver->show_xy($this->words[$i],
- $left,
- $this->wrapped[2] - $this->default_baseline);
- $left += $this->_word_widths[$i];
- };
-
- $index = $this->wrapped[0][0];
-
- $status = $driver->setfont($this->_get_font_name($driver, $index),
- $this->encodings[$index],
- $font_size->getPoints());
- if (is_null($status)) {
- error_log("TextBox::show: setfont call failed");
- return null;
- };
-
- $driver->show_xy(substr($this->words[$index],0,$this->wrapped[0][1])."-",
- $left,
- $this->wrapped[2] - $this->default_baseline);
-
- /**
- * Second part of wrapped word (after hyphen)
- */
-
- $left = $this->get_left();
- $top = $this->get_top();
- $driver->show_xy(substr($this->words[$index],$this->wrapped[0][1]),
- $left,
- $top - $this->default_baseline);
-
- $size = count($this->words);
- for ($i = $this->wrapped[0][0]+1; $i<$size; $i++) {
- // Activate font
- $status = $driver->setfont($this->_get_font_name($driver, $i),
- $this->encodings[$i],
- $font_size->getPoints());
- if (is_null($status)) {
- error_log("TextBox::show: setfont call failed");
- return null;
- };
-
- $driver->show_xy($this->words[$i],
- $left,
- $top - $this->default_baseline);
-
- $left += $this->_word_widths[$i];
- };
-
- return true;
- }
-
- function _showTextNormal(&$driver) {
- // draw generic box
- parent::show($driver);
-
- $font_size = $this->getCSSProperty(CSS_FONT_SIZE);
-
- $decoration = $this->getCSSProperty(CSS_TEXT_DECORATION);
-
- // draw text decoration
- $driver->decoration($decoration['U'],
- $decoration['O'],
- $decoration['T']);
-
- $letter_spacing = $this->getCSSProperty(CSS_LETTER_SPACING);
-
- if ($letter_spacing->getPoints() == 0) {
- // Output text with the selected font
- // note that we're using $default_baseline;
- // the alignment offset - the difference between baseline and default_baseline values
- // is taken into account inside the get_top/get_bottom functions
- //
- $size = count($this->words);
- $left = $this->get_left();
-
- for ($i=0; $i<$size; $i++) {
- // Activate font
- $status = $driver->setfont($this->_get_font_name($driver, $i),
- $this->encodings[$i],
- $font_size->getPoints());
- if (is_null($status)) {
- error_log("TextBox::show: setfont call failed");
- return null;
- };
-
- $driver->show_xy($this->words[$i],
- $left,
- $this->get_top() - $this->default_baseline);
-
- $left += $this->_word_widths[$i];
- };
- } else {
- $current_char = 0;
-
- $left = $this->get_left();
- $top = $this->get_top() - $this->default_baseline;
- $num_words = count($this->words);
-
- for ($i=0; $i<$num_words; $i++) {
- $num_chars = strlen($this->words[$i]);
-
- for ($j=0; $j<$num_chars; $j++) {
- $status = $driver->setfont($this->_get_font_name($driver, $i),
- $this->encodings[$i],
- $font_size->getPoints());
-
- $driver->show_xy($this->words[$i]{$j}, $left, $top);
- $left += $this->_widths[$current_char] + $letter_spacing->getPoints();
- $current_char++;
- };
- };
- };
-
- return true;
- }
-
- function show_fixed(&$driver) {
- $font_size = $this->getCSSProperty(CSS_FONT_SIZE);
-
- // Check if font-size have been set to 0; in this case we should not draw this box at all
- if ($font_size->getPoints() == 0) {
- return true;
- }
-
- return $this->_showText($driver);
- }
-
- function offset($dx, $dy) {
- parent::offset($dx, $dy);
-
- // Note that horizonal offset should be called explicitly from text-align routines
- // otherwise wrapped part will be offset twice (as offset is called both for
- // wrapped and non-wrapped parts).
- if (!is_null($this->wrapped)) {
- $this->offset_wrapped($dx, $dy);
- };
- }
-
- function offset_wrapped($dx, $dy) {
- $this->wrapped[1] += $dx;
- $this->wrapped[2] += $dy;
- }
-
- function reflow_whitespace(&$linebox_started, &$previous_whitespace) {
- $linebox_started = true;
- $previous_whitespace = false;
- return;
- }
-
- function is_null() { return false; }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.text.string.php b/thirdparty/html2ps_pdf/box.text.string.php
deleted file mode 100644
index b02a762a7..000000000
--- a/thirdparty/html2ps_pdf/box.text.string.php
+++ /dev/null
@@ -1,60 +0,0 @@
-readCSS($pipeline->getCurrentCSSState());
- return $box;
- }
-
- function TextBoxString($word, $encoding) {
- // Call parent constructor
- $this->TextBox();
- $this->add_subword($word, $encoding, array());
- }
-
- function get_extra_bottom() {
- return 0;
- }
-
- // "Pure" Text boxes never have margins/border/padding
- function get_extra_left() {
- return 0;
- }
-
- // "Pure" Text boxes never have margins/border/padding
- function get_extra_right() {
- return 0;
- }
-
- function get_extra_top() {
- return 0;
- }
-
- function get_full_width() {
- return $this->width;
- }
-
- function get_margin_top() {
- return 0;
- }
-
- function get_min_width(&$context) {
- return $this->width;
- }
-
- function get_max_width(&$context) {
- return $this->width;
- }
-
- // Note that we don't need to call complicated 'get_width' function inherited from GenericFormattedBox,
- // a TextBox never have width constraints nor children; its width is always defined by the string length
- function get_width() {
- return $this->width;
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.utils.text-align.inc.php b/thirdparty/html2ps_pdf/box.utils.text-align.inc.php
deleted file mode 100644
index d2252c33b..000000000
--- a/thirdparty/html2ps_pdf/box.utils.text-align.inc.php
+++ /dev/null
@@ -1,103 +0,0 @@
-_line_length_delta($context) / 2;
-
- $size = count($box->_line);
- for ($i=0; $i< $size; $i++) {
- $box->_line[$i]->offset($delta, 0);
- };
-
- $first_box =& $box->_line[0];
- if (isset($first_box->wrapped) && !is_null($first_box->wrapped)) {
- $first_box->offset_wrapped(-$delta, 0);
- };
-}
-
-function ta_right(&$box, &$context, $lastline) {
- $delta = $box->_line_length_delta($context);
-
- $size = count($box->_line);
- for ($i=0; $i<$size; $i++) {
- $box->_line[$i]->offset($delta, 0);
- };
-
- $first_box =& $box->_line[0];
- if (isset($first_box->wrapped) && !is_null($first_box->wrapped)) {
- $first_box->offset_wrapped(-$delta, 0);
- };
-}
-
-function ta_justify(&$box, &$context, $lastline) {
- // last line is never justified
- if ($lastline) {
- return;
- }
-
- // If line box contains less that two items, no justification can be done, just return
- if (count($box->_line) < 2) {
- return;
- }
-
- // Calculate extra space to be filled by this line
- $delta = $box->_line_length_delta($context);
-
- // note that if it is the very first line inside the container, 'text-indent' value
- // should not be taken into account while calculating delta value
- if (count($box->content) > 0) {
- if ($box->content[0]->uid === $box->_line[0]->uid) {
- $delta -= $box->text_indent->calculate($box);
- };
- };
-
- // if line takes less that MAX_JUSTIFY_FRACTION of available space, no justtification should be done
- if ($delta > $box->_line_length() * MAX_JUSTIFY_FRACTION) {
- return;
- };
-
- // Calculate offset for each whitespace box
- $whitespace_count = 0;
- $size = count($box->_line);
-
- // Why $size-1? Ignore whitespace box, if it is located at the very end of
- // line box
-
- // Also, ignore whitespace box at the very beginning of the line
- for ($i=1; $i<$size-1; $i++) {
- if (is_a($box->_line[$i],"WhitespaceBox")) {
- $whitespace_count++;
- };
- };
-
- if ($whitespace_count > 0) {
- $offset = $delta / $whitespace_count;
- } else {
- $offset = 0;
- };
-
- // Offset all boxes in current line box
- $num_whitespaces = 0;
- $size = count($box->_line);
- for ($i=1; $i < $size; $i++) {
- /*
- * Note that order is important: additional horizontal space
- * is added after the whitespace box; it is important, as
- * whitespace box (if it is the last box in the line) should not
- * run off the right edge of the container box
- */
- $box->_line[$i]->offset($offset * $num_whitespaces, 0);
-
- if (is_a($box->_line[$i],"WhitespaceBox")) {
- $num_whitespaces++;
- };
- };
-
- // The very first box is not offset in this case, so we don't need to
- // call offset_wrapped to compensate this.
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/box.whitespace.php b/thirdparty/html2ps_pdf/box.whitespace.php
deleted file mode 100644
index f18f7ddc4..000000000
--- a/thirdparty/html2ps_pdf/box.whitespace.php
+++ /dev/null
@@ -1,121 +0,0 @@
-readCSS($pipeline->getCurrentCSSState());
- $box->add_subword(" ", 'iso-8859-1', array());
- return $box;
- }
-
- function readCSS(&$state) {
- parent::readCSS($state);
-
- $this->_readCSSLengths($state,
- array(CSS_WORD_SPACING));
- }
-
- function get_extra_bottom() {
- return 0;
- }
-
- // "Pure" Text boxes never have margins/border/padding
- function get_extra_left() {
- return 0;
- }
-
- // "Pure" Text boxes never have margins/border/padding
- function get_extra_right() {
- return 0;
- }
-
- function get_extra_top() {
- return 0;
- }
-
- function get_full_width() {
- return $this->width;
- }
-
- function get_margin_top() {
- return 0;
- }
-
- function get_min_width(&$context) {
- return $this->width;
- }
-
- function get_max_width(&$context) {
- return $this->width;
- }
-
- function WhitespaceBox() {
- // Call parent constructor
- $this->TextBox();
- }
-
- // (!) SIDE EFFECT: current whitespace box can be replaced by a null box during reflow.
- // callers of reflow should take this into account and possilby check for this
- // after reflow returns. This can be detected by UID change.
- //
- function reflow(&$parent, &$context) {
- // Check if there are any boxes in parent's line box
- if ($parent->line_box_empty()) {
- // The very first whitespace in the line box should not affect neither height nor baseline of the line box;
- // because following boxes can be smaller that assumed whitespace height
- // Example: [whitespace] ; whitespace can overextend this line
-
- $this->width = 0;
- $this->height = 0;
- } elseif (is_a($parent->last_in_line(),"WhitespaceBox")) {
- // Duplicate whitespace boxes should not offset further content and affect the line box length
-
- $this->width = 0;
- $this->height = 0;
- } elseif ($this->maybe_line_break($parent, $context)) {
- $this->width = 0;
- $this->height = 0;
- };
-
- parent::reflow($parent, $context);
- }
-
- function reflow_text(&$driver) {
- if (is_null(parent::reflow_text($driver))) {
- return null;
- };
-
- // Override widths
- $letter_spacing = $this->getCSSProperty(CSS_LETTER_SPACING);
- $word_spacing = $this->getCSSProperty(CSS_WORD_SPACING);
-
- $this->width =
- $this->height * WHITESPACE_FONT_SIZE_FRACTION +
- $letter_spacing->getPoints() +
- $word_spacing->getPoints();
-
- return true;
- }
-
- function reflow_whitespace(&$linebox_started, &$previous_whitespace) {
- if (!$linebox_started ||
- ($linebox_started && $previous_whitespace)) {
-
- $link_destination = $this->getCSSProperty(CSS_HTML2PS_LINK_DESTINATION);
- if ($link_destination == "") {
- $this->parent->remove($this);
- } else {
- $this->font_height = 0.001;
- $this->height = 0;
- $this->width = 0;
- };
- };
-
- $previous_whitespace = true;
-
- // Note that there can (in theory) several whitespaces in a row, so
- // we could not modify a flag until we met a real text box
- }
-}
-?>
\ No newline at end of file
diff --git a/thirdparty/html2ps_pdf/cache/.gitignore b/thirdparty/html2ps_pdf/cache/.gitignore
deleted file mode 100644
index e69de29bb..000000000
diff --git a/thirdparty/html2ps_pdf/classes/include.php b/thirdparty/html2ps_pdf/classes/include.php
deleted file mode 100644
index 0dccd53ff..000000000
--- a/thirdparty/html2ps_pdf/classes/include.php
+++ /dev/null
@@ -1,39 +0,0 @@
-
diff --git a/thirdparty/html2ps_pdf/classes/org/active-link/doc/DocHTML.php b/thirdparty/html2ps_pdf/classes/org/active-link/doc/DocHTML.php
deleted file mode 100644
index eb33d0071..000000000
--- a/thirdparty/html2ps_pdf/classes/org/active-link/doc/DocHTML.php
+++ /dev/null
@@ -1,242 +0,0 @@
-CSSStringDefault = "
- body {background-color: white;}
- a {font-family: monospace;}
- ul {list-style-type: none;}
- .classTitle {color: blue;}
- .name {color: black;}
- .version {color: black;}
- .requires {color: red;}
- .extends {color: black;}
- .description {color: black;font-family: sans-serif;}
- .author {color: blue;}
- .methodsTitle {color: blue;}
- .methodList {color: blue;}
- .methodName {color: blue;font-weight: bold;}
- .returns {color: black;}
- .param {color: black;font-weight: bold;font-family: monospace;}
- ";
- }
-
- /**
- * Returns class documentation as a string, formatted in HTML
- * If argument is a filename, it parses the file for comments and generates documentation
- * If argument is an object of type PHPClass, then documentation is generated from it
- * @method getClassDoc
- * @param mixed argument
- * @returns string HTML-formatted documentation if successful, false otherwise
- */
- function getClassDoc($argument) {
- if(is_object($argument) && get_class($argument) == "phpclass")
- return $this->getClassDocFromClass($argument);
- elseif(is_string($argument))
- return $this->getClassDocFromFile($argument);
- else
- return false;
- }
-
- /**
- * Returns class documentation as a string, formatted in HTML
- * @method getClassDocFromClass
- * @param object objClass
- * @returns string HTML-formatted documentation if successful, false otherwise
- */
- function getClassDocFromClass($objClass) {
- if(is_object($objClass) && get_class($objClass) == "phpclass") {
- $classDocXML = new XML_("html");
- // ---------------------- HEAD ---------------------- //
- $headXML = new XMLBranch("head");
- $headXML->setTagContent($objClass->getInfo("name"), "head/title");
- $headXML->setTagContent("", "head/meta");
- $headXML->setTagAttribute("http-equiv", "content-type", "head/meta");
- $headXML->setTagAttribute("content", "text/html; charset=ISO-8859-1", "head/meta");
- $headXML->setTagContent($this->CSSStringDefault, "head/style");
- $headXML->setTagAttribute("type", "text/css", "head/style");
- // ---------------------- BODY ---------------------- //
- $bodyXML = new XMLBranch("body");
- $classTitleXML = new XMLBranch("h1");
- $classTitleXML->setTagAttribute("class", "classTitle");
- $classTitleXML->setTagContent($objClass->getInfo("name") . " Class");
- $bodyXML->addXMLBranch($classTitleXML);
- foreach($objClass->info as $infoKey => $infoValue) {
- $brXML = new XMLBranch("br");
- $bodyXML->addXMLBranch($brXML);
- if(is_array($infoValue)) {
- $spanXML = new XMLBranch("span");
- $spanXML->setTagAttribute("class", $infoKey);
- $spanXML->setTagContent(ucfirst($infoKey) . ":");
- $ulXML = new XMLBranch("ul");
- $ulXML->setTagAttribute("class", $infoKey);
- foreach($infoValue as $value) {
- $liXML = new XMLBranch("li");
- $liXML->setTagContent($value);
- $ulXML->addXMLBranch($liXML);
- }
- $bodyXML->addXMLBranch($spanXML);
- $bodyXML->addXMLBranch($ulXML);
- }
- else {
- $spanXML = new XMLBranch("span");
- $spanXML->setTagAttribute("class", $infoKey);
- $spanXML->setTagContent(ucfirst($infoKey) . ": " . $infoValue);
- $bodyXML->addXMLBranch($spanXML);
- }
- }
- $hrXML = new XMLBranch("hr");
- $bodyXML->addXMLBranch($hrXML);
- $h2XML = new XMLBranch("h2");
- $h2XML->setTagAttribute("class", "methodsTitle");
- $h2XML->setTagContent("All Methods");
- $bodyXML->addXMLBranch($h2XML);
- $spanXML = new XMLBranch("span");
- $spanXML->setTagAttribute("class", "methodList");
- foreach($objClass->methods as $methodName => $method) {
- $aMethodXML = new XMLBranch("a");
- $aMethodXML->setTagAttribute("href", "#" . $methodName);
- $aMethodXML->setTagContent($methodName);
- $brXML = new XMLBranch("br");
- $spanXML->addXMLBranch($aMethodXML);
- $spanXML->addXMLBranch($brXML);
- }
- $bodyXML->addXMLBranch($spanXML);
- foreach($objClass->methods as $methodName => $method) {
- $hrXML = new XMLBranch("hr");
- $bodyXML->addXMLBranch($hrXML);
- $pMethodXML = new XMLBranch("p");
- $aMethodXML = new XMLBranch("a");
- $aMethodXML->setTagAttribute("name", $methodName);
- $spanXMLName = new XMLBranch("span");
- $spanXMLName->setTagAttribute("class", "methodName");
- $spanXMLName->setTagContent($methodName);
- $spanXMLArgs = new XMLBranch("span");
- $tagContentArgs = " ( ";
- if(is_array($method->params) && count($method->params) > 0) {
- $paramCount = 0;
- foreach($method->params as $key => $value) {
- if($paramCount > 0)
- $tagContentArgs .= ", ";
- $tagContentArgs .= $key;
- $paramCount ++;
- }
- }
- $tagContentArgs .= " )";
- $spanXMLArgs->setTagContent($tagContentArgs);
- $aMethodXML->addXMLBranch($spanXMLName);
- $aMethodXML->addXMLBranch($spanXMLArgs);
- $pMethodXML->addXMLBranch($aMethodXML);
- $bodyXML->addXMLBranch($pMethodXML);
- unset($method->info["name"]);
- foreach($method->info as $infoKey => $infoValue) {
- if(is_array($infoValue)) {
- $pXML = new XMLBranch("p");
- $pXML->setTagAttribute("class", $infoKey);
- $pXML->setTagContent(ucfirst($infoKey) . ":");
- $ulXML = new XMLBranch("ul");
- $ulXML->setTagAttribute("class", $infoKey);
- foreach($infoValue as $value) {
- $liXML = new XMLBranch("li");
- $liXML->setTagContent($value);
- $ulXML->addXMLBranch($liXML);
- }
- $bodyXML->addXMLBranch($pXML);
- $bodyXML->addXMLBranch($ulXML);
- }
- else {
- $pXML = new XMLBranch("p");
- $pXML->setTagAttribute("class", $infoKey);
- $pXML->setTagContent(ucfirst($infoKey) . ": " . $infoValue);
- $bodyXML->addXMLBranch($pXML);
- }
- }
- if(is_array($method->params) && count($method->params) > 0) {
- $pParamXML = new XMLBranch("p");
- //$pParamXML->setTagAttribute("class", "param");
- $paramTitleXML = new XMLBranch("span");
- $paramTitleXML->setTagContent("Arguments:");
- $pParamXML->addXMLBranch($paramTitleXML);
- $paramListXML = new XMLBranch("ul");
- foreach($method->params as $key => $value) {
- $paramItemXML = new XMLBranch("li");
- $paramItemXML->setTagAttribute("class", "param");
- $paramItemXML->setTagContent($key);
- $paramListXML->addXMLBranch($paramItemXML);
- }
- $pParamXML->addXMLBranch($paramListXML);
- $bodyXML->addXMLBranch($pParamXML);
- }
- }
- // ---------------------- END ---------------------- //
- $classDocXML->addXMLBranch($headXML);
- $classDocXML->addXMLBranch($bodyXML);
- return $classDocXML->getXMLString(0);
- }
- else
- return false;
- }
-
- /**
- * Returns class documentation as a string, formatted in HTML
- * @method getClassDocFromFile
- * @param string filename
- * @returns string HTML-formatted documentation if successful, false otherwise
- */
- function getClassDocFromFile($filename) {
- if(is_string($filename) && file_exists($filename) && is_readable($filename)) {
- $objClass = new PHPClass($filename);
- return $this->getClassDocFromClass($objClass);
- }
- else
- return false;
- }
-
-}
diff --git a/thirdparty/html2ps_pdf/classes/org/active-link/doc/Method.php b/thirdparty/html2ps_pdf/classes/org/active-link/doc/Method.php
deleted file mode 100644
index 171f49338..000000000
--- a/thirdparty/html2ps_pdf/classes/org/active-link/doc/Method.php
+++ /dev/null
@@ -1,83 +0,0 @@
-info = array();
- $this->params = array();
- $this->setInfo("name", $name);
- }
-
- /**
- * Returns value of a property by name
- * @method getInfo
- * @param string name
- * @returns string value of a property if found, false otherwise
- */
- function getInfo($name) {
- if(array_key_exists($name, $this->info))
- return $this->info[$name];
- else
- return false;
- }
-
- /**
- * Sets a property with supplied name to a supplied value
- * @method setInfo
- * @param string name, string value
- * @returns none
- */
- function setInfo($name, $value) {
- $this->info[$name] = $value;
- }
-
- /**
- * Sets a parameter with supplied name and value
- * @method setParam
- * @param string name, string value
- * @returns none
- */
- function setParam($name, $value) {
- $this->params[$name] = $value;
- }
-
-}
diff --git a/thirdparty/html2ps_pdf/classes/org/active-link/doc/PHPClass.php b/thirdparty/html2ps_pdf/classes/org/active-link/doc/PHPClass.php
deleted file mode 100644
index efaff865f..000000000
--- a/thirdparty/html2ps_pdf/classes/org/active-link/doc/PHPClass.php
+++ /dev/null
@@ -1,195 +0,0 @@
-methods = array();
- $this->properties = array();
- $this->info = array();
- if($filename != "")
- $this->parseFromFile($filename);
- }
-
- /**
- * Deletes a property by name
- * @method deleteInfo
- * @param string name
- * @returns true if successful, false otherwise
- */
- function deleteInfo($name) {
- $success = false;
- if(array_key_exists($name, $this->info)) {
- unset($this->info[$name]);
- $success = true;
- }
- return $success;
- }
-
- /**
- * Returns a property value by name
- * @method getInfo
- * @param string name
- * @returns string value if successful, false otherwise
- */
- function getInfo($name) {
- if(array_key_exists($name, $this->info))
- return $this->info[$name];
- else
- return false;
- }
-
- /**
- * Parses a class from supplied filename
- * @method parseFromFile
- * @param string filename
- * @returns true if successful, false otherwise
- */
- function parseFromFile($filename) {
- $success = false;
- if(file_exists($filename) && is_readable($filename)) {
- $arrContents = file($filename);
- $parsing = false;
- $parsingBlocks = array();
- $tempBlock = array();
- foreach($arrContents as $line) {
- if(trim($line) == "/**") {
- $parsing = true;
- $blockstart = true;
- }
- elseif($parsing && trim($line) == "*/") {
- $parsing = false;
- $parsingBlocks[] = $tempBlock;
- $tempBlock = array();
- }
- else {
- if($parsing) {
- if($blockstart) {
- $tempBlock[] = $line;
- $blockstart = false;
- }
- else {
- $tempBlock[] = $line;
- }
- }
- }
- }
- foreach($parsingBlocks as $blockLines) {
- $block = array();
- foreach($blockLines as $line) {
- $str = strstr($line, "@");
- $str = substr($str, 1);
- if($str !== false) {
- $separatorPos = (strpos($str, " ") && strpos($str, "\t")) ? min(strpos($str, " "), strpos($str, "\t")) : (strpos($str, " ") ? strpos($str, " ") : (strpos($str, "\t") ? strpos($str, "\t") : strlen($str)));
- $name = trim(substr($str, 0, $separatorPos));
- $value = trim(substr($str, $separatorPos));
- }
- else {
- $name = "description";
- $value = trim($line);
- }
- if($name == "param" || $name == "description")
- $block[$name][] = $value;
- else
- $block[$name] = $value;
- }
- //print("
This script will attempt to check your system settings and detect
-most obvious problems which could prevent you from using html2ps:
-missing PHP extensions, invalid permissions on files used by the
-script, missing font files and so on. Please note that if list may be
-incomplete; please visit html2ps
-support forum in case you've encountered an unknown issue.
-