Merge lp:~igudym/openobject-addons/table-styles-addons into lp:openobject-addons/5.0

Proposed by Ivan Gudym
Status: Needs review
Proposed branch: lp:~igudym/openobject-addons/table-styles-addons
Merge into: lp:openobject-addons/5.0
Diff against target: 138 lines (+46/-11)
1 file modified
base_report_designer/wizard/tiny_sxw2rml/normalized_oo2rml.xsl (+46/-11)
To merge this branch: bzr merge lp:~igudym/openobject-addons/table-styles-addons
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+23617@code.launchpad.net

Description of the change

Report engine improvement:
More accurate table cell style - lines before/after, background color
Added column span support.

Needed server support - corresponding branch:
  lp:~igudym/openobject-server/table-styles-server

To post a comment you must log in.

Unmerged revisions

2715. By Ivan Gudym

BlockTable background fixes

2714. By Ivan Gudym

Collumn span added

2713. By Ivan Gudym

Add rowspan support

2712. By Ivan Gudym

Add span support

2711. By Ivan Gudym

Table style fix

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'base_report_designer/wizard/tiny_sxw2rml/normalized_oo2rml.xsl'
--- base_report_designer/wizard/tiny_sxw2rml/normalized_oo2rml.xsl 2009-02-17 11:38:59 +0000
+++ base_report_designer/wizard/tiny_sxw2rml/normalized_oo2rml.xsl 2010-04-17 19:30:31 +0000
@@ -29,6 +29,7 @@
29<xsl:key name="page_break_after" match="style:style[@style:family='paragraph' and ./style:properties/@fo:break-after='page']" use="@style:name" />29<xsl:key name="page_break_after" match="style:style[@style:family='paragraph' and ./style:properties/@fo:break-after='page']" use="@style:name" />
30<xsl:key name="table_column_style" match="style:style[@style:family='table-column']" use="@style:name" />30<xsl:key name="table_column_style" match="style:style[@style:family='table-column']" use="@style:name" />
31<xsl:key name="table_cell_style" match="style:style[@style:family='table-cell']" use="@style:name" />31<xsl:key name="table_cell_style" match="style:style[@style:family='table-cell']" use="@style:name" />
32<xsl:key name="table_row_style" match="style:style[@style:family='table-row']" use="@style:name" />
32<xsl:key name="paragraph_style" match="style:style[@style:family='paragraph']" use="@style:name" />33<xsl:key name="paragraph_style" match="style:style[@style:family='paragraph']" use="@style:name" />
3334
34<xsl:template match="office:document-content">35<xsl:template match="office:document-content">
@@ -134,16 +135,39 @@
134 <blockValign value="TOP" />135 <blockValign value="TOP" />
135 <xsl:call-template name="make_linestyle" />136 <xsl:call-template name="make_linestyle" />
136 <xsl:call-template name="make_tablebackground" />137 <xsl:call-template name="make_tablebackground" />
138 <xsl:call-template name="make_colspan" />
137 </blockTableStyle>139 </blockTableStyle>
138 </xsl:if>140 </xsl:if>
139 </xsl:for-each>141 </xsl:for-each>
140</xsl:template>142</xsl:template>
141143
144<xsl:template name="make_colspan">
145 <xsl:for-each select=".//table:table-row">
146 <xsl:variable name="row" select="position() - 1"/>
147 <xsl:for-each select=".//table:table-cell[@table:number-columns-spanned]">
148 <xsl:variable name="col" select="position() - 1"/>
149 <xsl:variable name="span" select="@table:number-columns-spanned"/>
150 <blockSpan span="{$span}" start="{$col},{$row}" stop="{$col + $span - 1},{$row}"/>
151 </xsl:for-each>
152 </xsl:for-each>
153</xsl:template>
154
155<xsl:template name="get_colspan">
156 <xsl:variable name="span">
157 <xsl:value-of select="@table:number-columns-spanned"/>
158 </xsl:variable>
159 <xsl:if test="not($span='') and not($span='none')"><xsl:value-of select="$span"/></xsl:if>
160 <xsl:if test="($span='') or ($span='none')">1</xsl:if>
161</xsl:template>
162
142<xsl:template name="make_linestyle">163<xsl:template name="make_linestyle">
143 <xsl:for-each select=".//table:table-row">164 <xsl:for-each select=".//table:table-row">
144 <xsl:variable name="row" select="position() - 1"/>165 <xsl:variable name="row" select="position() - 1"/>
145 <xsl:for-each select=".//table:table-cell">166 <xsl:for-each select=".//table:table-cell|table:covered-table-cell">
146 <xsl:variable name="col" select="position() - 1"/>167 <xsl:variable name="col" select="position() - 1"/>
168 <xsl:variable name="span">
169 <xsl:call-template name="get_colspan"/>
170 </xsl:variable>
147 <xsl:variable name="linebefore">171 <xsl:variable name="linebefore">
148 <xsl:value-of select="key('table_cell_style',@table:style-name)/style:properties/@fo:border-left"/>172 <xsl:value-of select="key('table_cell_style',@table:style-name)/style:properties/@fo:border-left"/>
149 </xsl:variable>173 </xsl:variable>
@@ -151,7 +175,7 @@
151 <xsl:variable name="colorname">175 <xsl:variable name="colorname">
152 <xsl:value-of select="substring-after($linebefore,'#')"/>176 <xsl:value-of select="substring-after($linebefore,'#')"/>
153 </xsl:variable>177 </xsl:variable>
154 <lineStyle kind="LINEBEFORE" colorName="#{$colorname}" start="{$col},{$row}" stop="{$col},-1"/>178 <lineStyle kind="LINEBEFORE" colorName="#{$colorname}" start="{$col},{$row}" stop="{$col + $span - 1},{$row}"/>
155 </xsl:if>179 </xsl:if>
156 <xsl:variable name="lineafter">180 <xsl:variable name="lineafter">
157 <xsl:value-of select="key('table_cell_style',@table:style-name)/style:properties/@fo:border-right"/>181 <xsl:value-of select="key('table_cell_style',@table:style-name)/style:properties/@fo:border-right"/>
@@ -160,7 +184,7 @@
160 <xsl:variable name="colorname">184 <xsl:variable name="colorname">
161 <xsl:value-of select="substring-after($lineafter,'#')"/>185 <xsl:value-of select="substring-after($lineafter,'#')"/>
162 </xsl:variable>186 </xsl:variable>
163 <lineStyle kind="LINEAFTER" colorName="#{$colorname}" start="{$col},{$row}" stop="{$col},-1"/>187 <lineStyle kind="LINEAFTER" colorName="#{$colorname}" start="{$col},{$row}" stop="{$col + $span - 1},{$row}"/>
164 </xsl:if>188 </xsl:if>
165 <xsl:variable name="lineabove">189 <xsl:variable name="lineabove">
166 <xsl:value-of select="key('table_cell_style',@table:style-name)/style:properties/@fo:border-top"/>190 <xsl:value-of select="key('table_cell_style',@table:style-name)/style:properties/@fo:border-top"/>
@@ -169,7 +193,7 @@
169 <xsl:variable name="colorname">193 <xsl:variable name="colorname">
170 <xsl:value-of select="substring-after($lineabove,'#')"/>194 <xsl:value-of select="substring-after($lineabove,'#')"/>
171 </xsl:variable>195 </xsl:variable>
172 <lineStyle kind="LINEABOVE" colorName="#{$colorname}" start="{$col},{$row}" stop="{$col},{$row}"/>196 <lineStyle kind="LINEABOVE" colorName="#{$colorname}" start="{$col},{$row}" stop="{$col + $span - 1},{$row}"/>
173 </xsl:if>197 </xsl:if>
174 <xsl:variable name="linebelow">198 <xsl:variable name="linebelow">
175 <xsl:value-of select="key('table_cell_style',@table:style-name)/style:properties/@fo:border-bottom"/>199 <xsl:value-of select="key('table_cell_style',@table:style-name)/style:properties/@fo:border-bottom"/>
@@ -178,7 +202,7 @@
178 <xsl:variable name="colorname">202 <xsl:variable name="colorname">
179 <xsl:value-of select="substring-after($linebelow,'#')"/>203 <xsl:value-of select="substring-after($linebelow,'#')"/>
180 </xsl:variable>204 </xsl:variable>
181 <lineStyle kind="LINEBELOW" colorName="#{$colorname}" start="{$col},{-1}" stop="{$col},{-1}"/>205 <lineStyle kind="LINEBELOW" colorName="#{$colorname}" start="{$col},{$row}" stop="{$col + $span - 1},{$row}"/>
182 </xsl:if>206 </xsl:if>
183 <xsl:variable name="grid">207 <xsl:variable name="grid">
184 <xsl:value-of select="key('table_cell_style',@table:style-name)/style:properties/@fo:border"/>208 <xsl:value-of select="key('table_cell_style',@table:style-name)/style:properties/@fo:border"/>
@@ -188,10 +212,10 @@
188 <xsl:value-of select="substring-after($grid,'#')"/>212 <xsl:value-of select="substring-after($grid,'#')"/>
189 </xsl:variable>213 </xsl:variable>
190 <!-- Don't use grid because we don't need a line between each rows -->214 <!-- Don't use grid because we don't need a line between each rows -->
191 <lineStyle kind="LINEBEFORE" colorName="#{$colorname}" start="{$col},{$row}" stop="{$col},-1"/>215 <lineStyle kind="LINEBEFORE" colorName="#{$colorname}" start="{$col},{$row}" stop="{$col + $span - 1},{$row}"/>
192 <lineStyle kind="LINEAFTER" colorName="#{$colorname}" start="{$col},{$row}" stop="{$col},-1"/>216 <lineStyle kind="LINEAFTER" colorName="#{$colorname}" start="{$col},{$row}" stop="{$col + $span - 1},{$row}"/>
193 <lineStyle kind="LINEABOVE" colorName="#{$colorname}" start="{$col},{$row}" stop="{$col},{$row}"/>217 <lineStyle kind="LINEABOVE" colorName="#{$colorname}" start="{$col},{$row}" stop="{$col + $span - 1},{$row}"/>
194 <lineStyle kind="LINEBELOW" colorName="#{$colorname}" start="{$col},{-1}" stop="{$col},{-1}"/>218 <lineStyle kind="LINEBELOW" colorName="#{$colorname}" start="{$col},{$row}" stop="{$col + $span - 1},{$row}"/>
195 </xsl:if>219 </xsl:if>
196 </xsl:for-each>220 </xsl:for-each>
197 </xsl:for-each>221 </xsl:for-each>
@@ -263,14 +287,21 @@
263 <!--Be careful when there are table:table-header-rows as287 <!--Be careful when there are table:table-header-rows as
264 parent node of table:table-row -->288 parent node of table:table-row -->
265 <xsl:variable name="row" select="position() - 1" />289 <xsl:variable name="row" select="position() - 1" />
266 <xsl:for-each select="./table:table-cell">290 <xsl:variable name="bkground">
291 <xsl:value-of select="key('table_row_style',@table:style-name)/style:properties/@fo:background-color" />
292 </xsl:variable>
293 <xsl:if test="not($bkground='') and boolean(key('table_row_style',@table:style-name)/style:properties/@fo:background-color) and starts-with($bkground,'#')">
294 <!--only RGB hexcolors are accepted -->
295 <blockBackground colorName="{$bkground}" start="0,{$row}" stop="-1,{$row}" />
296 </xsl:if>
297 <xsl:for-each select="./table:table-cell|table:covered-table-cell">
267 <xsl:variable name="col" select="position() - 1" />298 <xsl:variable name="col" select="position() - 1" />
268 <xsl:variable name="background">299 <xsl:variable name="background">
269 <xsl:value-of select="key('table_cell_style',@table:style-name)/style:properties/@fo:background-color" />300 <xsl:value-of select="key('table_cell_style',@table:style-name)/style:properties/@fo:background-color" />
270 </xsl:variable>301 </xsl:variable>
271 <xsl:if test="not($background='') and boolean(key('table_cell_style',@table:style-name)/style:properties/@fo:background-color) and starts-with($background,'#')">302 <xsl:if test="not($background='') and boolean(key('table_cell_style',@table:style-name)/style:properties/@fo:background-color) and starts-with($background,'#')">
272 <!--only RGB hexcolors are accepted -->303 <!--only RGB hexcolors are accepted -->
273 <blockBackground colorName="{$background}" start="{$col},{$row}" stop="{$col},-1" />304 <blockBackground colorName="{$background}" start="{$col},{$row}" stop="{$col},{$row}" />
274 </xsl:if>305 </xsl:if>
275 </xsl:for-each>306 </xsl:for-each>
276 </xsl:for-each>307 </xsl:for-each>
@@ -299,6 +330,10 @@
299 </td>330 </td>
300</xsl:template>331</xsl:template>
301332
333<xsl:template match="table:covered-table-cell">
334 <td/>
335</xsl:template>
336
302<xsl:template match="text:section">337<xsl:template match="text:section">
303 <section>338 <section>
304 <xsl:apply-templates />339 <xsl:apply-templates />