1 diff --git sc/source/core/data/table2.cxx sc/source/core/data/table2.cxx
2 index 889510f..0857312 100644
3 --- sc/source/core/data/table2.cxx
4 +++ sc/source/core/data/table2.cxx
5 @@ -663,6 +663,8 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
6 // Charts muessen beim Ein-/Ausblenden angepasst werden
7 ScChartListenerCollection* pCharts = pDestTab->pDocument->GetChartListenerCollection();
9 + bool bFlagChange = false;
11 BOOL bWidth = (nRow1==0 && nRow2==MAXROW && pColWidth && pDestTab->pColWidth);
12 BOOL bHeight = (nCol1==0 && nCol2==MAXCOL && pRowHeight && pDestTab->pRowHeight);
14 @@ -673,18 +675,18 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
16 for (SCCOL i=nCol1; i<=nCol2; i++)
18 - bool bThisHidden = ColHidden(i);
19 - bool bHiddenChange = (pDestTab->ColHidden(i) != bThisHidden);
20 + bool bThisHidden = ColHidden(i);
21 + bool bHiddenChange = (pDestTab->ColHidden(i) != bThisHidden);
22 bool bChange = bHiddenChange || (pDestTab->pColWidth[i] != pColWidth[i]);
23 pDestTab->pColWidth[i] = pColWidth[i];
24 pDestTab->pColFlags[i] = pColFlags[i];
25 - pDestTab->SetColHidden(i, i, bThisHidden);
26 + pDestTab->SetColHidden(i, i, bThisHidden);
27 //! Aenderungen zusammenfassen?
28 if (bHiddenChange && pCharts)
29 pCharts->SetRangeDirty(ScRange( i, 0, nTab, i, MAXROW, nTab ));
32 - pDestTab->InvalidatePageBreaks();
37 @@ -692,28 +694,45 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
38 bool bChange = pDestTab->pRowHeight->SumValues(nRow1, nRow2) != pRowHeight->SumValues(nRow1, nRow2);
41 - pDestTab->InvalidatePageBreaks();
44 pDestTab->pRowHeight->CopyFrom( *pRowHeight, nRow1, nRow2);
45 - for (SCROW i=nRow1; i<=nRow2; i++)
47 - // TODO: might need some performance improvement, block
48 - // operations instead of single GetValue()/SetValue() calls.
49 - BYTE nThisRowFlags = pRowFlags->GetValue(i);
50 - bool bThisHidden = RowHidden(i);
51 - bool bHiddenChange = (pDestTab->RowHidden(i) != bThisHidden);
52 - pDestTab->pRowFlags->SetValue( i, nThisRowFlags );
53 - pDestTab->SetRowHidden(i, i, bThisHidden);
54 - //! Aenderungen zusammenfassen?
55 - if (bHiddenChange && pCharts)
56 - pCharts->SetRangeDirty(ScRange( 0, i, nTab, MAXCOL, i, nTab ));
57 + pDestTab->pRowFlags->CopyFrom(*pRowFlags, nRow1, nRow2);
60 - pDestTab->InvalidatePageBreaks();
61 + for (SCROW i = nRow1; i <= nRow2; ++i)
63 + SCROW nThisLastRow, nDestLastRow;
64 + bool bThisHidden = RowHidden(i, nThisLastRow);
65 + bool bDestHidden = pDestTab->RowHidden(i, nDestLastRow);
67 + // If the segment sizes differ, we take the shorter segment of the two.
68 + SCROW nLastRow = ::std::min(nThisLastRow, nDestLastRow);
69 + if (nLastRow >= nRow2)
70 + // the last row shouldn't exceed the upper bound the caller specified.
73 + pDestTab->SetRowHidden(i, nLastRow, bThisHidden);
75 + bool bThisHiddenChange = (bThisHidden != bDestHidden);
76 + if (bThisHiddenChange && pCharts)
78 + // Hidden flags differ.
79 + pCharts->SetRangeDirty(ScRange(0, i, nTab, MAXCOL, nLastRow, nTab));
82 + if (bThisHiddenChange)
85 + // Jump to the last row of the identical flag segment.
89 pDestTab->DecRecalcLevel();
93 + pDestTab->InvalidatePageBreaks();
95 pDestTab->SetOutlineTable( pOutlineTable ); // auch nur wenn bColRowFlags