summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/table.hxx2
-rw-r--r--sc/source/core/data/table2.cxx68
-rw-r--r--sc/source/core/data/table5.cxx16
3 files changed, 85 insertions, 1 deletions
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 78e5875b6879..c797d6fa3d37 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -683,6 +683,8 @@ public:
void UpdatePageBreaks( const ScRange* pUserArea );
void RemoveManualBreaks();
BOOL HasManualBreaks() const;
+ void SetRowManualBreaks( const ::std::set<SCROW>& rBreaks );
+ void SetColManualBreaks( const ::std::set<SCCOL>& rBreaks );
void GetAllRowBreaks(::std::set<SCROW>& rBreaks, bool bPage, bool bManual) const;
void GetAllColBreaks(::std::set<SCCOL>& rBreaks, bool bPage, bool bManual) const;
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 9bd5b031fde5..8b7277ff1b41 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -155,6 +155,22 @@ void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE
mpFilteredRows->insertSegment(nStartRow, nSize, true);
mpHiddenRows->insertSegment(nStartRow, nSize, true);
+
+ if (!maRowManualBreaks.empty())
+ {
+ std::set<SCROW>::reverse_iterator rit = maRowManualBreaks.rbegin();
+ while (rit != maRowManualBreaks.rend())
+ {
+ SCROW nRow = *rit;
+ if (nRow < nStartRow)
+ break; // while
+ else
+ {
+ maRowManualBreaks.erase( (++rit).base());
+ maRowManualBreaks.insert( nRow + nSize);
+ }
+ }
+ }
}
for (SCCOL j=nStartCol; j<=nEndCol; j++)
@@ -185,6 +201,18 @@ void ScTable::DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE
mpFilteredRows->removeSegment(nStartRow, nStartRow+nSize);
mpHiddenRows->removeSegment(nStartRow, nStartRow+nSize);
+
+ if (!maRowManualBreaks.empty())
+ {
+ std::set<SCROW>::iterator it = maRowManualBreaks.upper_bound( nStartRow + nSize - 1);
+ maRowManualBreaks.erase( maRowManualBreaks.lower_bound( nStartRow), it);
+ while (it != maRowManualBreaks.end())
+ {
+ SCROW nRow = *it;
+ maRowManualBreaks.erase( it++);
+ maRowManualBreaks.insert( nRow - nSize);
+ }
+ }
}
{ // scope for bulk broadcast
@@ -233,6 +261,22 @@ void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE
mpHiddenCols->insertSegment(nStartCol, static_cast<SCCOL>(nSize), true);
mpFilteredCols->insertSegment(nStartCol, static_cast<SCCOL>(nSize), true);
+
+ if (!maColManualBreaks.empty())
+ {
+ std::set<SCCOL>::reverse_iterator rit = maColManualBreaks.rbegin();
+ while (rit != maColManualBreaks.rend())
+ {
+ SCCOL nCol = *rit;
+ if (nCol < nStartCol)
+ break; // while
+ else
+ {
+ maColManualBreaks.erase( (++rit).base());
+ maColManualBreaks.insert( nCol + nSize);
+ }
+ }
+ }
}
@@ -291,6 +335,18 @@ void ScTable::DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE
SCCOL nRmSize = nStartCol + static_cast<SCCOL>(nSize);
mpHiddenCols->removeSegment(nStartCol, nRmSize);
mpFilteredCols->removeSegment(nStartCol, nRmSize);
+
+ if (!maColManualBreaks.empty())
+ {
+ std::set<SCCOL>::iterator it = maColManualBreaks.upper_bound( nStartCol + nSize - 1);
+ maColManualBreaks.erase( maColManualBreaks.lower_bound( nStartCol), it);
+ while (it != maColManualBreaks.end())
+ {
+ SCCOL nCol = *it;
+ maColManualBreaks.erase( it++);
+ maColManualBreaks.insert( nCol - nSize);
+ }
+ }
}
@@ -688,6 +744,7 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
pDestTab->IncRecalcLevel();
if (bWidth)
+ {
for (SCCOL i=nCol1; i<=nCol2; i++)
{
bool bThisHidden = ColHidden(i);
@@ -703,6 +760,8 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
if (bChange)
bFlagChange = true;
}
+ pDestTab->SetColManualBreaks( maColManualBreaks);
+ }
if (bHeight)
{
@@ -754,6 +813,7 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
pDestTab->SetRowFiltered(i, nLastRow, bFiltered);
i = nLastRow;
}
+ pDestTab->SetRowManualBreaks( maRowManualBreaks);
}
pDestTab->DecRecalcLevel();
}
@@ -791,11 +851,17 @@ void ScTable::UndoToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
if (bWidth||bHeight)
{
if (bWidth)
+ {
for (SCCOL i=nCol1; i<=nCol2; i++)
pDestTab->pColWidth[i] = pColWidth[i];
+ pDestTab->SetColManualBreaks( maColManualBreaks);
+ }
if (bHeight)
+ {
pDestTab->CopyRowHeight(*this, nRow1, nRow2, 0);
- DecRecalcLevel();
+ pDestTab->SetRowManualBreaks( maRowManualBreaks);
+ }
+ DecRecalcLevel();
}
}
}
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index 2635b5821e4f..3916ab6ab559 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -326,6 +326,22 @@ BOOL ScTable::HasManualBreaks() const
return !maRowManualBreaks.empty() || !maColManualBreaks.empty();
}
+void ScTable::SetRowManualBreaks( const ::std::set<SCROW>& rBreaks )
+{
+ maRowManualBreaks = rBreaks;
+ InvalidatePageBreaks();
+ if (IsStreamValid())
+ SetStreamValid(FALSE);
+}
+
+void ScTable::SetColManualBreaks( const ::std::set<SCCOL>& rBreaks )
+{
+ maColManualBreaks = rBreaks;
+ InvalidatePageBreaks();
+ if (IsStreamValid())
+ SetStreamValid(FALSE);
+}
+
void ScTable::GetAllRowBreaks(set<SCROW>& rBreaks, bool bPage, bool bManual) const
{
if (bPage)