[Libreoffice-commits] core.git: sc/inc sc/source

himajin100000 himajin100000 at gmail.com
Tue Mar 20 20:13:57 UTC 2018


 sc/inc/globstr.hrc                  |   12 ++++++------
 sc/source/core/data/dpoutput.cxx    |   28 ++++++++++++++--------------
 sc/source/core/tool/stylehelper.cxx |   27 ++++++++++++++++++++++++++-
 3 files changed, 46 insertions(+), 21 deletions(-)

New commits:
commit 82aab78ccd0aab7502260124d330155a569c170e
Author: himajin100000 <himajin100000 at gmail.com>
Date:   Sun Mar 18 10:20:51 2018 +0900

    tdf#116470:Convert between ProgName/DisplayName for pivot table style
    
    to avoid styles in different languages to be unnecessarily registered
    
    Change-Id: I450909d798749f751b1c59cda28865f6c3ea76c3
    Reviewed-on: https://gerrit.libreoffice.org/51511
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index d08ec69ed2a5..8fc75f74b237 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -348,12 +348,12 @@
 #define STR_FUNCTIONLIST_MORE                   NC_("STR_FUNCTIONLIST_MORE", "More...")
 #define STR_ERR_INVALID_AREA                    NC_("STR_ERR_INVALID_AREA", "Invalid range")
 // Templates for data pilot tables.
-#define STR_PIVOT_STYLE_INNER                   NC_("STR_PIVOT_STYLE_INNER", "Pivot Table Value")
-#define STR_PIVOT_STYLE_RESULT                  NC_("STR_PIVOT_STYLE_RESULT", "Pivot Table Result")
-#define STR_PIVOT_STYLE_CATEGORY                NC_("STR_PIVOT_STYLE_CATEGORY", "Pivot Table Category")
-#define STR_PIVOT_STYLE_TITLE                   NC_("STR_PIVOT_STYLE_TITLE", "Pivot Table Title")
-#define STR_PIVOT_STYLE_FIELDNAME               NC_("STR_PIVOT_STYLE_FIELDNAME", "Pivot Table Field")
-#define STR_PIVOT_STYLE_TOP                     NC_("STR_PIVOT_STYLE_TOP", "Pivot Table Corner")
+#define STR_PIVOT_STYLENAME_INNER                   NC_("STR_PIVOT_STYLE_INNER", "Pivot Table Value")
+#define STR_PIVOT_STYLENAME_RESULT                  NC_("STR_PIVOT_STYLE_RESULT", "Pivot Table Result")
+#define STR_PIVOT_STYLENAME_CATEGORY                NC_("STR_PIVOT_STYLE_CATEGORY", "Pivot Table Category")
+#define STR_PIVOT_STYLENAME_TITLE                   NC_("STR_PIVOT_STYLE_TITLE", "Pivot Table Title")
+#define STR_PIVOT_STYLENAME_FIELDNAME               NC_("STR_PIVOT_STYLE_FIELDNAME", "Pivot Table Field")
+#define STR_PIVOT_STYLENAME_TOP                     NC_("STR_PIVOT_STYLE_TOP", "Pivot Table Corner")
 #define STR_OPERATION_FILTER                    NC_("STR_OPERATION_FILTER", "Filter")
 #define STR_OPERATION_SORT                      NC_("STR_OPERATION_SORT", "Sort")
 #define STR_OPERATION_SUBTOTAL                  NC_("STR_OPERATION_SUBTOTAL", "Subtotals")
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx
index c28f82c76f51..34e06009f5bf 100644
--- a/sc/source/core/data/dpoutput.cxx
+++ b/sc/source/core/data/dpoutput.cxx
@@ -300,9 +300,9 @@ void lcl_SetStyleById(ScDocument* pDoc, SCTAB nTab,
                                                     SFXSTYLEBIT_USERDEF ) );
         pStyle->SetParent( ScGlobal::GetRscString(STR_STYLENAME_STANDARD) );
         SfxItemSet& rSet = pStyle->GetItemSet();
-        if (strcmp(pStrId, STR_PIVOT_STYLE_RESULT) == 0 || strcmp(pStrId, STR_PIVOT_STYLE_TITLE) == 0)
+        if (strcmp(pStrId, STR_PIVOT_STYLENAME_RESULT) == 0 || strcmp(pStrId, STR_PIVOT_STYLENAME_TITLE) == 0)
             rSet.Put( SvxWeightItem( WEIGHT_BOLD, ATTR_FONT_WEIGHT ) );
