libraries/tbs/plugins/tbs_plugin_opentbs.php
function OpenDoc_ChartFindSeries(&$chart, $Txt) {

		// Find series declarations
		$p = 0;
		$s_idx = 0;
		$series = array();
		$cols = array(); // all columns attached to a series
		$cols_name = array();
		while($elSeries = clsTbsXmlLoc::FindElement($Txt, 'chart:series', $p)) {
			$s_cols = array();
			// Column of main value
			$col = $this->OpenDoc_ChartFindCol($cols, $elSeries, 'chart:values-cell-range-address', $s_idx);
			$s_cols[$col] = true;
			// Column of series's name
			$col_name = $this->OpenDoc_ChartFindCol($cols, $elSeries, 'chart:label-cell-address', $s_idx);
			// Columns for other values
			$src = $elSeries->GetInnerSrc();
			$p2 = 0;
			while($elDom = clsTbsXmlLoc::FindStartTag($src, 'chart:domain', $p2)) {
				$col = $this->OpenDoc_ChartFindCol($cols, $elDom, 'table:cell-range-address', $s_idx);
				$s_cols[$col] = true;
				$p2 = $elDom->PosEnd;
			}
			// rearrange col numbers
			ksort($s_cols);
			$s_cols = array_keys($s_cols); // nedded for havinf first col on index 0
			// Attribute to re-find the series
			$ref = $elSeries->GetAttLazy('chart:label-cell-address');
			// Add the series
			$series[$s_idx] = array('name'=>false, 'col_name'=>$col_name, 'cols'=>$s_cols, 'ref'=>$ref);
			$cols_name[$col_name] = $s_idx;
			$p = $elSeries->PosEnd;
			$s_idx++;
		}
		$chart['cols'] = $cols;

		// Column of categories
		$col_cat = false;
		$elCat = clsTbsXmlLoc::FindStartTag($Txt, 'chart:categories', 0);
		if ($elCat!==false) {
			$att = $elCat->GetAttLazy('table:cell-range-address');
			$col_cat = $this->Misc_ColNum($att, true); // the column of categories is always #1
		}
		$chart['col_cat'] = $col_cat;


		// Brows headers columns
		$elHeaders = clsTbsXmlLoc::FindElement($Txt, 'table:table-header-rows', 0);
		if ($elHeaders===false) return $this->RaiseError("(ChartFindSeries) : unable to found the series names in the chart ".$this->_ChartCaption.".");
		$p = 0;
		$col_num = 0;
		while (($elCell=clsTbsXmlLoc::FindElement($elHeaders, 'table:table-cell', $p))!==false) {
			$col_num++;
			if (isset($cols_name[$col_num])) {
				$elP = clsTbsXmlLoc::FindElement($elCell, 'text:p', 0);
				$name = ($elP===false) ? '' : $elP->GetInnerSrc();
				$s_idx = $cols_name[$col_num];
				$series[$s_idx]['name'] = $name;
			}
			$p = $elCell->PosEnd;
		}
		$chart['series'] = $series;
		$chart['col_nbr'] = $col_num;

		return true;

	}
function OpenDoc_ChartFindSeries(&$chart, $Txt) {

		// Find series declarations
		$p = 0;
		$s_idx = 0;
		$series = array();
		$cols = array(); // all columns attached to a series
		$cols_name = array();
		while($elSeries = clsTbsXmlLoc::FindElement($Txt, 'chart:series', $p)) {
			$s_cols = array();
			// Column of main value
			$col = $this->OpenDoc_ChartFindCol($cols, $elSeries, 'chart:values-cell-range-address', $s_idx);
			$s_cols[$col] = true;
			// Column of series's name
			$col_name = $this->OpenDoc_ChartFindCol($cols, $elSeries, 'chart:label-cell-address', $s_idx);
			// Columns for other values
			$src = $elSeries->GetInnerSrc();
			$p2 = 0;
			while($elDom = clsTbsXmlLoc::FindStartTag($src, 'chart:domain', $p2)) {
				$col = $this->OpenDoc_ChartFindCol($cols, $elDom, 'table:cell-range-address', $s_idx);
				$s_cols[$col] = true;
				$p2 = $elDom->PosEnd;
			}
			// rearrange col numbers
			ksort($s_cols);
			$s_cols = array_keys($s_cols); // nedded for havinf first col on index 0
			// Attribute to re-find the series
			$ref = $elSeries->GetAttLazy('chart:label-cell-address');
			// Add the series
			$series[$s_idx] = array('name'=>false, 'col_name'=>$col_name, 'cols'=>$s_cols, 'ref'=>$ref);
			$cols_name[$col_name] = $s_idx;
			$p = $elSeries->PosEnd;
			$s_idx++;
		}
		$chart['cols'] = $cols;

		// Column of categories
		$col_cat = false;
		$elCat = clsTbsXmlLoc::FindStartTag($Txt, 'chart:categories', 0);
		if ($elCat!==false) {
			$att = $elCat->GetAttLazy('table:cell-range-address');
			$col_cat = $this->Misc_ColNum($att, true); // the column of categories is always #1
		}
		$chart['col_cat'] = $col_cat;


		// Brows headers columns
		$elHeaders = clsTbsXmlLoc::FindElement($Txt, 'table:table-header-rows', 0);
		if ($elHeaders===false) return $this->RaiseError("(ChartFindSeries) : unable to found the series names in the chart ".$this->_ChartCaption.".");
		$p = 0;
		$col_num = 0;
		while (($elCell=clsTbsXmlLoc::FindElement($elHeaders, 'table:table-cell', $p))!==false) {
			$col_num++;
			if (isset($cols_name[$col_num])) {
				$elP = clsTbsXmlLoc::FindElement($elCell, 'text:p', 0);
				$name = ($elP===false) ? '' : $elP->GetInnerSrc();
				$s_idx = $cols_name[$col_num];
				$series[$s_idx]['name'] = $name;
			}
			$p = $elCell->PosEnd;
		}
		$chart['series'] = $series;
		$chart['col_nbr'] = $col_num;

		return true;

	}
