[Libreoffice-commits] .: sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Jan 24 07:58:40 PST 2011


 sc/inc/funcdesc.hxx               |    1 +
 sc/source/core/data/funcdesc.cxx  |    2 --
 sc/source/ui/formdlg/dwfunctr.cxx |   21 +++++----------------
 sc/source/ui/inc/dwfunctr.hxx     |    5 +----
 4 files changed, 7 insertions(+), 22 deletions(-)

New commits:
commit 2d25c3ec8cace3ba8aef806e60235ac872641652
Author: Sören Möller <soerenmoeller2001 at gmail.com>
Date:   Sun Jan 23 17:58:14 2011 +0100

    Removed local duplicate implementation and used ScFuntionMgr's instead
    
    Removed a duplicate of ScFuntionMgr's fillLastRecentlyUsedFunctions
    in ScFunctionDockWin and replaced its uses by use of ScFuntionMgr's
    implementation. Moved definition of LRU_MAX to header file

diff --git a/sc/inc/funcdesc.hxx b/sc/inc/funcdesc.hxx
index 05c71e9..bad1501 100644
--- a/sc/inc/funcdesc.hxx
+++ b/sc/inc/funcdesc.hxx
@@ -42,6 +42,7 @@
 #include <rtl/ustring.hxx>
 
 #define MAX_FUNCCAT 12  /* maximum number of categories for functions */
+#define LRU_MAX 10 /* maximal number of last recently used functions */
 
 class ScFuncDesc;
 class ScFunctionList;
diff --git a/sc/source/core/data/funcdesc.cxx b/sc/source/core/data/funcdesc.cxx
index 79be4f4..d5c662e 100644
--- a/sc/source/core/data/funcdesc.cxx
+++ b/sc/source/core/data/funcdesc.cxx
@@ -736,8 +736,6 @@ const formula::IFunctionDescription* ScFunctionMgr::getFunctionByName(const ::rt
 // -----------------------------------------------------------------------------
 void ScFunctionMgr::fillLastRecentlyUsedFunctions(::std::vector< const formula::IFunctionDescription*>& _rLastRUFunctions) const
 {
-#define LRU_MAX 10
-
     const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions();
     sal_uInt16 nLRUFuncCount = Min( rAppOpt.GetLRUFuncListCount(), (sal_uInt16)LRU_MAX );
     sal_uInt16* pLRUListIds = rAppOpt.GetLRUFuncList();
diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx
index c3f9897..90e0706 100644
--- a/sc/source/ui/formdlg/dwfunctr.cxx
+++ b/sc/source/ui/formdlg/dwfunctr.cxx
@@ -203,20 +203,9 @@ ScFunctionDockWin::~ScFunctionDockWin()
 
 void ScFunctionDockWin::InitLRUList()
 {
-    const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions();
-    USHORT nLRUFuncCount = Min( rAppOpt.GetLRUFuncListCount(), (USHORT)LRU_MAX );
-    USHORT*	pLRUListIds = rAppOpt.GetLRUFuncList();
+    ScFunctionMgr* pFuncMgr = ScGlobal::GetStarCalcFunctionMgr();
+    pFuncMgr->fillLastRecentlyUsedFunctions(aLRUList);
 
-    USHORT i;
-    for ( i=0; i<LRU_MAX; i++ )
-        aLRUList[i] = NULL;
-
-    if ( pLRUListIds )
-    {
-        ScFunctionMgr* pFuncMgr = ScGlobal::GetStarCalcFunctionMgr();
-        for ( i=0; i<nLRUFuncCount; i++ )
-            aLRUList[i] = pFuncMgr->Get( pLRUListIds[i] );
-    }
 
     USHORT	nSelPos	  = aCatBox.GetSelectEntryPos();
 
@@ -827,11 +816,11 @@ void ScFunctionDockWin::UpdateFunctionList()
     }
     else // LRU-Liste
     {
-        for ( USHORT i=0; i<LRU_MAX && aLRUList[i]; i++ )
+        for(::std::vector<const formula::IFunctionDescription*>::iterator iter=aLRUList.begin();iter!=aLRUList.end();++iter)
         {
-            const ScFuncDesc* pDesc = aLRUList[i];
+            const formula::IFunctionDescription* pDesc = *iter;
             pAllFuncList->SetEntryData(
-                    pAllFuncList->InsertEntry( *(pDesc->pFuncName) ),
+                    pAllFuncList->InsertEntry(pDesc->getFunctionName()),
                     (void*)pDesc );
         }
     }
diff --git a/sc/source/ui/inc/dwfunctr.hxx b/sc/source/ui/inc/dwfunctr.hxx
index 6522e33..b542958 100644
--- a/sc/source/ui/inc/dwfunctr.hxx
+++ b/sc/source/ui/inc/dwfunctr.hxx
@@ -43,9 +43,6 @@
 #include "privsplt.hxx"
 #include "funcdesc.hxx"
 
-#ifndef	LRU_MAX
-#define LRU_MAX 10
-#endif
 /*************************************************************************
 |*
 |* Ableitung vom SfxChildWindow als "Behaelter" fuer Controller
@@ -96,7 +93,7 @@ private:
     String**			pArgArr;
 
 
-    const ScFuncDesc*   aLRUList[LRU_MAX];
+    ::std::vector< const formula::IFunctionDescription*> aLRUList;
 
     void			UpdateFunctionList();
     void			UpdateLRUList();


More information about the Libreoffice-commits mailing list