summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/segmenttree.hxx1
-rw-r--r--sc/source/core/data/segmenttree.cxx5
-rw-r--r--sc/source/core/data/table2.cxx12
-rw-r--r--sc/source/core/data/table3.cxx4
4 files changed, 17 insertions, 5 deletions
diff --git a/sc/inc/segmenttree.hxx b/sc/inc/segmenttree.hxx
index f46e87373dbc..e20c531b685a 100644
--- a/sc/inc/segmenttree.hxx
+++ b/sc/inc/segmenttree.hxx
@@ -83,6 +83,7 @@ public:
void insertSegment(SCROW nRow, SCROW nSize, bool bSkipStartBoundary);
void enableTreeSearch(bool bEnable);
+ void setInsertFromBack(bool bInsertFromBack);
SCROW findLastNotOf(bool bValue) const;
private:
diff --git a/sc/source/core/data/segmenttree.cxx b/sc/source/core/data/segmenttree.cxx
index 9d302844cbe5..16e8d9f4560f 100644
--- a/sc/source/core/data/segmenttree.cxx
+++ b/sc/source/core/data/segmenttree.cxx
@@ -413,6 +413,11 @@ void ScFlatBoolRowSegments::enableTreeSearch(bool bEnable)
mpImpl->enableTreeSearch(bEnable);
}
+void ScFlatBoolRowSegments::setInsertFromBack(bool bEnable)
+{
+ mpImpl->setInsertFromBack(bEnable);
+}
+
SCROW ScFlatBoolRowSegments::findLastNotOf(bool bValue) const
{
return static_cast<SCROW>(mpImpl->findLastNotOf(bValue));
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 1ec0a09c345d..fc8dc0705ca5 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -781,8 +781,12 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
std::vector<ScShowRowsEntry> aEntries;
for (SCROW i = nRow1; i <= nRow2; ++i)
{
- SCROW nLastRow;
- bool bHidden = RowHidden(i, NULL, &nLastRow);
+ SCROW nThisLastRow, nDestLastRow;
+ bool bThisHidden = RowHidden(i, NULL, &nThisLastRow);
+ bool bDestHidden = pDestTab->RowHidden(i, NULL, &nDestLastRow);
+
+ // If the segment sizes differ, we take the shorter segment of the two.
+ SCROW nLastRow = ::std::min(nThisLastRow, nDestLastRow);
if (nLastRow >= nRow2)
// the last row shouldn't exceed the upper bound the caller specified.
nLastRow = nRow2;
@@ -795,10 +799,12 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
{
// Hidden flags differ.
pCharts->SetRangeDirty(ScRange(0, i, nTab, MAXCOL, nLastRow, nTab));
+ }
- if (bHiddenChanged)
+ if (bThisHiddenChange)
bFlagChange = true;
+ // Jump to the last row of the identical flag segment.
i = nLastRow;
}
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index b2c869010804..1d167e1f5828 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -1638,7 +1638,6 @@ SCSIZE ScTable::Query(ScQueryParam& rParamOrg, BOOL bKeepSub)
BOOL* pSpecial = new BOOL[nEntryCount];
lcl_PrepareQuery( pDocument, this, aParam, pSpecial );
- SCROW nEndRow = aParam.bUseDynamicRange ? aParam.nDynamicEndRow : aParam.nRow2;
if (!aParam.bInplace)
{
nOutRow = aParam.nDestRow + nHeader;
@@ -1655,7 +1654,8 @@ SCSIZE ScTable::Query(ScQueryParam& rParamOrg, BOOL bKeepSub)
ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
bool bHasObjects = pDrawLayer && pDrawLayer->HasObjectsInRows( nTab, aParam.nRow1 + nHeader, aParam.nRow2, false );
- for (SCROW j=aParam.nRow1 + nHeader; j<=aParam.nRow2; j++)
+ SCROW nRealRow2 = aParam.bUseDynamicRange ? aParam.nDynamicEndRow : aParam.nRow2;
+ for (SCROW j = aParam.nRow1 + nHeader; j <= nRealRow2; ++j)
{
BOOL bResult; // Filterergebnis
BOOL bValid = ValidQuery(j, aParam, pSpecial);