/** * 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) { $style = new ODTTableCellStyle(); $attrs = 0; $open = XMLUtil::getElementOpenTag('style:style', $xmlCode); if (!empty($open)) { $attrs += $style->importODTStyleInternal(ODTStyleStyle::getStyleProperties(), $open); } else { $open = XMLUtil::getElementOpenTag('style:default-style', $xmlCode); if (!empty($open)) { $style->setDefault(true); $attrs += $style->importODTStyleInternal(ODTStyleStyle::getStyleProperties(), $open); } } $open = XMLUtil::getElementOpenTag('style:paragraph-properties', $xmlCode); if (!empty($open)) { $attrs += $style->importODTStyleInternal(ODTParagraphStyle::getParagraphProperties(), $xmlCode); } $open = XMLUtil::getElementOpenTag('style:text-properties', $xmlCode); if (!empty($open)) { $attrs += $style->importODTStyleInternal(ODTTextStyle::getTextProperties(), $open); } $open = XMLUtil::getElementOpenTag('style:table-cell-properties', $xmlCode); if (!empty($open)) { $attrs += $style->importODTStyleInternal(self::$table_cell_fields, $open); } // If style has no meaningfull content then throw it away if ($attrs == 0) { return NULL; } return $style; }