[Libreoffice-commits] .: 2 commits - sd/source

Andras Timar timar at kemper.freedesktop.org
Fri Jul 22 12:55:24 PDT 2011


 sd/source/ui/dlg/TemplateScanner.cxx |   23 ++++++++++++++++++++++-
 sd/source/ui/inc/TemplateScanner.hxx |   14 ++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)

New commits:
commit 576591ca3dd1028f644116f81651a1179dc0da84
Author: Andras Timar <atimar at suse.com>
Date:   Fri Jul 22 21:53:52 2011 +0200

    take strings from sfx<lang>.res, don't duplicate them in sd<lang>.res

diff --git a/sd/AllLangResTarget_sd.mk b/sd/AllLangResTarget_sd.mk
index a6f256d..68a5c6b 100644
--- a/sd/AllLangResTarget_sd.mk
+++ b/sd/AllLangResTarget_sd.mk
@@ -93,7 +93,6 @@ $(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 c1c271d..4f7f614 100644
--- a/sd/source/ui/dlg/TemplateScanner.cxx
+++ b/sd/source/ui/dlg/TemplateScanner.cxx
@@ -32,7 +32,7 @@
 #include "TemplateScanner.hxx"
 
 #include <sfx2/templatelocnames.hrc>
-#include "sdresid.hxx"
+#include <sfx2/sfxresid.hxx>
 
 #include <comphelper/processfactory.hxx>
 #include <comphelper/documentconstants.hxx>
@@ -504,9 +504,9 @@ const TemplateEntry* TemplateScanner::GetLastAddedEntry (void) const
 {
     for( int i = 0; i < nCount; ++i )
     {
-        if( rString == ResId::toString( (const ResId)SdResId( (sal_uInt16)(nSourceResIds + i) ) ) )
+        if( rString == ResId::toString( (const ResId)SfxResId( (sal_uInt16)(nSourceResIds + i) ) ) )
         {
-            return ResId::toString( (const ResId)SdResId( (sal_uInt16)(nDestResIds + i) ) );
+            return ResId::toString( (const ResId)SfxResId( (sal_uInt16)(nDestResIds + i) ) );
         }
     }
     return rString;
commit 3ca0cf3b7f79c247e9f25ac7113dd6fbe9cf9d50
Author: Peter Rabi <prabi at caesar.elte.hu>
Date:   Wed Jul 20 16:48:09 2011 +0200

    Bugfix fdo#32895 : un-translated template names (part 1/2)
    
    Contributed under license LGPLv3+/MPL.

diff --git a/sd/AllLangResTarget_sd.mk b/sd/AllLangResTarget_sd.mk
index 68a5c6b..a6f256d 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 360d9e6..c1c271d 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 deb48ef..db5dbe7 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


More information about the Libreoffice-commits mailing list