Пример #1
0
 /** 
  * Create new block element and automatically initialize its contents 
  * with the given text string
  *
  * @param string $content The text string to be put inside the block box
  *
  * @return BlockBox new BlockBox object (with contents filled)
  *
  * @see InlineBox
  * @see InlineBox::create_from_text()
  */
 function &create_from_text($content, &$pipeline)
 {
     $box = new BlockBox();
     $box->readCSS($pipeline->get_current_css_state());
     $box->add_child(InlineBox::create_from_text($content, $box->get_css_property(CSS_WHITE_SPACE), $pipeline));
     return $box;
 }
 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;
 }
Пример #3
0
 function readCSS(&$state)
 {
     parent::readCSS($state);
     $this->_readCSS($state, array(CSS_LIST_STYLE));
     // Pseudo-CSS properties
     // '-list-counter'
     // increase counter value
     $value = $state->get_property(CSS_HTML2PS_LIST_COUNTER) + 1;
     $state->set_property(CSS_HTML2PS_LIST_COUNTER, $value);
     $state->set_property_on_level(CSS_HTML2PS_LIST_COUNTER, CSS_PROPERTY_LEVEL_PARENT, $value);
     // open the marker image if specified
     $list_style = $this->get_css_property(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;
     }
 }