diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-21 15:53:15 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-22 21:49:22 -0400 |
commit | 916baebaa7c604570748c5556cfbb99a61a56a28 (patch) | |
tree | 8c19ca9160e713360495523cfdbafeb04f386b70 /sc | |
parent | 987085cbb1ed6b8bb06ff3aba6f70686123ac811 (diff) |
Reduce the number of parameters.
Change-Id: I0424ca0da103cdcf3f76b6b7afe25cc0ad230bc2
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/inc/undocell.hxx | 7 | ||||
-rw-r--r-- | sc/source/ui/undo/undocell.cxx | 39 | ||||
-rw-r--r-- | sc/source/ui/view/viewfunc.cxx | 2 |
4 files changed, 22 insertions, 28 deletions
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index fc7e84e6b5e9..5bc31f59c837 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -792,7 +792,7 @@ sal_Bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, if (bUndo) { // wegen ChangeTracking darf UndoAction erst nach SetString angelegt werden - rDocShell.GetUndoManager()->AddUndoAction(new ScUndoEnterData( &rDocShell, rPos.Col(),rPos.Row(),rPos.Tab(), 1,pTabs, + rDocShell.GetUndoManager()->AddUndoAction(new ScUndoEnterData( &rDocShell, rPos, 1, pTabs, ppOldCells, pHasFormat, pOldFormats, rText, NULL ) ); } diff --git a/sc/source/ui/inc/undocell.hxx b/sc/source/ui/inc/undocell.hxx index 39c7595dda86..a41c5581ba84 100644 --- a/sc/source/ui/inc/undocell.hxx +++ b/sc/source/ui/inc/undocell.hxx @@ -75,8 +75,7 @@ class ScUndoEnterData: public ScSimpleUndo { public: TYPEINFO(); - ScUndoEnterData( ScDocShell* pNewDocShell, - SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab, + ScUndoEnterData( ScDocShell* pNewDocShell, const ScAddress& rPos, SCTAB nNewCount, SCTAB* pNewTabs, ScBaseCell** ppOldData, sal_Bool* pHasForm, sal_uLong* pOldForm, const String& rNewStr, EditTextObject* pObj = NULL ); @@ -97,9 +96,7 @@ private: sal_uLong* pOldFormats; EditTextObject* pNewEditData; sal_uLong nEndChangeAction; - SCCOL nCol; - SCROW nRow; - SCTAB nTab; + ScAddress maPos; SCTAB nCount; // Marked sheet void DoChange() const; diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx index 023245a1bc3b..b0f15f15186d 100644 --- a/sc/source/ui/undo/undocell.cxx +++ b/sc/source/ui/undo/undocell.cxx @@ -164,8 +164,7 @@ sal_Bool ScUndoCursorAttr::CanRepeat(SfxRepeatTarget& rTarget) const return (rTarget.ISA(ScTabViewTarget)); } -ScUndoEnterData::ScUndoEnterData( ScDocShell* pNewDocShell, - SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab, +ScUndoEnterData::ScUndoEnterData( ScDocShell* pNewDocShell, const ScAddress& rPos, SCTAB nNewCount, SCTAB* pNewTabs, ScBaseCell** ppOldData, sal_Bool* pHasForm, sal_uLong* pOldForm, const String& rNewStr, EditTextObject* pObj ) : @@ -176,9 +175,7 @@ ScUndoEnterData::ScUndoEnterData( ScDocShell* pNewDocShell, pHasFormat( pHasForm ), pOldFormats( pOldForm ), pNewEditData( pObj ), - nCol( nNewCol ), - nRow( nNewRow ), - nTab( nNewTab ), + maPos(rPos), nCount( nNewCount ) { SetChangeTrack(); @@ -207,13 +204,13 @@ void ScUndoEnterData::DoChange() const { // only when needed (old or new Edit cell, or Attribute)? for (sal_uInt16 i=0; i<nCount; i++) - pDocShell->AdjustRowHeight( nRow, nRow, pTabs[i] ); + pDocShell->AdjustRowHeight(maPos.Row(), maPos.Row(), pTabs[i]); ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if (pViewShell) { - pViewShell->SetTabNo( nTab ); - pViewShell->MoveCursorAbs( nCol, nRow, SC_FOLLOW_JUMP, false, false ); + pViewShell->SetTabNo(maPos.Tab()); + pViewShell->MoveCursorAbs(maPos.Col(), maPos.Row(), SC_FOLLOW_JUMP, false, false); } pDocShell->PostDataChanged(); @@ -225,7 +222,7 @@ void ScUndoEnterData::SetChangeTrack() if ( pChangeTrack ) { nEndChangeAction = pChangeTrack->GetActionMax() + 1; - ScAddress aPos( nCol, nRow, nTab ); + ScAddress aPos(maPos); for (sal_uInt16 i=0; i<nCount; i++) { aPos.SetTab( pTabs[i] ); @@ -252,21 +249,21 @@ void ScUndoEnterData::Undo() for (sal_uInt16 i=0; i<nCount; i++) { ScBaseCell* pNewCell = ppOldCells[i] ? ppOldCells[i]->Clone( *pDoc, SC_CLONECELL_STARTLISTENING ) : 0; - pDoc->PutCell( nCol, nRow, pTabs[i], pNewCell ); + pDoc->PutCell(maPos.Col(), maPos.Row(), pTabs[i], pNewCell); if (pHasFormat && pOldFormats) { if ( pHasFormat[i] ) - pDoc->ApplyAttr( nCol, nRow, pTabs[i], - SfxUInt32Item( ATTR_VALUE_FORMAT, pOldFormats[i] ) ); + pDoc->ApplyAttr(maPos.Col(), maPos.Row(), pTabs[i], + SfxUInt32Item(ATTR_VALUE_FORMAT, pOldFormats[i])); else { - ScPatternAttr aPattern( *pDoc->GetPattern( nCol, nRow, pTabs[i] ) ); + ScPatternAttr aPattern( *pDoc->GetPattern(maPos.Col(), maPos.Row(), pTabs[i])); aPattern.GetItemSet().ClearItem( ATTR_VALUE_FORMAT ); - pDoc->SetPattern( nCol, nRow, pTabs[i], aPattern, sal_True ); + pDoc->SetPattern(maPos.Col(), maPos.Row(), pTabs[i], aPattern, true); } } - pDocShell->PostPaintCell( nCol, nRow, pTabs[i] ); + pDocShell->PostPaintCell(maPos.Col(), maPos.Row(), pTabs[i]); } ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack(); @@ -283,7 +280,7 @@ void ScUndoEnterData::Undo() ScRangeList aChangeRanges; for ( sal_uInt16 i = 0; i < nCount; ++i ) { - aChangeRanges.Append( ScRange( nCol, nRow, pTabs[i] ) ); + aChangeRanges.Append( ScRange(maPos.Col(), maPos.Row(), pTabs[i])); } pModelObj->NotifyChanges( ::rtl::OUString( "cell-change" ), aChangeRanges ); } @@ -298,11 +295,11 @@ void ScUndoEnterData::Redo() { if (pNewEditData) // A clone of pNewEditData will be stored in ScEditCell. - pDoc->PutCell( nCol, nRow, pTabs[i], new ScEditCell(*pNewEditData, - pDoc, NULL ) ); + pDoc->PutCell(maPos.Col(), maPos.Row(), pTabs[i], new ScEditCell(*pNewEditData, + pDoc, NULL)); else - pDoc->SetString( nCol, nRow, pTabs[i], aNewString ); - pDocShell->PostPaintCell( nCol, nRow, pTabs[i] ); + pDoc->SetString(maPos.Col(), maPos.Row(), pTabs[i], aNewString); + pDocShell->PostPaintCell(maPos.Col(), maPos.Row(), pTabs[i]); } SetChangeTrack(); @@ -317,7 +314,7 @@ void ScUndoEnterData::Redo() ScRangeList aChangeRanges; for ( sal_uInt16 i = 0; i < nCount; ++i ) { - aChangeRanges.Append( ScRange( nCol, nRow, pTabs[i] ) ); + aChangeRanges.Append( ScRange(maPos.Col(), maPos.Row(), pTabs[i])); } pModelObj->NotifyChanges( ::rtl::OUString( "cell-change" ), aChangeRanges ); } diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index be08448c7b24..398fdf7cf181 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -717,7 +717,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, if ( bRecord ) { // because of ChangeTrack current first pDocSh->GetUndoManager()->AddUndoAction( - new ScUndoEnterData( pDocSh, nCol, nRow, nTab, nPos, pTabs, + new ScUndoEnterData( pDocSh, ScAddress(nCol, nRow, nTab), nPos, pTabs, ppOldCells, NULL, NULL, aString, pUndoData ) ); } |