Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index



From 2643db80f42a96a108c4733463ad97a147d456f0 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Thu, 2 Jun 2011 11:49:54 -0430
Subject: [PATCH] Replace List with std::vector<ScRange>.

---
 sc/source/ui/dbgui/dbnamdlg.cxx |   14 +++-----------
 sc/source/ui/inc/dbfunc.hxx     |    2 +-
 sc/source/ui/inc/dbnamdlg.hxx   |    4 +++-
 sc/source/ui/view/dbfunc.cxx    |   23 +++++++++--------------
 4 files changed, 16 insertions(+), 27 deletions(-)

diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx
index 09fd536..ab57796 100644
--- a/sc/source/ui/dbgui/dbnamdlg.cxx
+++ b/sc/source/ui/dbgui/dbnamdlg.cxx
@@ -194,14 +194,6 @@ ScDbNameDlg::ScDbNameDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* 
pParent,
 ScDbNameDlg::~ScDbNameDlg()
 {
     DELETEZ( pSaveObj );
-
-    ScRange* pEntry = (ScRange*)aRemoveList.First();
-    while ( pEntry )
-    {
-        aRemoveList.Remove( pEntry );
-        delete pEntry;
-        pEntry = (ScRange*)aRemoveList.Next();
-    }
 }
 
 
@@ -590,9 +582,9 @@ IMPL_LINK( ScDbNameDlg, RemoveBtnHdl, void *, EMPTYARG )
             SCCOL nColStart, nColEnd;
             SCROW nRowStart, nRowEnd;
             itr->GetArea( nTab, nColStart, nRowStart, nColEnd, nRowEnd );
-            aRemoveList.Insert(
-                new ScRange( ScAddress( nColStart, nRowStart, nTab ),
-                             ScAddress( nColEnd,   nRowEnd,   nTab ) ) );
+            aRemoveList.push_back(
+                ScRange( ScAddress( nColStart, nRowStart, nTab ),
+                         ScAddress( nColEnd,   nRowEnd,   nTab ) ) );
 
             rDBs.erase(itr);
 
diff --git a/sc/source/ui/inc/dbfunc.hxx b/sc/source/ui/inc/dbfunc.hxx
index abdfe13..291ec07 100644
--- a/sc/source/ui/inc/dbfunc.hxx
+++ b/sc/source/ui/inc/dbfunc.hxx
@@ -81,7 +81,7 @@ public:
     ScDBData*          GetDBData( bool bMarkArea = true, ScGetDBMode eMode = SC_DB_MAKE, 
ScGetDBSelection eSel = SC_DBSEL_KEEP);
     ScDBData*       GetAnonymousDBData();
 
-    void                       NotifyCloseDbNameDlg( const ScDBCollection& rNewColl, const List& 
rDelAreaList );
+    void                       NotifyCloseDbNameDlg( const ScDBCollection& rNewColl, const 
std::vector<ScRange> &rDelAreaList );
 
     void                       Consolidate( const ScConsolidateParam& rParam, sal_Bool bRecord = 
sal_True );
 
diff --git a/sc/source/ui/inc/dbnamdlg.hxx b/sc/source/ui/inc/dbnamdlg.hxx
index e547a47..247d405 100644
--- a/sc/source/ui/inc/dbnamdlg.hxx
+++ b/sc/source/ui/inc/dbnamdlg.hxx
@@ -29,6 +29,8 @@
 #ifndef SC_DBNAMDLG_HXX
 #define SC_DBNAMDLG_HXX
 
+#include <vector>
+
 #include <vcl/combobox.hxx>
 
 #include <vcl/fixed.hxx>
@@ -97,7 +99,7 @@ private:
 
     ScDBCollection     aLocalDbCol;
     ScRange                    theCurArea;
-    List                       aRemoveList;
+    std::vector<ScRange> aRemoveList;
 
 #ifdef _DBNAMDLG_CXX
 private:
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index a8a5049..b1b2386 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -211,7 +211,7 @@ ScDBData* ScDBFunc::GetAnonymousDBData()
 
 //     Datenbankbereiche aendern (Dialog)
 
-void ScDBFunc::NotifyCloseDbNameDlg( const ScDBCollection& rNewColl, const List& rDelAreaList )
+void ScDBFunc::NotifyCloseDbNameDlg( const ScDBCollection& rNewColl, const std::vector<ScRange> 
&rDelAreaList )
 {
 
     ScDocShell* pDocShell = GetViewData()->GetDocShell();
@@ -222,21 +222,16 @@ void ScDBFunc::NotifyCloseDbNameDlg( const ScDBCollection& rNewColl, const 
List&
     ScDBCollection* pRedoColl = NULL;
     const sal_Bool bRecord (pDoc->IsUndoEnabled());
 
-    long nDelCount = rDelAreaList.Count();
-    for (long nDelPos=0; nDelPos<nDelCount; nDelPos++)
+    std::vector<ScRange>::const_iterator iter;
+    for (iter = rDelAreaList.begin(); iter != rDelAreaList.end(); ++iter)
     {
-        ScRange* pEntry = (ScRange*) rDelAreaList.GetObject(nDelPos);
+        //     Targets am SBA abmelden nicht mehr noetig
+        const ScAddress& rStart = iter->aStart;
+        const ScAddress& rEnd   = iter->aEnd;
+        pDocShell->DBAreaDeleted( rStart.Tab(),
+                                  rStart.Col(), rStart.Row(),
+                                  rEnd.Col(),   rEnd.Row() );
 
-        if ( pEntry )
-        {
-            ScAddress& rStart = pEntry->aStart;
-            ScAddress& rEnd   = pEntry->aEnd;
-            pDocShell->DBAreaDeleted( rStart.Tab(),
-                                       rStart.Col(), rStart.Row(),
-                                       rEnd.Col(),   rEnd.Row() );
-
-            // Targets am SBA abmelden nicht mehr noetig
-        }
     }
 
     if (bRecord)
-- 
1.7.3.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.