1<?php 2 3require_once DOKU_PLUGIN.'odt/ODT/elements/ODTStateElement.php'; 4 5/** 6 * ODTElementTableHeaderCell: 7 * Class for handling the table "header" cell element. 8 * 9 * In ODT there is no header cell element so this is just a normal 10 * table cell with some extra handling for the automatic column 11 * count mode. 12 * 13 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 14 * @author LarsDW223 15 */ 16class ODTElementTableHeaderCell extends ODTElementTableCell 17{ 18 /** 19 * Constructor. 20 */ 21 public function __construct($style_name=NULL, $colspan = 0, $rowspan = 0) { 22 parent::__construct($style_name, $colspan, $rowspan); 23 $this->setClass ('table-header'); 24 } 25 26 /** 27 * Return string with encoded opening tag. 28 * 29 * @return string The ODT XML code to open this element. 30 */ 31 public function getOpeningTag () { 32 $colspan = $this->getColumnSpan(); 33 $rowspan = $this->getRowSpan(); 34 35 // Get our corresponding table. 36 $table = $this->getTable(); 37 $auto_columns = false; 38 $count = 0; 39 if (isset($table)) { 40 $auto_columns = $table->getTableAutoColumns(); 41 $count = $table->getCount(); 42 } 43 44 $encoded = '<table:table-cell office:value-type="'.$this->getValueType().'"'; 45 $encoded .= ' table:style-name="'.$this->getStyleName().'"'; 46 if ( $colspan > 1 ) { 47 $encoded .= ' table:number-columns-spanned="'.$colspan.'"'; 48 } else if ($auto_columns === true && $colspan == 0) { 49 $encoded .= ' table:number-columns-spanned="<MaxColsPlaceholder'.$count.'>"'; 50 } 51 if ( $rowspan > 1 ) { 52 $encoded .= ' table:number-rows-spanned="'.$rowspan.'"'; 53 } 54 $encoded .= '>'; 55 return $encoded; 56 } 57} 58