sc/inc/globstr.hrc                  |   19 +++++++++++++++++--
 sc/source/core/data/stlpool.cxx     |   19 ++++++++++++-------
 sc/source/core/tool/stylehelper.cxx |   33 +++++++++++++++++++++++++++++----
 3 files changed, 58 insertions(+), 13 deletions(-)

New commits:
commit 4a3466851c22920aa57443cb31b8f0c57d6c73ce
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Sat Oct 10 14:16:56 2020 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Sat Oct 10 15:59:35 2020 +0200

    Resolves: tdf#137370 Re-enable UI translated standard cell style names
    
    Regression from style rework
    
        commit 7b0aed617f1e57335837cf56ef2d222a96f8270d
        CommitDate: Wed Sep 28 11:42:56 2016 +0000
    
            Remove old cell styles from calc
    
    to
    
        commit 06f319937187f76ee402d53b3baa78c391c2af19
        CommitDate: Sun Oct 2 13:51:26 2016 +0000
    
            tdf#90937 Add a set of cell styles to calc
    
    Change-Id: I34dddb3ca3e54e3da5db112e1f9bcc8437fbda77
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104141
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins

diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index a325e4087555..9cc238bee9ba 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -271,10 +271,25 @@
 #define STR_IMPORT_DIF                          NC_("STR_IMPORT_DIF", "Dif 
Import")
 #define STR_STYLENAME_STANDARD_CELL             NC_("STR_STYLENAME_STANDARD", 
"Default Cell Style")
 #define STR_STYLENAME_STANDARD_PAGE             NC_("STR_STYLENAME_STANDARD", 
"Default Page Style")
+#define STR_STYLENAME_HEADING                   NC_("STR_STYLENAME_HEADING", 
"Heading")
+#define STR_STYLENAME_HEADING_1                 NC_("STR_STYLENAME_HEADING_1", 
"Heading 1")
+#define STR_STYLENAME_HEADING_2                 NC_("STR_STYLENAME_HEADING_2", 
"Heading 2")
+#define STR_STYLENAME_TEXT                      NC_("STR_STYLENAME_TEXT", 
"Text")
+#define STR_STYLENAME_NOTE                      NC_("STR_STYLENAME_NOTE", 
"Note")
+#define STR_STYLENAME_FOOTNOTE                  NC_("STR_STYLENAME_FOOTNOTE", 
"Footnote")
+#define STR_STYLENAME_HYPERLINK                 NC_("STR_STYLENAME_HYPERLINK", 
"Hyperlink")
+#define STR_STYLENAME_STATUS                    NC_("STR_STYLENAME_STATUS", 
"Status")
+#define STR_STYLENAME_GOOD                      NC_("STR_STYLENAME_GOOD", 
"Good")
+#define STR_STYLENAME_NEUTRAL                   NC_("STR_STYLENAME_NEUTRAL", 
"Neutral")
+#define STR_STYLENAME_BAD                       NC_("STR_STYLENAME_BAD", "Bad")
+#define STR_STYLENAME_WARNING                   NC_("STR_STYLENAME_WARNING", 
"Warning")
+#define STR_STYLENAME_ERROR                     NC_("STR_STYLENAME_ERROR", 
"Error")
+#define STR_STYLENAME_ACCENT                    NC_("STR_STYLENAME_ACCENT", 
"Accent")
+#define STR_STYLENAME_ACCENT_1                  NC_("STR_STYLENAME_ACCENT_1", 
"Accent 1")
+#define STR_STYLENAME_ACCENT_2                  NC_("STR_STYLENAME_ACCENT_2", 
"Accent 2")
+#define STR_STYLENAME_ACCENT_3                  NC_("STR_STYLENAME_ACCENT_3", 
"Accent 3")
 #define STR_STYLENAME_RESULT                    NC_("STR_STYLENAME_RESULT", 
"Result")
 #define STR_STYLENAME_RESULT1                   NC_("STR_STYLENAME_RESULT1", 
"Result2")
-#define STR_STYLENAME_HEADLINE                  NC_("STR_STYLENAME_HEADLINE", 
"Heading")
-#define STR_STYLENAME_HEADLINE1                 NC_("STR_STYLENAME_HEADLINE1", 
"Heading1")
 #define STR_STYLENAME_REPORT                    NC_("STR_STYLENAME_REPORT", 
"Report")
 #define STR_THESAURUS_NO_STRING                 NC_("STR_THESAURUS_NO_STRING", 
"Thesaurus can only be used in text cells!")
 #define STR_SPELLING_BEGIN_TAB                  NC_("STR_SPELLING_BEGIN_TAB", 
"Should the spellcheck be continued at the beginning of the current sheet?")
diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx
index 6a8fcd5f5663..59de29c849de 100644
--- a/sc/source/core/data/stlpool.cxx
+++ b/sc/source/core/data/stlpool.cxx
@@ -49,6 +49,7 @@
 #include <stlpool.hxx>
 #include <stlsheet.hxx>
 #include <editutil.hxx>
+#include <stylehelper.hxx>
 
 ScStyleSheetPool::ScStyleSheetPool( const SfxItemPool& rPoolP,
                                     ScDocument*     pDocument )
