diff options
-rw-r--r-- | sfx2/inc/sfx2/doctempl.hxx | 9 | ||||
-rw-r--r-- | sfx2/source/doc/doctempl.cxx | 29 |
2 files changed, 35 insertions, 3 deletions
diff --git a/sfx2/inc/sfx2/doctempl.hxx b/sfx2/inc/sfx2/doctempl.hxx index 1216ef09bcdc..cfd7e02a3027 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 dc72cb573e99..55df091e35e9 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() ) |