diff options
author | Peter Rabi <prabi@caesar.elte.hu> | 2011-07-28 12:06:00 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@novell.com> | 2011-07-29 15:28:15 +0100 |
commit | 45ff90404b02ad76e76d83365dc296a0b1220a35 (patch) | |
tree | 029094109caa8e79a57324f4b0b7d31dd111c67f /sfx2/source | |
parent | d298cdf53ac665004260181ff9eed56ef30889e7 (diff) |
Clean-up of bugfix fdo#32895 for the -3-4 branch
Contributed under license LGPLv3+/MPL.
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/doc/doctempl.cxx | 29 |
1 files changed, 27 insertions, 2 deletions
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() ) |