[Libreoffice-commits] .: Branch 'libreoffice-3-4' - sc/inc sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue Apr 19 12:30:21 PDT 2011
sc/inc/table.hxx | 2 +
sc/source/core/data/documen2.cxx | 3 ++
sc/source/core/data/table1.cxx | 44 +++++++++++++++++++++++++++++++++++++++
3 files changed, 49 insertions(+)
New commits:
commit 57ae7e77518af9298797ced36d87ad479339b541
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Tue Apr 19 15:28:02 2011 -0400
fdo#33341: Copy print ranges when copying sheet.
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 2d8f942..27c925b 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -912,6 +912,8 @@ private:
*/
void MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY);
+ void CopyPrintRange(const ScTable& rTable);
+
/**
* Use this to iterate through non-empty visible cells in a single column.
*/
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 1947a7a..5c4957d 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -904,6 +904,9 @@ sal_Bool ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, const ScMarkData* pO
pTab[nNewPos]->SetPageStyle( pTab[nOldPos]->GetPageStyle() );
pTab[nNewPos]->SetPendingRowHeights( pTab[nOldPos]->IsPendingRowHeights() );
+
+ // Copy the custom print range if exists.
+ pTab[nNewPos]->CopyPrintRange(*pTab[nOldPos]);
}
else
SetAutoCalc( bOldAutoCalc );
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 4eb5887..941de04 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1627,6 +1627,50 @@ 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;
+ if (rTable.pRepeatColRange)
+ {
+ pRepeatColRange = new ScRange(*rTable.pRepeatColRange);
+ pRepeatColRange->aStart.SetTab(nTab);
+ pRepeatColRange->aEnd.SetTab(nTab);
+ }
+
+ delete pRepeatRowRange;
+ 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++)
More information about the Libreoffice-commits
mailing list