diff options
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/data/xlsx/tdf58243.xlsx | bin | 0 -> 17952 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_export_test2.cxx | 11 | ||||
-rw-r--r-- | sc/source/core/data/attarray.cxx | 9 | ||||
-rw-r--r-- | sc/source/filter/inc/sheetdatabuffer.hxx | 9 | ||||
-rw-r--r-- | sc/source/filter/oox/sheetdatabuffer.cxx | 2 |
5 files changed, 27 insertions, 4 deletions
diff --git a/sc/qa/unit/data/xlsx/tdf58243.xlsx b/sc/qa/unit/data/xlsx/tdf58243.xlsx Binary files differnew file mode 100644 index 000000000000..f95e13b4b6db --- /dev/null +++ b/sc/qa/unit/data/xlsx/tdf58243.xlsx diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index ad3f125db7d9..9776b1629197 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -217,6 +217,7 @@ public: void testTdf145059(); void testTdf130104_XLSXIndent(); void testWholeRowBold(); + void testXlsxRowsOrder(); CPPUNIT_TEST_SUITE(ScExportTest2); @@ -333,6 +334,7 @@ public: CPPUNIT_TEST(testTdf145059); CPPUNIT_TEST(testTdf130104_XLSXIndent); CPPUNIT_TEST(testWholeRowBold); + CPPUNIT_TEST(testXlsxRowsOrder); CPPUNIT_TEST_SUITE_END(); @@ -3113,6 +3115,15 @@ void ScExportTest2::testWholeRowBold() xDocSh3->DoClose(); } +void ScExportTest2::testXlsxRowsOrder() +{ + ScDocShellRef xDocSh = loadDoc(u"tdf58243.", FORMAT_XLSX); + CPPUNIT_ASSERT(xDocSh.is()); + // Make sure code in SheetDataBuffer doesn't assert columns/rows sorting. + ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + xDocSh->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index 5af0e3b3609d..1b84ae4616a5 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -930,6 +930,15 @@ void ScAttrArray::SetAttrEntries(std::vector<ScAttrEntry> && vNewData) pDocPool->Remove(*rEntry.pPattern); mvData = std::move(vNewData); + +#ifdef DBG_UTIL + SCROW lastEndRow = -1; + for(const auto& entry : mvData) + { // Verify that the data is not corrupted. + assert(entry.nEndRow > lastEndRow); + lastEndRow = entry.nEndRow; + } +#endif } static void lcl_MergeDeep( SfxItemSet& rMergeSet, const SfxItemSet& rSource ) diff --git a/sc/source/filter/inc/sheetdatabuffer.hxx b/sc/source/filter/inc/sheetdatabuffer.hxx index 33366fde9f9e..8eee9f7b79b0 100644 --- a/sc/source/filter/inc/sheetdatabuffer.hxx +++ b/sc/source/filter/inc/sheetdatabuffer.hxx @@ -199,14 +199,19 @@ private: { bool operator() (const RowRangeStyle& lhs, const RowRangeStyle& rhs) const { - return lhs.mnStartRow<rhs.mnStartRow; + // This end-vs-start comparison is needed by the lower_bound() use + // in SheetDataBuffer::addColXfStyleProcessRowRanges() that searches + // for partially overlapping ranges. In all other places the ranges + // should be non-overlapping, in which case this is the same as the "normal" + // comparison. + return lhs.mnEndRow<rhs.mnStartRow; } }; struct StyleRowRangeCompEqual { bool operator() (const RowRangeStyle& lhs, const RowRangeStyle& rhs) const { - return lhs.mnStartRow==rhs.mnStartRow; + return lhs.mnStartRow==rhs.mnStartRow && lhs.mnEndRow == rhs.mnEndRow; } }; typedef ::o3tl::sorted_vector< RowRangeStyle, StyleRowRangeComp > RowStyles; diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx index 6dbec9e6bd9d..259e3190107b 100644 --- a/sc/source/filter/oox/sheetdatabuffer.cxx +++ b/sc/source/filter/oox/sheetdatabuffer.cxx @@ -409,8 +409,6 @@ void SheetDataBuffer::addColXfStyleProcessRowRanges() RowRangeStyle aStyleRows; aStyleRows.mnNumFmt.first = nXfId; aStyleRows.mnNumFmt.second = -1; - aStyleRows.mnStartRow = rRange.mnFirst; - aStyleRows.mnEndRow = rRange.mnLast; // Reset row range for each column aStyleRows.mnStartRow = rRange.mnFirst; |