diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-24 19:22:59 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-24 19:22:59 +0200 |
commit | 4c04de3d52bb60c4f37c9dbf71a9caa5367d535a (patch) | |
tree | 87857afc663c7e8d891fec4dc275e8b86a1b2b8d /sd | |
parent | 418a4edf9a13bb5ca376b057f7240ed76b2e2f8f (diff) | |
parent | 255401622e4eea28a46c496de245c7318180598c (diff) |
Merge branch 'master' into feature/gnumake4
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/dlg/TemplateScanner.cxx | 23 | ||||
-rw-r--r-- | sd/source/ui/inc/TemplateScanner.hxx | 14 |
2 files changed, 36 insertions, 1 deletions
diff --git a/sd/source/ui/dlg/TemplateScanner.cxx b/sd/source/ui/dlg/TemplateScanner.cxx index d879d497803b..e98618856fab 100644 --- a/sd/source/ui/dlg/TemplateScanner.cxx +++ b/sd/source/ui/dlg/TemplateScanner.cxx @@ -31,6 +31,9 @@ #include "TemplateScanner.hxx" +#include <sfx2/templatelocnames.hrc> +#include <sfx2/sfxresid.hxx> + #include <comphelper/processfactory.hxx> #include <comphelper/documentconstants.hxx> @@ -263,7 +266,9 @@ TemplateScanner::State TemplateScanner::ScanEntry (void) || (sContentType == IMPRESS_XML_TEMPLATE) || (sContentType == IMPRESS_XML_TEMPLATE_B)) { - mpLastAddedEntry = new TemplateEntry(sTitle, sTargetURL); + ::rtl::OUString sLocalisedTitle = ConvertResourceString( + STR_TEMPLATE_NAME1_DEF, STR_TEMPLATE_NAME1, NUM_TEMPLATE_NAMES, sTitle ); + mpLastAddedEntry = new TemplateEntry(sLocalisedTitle, sTargetURL); mpTemplateDirectory->maEntries.push_back(mpLastAddedEntry); } } @@ -491,6 +496,22 @@ const TemplateEntry* TemplateScanner::GetLastAddedEntry (void) const return mpLastAddedEntry; } + + + +::rtl::OUString TemplateScanner::ConvertResourceString ( + int nSourceResIds, int nDestResIds, int nCount, const ::rtl::OUString& rString ) +{ + for( int i = 0; i < nCount; ++i ) + { + if( rString == ResId::toString( (const ResId)SfxResId( (sal_uInt16)(nSourceResIds + i) ) ) ) + { + return ResId::toString( (const ResId)SfxResId( (sal_uInt16)(nDestResIds + i) ) ); + } + } + return rString; +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/TemplateScanner.hxx b/sd/source/ui/inc/TemplateScanner.hxx index 86c862a298cf..87141fa286bc 100644 --- a/sd/source/ui/inc/TemplateScanner.hxx +++ b/sd/source/ui/inc/TemplateScanner.hxx @@ -214,6 +214,20 @@ private: Returns one of the states ERROR, SCAN_ENTRY, or SCAN_FOLDER. */ State ScanEntry (void); + + /** Convert a resource string - a template name - to its localised pair if it exists. + @param nSourceResIds + Resource ID where the list of original en-US template names begin. + @param nDestResIds + Resource ID where the list of localised template names begin. + @param nCount + The number of names that have been localised. + @param rString + Name to be translated. + @return + The localised pair of rString or rString if the former does not exist. + */ + ::rtl::OUString ConvertResourceString ( int nSourceResIds, int nDestResIds, int nCount, const ::rtl::OUString& rString ); }; } // end of namespace sd |