@@ -71,14 +72,14 @@ void ScStyleSheetPool::SetDocument( ScDocument* pDocument )
 SfxStyleSheetBase& ScStyleSheetPool::Make( const OUString& rName,
                                            SfxStyleFamily eFam, 
SfxStyleSearchBits mask)
 {
-    //  When updating styles from a template, Office 5.1 sometimes created
-    //  files with multiple default styles.
-    //  Create new styles in that case:
-
-    //TODO: only when loading?
-
     if ( rName == STRING_STANDARD && Find( rName, eFam ) != nullptr )
     {
+        //  When updating styles from a template, Office 5.1 sometimes created
+        //  files with multiple default styles.
+        //  Create new styles in that case:
+
+        //TODO: only when loading?
+
         OSL_FAIL("renaming additional default style");
         sal_uInt32 nCount = GetIndexedStyleSheets().GetNumberOfStyleSheets();
         for ( sal_uInt32 nAdd = 1; nAdd <= nCount; nAdd++ )
@@ -91,7 +92,11 @@ SfxStyleSheetBase& ScStyleSheetPool::Make( const OUString& 
rName,
                 return SfxStyleSheetPool::Make(aNewName, eFam, mask);
         }
     }
-    return SfxStyleSheetPool::Make(rName, eFam, mask);
+
+    // Core uses translated names for both naming and display.
+    // This for all three, loading standard builtin styles from styles.xml
+    // configuration, loading documents and updating from templates.
+    return SfxStyleSheetPool::Make( 
ScStyleNameConversion::ProgrammaticToDisplayName( rName, eFam), eFam, mask);
 }
 
 SfxStyleSheetBase* ScStyleSheetPool::Create( const OUString&   rName,
diff --git a/sc/source/core/tool/stylehelper.cxx 
b/sc/source/core/tool/stylehelper.cxx
index 4ae540af921b..9cec093029ae 100644
--- a/sc/source/core/tool/stylehelper.cxx
+++ b/sc/source/core/tool/stylehelper.cxx
@@ -33,8 +33,8 @@
 #define SC_STYLE_PROG_STANDARD      "Default"
 #define SC_STYLE_PROG_RESULT        "Result"
 #define SC_STYLE_PROG_RESULT1       "Result2"
-#define SC_STYLE_PROG_HEADLINE      "Heading"
-#define SC_STYLE_PROG_HEADLINE1     "Heading1"
+#define SC_STYLE_PROG_HEADING       "Heading"
+#define SC_STYLE_PROG_HEADING1      "Heading1"
 #define SC_STYLE_PROG_REPORT        "Report"
 
 #define SC_PIVOT_STYLE_PROG_INNER                  "Pivot Table Value"
@@ -60,11 +60,36 @@ static const ScDisplayNameMap* lcl_GetStyleNameMap( 
SfxStyleFamily nType )
     {
         static ScDisplayNameMap const aCellMap[]
         {
+            // Standard builtin styles from configuration.
+            // Defined in sc/res/xml/styles.xml
+            // Installed to "$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER 
"/calc/styles.xml"
+            // e.g. /usr/lib64/libreoffice/share/calc/styles.xml
+            // or instdir/share/calc/styles.xml
+            { ScResId( STR_STYLENAME_HEADING ),   "Heading" },
+            { ScResId( STR_STYLENAME_HEADING_1 ), "Heading 1" },
+            { ScResId( STR_STYLENAME_HEADING_2 ), "Heading 2" },
+            { ScResId( STR_STYLENAME_TEXT ),      "Text" },
+            { ScResId( STR_STYLENAME_NOTE ),      "Note" },
+            { ScResId( STR_STYLENAME_FOOTNOTE ),  "Footnote" },
+            { ScResId( STR_STYLENAME_HYPERLINK ), "Hyperlink" },
+            { ScResId( STR_STYLENAME_STATUS ),    "Status" },
+            { ScResId( STR_STYLENAME_GOOD ),      "Good" },
+            { ScResId( STR_STYLENAME_NEUTRAL ),   "Neutral" },
+            { ScResId( STR_STYLENAME_BAD ),       "Bad" },
+            { ScResId( STR_STYLENAME_WARNING ),   "Warning" },
+            { ScResId( STR_STYLENAME_ERROR ),     "Error" },
+            { ScResId( STR_STYLENAME_ACCENT ),    "Accent" },
+            { ScResId( STR_STYLENAME_ACCENT_1 ),  "Accent 1" },
+            { ScResId( STR_STYLENAME_ACCENT_2 ),  "Accent 2" },
+            { ScResId( STR_STYLENAME_ACCENT_3 ),  "Accent 3" },
+            { ScResId( STR_STYLENAME_RESULT ),    "Result" },
+            // API compatibility programmatic names after.
             { ScResId( STR_STYLENAME_STANDARD_CELL ), 
OUString(SC_STYLE_PROG_STANDARD) },
             { ScResId( STR_STYLENAME_RESULT ), OUString(SC_STYLE_PROG_RESULT) 
},
             { ScResId( STR_STYLENAME_RESULT1 ), 
OUString(SC_STYLE_PROG_RESULT1) },
-            { ScResId( STR_STYLENAME_HEADLINE ), 
OUString(SC_STYLE_PROG_HEADLINE) },
-            { ScResId( STR_STYLENAME_HEADLINE1 ), 
OUString(SC_STYLE_PROG_HEADLINE1) },
+            { ScResId( STR_STYLENAME_HEADING ), 
OUString(SC_STYLE_PROG_HEADING) },
+            { ScResId( STR_STYLENAME_HEADING_1 ), 
OUString(SC_STYLE_PROG_HEADING1) },
+            // Pivot table styles.
             { ScResId( STR_PIVOT_STYLENAME_INNER ), 
OUString(SC_PIVOT_STYLE_PROG_INNER) },
             { ScResId( STR_PIVOT_STYLENAME_RESULT ), 
OUString(SC_PIVOT_STYLE_PROG_RESULT) },
             { ScResId( STR_PIVOT_STYLENAME_CATEGORY ), 
OUString(SC_PIVOT_STYLE_PROG_CATEGORY) },
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to