-        if (strcmp(pStrId, STR_PIVOT_STYLE_CATEGORY) == 0 || strcmp(pStrId, STR_PIVOT_STYLE_TITLE) == 0)
+        if (strcmp(pStrId, STR_PIVOT_STYLENAME_CATEGORY) == 0 || strcmp(pStrId, STR_PIVOT_STYLENAME_TITLE) == 0)
             rSet.Put( SvxHorJustifyItem( SvxCellHorJustify::Left, ATTR_HOR_JUSTIFY ) );
     }
 
@@ -788,17 +788,17 @@ void ScDPOutput::HeaderCell( SCCOL nCol, SCROW nRow, SCTAB nTab,
             outputimp.OutputBlockFrame( nCol,nMemberStartRow+static_cast<SCROW>(nLevel), nCol,nDataStartRow-1 );
 
             lcl_SetStyleById( pDoc,nTab, nCol,nMemberStartRow+static_cast<SCROW>(nLevel), nCol,nDataStartRow-1,
-                                    STR_PIVOT_STYLE_TITLE );
+                                    STR_PIVOT_STYLENAME_TITLE );
             lcl_SetStyleById( pDoc,nTab, nCol,nDataStartRow, nCol,nTabEndRow,
-                                    STR_PIVOT_STYLE_RESULT );
+                                    STR_PIVOT_STYLENAME_RESULT );
         }
         else
         {
             outputimp.OutputBlockFrame( nMemberStartCol+static_cast<SCCOL>(nLevel),nRow, nDataStartCol-1,nRow );
             lcl_SetStyleById( pDoc,nTab, nMemberStartCol+static_cast<SCCOL>(nLevel),nRow, nDataStartCol-1,nRow,
-                                    STR_PIVOT_STYLE_TITLE );
+                                    STR_PIVOT_STYLENAME_TITLE );
             lcl_SetStyleById( pDoc,nTab, nDataStartCol,nRow, nTabEndCol,nRow,
-                                    STR_PIVOT_STYLE_RESULT );
+                                    STR_PIVOT_STYLENAME_RESULT );
         }
     }
 }
@@ -835,7 +835,7 @@ void ScDPOutput::FieldCell(
         pDoc->ApplyFlagsTab(nCol, nRow, nCol, nRow, nTab, nMergeFlag);
     }
 
-    lcl_SetStyleById( pDoc,nTab, nCol,nRow, nCol,nRow, STR_PIVOT_STYLE_FIELDNAME );
+    lcl_SetStyleById( pDoc,nTab, nCol,nRow, nCol,nRow, STR_PIVOT_STYLENAME_FIELDNAME );
 }
 
 static void lcl_DoFilterButton( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab )
@@ -998,13 +998,13 @@ void ScDPOutput::Output()
     }
     pDoc->SetString(nTabStartCol, nTabStartRow, nTab, aDataDescription);
 
-    //  set STR_PIVOT_STYLE_INNER for whole data area (subtotals are overwritten)
+    //  set STR_PIVOT_STYLENAME_INNER for whole data area (subtotals are overwritten)
 
     if ( nDataStartRow > nTabStartRow )
         lcl_SetStyleById( pDoc, nTab, nTabStartCol, nTabStartRow, nTabEndCol, nDataStartRow-1,
-                            STR_PIVOT_STYLE_TOP );
+                            STR_PIVOT_STYLENAME_TOP );
     lcl_SetStyleById( pDoc, nTab, nDataStartCol, nDataStartRow, nTabEndCol, nTabEndRow,
-                        STR_PIVOT_STYLE_INNER );
+                        STR_PIVOT_STYLENAME_INNER  );
 
     //  output column headers:
     ScDPOutputImpl outputimp( pDoc, nTab,
@@ -1042,10 +1042,10 @@ void ScDPOutput::Output()
                     else
                         outputimp.OutputBlockFrame( nColPos,nRowPos, nEndColPos,nRowPos );
 
-                    lcl_SetStyleById( pDoc, nTab, nColPos,nRowPos, nEndColPos,nDataStartRow-1, STR_PIVOT_STYLE_CATEGORY );
+                    lcl_SetStyleById( pDoc, nTab, nColPos,nRowPos, nEndColPos,nDataStartRow-1, STR_PIVOT_STYLENAME_CATEGORY );
                 }
                 else
-                    lcl_SetStyleById( pDoc, nTab, nColPos,nRowPos, nColPos,nDataStartRow-1, STR_PIVOT_STYLE_CATEGORY );
+                    lcl_SetStyleById( pDoc, nTab, nColPos,nRowPos, nColPos,nDataStartRow-1, STR_PIVOT_STYLENAME_CATEGORY );
             }
             else if (  pArray[nCol].Flags & sheet::MemberResultFlags::SUBTOTAL )
                 outputimp.AddCol( nColPos );
