[Libreoffice-commits] .: sfx2/inc sfx2/source
Michael Meeks
michael at kemper.freedesktop.org
Fri Jul 29 07:30:58 PDT 2011
sfx2/inc/sfx2/doctempl.hxx | 9 ++++++++-
sfx2/source/doc/doctempl.cxx | 29 +++++++++++++++++++++++++++--
2 files changed, 35 insertions(+), 3 deletions(-)
New commits:
commit dae746b9999b5a428311d57fc7f2e66a8a8b22e1
Author: Peter Rabi <prabi at caesar.elte.hu>
Date: Thu Jul 28 12:06:00 2011 +0200
Clean-up of bugfix fdo#32895 for the -3-4 branch
Contributed under license LGPLv3+/MPL.
diff --git a/sfx2/inc/sfx2/doctempl.hxx b/sfx2/inc/sfx2/doctempl.hxx
index dff363e..52e8cfc 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 dc72cb5..55df091 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() )
More information about the Libreoffice-commits
mailing list