sc/inc/column.hxx | 5 + sc/qa/unit/data/xlsx/too-many-cols-rows.xlsx |binary sc/qa/unit/subsequent_filters_test2.cxx | 6 ++ sc/source/core/data/column.cxx | 4 - sc/source/core/data/document.cxx | 18 +++--- sc/source/core/data/table2.cxx | 5 - sc/source/core/data/table3.cxx | 6 ++ sc/source/core/data/table4.cxx | 1 sc/source/filter/oox/excelfilter.cxx | 74 ++++--------------------- sc/source/filter/xml/XMLStylesExportHelper.cxx | 1 sc/source/ui/view/viewdata.cxx | 8 ++ 11 files changed, 51 insertions(+), 77 deletions(-)
New commits: commit b22d37182ff6c7fd9a40aec8f412760cb440bbaa Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Tue Apr 12 13:01:13 2022 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Thu Apr 14 13:12:32 2022 +0200 compress row height calculation (tdf#148492) Change-Id: I42346472485f00bd64d08d2e2d0aef0ec02423f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132897 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 76ec80c44ac2..62bdca38a3e4 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -2994,8 +2994,14 @@ void ScViewData::RecalcPixPos() // after zoom changes tools::Long nPixPosY = 0; SCROW nPosY = pThisTab->nPosY[eWhich]; + tools::Long nRowHeight = -1; + SCROW nLastSameHeightRow = -1; for (SCROW j=0; j<nPosY; j++) - nPixPosY -= ToPixel(mrDoc.GetRowHeight(j, nTabNo), nPPTY); + { + if(nLastSameHeightRow < j) + nRowHeight = ToPixel(mrDoc.GetRowHeight(j, nTabNo, nullptr, &nLastSameHeightRow), nPPTY); + nPixPosY -= nRowHeight; + } pThisTab->nPixPosY[eWhich] = nPixPosY; } } commit 62a80bf2cd2b876989e39b535710f017b8250f86 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Wed Mar 30 12:00:25 2022 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Thu Apr 14 13:12:23 2022 +0200 don't clamp columns to allocated ones for flags Flags and attributes can be set even for unallocated columns. Change-Id: I7c4e6b9c8f9359620f6c2ab06fe0563183b88f9a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132304 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index bc5a523ebffe..415507f313e1 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -2640,8 +2640,6 @@ bool ScTable::IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, *pOnlyNotBecauseOfMatrix = false; return false; } - nCol1 = ClampToAllocatedColumns(nCol1); - nCol2 = ClampToAllocatedColumns(nCol2); bool bIsEditable = true; if ( nLockCount ) commit 0de230a0a3edf64402cdeda379fd039fccda2462 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Wed Mar 23 11:48:09 2022 +0100 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Thu Apr 14 13:12:15 2022 +0200 handle xlsx with too large sheets the same way as e.g. ods The generic approach sets an error code on import and then SfxBaseModel::handleLoadError() takes care of it. This also allows checking for the warning in unittests. A drawback is that this generic approach can handle only one error code, so if a sheets has too many rows and column, there will be only one warning, but I consider that to be minor. Change-Id: I1d5f7f9162ef63c3c2e8414823d18a1ff50ad71e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131970 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sc/qa/unit/data/xlsx/too-many-cols-rows.xlsx b/sc/qa/unit/data/xlsx/too-many-cols-rows.xlsx new file mode 100644 index 000000000000..45ef9a11f5e8 Binary files /dev/null and b/sc/qa/unit/data/xlsx/too-many-cols-rows.xlsx differ diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx index 70466d7816c8..ead6c8da4070 100644 --- a/sc/qa/unit/subsequent_filters_test2.cxx +++ b/sc/qa/unit/subsequent_filters_test2.cxx @@ -3061,6 +3061,12 @@ void ScFiltersTest2::testTooManyColsRows() CPPUNIT_ASSERT(xDocSh->GetErrorCode() == SCWARN_IMPORT_ROW_OVERFLOW || xDocSh->GetErrorCode() == SCWARN_IMPORT_COLUMN_OVERFLOW); xDocSh->DoClose(); + + xDocSh = loadDoc(u"too-many-cols-rows.", FORMAT_XLSX); + CPPUNIT_ASSERT(xDocSh.is()); + CPPUNIT_ASSERT(xDocSh->GetErrorCode() == SCWARN_IMPORT_ROW_OVERFLOW + || xDocSh->GetErrorCode() == SCWARN_IMPORT_COLUMN_OVERFLOW); + xDocSh->DoClose(); } CPPUNIT_TEST_SUITE_REGISTRATION(ScFiltersTest2); diff --git a/sc/source/filter/oox/excelfilter.cxx b/sc/source/filter/oox/excelfilter.cxx index e5815200e063..e73e0204c50f 100644 --- a/sc/source/filter/oox/excelfilter.cxx +++ b/sc/source/filter/oox/excelfilter.cxx @@ -33,11 +33,6 @@ #include <document.hxx> #include <docsh.hxx> #include <scerrors.hxx> -#include <vcl/svapp.hxx> -#include <vcl/weld.hxx> -#include <svtools/sfxecode.hxx> -#include <svtools/ehdl.hxx> -#include <tools/urlobj.hxx> #include <tools/diagnose_ex.h> namespace oox::xls { @@ -108,66 +103,23 @@ bool ExcelFilter::importDocument() WorkbookGlobalsRef xBookGlob(WorkbookHelper::constructGlobals(*this)); if (xBookGlob) { - rtl::Reference<FragmentHandler> xWorkbookFragment( new WorkbookFragment(*xBookGlob, aWorkbookPath)); + rtl::Reference<WorkbookFragment> xWorkbookFragment( new WorkbookFragment(*xBookGlob, aWorkbookPath)); - const WorkbookFragment* pWF = static_cast<const WorkbookFragment*>(xWorkbookFragment.get()); - const ScDocument& rDoc = pWF->getScDocument(); - if (ScDocShell* pDocSh = static_cast<ScDocShell*>(rDoc.GetDocumentShell())) - pDocSh->SetInitialLinkUpdate( pDocSh->GetMedium()); + ScDocument& rDoc = xWorkbookFragment->getScDocument(); + ScDocShell* pDocSh = static_cast<ScDocShell*>(rDoc.GetDocumentShell()); + assert( pDocSh ); + pDocSh->SetInitialLinkUpdate( pDocSh->GetMedium()); bool bRet = importFragment( xWorkbookFragment); - if (bRet) + if (bRet && !pDocSh->GetErrorCode()) { - const AddressConverter& rAC = pWF->getAddressConverter(); - if (rAC.isTabOverflow() || rAC.isColOverflow() || rAC.isRowOverflow()) - { - if (rDoc.IsUserInteractionEnabled()) - { - // Show data loss warning. - - INetURLObject aURL( getFileUrl()); - SfxErrorContext aContext( ERRCTX_SFX_OPENDOC, - aURL.getName( INetURLObject::LAST_SEGMENT, true, - INetURLObject::DecodeMechanism::WithCharset), - nullptr, RID_ERRCTX); - - OUString aWarning; - aContext.GetString( ERRCODE_NONE.MakeWarning(), aWarning); - aWarning += ":\n"; - - OUString aMsg; - if (rAC.isTabOverflow()) - { - if (ErrorHandler::GetErrorString( SCWARN_IMPORT_SHEET_OVERFLOW, aMsg)) - aWarning += aMsg; - } - if (rAC.isColOverflow()) - { - if (!aMsg.isEmpty()) - aWarning += "\n"; - if (ErrorHandler::GetErrorString( SCWARN_IMPORT_COLUMN_OVERFLOW, aMsg)) - aWarning += aMsg; - } - if (rAC.isRowOverflow()) - { - if (!aMsg.isEmpty()) - aWarning += "\n"; - if (ErrorHandler::GetErrorString( SCWARN_IMPORT_ROW_OVERFLOW, aMsg)) - aWarning += aMsg; - } - - /* XXX displaying a dialog here is ugly and should - * rather happen at UI level instead of at the filter - * level, but it seems there's no way to transport - * detailed information other than returning true or - * false at this point? */ - - std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(ScDocShell::GetActiveDialogParent(), - VclMessageType::Warning, VclButtonsType::Ok, - aWarning)); - xWarn->run(); - } - } + const AddressConverter& rAC = xWorkbookFragment->getAddressConverter(); + if (rAC.isTabOverflow()) + pDocSh->SetError(SCWARN_IMPORT_SHEET_OVERFLOW); + else if (rAC.isColOverflow()) + pDocSh->SetError(SCWARN_IMPORT_COLUMN_OVERFLOW); + else if (rAC.isRowOverflow()) + pDocSh->SetError(SCWARN_IMPORT_ROW_OVERFLOW); } return bRet; } commit ba45318c942a0ed399d23b20bf82d7bd0ffa45ea Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Tue Mar 29 20:44:10 2022 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Thu Apr 14 13:12:04 2022 +0200 allocate columns for initDataRows() Triggered by TestSort::testSortImages() with INITIALCOLCOUNT set to 1. Change-Id: Ifd3e63de6411e0a4d8776ed6cc8a7b6c7c64eec6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132283 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 8c48f705d1be..3508c183e85f 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -476,6 +476,7 @@ std::unique_ptr<ScSortInfoArray> ScTable::CreateSortInfoArray( const sc::Reorder pArray->SetKeepQuery(rParam.mbHiddenFiltered); pArray->SetUpdateRefs(rParam.mbUpdateRefs); + CreateColumnIfNotExists(nCol2); initDataRows( *pArray, *this, aCol, nCol1, nRow1, nCol2, nRow2, rParam.mbHiddenFiltered, rParam.maDataAreaExtras.mbCellFormats, true, true, false); } @@ -519,6 +520,7 @@ std::unique_ptr<ScSortInfoArray> ScTable::CreateSortInfoArray( } } + CreateColumnIfNotExists(rSortParam.nCol2); initDataRows( *pArray, *this, aCol, rSortParam.nCol1, nInd1, rSortParam.nCol2, nInd2, bKeepQuery, rSortParam.aDataAreaExtras.mbCellFormats, true, true, false); } @@ -906,6 +908,7 @@ void ScTable::SortReorderAreaExtrasByRow( ScSortInfoArray* pArray, for (SCCOL nCol = rDataAreaExtras.mnStartCol; nCol < nDataCol1; nCol += nChunkCols) { const SCCOL nEndCol = std::min<SCCOL>( nCol + nChunkCols - 1, nDataCol1 - 1); + CreateColumnIfNotExists(nEndCol); initDataRows( *pArray, *this, aCol, nCol, nRow1, nEndCol, nLastRow, false, rDataAreaExtras.mbCellFormats, rDataAreaExtras.mbCellNotes, rDataAreaExtras.mbCellDrawObjects, true); SortReorderByRow( pArray, nCol, nEndCol, pProgress, true); @@ -914,6 +917,7 @@ void ScTable::SortReorderAreaExtrasByRow( ScSortInfoArray* pArray, for (SCCOL nCol = nDataCol2 + 1; nCol <= rDataAreaExtras.mnEndCol; nCol += nChunkCols) { const SCCOL nEndCol = std::min<SCCOL>( nCol + nChunkCols - 1, rDataAreaExtras.mnEndCol); + CreateColumnIfNotExists(nEndCol); initDataRows( *pArray, *this, aCol, nCol, nRow1, nEndCol, nLastRow, false, rDataAreaExtras.mbCellFormats, rDataAreaExtras.mbCellNotes, rDataAreaExtras.mbCellDrawObjects, true); SortReorderByRow( pArray, nCol, nEndCol, pProgress, true); commit 505f3ff47e5ec5063da69a1a894ef0040c8ae9b1 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Tue Mar 29 20:11:30 2022 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Thu Apr 14 13:11:55 2022 +0200 use ScTable::ColumnData() in ScDocument::ExtendOverlapped() Otherwise there's invalid array access triggered by VBAMacroTest::testVba() with INITIALCOLCOUNT set to 1. Change-Id: Iaff333788d2d29444139c99b0f6e82b69a5a2d84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132282 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 941b8ade54ca..0ee24ea0ab8c 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -5543,25 +5543,25 @@ void ScDocument::ExtendOverlapped( SCCOL& rStartCol, SCROW& rStartRow, //TODO: pass on ? - ScAttrArray* pAttrArray = maTabs[nTab]->aCol[nOldCol].pAttrArray.get(); + const ScAttrArray& pAttrArray = maTabs[nTab]->ColumnData(nOldCol).AttrArray(); SCSIZE nIndex; - if ( pAttrArray->Count() ) - pAttrArray->Search( nOldRow, nIndex ); + if ( pAttrArray.Count() ) + pAttrArray.Search( nOldRow, nIndex ); else nIndex = 0; SCROW nAttrPos = nOldRow; while (nAttrPos<=nEndRow) { - OSL_ENSURE( nIndex < pAttrArray->Count(), "Wrong index in AttrArray" ); + OSL_ENSURE( nIndex < pAttrArray.Count(), "Wrong index in AttrArray" ); bool bHorOverlapped; - if ( pAttrArray->Count() ) - bHorOverlapped = pAttrArray->mvData[nIndex].pPattern->GetItem(ATTR_MERGE_FLAG).IsHorOverlapped(); + if ( pAttrArray.Count() ) + bHorOverlapped = pAttrArray.mvData[nIndex].pPattern->GetItem(ATTR_MERGE_FLAG).IsHorOverlapped(); else bHorOverlapped = GetDefPattern()->GetItem(ATTR_MERGE_FLAG).IsHorOverlapped(); if ( bHorOverlapped ) { - SCROW nEndRowSeg = (pAttrArray->Count()) ? pAttrArray->mvData[nIndex].nEndRow : MaxRow(); + SCROW nEndRowSeg = (pAttrArray.Count()) ? pAttrArray.mvData[nIndex].nEndRow : MaxRow(); SCROW nLoopEndRow = std::min( nEndRow, nEndRowSeg ); for (SCROW nAttrRow = nAttrPos; nAttrRow <= nLoopEndRow; nAttrRow++) { @@ -5573,9 +5573,9 @@ void ScDocument::ExtendOverlapped( SCCOL& rStartCol, SCROW& rStartRow, rStartCol = nTempCol; } } - if ( pAttrArray->Count() ) + if ( pAttrArray.Count() ) { - nAttrPos = pAttrArray->mvData[nIndex].nEndRow + 1; + nAttrPos = pAttrArray.mvData[nIndex].nEndRow + 1; ++nIndex; } else commit 2baf91e9307f2cc2a0342976cea96c41a701dc64 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Tue Mar 29 19:59:01 2022 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Thu Apr 14 13:11:48 2022 +0200 allocate columns in ScTable::Compare() This gets triggered by ScCellRangeObj::testSortOOB() if INITIALCOLCOUNT is set to 1. Change-Id: I4d9715e89403072b312c0002a43c67ac59960d1a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132281 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 3f26d58a02fc..8c48f705d1be 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -1736,6 +1736,7 @@ short ScTable::Compare(SCCOLROW nIndex1, SCCOLROW nIndex2) const do { SCCOL nCol = static_cast<SCCOL>(aSortParam.maKeyState[nSort].nField); + CreateColumnIfNotExists(nCol); ScRefCellValue aCell1 = aCol[nCol].GetCellValue(nIndex1); ScRefCellValue aCell2 = aCol[nCol].GetCellValue(nIndex2); nRes = CompareCell(nSort, aCell1, nCol, nIndex1, aCell2, nCol, nIndex2); @@ -1743,6 +1744,7 @@ short ScTable::Compare(SCCOLROW nIndex1, SCCOLROW nIndex2) const } else { + CreateColumnIfNotExists(std::max(nIndex1, nIndex2)); do { SCROW nRow = aSortParam.maKeyState[nSort].nField; commit e7d1a46a9b68ed9a8668d6c737fde9f3c188b5af Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Tue Mar 29 14:23:24 2022 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Thu Apr 14 13:11:40 2022 +0200 allocate column in ScTable::FillSeries() when needed There's an assert triggered by Test::testAutoFill() if INITIALCOLCOUNT is set to 1. Change-Id: I65ecd7df3bf6b38a8121a252f7f53dd7f5bbb0fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132270 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 43df3aef3220..93d38c9e3ec4 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -2403,6 +2403,7 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bOverflow = isOverflow( nVal, nMaxValue, nStepValue, nStartVal, eFillCmd); } + CreateColumnIfNotExists(nCol); if (bError) aCol[nCol].SetError(static_cast<SCROW>(nRow), FormulaError::NoValue); else if (!bOverflow && bNonEmpty) commit d37a99b7a4fdb7d896e52e3fd5c438647fa8552a Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Tue Mar 29 12:47:27 2022 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Thu Apr 14 13:11:32 2022 +0200 avoid repeated calls to ScMarkData::GetMarkedRanges() (tdf#148147) ScTable::HasSelectionMatrixFragment() gets called several times when opening 'Sheet' in the menubar, and the functions it calls end up a quadratic cost for the number of columns repeatedly calling ScMarkData::GetMarkedRanges() for the same object. Fix the performance problem by getting the value once and reusing it. Change-Id: I8b05475832c3560318c43429c3b9323035a3691f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132267 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 1361ba514f2e..fd1b42a0f81b 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -302,7 +302,10 @@ public: SCSIZE VisibleCount( SCROW nStartRow, SCROW nEndRow ) const; sc::MatrixEdge GetBlockMatrixEdges(SCROW nRow1, SCROW nRow2, sc::MatrixEdge nMask, bool bNoMatrixAtAll ) const; - bool HasSelectionMatrixFragment(const ScMarkData& rMark) const; + // Repeated calls to HasSelectionMatrixFragment() repeatedly call rMark.GetMarkedRanges(), + // which may be quite slow. For that reason first save the result of rMark.GetMarkedRanges() + // pass that to HasSelectionMatrixFragment() calls. + bool HasSelectionMatrixFragment(const ScMarkData& rMark, const ScRangeList& rRangeList) const; bool GetFirstVisibleAttr( SCROW& rFirstRow ) const; bool GetLastVisibleAttr( SCROW& rLastRow ) const; diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 94c83f002dfe..c98ef7ef3de1 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -189,7 +189,7 @@ sc::MatrixEdge ScColumn::GetBlockMatrixEdges( SCROW nRow1, SCROW nRow2, sc::Matr return nEdges; } -bool ScColumn::HasSelectionMatrixFragment(const ScMarkData& rMark) const +bool ScColumn::HasSelectionMatrixFragment(const ScMarkData& rMark, const ScRangeList& rRangeList) const { using namespace sc; @@ -200,7 +200,7 @@ bool ScColumn::HasSelectionMatrixFragment(const ScMarkData& rMark) const ScAddress aCurOrigin = aOrigin; bool bOpen = false; - ScRangeList aRanges = rMark.GetMarkedRanges(); + ScRangeList aRanges = rRangeList; // cached rMark.GetMarkedRanges(), for performance reasons (tdf#148147) for (size_t i = 0, n = aRanges.size(); i < n; ++i) { const ScRange& r = aRanges[i]; diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 023e853ecdc4..bc5a523ebffe 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -2615,13 +2615,14 @@ bool ScTable::HasBlockMatrixFragment( const SCCOL nCol1, SCROW nRow1, const SCCO bool ScTable::HasSelectionMatrixFragment( const ScMarkData& rMark ) const { std::vector<sc::ColRowSpan> aSpans = rMark.GetMarkedColSpans(); + ScRangeList rangeList = rMark.GetMarkedRanges(); for (const sc::ColRowSpan & aSpan : aSpans) { SCCOL nEndCol = ClampToAllocatedColumns(aSpan.mnEnd); for ( SCCOLROW j=aSpan.mnStart; j<=nEndCol; j++ ) { - if ( aCol[j].HasSelectionMatrixFragment(rMark) ) + if ( aCol[j].HasSelectionMatrixFragment(rMark, rangeList) ) return true; } } commit 87607885b027475d4107b9cfaa53a88df573fef1 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Mon Mar 28 13:24:14 2022 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Thu Apr 14 13:11:25 2022 +0200 initialize output parameter of ScFormatRangeStyles::GetStyleNameIndex() ScMyDefaultStyles::FillDefaultStyles() calls this in a loop and compares with previous. Change-Id: Iba3420023e16c3091f4695640251a5525b28f467 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132199 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx index a03f73fdd1a1..0428f53af57b 100644 --- a/sc/source/filter/xml/XMLStylesExportHelper.cxx +++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx @@ -763,6 +763,7 @@ sal_Int32 ScFormatRangeStyles::GetStyleNameIndex(const sal_Int32 nTable, const sal_Int32 nColumn, const sal_Int32 nRow, bool& bIsAutoStyle) const { OSL_ENSURE(o3tl::make_unsigned(nTable) < aTables.size(), "wrong table"); + bIsAutoStyle = false; if (o3tl::make_unsigned(nTable) >= aTables.size()) return -1; for (const ScMyFormatRange & rFormatRange : aTables[nTable])