[Libreoffice-commits] core.git: include/svx svx/source

Caolán McNamara caolanm at redhat.com
Mon May 15 12:27:31 UTC 2017


 include/svx/gallery.hxx          |   13 +++++++------
 svx/source/gallery2/gallery1.cxx |   25 ++++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 7 deletions(-)

New commits:
commit 3b0915d094d795486159ed6f003f5f783fc6651f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 15 13:18:45 2017 +0100

    tdf#107845 string resource ids effectively ended up in the gallery format
    
    which is a problem since...
    
    commit 34f7e618ddd3399d9e7f3998e25545256255d02d
    Date:   Sun Apr 30 17:01:32 2017 +0100
    
        untranslated strings are just strings
    
    and recover GALLERY_THEME_HTMLBUTTONS and GALLERY_THEME_DUMMY5 from
    
    commit 2d3a9c51055a285a2ac8d45e3ef31d248362589b
    Date:   Mon Jul 2 21:02:19 2012 +0200
    
        hrc cleanup: Remove unused defines
    
        Change-Id: I3fa45e4550295b94a6ab0acf9bcd0b25db73e689
    
    Change-Id: Idae2c00f43e2062544f3de22e586bb163864bc03

diff --git a/include/svx/gallery.hxx b/include/svx/gallery.hxx
index 27429fb47bb5..d5a534615734 100644
--- a/include/svx/gallery.hxx
+++ b/include/svx/gallery.hxx
@@ -27,12 +27,13 @@
 // Defines for preinstalled themes
 // Has to be in sync with svx/inc/galtheme.hrc
 #define GALLERY_THEME_3D                1
-#define GALLERY_THEME_BULLETS       3
-#define GALLERY_THEME_HOMEPAGE      10
-#define GALLERY_THEME_POWERPOINT    16
-#define GALLERY_THEME_SOUNDS        18
-#define GALLERY_THEME_USERSOUNDS    21
-
+#define GALLERY_THEME_BULLETS           3
+#define GALLERY_THEME_HOMEPAGE          10
+#define GALLERY_THEME_HTMLBUTTONS       15
+#define GALLERY_THEME_POWERPOINT        16
+#define GALLERY_THEME_SOUNDS            18
+#define GALLERY_THEME_USERSOUNDS        21
+#define GALLERY_THEME_DUMMY5            36
 #define GALLERY_THEME_FONTWORK          37
 #define GALLERY_THEME_FONTWORK_VERTICAL 38
 
diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx
index ae03b34f6c1e..6f8992fafb46 100644
--- a/svx/source/gallery2/gallery1.cxx
+++ b/svx/source/gallery2/gallery1.cxx
@@ -101,7 +101,30 @@ GalleryThemeEntry::GalleryThemeEntry( bool bCreateUniqueURL,
     // This is awful - we shouldn't use these resources if we
     // possibly can avoid them
     if( aName.isEmpty() && nId && bThemeNameFromResource )
-        aName = GAL_RESSTR( RID_GALLERYSTR_THEME_START + (sal_uInt16) nId );
+    {
+        //some of these are supposed to *not* be localized
+        //so catch them before looking up the resource
+        const std::pair<sal_uInt16, const char*> aUnlocalized[] =
+        {
+            { GALLERY_THEME_HOMEPAGE, RID_GALLERYSTR_THEME_HTMLBUTTONS },
+            { GALLERY_THEME_POWERPOINT, RID_GALLERYSTR_THEME_POWERPOINT },
+            { GALLERY_THEME_USERSOUNDS, RID_GALLERYSTR_THEME_USERSOUNDS },
+            { GALLERY_THEME_DUMMY5, RID_GALLERYSTR_THEME_DUMMY5 },
+            { GALLERY_THEME_FONTWORK, RID_GALLERYSTR_THEME_FONTWORK },
+            { GALLERY_THEME_FONTWORK_VERTICAL, RID_GALLERYSTR_THEME_FONTWORK_VERTICAL }
+        };
+        for (size_t i = 0; i < SAL_N_ELEMENTS(aUnlocalized); ++i)
+        {
+            if (aUnlocalized[i].first == nId)
+            {
+                aName = OUString::createFromAscii(aUnlocalized[i].second);
+                break;
+            }
+        }
+        //look up the rest of the ids in string resources
+        if (aName.isEmpty())
+            aName = GAL_RESSTR(RID_GALLERYSTR_THEME_START + (sal_uInt16) nId);
+    }
 
     if( aName.isEmpty() )
         aName = rName;


More information about the Libreoffice-commits mailing list