summaryrefslogtreecommitdiffstats
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@suse.com>2011-09-19 20:19:16 -0400
committerKohei Yoshida <kohei.yoshida@suse.com>2011-09-19 20:19:16 -0400
commitc2ab21aa25f5ae95f6faebe3cc7b2e44729f7ad7 (patch)
tree8f490105ed1a4e7fb7b8778997255b86a1018fc9 /sc
parentLet's avoid modifying the selection data during search and replace. (diff)
downloadcore-c2ab21aa25f5ae95f6faebe3cc7b2e44729f7ad7.tar.gz
core-c2ab21aa25f5ae95f6faebe3cc7b2e44729f7ad7.zip
A little cleanup.
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/view/viewfun2.cxx26
1 files changed, 11 insertions, 15 deletions
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 88196cb0d5fb..191771a9281d 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -1627,15 +1627,15 @@ void ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
//! account for bAttrib during Undo !!!
- ScDocument* pUndoDoc = NULL;
- ScMarkData* pUndoMark = NULL;
+ std::auto_ptr<ScDocument> pUndoDoc;
+ std::auto_ptr<ScMarkData> pUndoMark;
rtl::OUString aUndoStr;
if (bAddUndo)
{
- pUndoMark = new ScMarkData( rMark ); // Mark is being modified
+ pUndoMark.reset(new ScMarkData(rMark)); // Mark is being modified
if ( nCommand == SVX_SEARCHCMD_REPLACE_ALL )
{
- pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
+ pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO));
pUndoDoc->InitUndo( pDoc, nStartTab, nEndTab );
}
}
@@ -1644,7 +1644,7 @@ void ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
{ //! select all, after pUndoMark has been created
for ( SCTAB j = nStartTab; j <= nEndTab; j++ )
{
- rMark.SelectTable( j, sal_True );
+ rMark.SelectTable( j, true );
}
}
@@ -1652,7 +1652,7 @@ void ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
InitOwnBlockMode();
// If search starts at the beginning don't ask again whether it shall start at the beginning
- sal_Bool bFirst = true;
+ bool bFirst = true;
if ( nCol == 0 && nRow == 0 && nTab == nStartTab && !pSearchItem->GetBackward() )
bFirst = false;
@@ -1661,17 +1661,16 @@ void ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
{
GetFrameWin()->EnterWait();
ScRangeList aMatchedRanges;
- if (pDoc->SearchAndReplace(*pSearchItem, nCol, nRow, nTab, rMark, aMatchedRanges, aUndoStr, pUndoDoc))
+ if (pDoc->SearchAndReplace(*pSearchItem, nCol, nRow, nTab, rMark, aMatchedRanges, aUndoStr, pUndoDoc.get()))
{
- bFound = sal_True;
- bFirst = sal_True;
+ bFound = true;
+ bFirst = true;
if (bAddUndo)
{
GetViewData()->GetDocShell()->GetUndoManager()->AddUndoAction(
new ScUndoReplace( GetViewData()->GetDocShell(), *pUndoMark,
nCol, nRow, nTab,
- aUndoStr, pUndoDoc, pSearchItem ) );
- pUndoDoc = NULL;
+ aUndoStr, pUndoDoc.release(), pSearchItem ) );
}
rMark.ResetMark();
@@ -1781,7 +1780,7 @@ void ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
DoneBlockMode(sal_True);
AlignToCursor( nCol, nRow, SC_FOLLOW_JUMP );
- SetCursor( nCol, nRow, sal_True );
+ SetCursor( nCol, nRow, true );
if ( nCommand == SVX_SEARCHCMD_REPLACE
|| nCommand == SVX_SEARCHCMD_REPLACE_ALL )
@@ -1796,9 +1795,6 @@ void ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
pDocSh->PostPaintGridAll(); // mark
GetFrameWin()->LeaveWait();
}
-
- delete pUndoDoc; // remove if not used
- delete pUndoMark; // can always be removed
}