diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-02-06 11:51:27 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-02-07 13:07:57 +0000 |
commit | 1c48275a28fa3bccdeb6bc12e4f0bcea6c05a81b (patch) | |
tree | ab2355dba87b8a59efa0c8c90f4a3f384ad8a19c | |
parent | 7863798f2ab420fdb91ba3dcda6cea2ab2aded9d (diff) |
convert resources containing strings to stringarray resources
Change-Id: I8a306b417dcf533a148e34a6314e37589dcdda12
-rw-r--r-- | include/svx/swframeposstrings.hxx | 6 | ||||
-rw-r--r-- | sc/source/core/data/funcdesc.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/src/compiler.src | 58 | ||||
-rw-r--r-- | svx/source/dialog/swframeposstrings.cxx | 27 | ||||
-rw-r--r-- | svx/source/dialog/swframeposstrings.src | 259 | ||||
-rw-r--r-- | sw/source/ui/utlui/utlui.src | 114 | ||||
-rw-r--r-- | sw/source/uibase/utlui/initui.cxx | 22 |
7 files changed, 103 insertions, 391 deletions
diff --git a/include/svx/swframeposstrings.hxx b/include/svx/swframeposstrings.hxx index b81765ab8641..e04522e326cb 100644 --- a/include/svx/swframeposstrings.hxx +++ b/include/svx/swframeposstrings.hxx @@ -27,7 +27,7 @@ contains strings needed for positioning dialogs of frames and drawing in Writer */ -class SvxSwFramePosString_Impl; +class ResStringArray; class SVX_DLLPUBLIC SvxSwFramePosString { public: @@ -80,10 +80,10 @@ public: STR_MAX }; - const OUString& GetString(StringId eId); + OUString GetString(StringId eId) const; private: - std::unique_ptr<SvxSwFramePosString_Impl> pImpl; + std::unique_ptr<ResStringArray> pImpl; }; #endif diff --git a/sc/source/core/data/funcdesc.cxx b/sc/source/core/data/funcdesc.cxx index 56288b936166..b0c267177e29 100644 --- a/sc/source/core/data/funcdesc.cxx +++ b/sc/source/core/data/funcdesc.cxx @@ -629,7 +629,7 @@ sal_uInt32 ScFunctionCategory::getCount() const OUString ScFunctionCategory::getName() const { if ( m_sName.isEmpty() ) - m_sName = ScFunctionMgr::GetCategoryName(m_nCategory+1); + m_sName = ScFunctionMgr::GetCategoryName(m_nCategory); return m_sName; } @@ -770,14 +770,14 @@ void ScFunctionMgr::fillLastRecentlyUsedFunctions(::std::vector< const formula:: OUString ScFunctionMgr::GetCategoryName(sal_uInt32 _nCategoryNumber ) { - if ( _nCategoryNumber > SC_FUNCGROUP_COUNT ) + if (_nCategoryNumber >= SC_FUNCGROUP_COUNT) { OSL_FAIL("Invalid category number!"); return OUString(); } - std::unique_ptr<ScResourcePublisher> pCategories( new ScResourcePublisher( ScResId( RID_FUNCTION_CATEGORIES ) ) ); - return SC_RESSTR(static_cast<sal_uInt16>(_nCategoryNumber)); + ResStringArray aStringArray(ScResId(RID_FUNCTION_CATEGORIES)); + return aStringArray.GetString(_nCategoryNumber); } sal_Unicode ScFunctionMgr::getSingleToken(const formula::IFunctionManager::EToken _eToken) const diff --git a/sc/source/core/src/compiler.src b/sc/source/core/src/compiler.src index d89ad7011907..dd3199eda97d 100644 --- a/sc/source/core/src/compiler.src +++ b/sc/source/core/src/compiler.src @@ -20,51 +20,21 @@ #include "sc.hrc" #include <formula/compiler.hrc> -Resource RID_FUNCTION_CATEGORIES +StringArray RID_FUNCTION_CATEGORIES { - String 1 - { - Text[ en-US ] = "Database" ; - }; - String 2 - { - Text[ en-US ] = "Date&Time" ; - }; - String 3 - { - Text[ en-US ] = "Financial" ; - }; - String 4 - { - Text[ en-US ] = "Information" ; - }; - String 5 - { - Text[ en-US ] = "Logical" ; - }; - String 6 - { - Text[ en-US ] = "Mathematical" ; - }; - String 7 - { - Text[ en-US ] = "Array" ; - }; - String 8 - { - Text[ en-US ] = "Statistical" ; - }; - String 9 - { - Text[ en-US ] = "Spreadsheet" ; - }; - String 10 - { - Text[ en-US ] = "Text" ; - }; - String 11 - { - Text[ en-US ] = "Add-in" ; + ItemList [ en-US ] = + { + < "Database" ; >; + < "Date&Time" ; >; + < "Financial" ; >; + < "Information" ; >; + < "Logical" ; >; + < "Mathematical" ; >; + < "Array" ; >; + < "Statistical" ; >; + < "Spreadsheet" ; >; + < "Text" ; >; + < "Add-in" ; >; }; }; diff --git a/svx/source/dialog/swframeposstrings.cxx b/svx/source/dialog/swframeposstrings.cxx index a055b7789021..731b17d7c5a5 100644 --- a/svx/source/dialog/swframeposstrings.cxx +++ b/svx/source/dialog/swframeposstrings.cxx @@ -18,44 +18,27 @@ */ #include <svx/swframeposstrings.hxx> -#include <tools/rc.hxx> +#include <tools/resary.hxx> #include <tools/debug.hxx> #include <svx/dialmgr.hxx> #include <svx/dialogs.hrc> -class SvxSwFramePosString_Impl : public Resource -{ - friend class SvxSwFramePosString; - OUString aStrings[SvxSwFramePosString::STR_MAX]; -public: - SvxSwFramePosString_Impl(); -}; -SvxSwFramePosString_Impl::SvxSwFramePosString_Impl() : - Resource(SVX_RES(RID_SVXSW_FRAMEPOSITIONS)) -{ - for(sal_uInt16 i = 0; i < SvxSwFramePosString::STR_MAX; i++) - { - //string ids have to start at 1 - aStrings[i] = SVX_RESSTR(i + 1); - } - FreeResource(); -} - SvxSwFramePosString::SvxSwFramePosString() : - pImpl(new SvxSwFramePosString_Impl) + pImpl(new ResStringArray(SVX_RES(RID_SVXSW_FRAMEPOSITIONS))) { + assert(pImpl->Count() == SvxSwFramePosString::STR_MAX); } SvxSwFramePosString::~SvxSwFramePosString() { } -const OUString& SvxSwFramePosString::GetString(StringId eId) +OUString SvxSwFramePosString::GetString(StringId eId) const { DBG_ASSERT(eId >= 0 && eId < STR_MAX, "invalid StringId"); if(!(eId >= 0 && eId < STR_MAX)) eId = LEFT; - return pImpl->aStrings[eId]; + return pImpl->GetString(eId); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/swframeposstrings.src b/svx/source/dialog/swframeposstrings.src index 6ba0bbd1d5d5..c36efbf0296a 100644 --- a/svx/source/dialog/swframeposstrings.src +++ b/svx/source/dialog/swframeposstrings.src @@ -18,220 +18,53 @@ */ #include <svx/dialogs.hrc> -//the following defines have to match the (enum values + 1) in svx/swframeposstrings.hxx! -#define STR_LEFT 1 -#define STR_RIGHT 2 -#define STR_FROMLEFT 3 -#define STR_MIR_LEFT 4 -#define STR_MIR_RIGHT 5 -#define STR_MIR_FROMLEFT 6 -#define STR_FRAME 7 -#define STR_PRTAREA 8 -#define STR_REL_PG_LEFT 9 -#define STR_REL_PG_RIGHT 10 -#define STR_REL_FRM_LEFT 11 -#define STR_REL_FRM_RIGHT 12 -#define STR_MIR_REL_PG_LEFT 13 -#define STR_MIR_REL_PG_RIGHT 14 -#define STR_MIR_REL_FRM_LEFT 15 -#define STR_MIR_REL_FRM_RIGHT 16 -#define STR_REL_PG_FRAME 17 -#define STR_REL_PG_PRTAREA 18 -#define STR_REL_BASE 19 -#define STR_REL_CHAR 20 -#define STR_REL_ROW 21 -#define STR_REL_BORDER 22 -#define STR_REL_PRTAREA 23 -#define STR_FLY_REL_PG_LEFT 24 -#define STR_FLY_REL_PG_RIGHT 25 -#define STR_FLY_REL_PG_FRAME 26 -#define STR_FLY_REL_PG_PRTAREA 27 -#define STR_FLY_MIR_REL_PG_LEFT 28 -#define STR_FLY_MIR_REL_PG_RIGHT 29 -#define STR_TOP 30 -#define STR_BOTTOM 31 -#define STR_CENTER_HORI 32 -#define STR_CENTER_VERT 33 -#define STR_FROMTOP 34 -#define STR_FROMBOTTOM 35 -#define STR_BELOW 36 -#define STR_FROMRIGHT 37 -#define STR_REL_PG_TOP 38 -#define STR_REL_PG_BOTTOM 39 -#define STR_REL_FRM_TOP 40 -#define STR_REL_FRM_BOTTOM 41 -#define STR_REL_LINE 42 - -Resource RID_SVXSW_FRAMEPOSITIONS +//the following string have to match the (enum values) positions in svx/swframeposstrings.hxx! +StringArray RID_SVXSW_FRAMEPOSITIONS { - String STR_LEFT - { - Text [ en-US ] = "Left" ; - }; - String STR_MIR_LEFT - { - Text [ en-US ] = "Inside" ; - }; - String STR_RIGHT - { - Text [ en-US ] = "Right" ; - }; - String STR_MIR_RIGHT - { - Text [ en-US ] = "Outside" ; - }; - String STR_CENTER_VERT - { - Text [ en-US ] = "Center" ; - }; - String STR_FROMLEFT - { - Text [ en-US ] = "From left" ; - }; - String STR_MIR_FROMLEFT - { - Text [ en-US ] = "From inside" ; - }; - String STR_FRAME - { - Text [ en-US ] = "Paragraph area" ; - }; - String STR_PRTAREA - { - Text [ en-US ] = "Paragraph text area" ; - }; - String STR_REL_PG_LEFT - { - Text [ en-US ] = "Left page border" ; - }; - String STR_MIR_REL_PG_LEFT - { - Text [ en-US ] = "Inner page border" ; - }; - String STR_REL_PG_RIGHT - { - Text [ en-US ] = "Right page border" ; - }; - String STR_MIR_REL_PG_RIGHT - { - Text [ en-US ] = "Outer page border" ; - }; - String STR_REL_FRM_LEFT - { - Text [ en-US ] = "Left paragraph border" ; - }; - String STR_MIR_REL_FRM_LEFT - { - Text [ en-US ] = "Inner paragraph border" ; - }; - String STR_REL_FRM_RIGHT - { - Text [ en-US ] = "Right paragraph border" ; - }; - String STR_MIR_REL_FRM_RIGHT - { - Text [ en-US ] = "Outer paragraph border" ; - }; - String STR_REL_PG_FRAME - { - Text [ en-US ] = "Entire page" ; - }; - String STR_REL_PG_PRTAREA - { - Text [ en-US ] = "Page text area" ; - }; - String STR_TOP - { - Text [ en-US ] = "Top" ; - }; - String STR_BOTTOM - { - Text [ en-US ] = "Bottom" ; - }; - String STR_CENTER_HORI - { - Text [ en-US ] = "Center" ; - }; - String STR_FROMTOP - { - Text [ en-US ] = "From top" ; - }; - String STR_FROMBOTTOM - { - Text [ en-US ] = "From bottom" ; - }; - String STR_BELOW - { - Text [ en-US ] = "Below" ; - }; - String STR_FROMRIGHT - { - Text [ en-US ] = "From right" ; - }; - String STR_REL_PG_TOP - { - Text [ en-US ] = "Top page border" ; - }; - String STR_REL_PG_BOTTOM - { - Text [ en-US ] = "Bottom page border" ; - }; - String STR_REL_FRM_TOP - { - Text [ en-US ] = "Top paragraph border" ; - }; - String STR_REL_FRM_BOTTOM - { - Text [ en-US ] = "Bottom paragraph border" ; - }; - String STR_REL_BORDER - { - Text [ en-US ] = "Margin" ; - }; - String STR_REL_PRTAREA - { - Text [ en-US ] = "Paragraph text area" ; - }; - String STR_FLY_REL_PG_LEFT - { - Text [ en-US ] = "Left frame border" ; - }; - String STR_FLY_MIR_REL_PG_LEFT - { - Text [ en-US ] = "Inner frame border" ; - }; - String STR_FLY_REL_PG_RIGHT - { - Text [ en-US ] = "Right frame border" ; - }; - String STR_FLY_MIR_REL_PG_RIGHT - { - Text [ en-US ] = "Outer frame border" ; - }; - String STR_FLY_REL_PG_FRAME - { - Text [ en-US ] = "Entire frame" ; - }; - String STR_FLY_REL_PG_PRTAREA - { - Text [ en-US ] = "Frame text area" ; - }; - String STR_REL_BASE - { - Text [ en-US ] = "Base line" ; - }; - String STR_REL_CHAR - { - Text [ en-US ] = "Character" ; - }; - String STR_REL_ROW - { - Text [ en-US ] = "Row" ; - }; - // #i22341# - String STR_REL_LINE - { - Text [ en-US ] = "Line of text" ; + ItemList [ en-US ] = + { + < "Left" ; > ; + < "Inside" ; > ; + < "Right" ; > ; + < "Outside" ; > ; + < "Center" ; > ; + < "From left" ; > ; + < "From inside" ; > ; + < "Paragraph area" ; > ; + < "Paragraph text area" ; > ; + < "Left page border" ; > ; + < "Inner page border" ; > ; + < "Right page border" ; > ; + < "Outer page border" ; > ; + < "Left paragraph border" ; > ; + < "Inner paragraph border" ; > ; + < "Right paragraph border" ; > ; + < "Outer paragraph border" ; > ; + < "Entire page" ; > ; + < "Page text area" ; > ; + < "Top" ; > ; + < "Bottom" ; > ; + < "Center" ; > ; + < "From top" ; > ; + < "From bottom" ; > ; + < "Below" ; > ; + < "From right" ; > ; + < "Top page border" ; > ; + < "Bottom page border" ; > ; + < "Top paragraph border" ; > ; + < "Bottom paragraph border" ; > ; + < "Margin" ; > ; + < "Paragraph text area" ; > ; + < "Left frame border" ; > ; + < "Inner frame border" ; > ; + < "Right frame border" ; > ; + < "Outer frame border" ; > ; + < "Entire frame" ; > ; + < "Frame text area" ; > ; + < "Base line" ; > ; + < "Character" ; > ; + < "Row" ; > ; + < "Line of text" ; > ; }; }; diff --git a/sw/source/ui/utlui/utlui.src b/sw/source/ui/utlui/utlui.src index 61f465374245..574f52e04777 100644 --- a/sw/source/ui/utlui/utlui.src +++ b/sw/source/ui/utlui/utlui.src @@ -22,99 +22,33 @@ #include "helpid.h" #include "comcore.hrc" -Resource RID_SHELLRES_AUTOFMTSTRS +StringArray RID_SHELLRES_AUTOFMTSTRS { - String STR_AUTOFMTREDL_DEL_EMPTY_PARA+1 + ItemList [ en-US ] = { - Text [ en-US ] = "Remove empty paragraphs" ; + < "Remove empty paragraphs" ; > ; + < "Use replacement table" ; > ; + < "Correct TWo INitial CApitals" ; > ; + < "Capitalize first letter of sentences" ; > ; + < "Replace \"standard\" quotes with %1 \bcustom%2 quotes" ; > ; + < "Replace Custom Styles" ; > ; + < "Bullets replaced"; > ; + < "Automatic _underline_"; > ; + < "Automatic *bold*"; > ; + < "Replace 1/2 ... with ½ ..." ; > ; + < "URL recognition" ; > ; + < "Replace dashes" ; > ; + < "Replace 1st... with 1^st..." ; > ; + < "Combine single line paragraphs"; > ; + < "Set \"Text body\" Style"; > ; + < "Set \"Text body indent\" Style"; > ; + < "Set \"Hanging indent\" Style"; > ; + < "Set \"Text body indent\" Style"; > ; + < "Set \"Heading $(ARG1)\" Style"; > ; + < "Set \"Bullet\" or \"Numbering\" Style"; > ; + < "Combine paragraphs"; > ; + < "Add non breaking space"; > ; }; - String STR_AUTOFMTREDL_USE_REPLACE+1 - { - Text [ en-US ] = "Use replacement table" ; - }; - String STR_AUTOFMTREDL_CPTL_STT_WORD+1 - { - Text [ en-US ] = "Correct TWo INitial CApitals" ; - }; - String STR_AUTOFMTREDL_CPTL_STT_SENT+1 - { - Text [ en-US ] = "Capitalize first letter of sentences" ; - }; - String STR_AUTOFMTREDL_TYPO+1 - { - Text [ en-US ] = "Replace \"standard\" quotes with %1 \bcustom%2 quotes" ; - }; - String STR_AUTOFMTREDL_USER_STYLE+1 - { - Text [ en-US ] = "Replace Custom Styles" ; - }; - String STR_AUTOFMTREDL_BULLET+1 - { - Text [ en-US ] = "Bullets replaced"; - }; - String STR_AUTOFMTREDL_UNDER+1 - { - Text [ en-US ] = "Automatic _underline_"; - }; - String STR_AUTOFMTREDL_BOLD+1 - { - Text [ en-US ] = "Automatic *bold*"; - }; - String STR_AUTOFMTREDL_FRACTION+1 - { - Text [ en-US ] = "Replace 1/2 ... with ½ ..." ; - }; - String STR_AUTOFMTREDL_DETECT_URL+1 - { - Text [ en-US ] = "URL recognition" ; - }; - String STR_AUTOFMTREDL_DASH+1 - { - Text [ en-US ] = "Replace dashes" ; - }; - String STR_AUTOFMTREDL_ORDINAL+1 - { - Text [ en-US ] = "Replace 1st... with 1^st..." ; - }; - String STR_AUTOFMTREDL_RIGHT_MARGIN+1 - { - Text [ en-US ] = "Combine single line paragraphs"; - }; - - String STR_AUTOFMTREDL_SET_TMPL_TEXT +1 - { - Text [ en-US ] = "Set \"Text body\" Style"; - }; - String STR_AUTOFMTREDL_SET_TMPL_INDENT +1 - { - Text [ en-US ] = "Set \"Text body indent\" Style"; - }; - String STR_AUTOFMTREDL_SET_TMPL_NEG_INDENT +1 - { - Text [ en-US ] = "Set \"Hanging indent\" Style"; - }; - String STR_AUTOFMTREDL_SET_TMPL_TEXT_INDENT +1 - { - Text [ en-US ] = "Set \"Text body indent\" Style"; - }; - String STR_AUTOFMTREDL_SET_TMPL_HEADLINE +1 - { - Text [ en-US ] = "Set \"Heading $(ARG1)\" Style"; - }; - String STR_AUTOFMTREDL_SET_NUMBULET +1 - { - Text [ en-US ] = "Set \"Bullet\" or \"Numbering\" Style"; - }; - - String STR_AUTOFMTREDL_DEL_MORELINES +1 - { - Text [ en-US ] = "Combine paragraphs"; - }; - String STR_AUTOFMTREDL_NON_BREAK_SPACE +1 - { - Text [ en-US ] = "Add non breaking space"; - }; - }; // Miscellaneous diff --git a/sw/source/uibase/utlui/initui.cxx b/sw/source/uibase/utlui/initui.cxx index ab67b03b5c5d..8e641e358fa4 100644 --- a/sw/source/uibase/utlui/initui.cxx +++ b/sw/source/uibase/utlui/initui.cxx @@ -19,6 +19,7 @@ #include <config_features.h> +#include <tools/resary.hxx> #include <unotools/localedatawrapper.hxx> #include <viewsh.hxx> #include <initui.hxx> @@ -269,35 +270,26 @@ SwGlossaryList* GetGlossaryList() return pGlossaryList; } -struct ImpAutoFormatNameListLoader : public Resource -{ - explicit ImpAutoFormatNameListLoader( std::vector<OUString>& rLst ); -}; - void ShellResource::GetAutoFormatNameLst_() const { assert(!pAutoFormatNameLst); pAutoFormatNameLst.reset( new std::vector<OUString> ); pAutoFormatNameLst->reserve(STR_AUTOFMTREDL_END); - ImpAutoFormatNameListLoader aTmp(*pAutoFormatNameLst); -} -ImpAutoFormatNameListLoader::ImpAutoFormatNameListLoader( std::vector<OUString>& rLst ) - : Resource( ResId(RID_SHELLRES_AUTOFMTSTRS, *pSwResMgr) ) -{ - for( sal_uInt16 n = 0; n < STR_AUTOFMTREDL_END; ++n ) + ResStringArray aStringArray(ResId(RID_SHELLRES_AUTOFMTSTRS, *pSwResMgr)); + assert(aStringArray.Count() === STR_AUTOFMTREDL_END); + for (sal_uInt16 n = 0; n < STR_AUTOFMTREDL_END; ++n) { - OUString p(ResId(n + 1, *pSwResMgr)); - if(STR_AUTOFMTREDL_TYPO == n) + OUString p(aStringArray.GetString(n)); + if (STR_AUTOFMTREDL_TYPO == n) { const SvtSysLocale aSysLocale; const LocaleDataWrapper& rLclD = aSysLocale.GetLocaleData(); p = p.replaceFirst("%1", rLclD.getDoubleQuotationMarkStart()); p = p.replaceFirst("%2", rLclD.getDoubleQuotationMarkEnd()); } - rLst.insert(rLst.begin() + n, p); + pAutoFormatNameLst->push_back(p); } - FreeResource(); } OUString SwAuthorityFieldType::GetAuthFieldName(ToxAuthorityField eType) |