diff --git a/sc/source/filter/xml/cachedattraccess.cxx b/sc/source/filter/xml/cachedattraccess.cxx index 334e154b2f13..288c996aebf2 100644 --- a/sc/source/filter/xml/cachedattraccess.cxx +++ b/sc/source/filter/xml/cachedattraccess.cxx @@ -21,7 +21,7 @@ bool ScXMLCachedRowAttrAccess::Cache::hasCache(sal_Int32 nTab, sal_Int32 nRow) c ScXMLCachedRowAttrAccess::ScXMLCachedRowAttrAccess(ScDocument* pDoc) : mpDoc(pDoc) {} -bool ScXMLCachedRowAttrAccess::rowHidden(sal_Int32 nTab, sal_Int32 nRow) +bool ScXMLCachedRowAttrAccess::rowHidden(sal_Int32 nTab, sal_Int32 nRow, sal_Int32& nEndRow) { if (!maHidden.hasCache(nTab, nRow)) { @@ -31,10 +31,12 @@ bool ScXMLCachedRowAttrAccess::rowHidden(sal_Int32 nTab, sal_Int32 nRow) maHidden.mnRow1 = static_cast(nRow1); maHidden.mnRow2 = static_cast(nRow2); } + + nEndRow = maHidden.mnRow2; return maHidden.mbValue; } -bool ScXMLCachedRowAttrAccess::rowFiltered(sal_Int32 nTab, sal_Int32 nRow) +bool ScXMLCachedRowAttrAccess::rowFiltered(sal_Int32 nTab, sal_Int32 nRow, sal_Int32& nEndRow) { if (!maFiltered.hasCache(nTab, nRow)) { @@ -44,6 +46,7 @@ bool ScXMLCachedRowAttrAccess::rowFiltered(sal_Int32 nTab, sal_Int32 nRow) maFiltered.mnRow1 = static_cast(nRow1); maFiltered.mnRow2 = static_cast(nRow2); } + nEndRow = maFiltered.mnRow2; return maFiltered.mbValue; } diff --git a/sc/source/filter/xml/cachedattraccess.hxx b/sc/source/filter/xml/cachedattraccess.hxx index 6556617d9080..ce07299e729d 100644 --- a/sc/source/filter/xml/cachedattraccess.hxx +++ b/sc/source/filter/xml/cachedattraccess.hxx @@ -34,8 +34,8 @@ class ScXMLCachedRowAttrAccess public: explicit ScXMLCachedRowAttrAccess(ScDocument* pDoc); - bool rowHidden(sal_Int32 nTab, sal_Int32 nRow); - bool rowFiltered(sal_Int32 nTab, sal_Int32 nRow); + bool rowHidden(sal_Int32 nTab, sal_Int32 nRow, sal_Int32& nEndRow); + bool rowFiltered(sal_Int32 nTab, sal_Int32 nRow, sal_Int32& nEndRow); private: Cache maHidden; Cache maFiltered; diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index d8b855f929b0..58464e015a78 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -1429,6 +1429,8 @@ void ScXMLExport::OpenRow(const sal_Int32 nTable, const sal_Int32 nStartRow, con bool bFiltered = false; sal_Int32 nEqualRows(1); sal_Int32 nEndRow(nStartRow + nRepeatRow); + sal_Int32 nEndRowHidden = nStartRow - 1; + sal_Int32 nEndRowFiltered = nStartRow - 1; sal_Int32 nRow; for (nRow = nStartRow; nRow < nEndRow; ++nRow) { @@ -1437,17 +1439,22 @@ void ScXMLExport::OpenRow(const sal_Int32 nTable, const sal_Int32 nStartRow, con nPrevIndex = pRowStyles->GetStyleNameIndex(nTable, nRow); if (pDoc) { - bPrevHidden = rRowAttr.rowHidden(nTable, nRow); - bPrevFiltered = rRowAttr.rowFiltered(nTable, nRow); + if (nRow > nEndRowHidden) + bPrevHidden = rRowAttr.rowHidden(nTable, nRow, nEndRowHidden); + if (nRow > nEndRowFiltered) + bPrevFiltered = rRowAttr.rowFiltered(nTable, nRow, nEndRowFiltered); } + } else { nIndex = pRowStyles->GetStyleNameIndex(nTable, nRow); if (pDoc) { - bHidden = rRowAttr.rowHidden(nTable, nRow); - bFiltered = rRowAttr.rowFiltered(nTable, nRow); + if (nRow > nEndRowHidden) + bHidden = rRowAttr.rowHidden(nTable, nRow, nEndRowHidden); + if (nRow > nEndRowFiltered) + bFiltered = rRowAttr.rowFiltered(nTable, nRow, nEndRowFiltered); } if (nIndex == nPrevIndex && bHidden == bPrevHidden && bFiltered == bPrevFiltered && !(bHasRowHeader && ((nRow == aRowHeaderRange.StartRow) || (nRow - 1 == aRowHeaderRange.EndRow))) && @@ -1481,8 +1488,10 @@ void ScXMLExport::OpenRow(const sal_Int32 nTable, const sal_Int32 nStartRow, con bool bFiltered = false; if (pDoc) { - bHidden = rRowAttr.rowHidden(nTable, nStartRow); - bFiltered = rRowAttr.rowFiltered(nTable, nStartRow); + sal_Int32 nEndRowHidden; + sal_Int32 nEndRowFiltered; + bHidden = rRowAttr.rowHidden(nTable, nStartRow, nEndRowHidden); + bFiltered = rRowAttr.rowFiltered(nTable, nStartRow, nEndRowFiltered); } OpenNewRow(nIndex, nStartRow, 1, bHidden, bFiltered); }