diff options
Diffstat (limited to 'sc/source/core/data/table1.cxx')
-rw-r--r-- | sc/source/core/data/table1.cxx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 583dc3f1d086..d4c194676471 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -1627,6 +1627,52 @@ void ScTable::MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, d rCol = nNewCol; } +namespace { + +class SetTableIndex : public ::std::unary_function<ScRange, void> +{ + SCTAB mnTab; +public: + SetTableIndex(SCTAB nTab) : mnTab(nTab) {} + + void operator() (ScRange& rRange) const + { + rRange.aStart.SetTab(mnTab); + rRange.aEnd.SetTab(mnTab); + } +}; + +} + +void ScTable::CopyPrintRange(const ScTable& rTable) +{ + // The table index shouldn't be used when the print range is used, but + // just in case set the correct table index. + + aPrintRanges = rTable.aPrintRanges; + ::std::for_each(aPrintRanges.begin(), aPrintRanges.end(), SetTableIndex(nTab)); + + bPrintEntireSheet = rTable.bPrintEntireSheet; + + delete pRepeatColRange; + pRepeatColRange = NULL; + if (rTable.pRepeatColRange) + { + pRepeatColRange = new ScRange(*rTable.pRepeatColRange); + pRepeatColRange->aStart.SetTab(nTab); + pRepeatColRange->aEnd.SetTab(nTab); + } + + delete pRepeatRowRange; + pRepeatRowRange = NULL; + if (rTable.pRepeatRowRange) + { + pRepeatRowRange = new ScRange(*rTable.pRepeatRowRange); + pRepeatRowRange->aStart.SetTab(nTab); + pRepeatRowRange->aEnd.SetTab(nTab); + } +} + void ScTable::DoColResize( SCCOL nCol1, SCCOL nCol2, SCSIZE nAdd ) { for (SCCOL nCol=nCol1; nCol<=nCol2; nCol++) |