diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-04-13 12:37:10 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-04-14 05:33:01 +0000 |
commit | 44c1cfc7d8ab7afb1e01ac57d3feeb410ba43748 (patch) | |
tree | 8b635afcd1f20c619625df1c9856b64eafb94ae6 | |
parent | ea6196f0a51d1bf4cd722468406dcc8c64c7435c (diff) |
no need to call rowHidden and rowFiltered repeatedly, tdf#90659
Change-Id: Ie104a0d6c2ee0a88363fb461762e2bcca00976dd
Reviewed-on: https://gerrit.libreoffice.org/24052
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r-- | sc/source/filter/xml/cachedattraccess.cxx | 7 | ||||
-rw-r--r-- | sc/source/filter/xml/cachedattraccess.hxx | 4 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlexprt.cxx | 21 |
3 files changed, 22 insertions, 10 deletions
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<sal_Int32>(nRow1); maHidden.mnRow2 = static_cast<sal_Int32>(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<sal_Int32>(nRow1); maFiltered.mnRow2 = static_cast<sal_Int32>(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); } |