diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-05-17 10:02:05 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-05-20 20:13:09 -0400 |
commit | 1a43dd8e5b0b948bbc37e3f2989cafea5c996b1b (patch) | |
tree | b9844b62c639c3f71416f43529404a2f45f080b9 /sc | |
parent | 11a164f0ac81f4cff4b2698e1fc114ce7e4737df (diff) |
Move the boolean flags to the context bucket.
To reduce the number of function parameters lower.
Change-Id: I816bd7c27070597f5fcdf69bdc7d981279390ca6
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/clipcontext.hxx | 13 | ||||
-rw-r--r-- | sc/inc/column.hxx | 3 | ||||
-rw-r--r-- | sc/inc/table.hxx | 6 | ||||
-rw-r--r-- | sc/source/core/data/clipcontext.cxx | 15 | ||||
-rw-r--r-- | sc/source/core/data/column.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/data/table2.cxx | 14 |
7 files changed, 42 insertions, 21 deletions
diff --git a/sc/inc/clipcontext.hxx b/sc/inc/clipcontext.hxx index e28d265df47d..0df627c77091 100644 --- a/sc/inc/clipcontext.hxx +++ b/sc/inc/clipcontext.hxx @@ -30,6 +30,8 @@ class ClipContextBase SCTAB mnTabStart; SCTAB mnTabEnd; + ClipContextBase(); // disabled + public: ClipContextBase(ScDocument& rDoc); virtual ~ClipContextBase(); @@ -44,7 +46,6 @@ public: class CopyFromClipContext : public ClipContextBase { - ScDocument* mpRefUndoDoc; ScDocument* mpClipDoc; sal_uInt16 mnInsertFlag; @@ -69,9 +70,17 @@ public: class CopyToClipContext : public ClipContextBase { + bool mbKeepScenarioFlags:1; + bool mbCloneNotes:1; + + CopyToClipContext(); // disabled + public: - CopyToClipContext(ScDocument& rDoc); + CopyToClipContext(ScDocument& rDoc, bool bKeepScenarioFlags, bool bCloneNotes); virtual ~CopyToClipContext(); + + bool isKeepScenarioFlags() const; + bool isCloneNotes() const; }; } diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 0eab575d6cb5..4e5688cb51b8 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -216,7 +216,8 @@ public: void InsertRow( SCROW nStartRow, SCSIZE nSize ); void DeleteRow( SCROW nStartRow, SCSIZE nSize ); void DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag ); - void CopyToClip( sc::CopyToClipContext& rCxt, SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKeepScenarioFlags ) const; + void CopyToClip( + sc::CopyToClipContext& rCxt, SCROW nRow1, SCROW nRow2, ScColumn& rColumn ) const; void CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol); void CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDestCol ); bool InitBlockPosition( sc::ColumnBlockPosition& rBlockPos ); diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 2538a0b5822d..9b0d4d2f0746 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -380,10 +380,8 @@ public: bool* pUndoOutline = NULL ); void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nDelFlag); - void CopyToClip( sc::CopyToClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable, - bool bKeepScenarioFlags, bool bCloneNoteCaptions ); - void CopyToClip( sc::CopyToClipContext& rCxt, const ScRangeList& rRanges, ScTable* pTable, - bool bKeepScenarioFlags, bool bCloneNoteCaptions ); + void CopyToClip( sc::CopyToClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable ); + void CopyToClip( sc::CopyToClipContext& rCxt, const ScRangeList& rRanges, ScTable* pTable ); void CopyStaticToDocument(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pDestTab); void CopyCellToDocument( SCCOL nSrcCol, SCROW nSrcRow, SCCOL nDestCol, SCROW nDestRow, ScTable& rDestTab ); diff --git a/sc/source/core/data/clipcontext.cxx b/sc/source/core/data/clipcontext.cxx index e3db67d58797..8a02cea1dad2 100644 --- a/sc/source/core/data/clipcontext.cxx +++ b/sc/source/core/data/clipcontext.cxx @@ -101,9 +101,22 @@ bool CopyFromClipContext::isSkipAttrForEmptyCells() const return mbSkipAttrForEmptyCells; } -CopyToClipContext::CopyToClipContext(ScDocument& rDoc) : ClipContextBase(rDoc) {} +CopyToClipContext::CopyToClipContext( + ScDocument& rDoc, bool bKeepScenarioFlags, bool bCloneNotes) : + ClipContextBase(rDoc), mbKeepScenarioFlags(bKeepScenarioFlags), mbCloneNotes(bCloneNotes) {} + CopyToClipContext::~CopyToClipContext() {} +bool CopyToClipContext::isKeepScenarioFlags() const +{ + return mbKeepScenarioFlags; +} + +bool CopyToClipContext::isCloneNotes() const +{ + return mbCloneNotes; +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 655918b58e08..9fb640673d02 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1185,10 +1185,10 @@ void ScColumn::InsertRow( SCROW nStartRow, SCSIZE nSize ) void ScColumn::CopyToClip( - sc::CopyToClipContext& rCxt, SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKeepScenarioFlags) const + sc::CopyToClipContext& rCxt, SCROW nRow1, SCROW nRow2, ScColumn& rColumn ) const { pAttrArray->CopyArea( nRow1, nRow2, 0, *rColumn.pAttrArray, - bKeepScenarioFlags ? (SC_MF_ALL & ~SC_MF_SCENARIO) : SC_MF_ALL ); + rCxt.isKeepScenarioFlags() ? (SC_MF_ALL & ~SC_MF_SCENARIO) : SC_MF_ALL ); SCSIZE i; SCSIZE nBlockCount = 0; diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 4ba787fdda36..7fb04a95656f 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -1995,7 +1995,7 @@ void ScDocument::CopyToClip(const ScClipParam& rClipParam, else pClipDoc->ResetClip(this, pMarks); - sc::CopyToClipContext aCxt(*pClipDoc); + sc::CopyToClipContext aCxt(*pClipDoc, bKeepScenarioFlags, bCloneNoteCaptions); aCxt.setTabRange(i, nEndTab-1); CopyRangeNamesToClip(pClipDoc, aClipRange, pMarks, bAllTabs); @@ -2007,7 +2007,7 @@ void ScDocument::CopyToClip(const ScClipParam& rClipParam, if ( !bUseRangeForVBA && ( pMarks && !pMarks->GetTableSelect(i) ) ) continue; - maTabs[i]->CopyToClip(aCxt, rClipParam.maRanges, pClipDoc->maTabs[i], bKeepScenarioFlags, bCloneNoteCaptions); + maTabs[i]->CopyToClip(aCxt, rClipParam.maRanges, pClipDoc->maTabs[i]); if (pDrawLayer && bIncludeObjects) { @@ -2093,11 +2093,11 @@ void ScDocument::CopyTabToClip(SCCOL nCol1, SCROW nRow1, rClipParam.maRanges.Append(ScRange(nCol1, nRow1, 0, nCol2, nRow2, 0)); pClipDoc->ResetClip( this, nTab ); - sc::CopyToClipContext aCxt(*pClipDoc); + sc::CopyToClipContext aCxt(*pClipDoc, false, true); aCxt.setTabRange(nTab, nTab); if (nTab < static_cast<SCTAB>(maTabs.size()) && nTab < static_cast<SCTAB>(pClipDoc->maTabs.size())) if (maTabs[nTab] && pClipDoc->maTabs[nTab]) - maTabs[nTab]->CopyToClip(aCxt, nCol1, nRow1, nCol2, nRow2, pClipDoc->maTabs[nTab], false, true); + maTabs[nTab]->CopyToClip(aCxt, nCol1, nRow1, nCol2, nRow2, pClipDoc->maTabs[nTab]); pClipDoc->GetClipParam().mbCutMode = false; } diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index e8d510f91e99..d1605c7f2c03 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -606,7 +606,7 @@ void ScTable::DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark ) // pTable = Clipboard void ScTable::CopyToClip( sc::CopyToClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, - ScTable* pTable, bool bKeepScenarioFlags, bool bCloneNoteCaptions ) + ScTable* pTable ) { if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2)) { @@ -616,12 +616,13 @@ void ScTable::CopyToClip( pTable->mpRangeName = new ScRangeName(*mpRangeName); // notes - maNotes.clone(pTable->pDocument, nCol1, nRow1, nCol2, nRow2, bCloneNoteCaptions, nTab, pTable->maNotes); + maNotes.clone( + pTable->pDocument, nCol1, nRow1, nCol2, nRow2, rCxt.isCloneNotes(), nTab, pTable->maNotes); SCCOL i; for ( i = nCol1; i <= nCol2; i++) - aCol[i].CopyToClip(rCxt, nRow1, nRow2, pTable->aCol[i], bKeepScenarioFlags); + aCol[i].CopyToClip(rCxt, nRow1, nRow2, pTable->aCol[i]); // copy widths/heights, and only "hidden", "filtered" and "manual" flags // also for all preceding columns/rows, to have valid positions for drawing objects @@ -656,15 +657,14 @@ void ScTable::CopyToClip( } void ScTable::CopyToClip( - sc::CopyToClipContext& rCxt, const ScRangeList& rRanges, ScTable* pTable, - bool bKeepScenarioFlags, bool bCloneNoteCaptions ) + sc::CopyToClipContext& rCxt, const ScRangeList& rRanges, ScTable* pTable ) { ScRangeList aRanges(rRanges); for ( size_t i = 0, nListSize = aRanges.size(); i < nListSize; ++i ) { ScRange* p = aRanges[ i ]; - CopyToClip(rCxt, p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(), - pTable, bKeepScenarioFlags, bCloneNoteCaptions); + CopyToClip( + rCxt, p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(), pTable); } } |