diff --git a/ChangeLog.txt b/ChangeLog.txt index 32c43b9f..6dfe0729 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,9 @@ +2015-05-07 LarsDW223 + + * Added support for multi column frames (to provide it to the wrap plugin). + New functions are: createMultiColumnFrameStyle (stylefactory), _odtOpenMultiColumnFrame, + _odtCloseMultiColumnFrame. + 2015-05-05 LarsDW223 * Bugfix: The function 'adjustValueForODT' did not convert the color name 'black' to '#000000'. This is fixed now. diff --git a/helper/stylefactory.php b/helper/stylefactory.php index c70ba483..9890c498 100644 --- a/helper/stylefactory.php +++ b/helper/stylefactory.php @@ -637,5 +637,60 @@ public static function createTableColumnStyle(&$style, $properties, $disabled_pr return $style_name; } + + /** + * This function creates a frame style for multiple columns, 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'. + * Properties which shall not be used in the style can be disabled by setting the value in disabled_props + * to 1 e.g. $disabled_props ['color'] = 1 would block the usage of the color property. + * + * The currently supported properties are: + * column-count, column-rule, column-gap + * + * The function returns the name of the new style or NULL if all relevant properties are empty. + * + * @author LarsDW223 + */ + public static function createMultiColumnFrameStyle(&$style, $properties, $disabled_props = NULL) { + $attrs = 0; + + if ( empty ($disabled_props ['column-count']) === true ) { + $columns = $properties ['column-count']; + $attrs++; + } + + if ( empty ($disabled_props ['column-rule']) === true ) { + $rule_parts = explode (' ', $properties ['column-rule']); + $attrs++; + } + + if ( empty ($disabled_props ['column-gap']) === true ) { + $gap = $properties ['column-gap']; + $attrs++; + } + + // If all relevant properties are empty or disabled, then there + // are no attributes for our style. Return NULL to indicate 'no style required'. + if ( $attrs == 0 ) { + return NULL; + } + + // Create style name. + $style_name = self::getNewStylename ('Frame'); + + $width = '1000*'; + + $style = ' + + + + + + + +'; + + return $style_name; + } } ?> diff --git a/renderer.php b/renderer.php index 988154ad..0f7216ce 100644 --- a/renderer.php +++ b/renderer.php @@ -2572,6 +2572,43 @@ public function _processCSSClass(&$properties, helper_plugin_odt_cssimport $impo } } } + + /** + * This function opens a multi column frame according to the parameters in $properties. + * See function createMultiColumnFrameStyle of helper class stylefactory.php for more + * information about the supported properties/CSS styles. + * + * @author LarsDW223 + */ + function _odtOpenMultiColumnFrame ($properties) { + // Create style name. + $style_name = $this->factory->createMultiColumnFrameStyle ($style, $properties); + $this->autostyles[$style_name] = $style; + + $width_abs = $this->_getAbsWidthMindMargins (100); + + // Group the frame so that they are stacked one on each other. + $this->p_close(); + $this->doc .= ''; + + // Draw a frame with a text box in it. the text box will be left opened + // to grow with the content (requires fo:min-height in $style_name). + $this->doc .= ''; + $this->doc .= ''; + } + + /** + * This function closes a multi column frame (previously opened with _odtOpenMultiColumnFrame). + * + * @author LarsDW223 + */ + function _odtCloseMultiColumnFrame () { + $this->doc .= ''; + $this->doc .= ''; + + $this->div_z_index -= 5; + } } //Setup VIM: ex: et ts=4 enc=utf-8 :