'; // Font definitions. May not be present if in template mode, in which case they will be added to styles.xml var $fonts = array( "StarSymbol"=>'', // for bullets "Bitstream Vera Sans Mono"=>'', // for source code ); /** * @param null $source */ public function import($source=NULL) { $auto_styles_ret = parent::importFromODT($this->automatic, 'office:automatic-styles'); $styles_ret = parent::importFromODTFile(DOKU_INC.'lib/plugins/odt/styles.xml', 'office:styles'); $master_styles_ret = parent::importFromODTFile(DOKU_INC.'lib/plugins/odt/styles.xml', 'office:master-styles'); if (!$auto_styles_ret || !$styles_ret || !$master_styles_ret) { return false; } return true; } /** * @param null $destination */ public function export($root_element) { return parent::exportToODT($root_element); } /** * Return style name for queired basic style $style. * * The class simply returns the corresponding style names * used in styles.xml. * * @param string $style * @return null|string */ public function getStyleName($style) { switch ($style) { case 'standard': return 'Standard'; case 'body': return 'Text_20_body'; case 'heading1': return 'Heading_20_1'; case 'heading2': return 'Heading_20_2'; case 'heading3': return 'Heading_20_3'; case 'heading4': return 'Heading_20_4'; case 'heading5': return 'Heading_20_5'; case 'list': return 'List_20_1'; case 'list content': return 'List_20_1_Content'; case 'list first': return 'List_20_1_Content_First'; case 'list last': return 'List_20_1_Content_Last'; case 'numbering': return 'Numbering_20_1'; case 'numbering content': return 'Numbering_20_1_Content'; case 'numbering first': return 'Numbering_20_1_Content_First'; case 'numbering last': return 'Numbering_20_1_Content_Last'; case 'table': return 'Table'; case 'table content': return 'Table_20_Contents'; case 'table heading': return 'Table_20_Heading'; case 'table header': return 'tableheader'; case 'table cell': return 'tablecell'; case 'tablealign center': return 'tablealigncenter'; case 'tablealign right': return 'tablealignright'; case 'tablealign left': return 'tablealignleft'; case 'preformatted': return 'Preformatted_20_Text'; case 'source code': return 'Source_20_Code'; case 'source file': return 'Source_20_File'; case 'horizontal line': return 'Horizontal_20_Line'; case 'footnote': return 'Footnote'; case 'footnote anchor': return 'Footnote_20_Anchor'; case 'footnote characters': return 'Footnote_20_Symbol'; case 'emphasis': return 'Emphasis'; case 'strong': return 'Strong_20_Emphasis'; case 'underline': return 'underline'; case 'sub': return 'sub'; case 'sup': return 'sup'; case 'del': return 'del'; case 'media': return 'media'; case 'media left': return 'medialeft'; case 'media right': return 'mediaright'; case 'media center': return 'mediacenter'; case 'legend center': return 'legendcenter'; case 'graphics': return 'Graphics'; case 'monospace': return 'Source_20_Text'; case 'table quotation1': return 'Table_Quotation1'; case 'table quotation2': return 'Table_Quotation2'; case 'table quotation3': return 'Table_Quotation3'; case 'table quotation4': return 'Table_Quotation4'; case 'table quotation5': return 'Table_Quotation5'; case 'cell quotation1': return 'Cell_Quotation1'; case 'cell quotation2': return 'Cell_Quotation2'; case 'cell quotation3': return 'Cell_Quotation3'; case 'cell quotation4': return 'Cell_Quotation4'; case 'cell quotation5': return 'Cell_Quotation5'; case 'first page': return 'pm1'; case 'internet link': return 'Internet_20_link'; case 'visited internet link': return 'Visited_20_Internet_20_Link'; case 'local link': return 'Local_20_link'; case 'visited local link': return 'Visited_20_Local_20_Link'; case 'contents heading': return 'Contents_20_Heading'; } // Not supported basic style. return NULL; } /** * @param string $filename * @return string */ function getMissingFonts($filename) { $value = ''; $existing_styles = io_readFile($filename); foreach ($this->fonts as $name=>$xml) { if (strpos($existing_styles, 'style:name="'.$name.'"') === FALSE) { $value .= $xml; } } return $value; } }