Related: tdf#100709 Fix two bugs in SheetDataBuffer::addColXfStyle

The addColXfStyle method is supposed to add a formatId to all the cells in a
specified CellRange where there is no previously set formatId in the
maStylesPerColumn member variable.

There where two bugs in this function:
 - If there is overlap between the row ranges already in maStylesPerColumnBB and
   the given RowRange, it should be updated to only cover non-overlapping cells.
 - In the case when the given CellRange spans multiple columns, the RowRange
   should be applied to all these columns.  When the row range given to this
   method is changed because of earlier set RowRanges in
   maStylesPerColumn[nCol], the RowRange was not reset to the given method
   argument for a new column.

Change-Id: I4244c4303ca983801c5116cbd26971dd641411ab
Reviewed-on: https://gerrit.libreoffice.org/28509
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
This commit is contained in:
Maarten Bosmans
2016-08-25 12:47:26 +02:00
committed by Markus Mohrhard
parent 9876ffe934
commit d16070a30d

View File

@@ -371,6 +371,10 @@ void SheetDataBuffer::addColXfStyle( sal_Int32 nXfId, sal_Int32 nFormatId, const
else
{
RowStyles& rRowStyles = maStylesPerColumn[ nCol ];
// Reset row range for each column
aStyleRows.mnStartRow = rAddress.StartRow;
aStyleRows.mnEndRow = rAddress.EndRow;
// If the rowrange style includes rows already
// allocated to a style then we need to split
// the range style Rows into sections ( to
@@ -407,6 +411,8 @@ void SheetDataBuffer::addColXfStyle( sal_Int32 nXfId, sal_Int32 nFormatId, const
aRangeRowsSplits.push_back( aSplit );
}
}
if ( aStyleRows.mnStartRow <= r.mnEndRow && r.mnEndRow < aStyleRows.mnEndRow )
aStyleRows.mnStartRow = r.mnEndRow + 1;
}
std::vector< RowRangeStyle >::iterator splits_it = aRangeRowsSplits.begin();
std::vector< RowRangeStyle >::iterator splits_end = aRangeRowsSplits.end();