summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorPeter Rabi <prabi@caesar.elte.hu>2011-07-20 16:48:09 +0200
committerAndras Timar <atimar@suse.com>2011-07-22 21:52:45 +0200
commita8ef97f13b16a984d48450b05e4cb337f53a03a1 (patch)
tree2b34aaa0d365ecd7a5130c65e6cdd5707467e31c /sd
parent4cae99bd81d4c64a292b5e59753916b67c9dc24c (diff)
Bugfix fdo#32895 : un-translated template names (part 1/2)
Contributed under license LGPLv3+/MPL.
Diffstat (limited to 'sd')
-rw-r--r--sd/AllLangResTarget_sd.mk1
-rw-r--r--sd/source/ui/dlg/TemplateScanner.cxx23
-rw-r--r--sd/source/ui/inc/TemplateScanner.hxx14
3 files changed, 37 insertions, 1 deletions
diff --git a/sd/AllLangResTarget_sd.mk b/sd/AllLangResTarget_sd.mk
index 68a5c6bf1cee..a6f256d00ee1 100644
--- a/sd/AllLangResTarget_sd.mk
+++ b/sd/AllLangResTarget_sd.mk
@@ -93,6 +93,7 @@ $(eval $(call gb_SrsTarget_add_files,sd/res,\
sd/source/ui/slidesorter/view/SlsResource.src \
sd/source/ui/table/TableDesignPane.src \
sd/source/ui/view/DocumentRenderer.src \
+ sfx2/source/doc/templatelocnames.src \
))
$(eval $(call gb_SrsTarget_add_templates,sd/res,\
diff --git a/sd/source/ui/dlg/TemplateScanner.cxx b/sd/source/ui/dlg/TemplateScanner.cxx
index d879d497803b..0dd67622852e 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 "sdresid.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)SdResId( (sal_uInt16)(nSourceResIds + i) ) ) )
+ {
+ return ResId::toString( (const ResId)SdResId( (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