/** * Create new style by importing ODT style definition. * * @param $xmlCode Style definition in ODT XML format * @return ODTStyle New specific style */ public static function importODTStyle($xmlCode) { $matches = array(); if (preg_match('/style:family="[^"]+"/', $xmlCode, $matches) !== 1) { return NULL; } $family = substr($matches[0], strlen('style:family=')); $family = trim($family, '"<>'); switch ($family) { case 'text': return ODTTextStyle::importODTStyle($xmlCode); case 'paragraph': return ODTParagraphStyle::importODTStyle($xmlCode); case 'table': return ODTTableStyle::importODTStyle($xmlCode); case 'table-column': return ODTTableColumnStyle::importODTStyle($xmlCode); case 'table-row': return ODTTableRowStyle::importODTStyle($xmlCode); case 'table-cell': return ODTTableCellStyle::importODTStyle($xmlCode); } // Unknown/not implemented style family. // Return NULL, in this case ODTStyle will create a generic unknown style. return NULL; }