summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2011-07-24 19:22:59 +0200
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2011-07-24 19:22:59 +0200
commit4e1240e7afa91261578532eeca90e325b4231255 (patch)
treeb903aee8b03e421bdafd3c94dfc346311bb75aed
parent0fb9e53c06265200b8836e60d9c748671126ca2b (diff)
parent576591ca3dd1028f644116f81651a1179dc0da84 (diff)
Merge branch 'master' into feature/gnumake4feature/gnumake4
-rw-r--r--sd/source/ui/dlg/TemplateScanner.cxx23
-rw-r--r--sd/source/ui/inc/TemplateScanner.hxx14
2 files changed, 36 insertions, 1 deletions
diff --git a/sd/source/ui/dlg/TemplateScanner.cxx b/sd/source/ui/dlg/TemplateScanner.cxx
index 360d9e645..4f7f61417 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 deb48ef05..db5dbe75a 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