function OpenDoc_ChartFindSeries ( & $ chart , $ Txt ) { // Find series declarations $ p = 0 ; $ s_idx = 0 ; $ series = array ( ) ; $ cols = array ( ) ; // all columns attached to a series $ cols_name = array ( ) ; while ( $ elSeries = clsTbsXmlLoc :: FindElement ( $ Txt , 'chart:series' , $ p ) ) { $ s_cols = array ( ) ; // Column of main value $ col = $ this -> OpenDoc_ChartFindCol ( $ cols , $ elSeries , 'chart:values-cell-range-address' , $ s_idx ) ; $ s_cols [ $ col ] = true ; // Column of series's name $ col_name = $ this -> OpenDoc_ChartFindCol ( $ cols , $ elSeries , 'chart:label-cell-address' , $ s_idx ) ; // Columns for other values $ src = $ elSeries -> GetInnerSrc ( ) ; $ p2 = 0 ; while ( $ elDom = clsTbsXmlLoc :: FindStartTag ( $ src , 'chart:domain' , $ p2 ) ) { $ col = $ this -> OpenDoc_ChartFindCol ( $ cols , $ elDom , 'table:cell-range-address' , $ s_idx ) ; $ s_cols [ $ col ] = true ; $ p2 = $ elDom -> PosEnd ; } // rearrange col numbers ksort ( $ s_cols ) ; $ s_cols = array_keys ( $ s_cols ) ; // nedded for havinf first col on index 0 // Attribute to re-find the series $ ref = $ elSeries -> GetAttLazy ( 'chart:label-cell-address' ) ; // Add the series $ series [ $ s_idx ] = array ( 'name' => false , 'col_name' => $ col_name , 'cols' => $ s_cols , 'ref' => $ ref ) ; $ cols_name [ $ col_name ] = $ s_idx ; $ p = $ elSeries -> PosEnd ; $ s_idx ++ ; } $ chart [ 'cols' ] = $ cols ; // Column of categories $ col_cat = false ; $ elCat = clsTbsXmlLoc :: FindStartTag ( $ Txt , 'chart:categories' , 0 ) ; if ( $ elCat !== false ) { $ att = $ elCat -> GetAttLazy ( 'table:cell-range-address' ) ; $ col_cat = $ this -> Misc_ColNum ( $ att , true ) ; // the column of categories is always #1 } $ chart [ 'col_cat' ] = $ col_cat ; // Brows headers columns $ elHeaders = clsTbsXmlLoc :: FindElement ( $ Txt , 'table:table-header-rows' , 0 ) ; if ( $ elHeaders === false ) return $ this -> RaiseError ( "(ChartFindSeries) : unable to found the series names in the chart " . $ this -> _ChartCaption . "." ) ; $ p = 0 ; $ col_num = 0 ; while ( ( $ elCell = clsTbsXmlLoc :: FindElement ( $ elHeaders , 'table:table-cell' , $ p ) ) !== false ) { $ col_num ++ ; if ( isset ( $ cols_name [ $ col_num ] ) ) { $ elP = clsTbsXmlLoc :: FindElement ( $ elCell , 'text:p' , 0 ) ; $ name = ( $ elP === false ) ? '' : $ elP -> GetInnerSrc ( ) ; $ s_idx = $ cols_name [ $ col_num ] ; $ series [ $ s_idx ] [ 'name' ] = $ name ; } $ p = $ elCell -> PosEnd ; } $ chart [ 'series' ] = $ series ; $ chart [ 'col_nbr' ] = $ col_num ; return true ; }
Find and save informations abouts all series in the chart.
Find and save informations abouts all series in the chart .