[Libreoffice-commits] .: sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Sep 19 17:19:19 PDT 2011


 sc/source/ui/view/viewfun2.cxx |   26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

New commits:
commit c2ab21aa25f5ae95f6faebe3cc7b2e44729f7ad7
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Sep 19 20:19:16 2011 -0400

    A little cleanup.

diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 88196cb..191771a 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
 }
 
 


More information about the Libreoffice-commits mailing list