Car Price Volvo $50000 SAAB $48000 */ ?> processChildNodes($node, self::$CHILDNODES); } } class FO_Table extends FO_LayoutObject { private $colCount = 0; private static $CHILDNODES = array( FO_TableColumn, FO_TableHeader, FO_TableFooter, FO_TableBody ); protected function getChildNodes() { return self::$CHILDNODES; } protected function initFOObject(FO_Object $col) { if (!$col instanceof FO_TableColumn) { return; } $col->setContext("column", $this->colCount++); } protected function postParse(FO_Object $obj) { if ($obj instanceof FO_TableHeader) { $this->setLocalContext("width", $obj->getContext("width")); $this->setLocalContext("height", $this->getContext("height")+ $obj->getContext("height")); $this->setContext("y", $this->getContext("y") + $obj->getContext("height")); } else if($obj instanceof FO_TableBody) { $this->setLocalContext("width", $obj->getContext("width")); $this->setLocalContext("height", $this->getContext("height")+ $obj->getContext("height")); $this->setContext("y", $this->getContext("y") + $obj->getContext("height")); } else if($obj instanceof FO_TableColumn) { $col = $obj->getContext("column"); $this->setContext("column-$col-width", $obj->getContext("width")); } } } class FO_TableCaption extends FO_Object { private static $CHILDNODES = array( FO_Block, FO_BlockContainer, FO_ListBlock ); public function parse(DOMNode $node) { $this->processChildNodes($node, self::$CHILDNODES); } } class FO_TableColumn extends FO_Object { private static $CHILDNODES = array(); public function parse(DOMNode $node) { $width = $this->getSizeAttribute($node, "column-width"); //calc internal width $this->setContext("width", $width); $this->processChildNodes($node, self::$CHILDNODES); } } class FO_TableRow extends FO_LayoutObject { private $colIndex = 0; private static $CHILDNODES = array( FO_TableCell ); protected function getChildNodes() { return self::$CHILDNODES; } protected function initFOObject(FO_Object $col) { if (!$col instanceof FO_TableCell) { return; } $col->setContext("column", $this->colIndex++); } protected function postParse(FO_Object $obj) { if ($obj instanceof FO_TableCell) { $this->setContext("x", $this->getContext("x")+ $obj->getContext("width")); $this->setLocalContext("width", $this->getContext("width")+ $obj->getContext("width")); if ($this->getContext("height") < $obj->getContext("height")) { $this->setLocalContext("height", $obj->getContext("height")); } } else if ($obj instanceof FO_TableRow) { $this->setLocalContext("width", $obj->getContext("width")); $this->setLocalContext("height", $this->getContext("height")+ $obj->getContext("height")); $this->setContext("y", $this->getContext("y") + $obj->getContext("height")); } } } class FO_TableHeader extends FO_TableRow { private static $CHILDNODES = array( FO_TableCell, FO_TableRow ); protected function getChildNodes() { return self::$CHILDNODES; } } class FO_TableFooter extends FO_LayoutObject { private static $CHILDNODES = array( FO_TableCell, FO_TableRow ); protected function getChildNodes() { return self::$CHILDNODES; } } class FO_TableBody extends FO_LayoutObject { private static $CHILDNODES = array( FO_TableCell, FO_TableRow ); protected function getChildNodes() { return self::$CHILDNODES; } protected function postParse(FO_Object $obj) { if ($obj instanceof FO_TableRow) { $this->setLocalContext("width", $obj->getContext("width")); $this->setLocalContext("height", $this->getContext("height")+ $obj->getContext("height")); $this->setContext("y", $this->getContext("y") + $obj->getContext("height")); } } } class FO_TableCell extends FO_LayoutObject { private static $CHILDNODES = array( FO_Block, FO_BlockContainer, FO_ListBlock, FO_Table, FO_TableAndCaption ); protected function getChildNodes() { return self::$CHILDNODES; } public function parse(DOMNode $node) { $col = $this->getContext("column"); $width = $this->getContext("column-$col-width"); $this->setLocalContext("width", $width); parent::parse($node); } /** * Overlap borders that the total width isn't larger than the * specified */ protected function drawBordersAndBackground($pos) { list($x1, $y1, $width1, $height1) = $pos[0]; list($x2, $y2, $width2, $height2) = $pos[1]; $xd = ($x1-$x2)/2; $yd = ($y1-$y2)/2; $wd = ($width2-$width1)/2; $hd = ($height2-$height1)/2; $this->drawBackground($x2, $y2, $width2+$wd, $height2+$hd); $this->drawBorders($x2, $y2, $width2+$wd, $height2+$hd); } protected function postParse(FO_Object $obj) { $this->setLocalContext("height", $this->getContext("height")+ $obj->getContext("height")+0.5); // oesi - add +0.5 for tablespace } } ?>