Skip Menu |

This queue is for tickets about the OpenOffice-OODoc CPAN distribution.

Report information
The Basics
Id: 83070
Status: new
Priority: 0/
Queue: OpenOffice-OODoc

People
Owner: Nobody in particular
Requestors: evveelen [...] aimvalley.nl
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: cellSpan not handled correctly in header row
Date: Thu, 31 Jan 2013 14:08:07 +0100
To: bug-OpenOffice-OODoc [...] rt.cpan.org
From: Erik van Veelen <evveelen [...] aimvalley.nl>
L.S. Detected using OODoc-2.125. When setting a cellSpan on cells in a table-header the logic to insert the <table:covered-table-cell>s is incorrect. The cellSpan routine can be called with a row-element inside the table-header (presumably retrieved by a getHeaderRow(). However the loop inside cellSpan will make a call to retrieve the row to insert the covered-cells in by calling getRow(). getRow however ignores the header rows so the covered-cells will then be inserted in some different row. The easiest way to reproduce this is by creating a table with a header and have 1 (or more) cell(s) in the heading with a colspan of 2. This will insert the covered-cells in the 1st non-header row (if that row exists!). I have patched this by replacing the cellSpan() sub with: Show quoted text
> sub cellSpan > { > my $self = shift; > @_ = $self->getTableCell(@_); > my $cell = shift or return undef; > > my $rnum = undef; > my $cnum = undef; > my $table = undef; > > my $old_hspan = $cell->att('table:number-columns-spanned') || 1; > my $old_vspan = $cell->att('table:number-rows-spanned') || 1; > my $hspan = shift; > my $vspan = shift; > unless ($hspan || $vspan) > { > return wantarray ? ($old_hspan, $old_vspan) : $old_hspan; > } > $hspan = $old_hspan unless $hspan; > $vspan = $old_vspan unless $vspan; > > $self->removeCellSpan($cell); > my $row = $cell->parent('table:table-row'); > $table = $row->parent('table:table') unless $table; > my $vpos = $row->getLocalPosition; > my $hpos = $cell->getLocalPosition(qr'table:(covered-|)table-cell'); > my $hend = $hpos + $hspan - 1; > my $vend = $vpos + $vspan - 1; > $cell->setAttribute('table:number-columns-spanned', $hspan); > $cell->setAttribute('table:number-rows-spanned', $vspan); > > my $cr = $row; #<==== ADD: initial current row to the row passed by caller > ROW: for (my $i = $vpos ; $i <= $vend ; $i++) > { > #my $cr = $self->getRow($table, $i) or last ROW; <==== REMOVE: illegal call in header context > CELL: for (my $j = $hpos ; $j <= $hend ; $j++) > { > my $covered = $self->getCell($cr, $j) > or last CELL; > next CELL if $covered == $cell; > > my @paras = $covered->children('text:p'); > while (@paras) > { > my $p = shift @paras; > $p->paste_last_child($cell) if > (defined $p->text && $p->text ge ' '); > } > $self->removeCellSpan($covered); > $covered->set_name('table:covered-table-cell'); > } > $cr = $cr->sibling(1) or last ROW; #<==== ADD: update current row to the next row > } > return wantarray ? ($hspan, $vspan) : $hspan; > } >
This patch does work for horizontal and vertical spans, however it was not tested extensively. Please let me know if more details are needed. Regards, -- Erik van Veelen AimValley B.V. P.O. Box 2194, 1200 CD Hilversum, The Netherlands Tel: +31 35 689 1929, Fax: +31 35 689 1901 AimValley certificate http://www.aimvalley.com/aimvalley-ca-certificate-2007.crt