/** * This function opens a new paragraph using the style as set in the assoziative array $properties. * The parameters in the array should be named as the CSS property names e.g. 'color' or 'background-color'. * The property 'background-image' is emulated by inserting an image manually in the paragraph. * * The currently supported properties are: * background-color, color, font-style, font-weight, font-size, border, font-family, font-variant, letter-spacing, * vertical-align, line-height, background-image (emulated) * * The paragraph must be closed by calling 'p_close'. * * @author LarsDW223 * * @param array $properties */ function _odtParagraphOpenUseProperties($properties) { $disabled = array(); if ($this->in_paragraph) { // opening a paragraph inside another paragraph is illegal return; } $this->in_paragraph = true; $odt_bg = $properties['background-color']; $picture = $properties['background-image']; if (!empty($picture)) { // If a picture/background-image is set, than we insert it manually here. // This is a workaround because ODT background-image works different than in CSS. // Define graphic style for picture $this->style_count++; $style_name = 'odt_auto_style_span_graphic_' . $this->style_count; $image_style = '<style:style style:name="' . $style_name . '" style:family="graphic" style:parent-style-name="' . $this->styleset->getStyleName('graphics') . '"><style:graphic-properties style:vertical-pos="middle" style:vertical-rel="text" style:horizontal-pos="from-left" style:horizontal-rel="paragraph" fo:background-color="' . $odt_bg . '" style:flow-with-text="true"></style:graphic-properties></style:style>'; // Add style and image to our document $this->autostyles[$style_name] = $image_style; $this->_odtAddImage($picture, NULL, NULL, NULL, NULL, $style_name); } // Create the style for the paragraph. $disabled['background-image'] = 1; $style_name = $this->_createParagraphStyle($properties, $disabled); // Open a paragraph $this->doc .= '<text:p text:style-name="' . $style_name . '">'; }
/** * @param null $destination */ public function export($root_element) { return parent::exportToODT($root_element); }