@@ -1095,10 +1095,10 @@ void ScDPOutput::Output()
                     if ( nField == pRowFields.size() - 2 )
                         outputimp.OutputBlockFrame( nColPos+1, nRowPos, nColPos+1, nEndRowPos );
 
-                    lcl_SetStyleById( pDoc, nTab, nColPos,nRowPos, nDataStartCol-1,nEndRowPos, STR_PIVOT_STYLE_CATEGORY );
+                    lcl_SetStyleById( pDoc, nTab, nColPos,nRowPos, nDataStartCol-1,nEndRowPos, STR_PIVOT_STYLENAME_CATEGORY );
                 }
                 else
-                    lcl_SetStyleById( pDoc, nTab, nColPos,nRowPos, nDataStartCol-1,nRowPos, STR_PIVOT_STYLE_CATEGORY );
+                    lcl_SetStyleById( pDoc, nTab, nColPos,nRowPos, nDataStartCol-1,nRowPos, STR_PIVOT_STYLENAME_CATEGORY );
             }
             else if (  pArray[nRow].Flags & sheet::MemberResultFlags::SUBTOTAL )
                 outputimp.AddRow( nRowPos );
diff --git a/sc/source/core/tool/stylehelper.cxx b/sc/source/core/tool/stylehelper.cxx
index 46f8c444b27c..525e4f2d37ad 100644
--- a/sc/source/core/tool/stylehelper.cxx
+++ b/sc/source/core/tool/stylehelper.cxx
@@ -36,6 +36,13 @@
 #define SC_STYLE_PROG_HEADLINE1     "Heading1"
 #define SC_STYLE_PROG_REPORT        "Report"
 
+#define SC_PIVOT_STYLE_PROG_INNER                  "Pivot Table Value"
+#define SC_PIVOT_STYLE_PROG_RESULT                 "Pivot Table Result"
+#define SC_PIVOT_STYLE_PROG_CATEGORY               "Pivot Table Category"
+#define SC_PIVOT_STYLE_PROG_TITLE                  "Pivot Table Title"
+#define SC_PIVOT_STYLE_PROG_FIELDNAME              "Pivot Table Field"
+#define SC_PIVOT_STYLE_PROG_TOP                    "Pivot Table Corner"
+
 struct ScDisplayNameMap
 {
     OUString  aDispName;
@@ -47,7 +54,7 @@ static const ScDisplayNameMap* lcl_GetStyleNameMap( SfxStyleFamily nType )
     if ( nType == SfxStyleFamily::Para )
     {
         static bool bCellMapFilled = false;
-        static ScDisplayNameMap aCellMap[6];
+        static ScDisplayNameMap aCellMap[12];
         if ( !bCellMapFilled )
         {
             aCellMap[0].aDispName = ScGlobal::GetRscString( STR_STYLENAME_STANDARD );
@@ -65,6 +72,24 @@ static const ScDisplayNameMap* lcl_GetStyleNameMap( SfxStyleFamily nType )
             aCellMap[4].aDispName = ScGlobal::GetRscString( STR_STYLENAME_HEADLINE1 );
             aCellMap[4].aProgName = SC_STYLE_PROG_HEADLINE1;
 
+            aCellMap[5].aDispName = ScGlobal::GetRscString( STR_PIVOT_STYLENAME_INNER );
+            aCellMap[5].aProgName = SC_PIVOT_STYLE_PROG_INNER;
+
+            aCellMap[6].aDispName = ScGlobal::GetRscString( STR_PIVOT_STYLENAME_RESULT );
+            aCellMap[6].aProgName = SC_PIVOT_STYLE_PROG_RESULT;
+
+            aCellMap[7].aDispName = ScGlobal::GetRscString( STR_PIVOT_STYLENAME_CATEGORY );
+            aCellMap[7].aProgName = SC_PIVOT_STYLE_PROG_CATEGORY;
+
+            aCellMap[8].aDispName = ScGlobal::GetRscString( STR_PIVOT_STYLENAME_TITLE );
+            aCellMap[8].aProgName = SC_PIVOT_STYLE_PROG_TITLE;
+
+            aCellMap[9].aDispName = ScGlobal::GetRscString( STR_PIVOT_STYLENAME_FIELDNAME );
+            aCellMap[9].aProgName = SC_PIVOT_STYLE_PROG_FIELDNAME;
+
+            aCellMap[10].aDispName = ScGlobal::GetRscString( STR_PIVOT_STYLENAME_TOP );
+            aCellMap[10].aProgName = SC_PIVOT_STYLE_PROG_TOP;
+
             //  last entry remains empty
 
             bCellMapFilled = true;


More information about the Libreoffice-commits mailing list