Kaydet (Commit) d16070a3 authored tarafından Maarten Bosmans's avatar Maarten Bosmans Kaydeden (comit) Markus Mohrhard

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/28509Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst 9876ffe9
...@@ -371,6 +371,10 @@ void SheetDataBuffer::addColXfStyle( sal_Int32 nXfId, sal_Int32 nFormatId, const ...@@ -371,6 +371,10 @@ void SheetDataBuffer::addColXfStyle( sal_Int32 nXfId, sal_Int32 nFormatId, const
else else
{ {
RowStyles& rRowStyles = maStylesPerColumn[ nCol ]; 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 // If the rowrange style includes rows already
// allocated to a style then we need to split // allocated to a style then we need to split
// the range style Rows into sections ( to // the range style Rows into sections ( to
...@@ -407,6 +411,8 @@ void SheetDataBuffer::addColXfStyle( sal_Int32 nXfId, sal_Int32 nFormatId, const ...@@ -407,6 +411,8 @@ void SheetDataBuffer::addColXfStyle( sal_Int32 nXfId, sal_Int32 nFormatId, const
aRangeRowsSplits.push_back( aSplit ); 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_it = aRangeRowsSplits.begin();
std::vector< RowRangeStyle >::iterator splits_end = aRangeRowsSplits.end(); std::vector< RowRangeStyle >::iterator splits_end = aRangeRowsSplits.end();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment