[Libreoffice-commits] core.git: scaddins/source

Caolán McNamara caolanm at redhat.com
Tue Feb 14 12:15:11 UTC 2017


 scaddins/source/datefunc/datefunc.hxx |   29 +++++++-----------------
 scaddins/source/datefunc/datefunc.src |   41 ++++++++--------------------------
 2 files changed, 19 insertions(+), 51 deletions(-)

New commits:
commit dd355079b82f3b2b7e49533c89aee7819ffae3d3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 14 12:07:49 2017 +0000

    replace localresource of strings and keys with StringArray
    
    Change-Id: I4bbf5286384905b6201b1a04f161d50f4c9d4aef

diff --git a/scaddins/source/datefunc/datefunc.hxx b/scaddins/source/datefunc/datefunc.hxx
index 1a30f8a..d66b739 100644
--- a/scaddins/source/datefunc/datefunc.hxx
+++ b/scaddins/source/datefunc/datefunc.hxx
@@ -37,35 +37,27 @@
 #include <tools/rc.hxx>
 #include <tools/resary.hxx>
 
-
 class ScaResId : public ResId
 {
 public:
-                                ScaResId( sal_uInt16 nResId, ResMgr& rResMgr );
+    ScaResId(sal_uInt16 nResId, ResMgr& rResMgr);
 };
 
-
-class ScaResStringLoader : public Resource
+class ScaResStringLoader
 {
 private:
     OUString                    aStr;
 
 public:
-    inline                      ScaResStringLoader( sal_uInt16 nResId, sal_uInt16 nStrId, ResMgr& rResMgr );
-
-    inline const OUString&      GetString() const   { return aStr; }
+    ScaResStringLoader(sal_uInt16 nResId, sal_uInt16 nStrId, ResMgr& rResMgr)
+    {
+        ResStringArray aStrArray(ScaResId(nResId, rResMgr));
+        aStr = aStrArray.GetString(aStrArray.FindIndex(nStrId));
+    }
 
+    const OUString&      GetString() const   { return aStr; }
 };
 
-
-inline ScaResStringLoader::ScaResStringLoader( sal_uInt16 nResId, sal_uInt16 nStrId, ResMgr& rResMgr ) :
-    Resource( ScaResId( nResId, rResMgr ) ),
-    aStr( ScaResId( nStrId, rResMgr ) )
-{
-    FreeResource();
-}
-
-
 class ScaResStringArrLoader : public Resource
 {
 private:
@@ -84,7 +76,6 @@ inline ScaResStringArrLoader::ScaResStringArrLoader( sal_uInt16 nResId, sal_uInt
     FreeResource();
 }
 
-
 class ScaResPublisher : public Resource
 {
 public:
@@ -94,14 +85,12 @@ public:
     using Resource::FreeResource;
 };
 
-
 class ScaFuncRes : public Resource
 {
 public:
-                                ScaFuncRes( ResId& rResId, ResMgr& rResMgr, sal_uInt16 nIndex, OUString& rRet );
+    ScaFuncRes(ResId& rResId, ResMgr& rResMgr, sal_uInt16 nIndex, OUString& rRet);
 };
 
-
 enum class ScaCategory
 {
     DateTime,
diff --git a/scaddins/source/datefunc/datefunc.src b/scaddins/source/datefunc/datefunc.src
index 17a64b1..be54ec5 100644
--- a/scaddins/source/datefunc/datefunc.src
+++ b/scaddins/source/datefunc/datefunc.src
@@ -198,39 +198,18 @@ Resource RID_DATE_FUNCTION_DESCRIPTIONS
     };
 };
 
-Resource RID_DATE_FUNCTION_NAMES
+StringArray RID_DATE_FUNCTION_NAMES
 {
-    String DATE_FUNCNAME_DiffWeeks
+    ItemList [ en-US ] =
     {
-        Text [ en-US ] = "WEEKS";
-    };
-    String DATE_FUNCNAME_DiffMonths
-    {
-        Text [ en-US ] = "MONTHS";
-    };
-    String DATE_FUNCNAME_DiffYears
-    {
-        Text [ en-US ] = "YEARS";
-    };
-    String DATE_FUNCNAME_IsLeapYear
-    {
-        Text [ en-US ] = "ISLEAPYEAR";
-    };
-    String DATE_FUNCNAME_DaysInMonth
-    {
-        Text [ en-US ] = "DAYSINMONTH";
-    };
-    String DATE_FUNCNAME_DaysInYear
-    {
-        Text [ en-US ] = "DAYSINYEAR";
-    };
-    String DATE_FUNCNAME_WeeksInYear
-    {
-        Text [ en-US ] = "WEEKSINYEAR";
-    };
-    String DATE_FUNCNAME_Rot13
-    {
-        Text [ en-US ] = "ROT13";
+        < "WEEKS" ; DATE_FUNCNAME_DiffWeeks ; >;
+        < "MONTHS" ; DATE_FUNCNAME_DiffMonths ; >;
+        < "YEARS" ; DATE_FUNCNAME_DiffYears ; >;
+        < "ISLEAPYEAR" ; DATE_FUNCNAME_IsLeapYear ; >;
+        < "DAYSINMONTH" ; DATE_FUNCNAME_DaysInMonth ; >;
+        < "DAYSINYEAR" ; DATE_FUNCNAME_DaysInYear ; >;
+        < "WEEKSINYEAR" ; DATE_FUNCNAME_WeeksInYear ; >;
+        < "ROT13" ; DATE_FUNCNAME_Rot13 ; >;
     };
 };
 


More information about the Libreoffice-commits mailing list