summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Rabi <prabi@caesar.elte.hu>2011-07-28 12:06:00 +0200
committerMichael Meeks <michael.meeks@novell.com>2011-07-29 15:28:15 +0100
commitdae746b9999b5a428311d57fc7f2e66a8a8b22e1 (patch)
tree57749254ef22c4d1ae01c1a67c92f5807f8daad7
parent03198f825bd0a776f2f08aa7fb81c3cfa5324a69 (diff)
Clean-up of bugfix fdo#32895 for the -3-4 branch
Contributed under license LGPLv3+/MPL.
-rw-r--r--sfx2/inc/sfx2/doctempl.hxx9
-rw-r--r--sfx2/source/doc/doctempl.cxx29
2 files changed, 35 insertions, 3 deletions
diff --git a/sfx2/inc/sfx2/doctempl.hxx b/sfx2/inc/sfx2/doctempl.hxx
index dff363ea80..52e8cfccc8 100644
--- a/sfx2/inc/sfx2/doctempl.hxx
+++ b/sfx2/inc/sfx2/doctempl.hxx
@@ -95,7 +95,14 @@ public:
::rtl::OUString GetTemplateTargetURLFromComponent( const ::rtl::OUString& aGroupName,
const ::rtl::OUString& aTitle );
- // Save as template worked -> update
+ // Convert a resource string - a template name - to its localised pair
+ // if it exists in templatelocnames.src
+ static ::rtl::OUString ConvertResourceString(int nSourceResIds,
+ int nDestResIds,
+ int nCount,
+ const ::rtl::OUString& rString);
+
+ // Speichern als Vorlage hat geklappt -> Aktualisieren
void NewTemplate(sal_uInt16 nRegion,
const String &rLongName,
const String &rFileName);
diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx
index dc72cb573e..55df091e35 100644
--- a/sfx2/source/doc/doctempl.cxx
+++ b/sfx2/source/doc/doctempl.cxx
@@ -778,6 +778,31 @@ String SfxDocumentTemplates::GetDefaultTemplatePath
//------------------------------------------------------------------------
+/** 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.
+*/
+OUString SfxDocumentTemplates::ConvertResourceString (
+ int nSourceResIds, int nDestResIds, int nCount, const OUString& rString )
+{
+ for( int i = 0; i < nCount; ++i )
+ {
+ if( rString == ResId::toString( SfxResId( nSourceResIds + i) ) )
+ return ResId::toString( SfxResId( nDestResIds + i ) );
+ }
+ return rString;
+}
+
+//------------------------------------------------------------------------
+
sal_Bool SfxDocumentTemplates::SaveDir
(
// SfxTemplateDir& rDir // Save Directory
@@ -1764,7 +1789,7 @@ DocTempl_EntryData_Impl::DocTempl_EntryData_Impl( RegionData_Impl* pParent,
const OUString& rTitle )
{
mpParent = pParent;
- maTitle = ConvertResourceString(
+ maTitle = SfxDocumentTemplates::ConvertResourceString(
STR_TEMPLATE_NAME1_DEF, STR_TEMPLATE_NAME1, NUM_TEMPLATE_NAMES, rTitle );
mbIsOwner = sal_False;
mbDidConvert= sal_False;
@@ -1790,7 +1815,7 @@ int DocTempl_EntryData_Impl::Compare( const OUString& rTitle ) const
return maTitle.compareTo( rTitle );
}
-//------------------------------------------------------------------------
+// -----------------------------------------------------------------------
SfxObjectShellRef DocTempl_EntryData_Impl::CreateObjectShell()
{
if( ! mxObjShell.Is() )