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

Muhammet Kara muhammet.kara at pardus.org.tr
Fri Jul 29 21:33:45 UTC 2016


 sc/inc/sc.hrc                  |   14 ++++++++-
 sc/source/ui/src/scstring.src  |   61 +++++++++++++++++++++++++++++++----------
 sc/source/ui/unoobj/docuno.cxx |   25 ++++++----------
 3 files changed, 70 insertions(+), 30 deletions(-)

New commits:
commit a3e57b44b26db382b7fe3004aa0211e26c07e6db
Author: Muhammet Kara <muhammet.kara at pardus.org.tr>
Date:   Fri Jul 29 17:28:47 2016 +0300

    tdf#91665 l10n: Replace string list by separate strings in ScPrintUIOptions
    
    String lists are sometimes (mis)used to group unrelated items;
    the advantage(?) being that only one identifier needs to be defined
    for the whole group. The items are then referenced by index,
    which is rather fragile when they are used in different parts of UI.
    String lists like this one should be replaced by separate strings.
    
    Change-Id: I78a2c8d1a8e5b1fed6a2d0afefd96ec126bb79af
    Reviewed-on: https://gerrit.libreoffice.org/27689
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index ba1ccb4..f413f7f 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -826,6 +826,18 @@
 #define SCSTR_AUTHOR                (STR_START + 113)
 #define SCSTR_UNIT                  (STR_START + 114)
 
+// print options
+#define SCSTR_PRINTOPT_PAGES            (STR_START + 120)
+#define SCSTR_PRINTOPT_SUPPRESSEMPTY    (STR_START + 121)
+#define SCSTR_PRINTOPT_PRNTCONTENT      (STR_START + 122)
+#define SCSTR_PRINTOPT_ALLSHEETS        (STR_START + 123)
+#define SCSTR_PRINTOPT_SELECTEDSHEETS   (STR_START + 124)
+#define SCSTR_PRINTOPT_SELECTEDCELLS    (STR_START + 125)
+#define SCSTR_PRINTOPT_FROMWHICH        (STR_START + 126)
+#define SCSTR_PRINTOPT_ALLPAGES         (STR_START + 127)
+#define SCSTR_PRINTOPT_PAGES_           (STR_START + 128)
+#define SCSTR_PRINTOPT_PRODNAME         (STR_START + 129)
+
 // accessibility
 
 // CSV import
@@ -886,7 +898,7 @@
 #define SCSTR_FORMULA_AUTOCORRECTION    (STR_START + 214)
 
 #define SCSTR_RENAMEOBJECT              (STR_START + 215)
-#define SCSTR_PRINT_OPTIONS             (STR_START + 216)
+//free slot
 #define SCSTR_WARN_ME_IN_FUTURE_CHECK   (STR_START + 217)
 
 // header of search result dialog
diff --git a/sc/source/ui/src/scstring.src b/sc/source/ui/src/scstring.src
index 2da99e2..fab1ebd 100644
--- a/sc/source/ui/src/scstring.src
+++ b/sc/source/ui/src/scstring.src
@@ -703,21 +703,54 @@ String SCSTR_MOREBTN_FEWEROPTIONS
     Text [ en-US ] = "Fewer ~Options";
 };
 
-StringArray SCSTR_PRINT_OPTIONS
+String SCSTR_PRINTOPT_PAGES
 {
-    ItemList [en-US] =
-    {
-        < "Pages"; >;
-        < "~Suppress output of empty pages"; >;
-        < "Print content"; >;
-        < "~All sheets"; >;
-        < "~Selected sheets"; >;
-        < "Selected cells"; >;
-        < "From which print"; >;
-        < "All ~pages"; >;
-        < "Pa~ges"; >;
-        < "%PRODUCTNAME %s"; >;
-    };
+    Text [ en-US ] = "Pages";
+};
+
+String SCSTR_PRINTOPT_SUPPRESSEMPTY
+{
+    Text [ en-US ] = "~Suppress output of empty pages";
+};
+
+String SCSTR_PRINTOPT_PRNTCONTENT
+{
+    Text [ en-US ] = "Print content";
+};
+
+String SCSTR_PRINTOPT_ALLSHEETS
+{
+    Text [ en-US ] = "~All sheets";
+};
+
+String SCSTR_PRINTOPT_SELECTEDSHEETS
+{
+    Text [ en-US ] = "~Selected sheets";
+};
+
+String SCSTR_PRINTOPT_SELECTEDCELLS
+{
+    Text [ en-US ] = "Selected cells";
+};
+
+String SCSTR_PRINTOPT_FROMWHICH
+{
+    Text [ en-US ] = "From which print";
+};
+
+String SCSTR_PRINTOPT_ALLPAGES
+{
+    Text [ en-US ] = "All ~pages";
+};
+
+String SCSTR_PRINTOPT_PAGES_
+{
+    Text [ en-US ] = "Pa~ges";
+};
+
+String SCSTR_PRINTOPT_PRODNAME
+{
+    Text [ en-US ] = "%PRODUCTNAME %s";
 };
 
 String SCSTR_WARN_ME_IN_FUTURE_CHECK
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 4ce35d1..442ad4c 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -242,11 +242,6 @@ ScPrintUIOptions::ScPrintUIOptions()
     sal_Int32 nContent = rPrintOpt.GetAllSheets() ? 0 : 1;
     bool bSuppress = rPrintOpt.GetSkipEmpty();
 
-    ResStringArray aStrings( ScResId( SCSTR_PRINT_OPTIONS ) );
-    OSL_ENSURE( aStrings.Count() >= 10, "resource incomplete" );
-    if( aStrings.Count() < 10 ) // bad resource ?
-        return;
-
     sal_Int32 nNumProps= 9, nIdx = 0;
 
     m_aUIProperties.resize(nNumProps);
@@ -257,34 +252,34 @@ ScPrintUIOptions::ScPrintUIOptions()
 
     // create Section for spreadsheet (results in an extra tab page in dialog)
     SvtModuleOptions aOpt;
-    OUString aAppGroupname( aStrings.GetString( 9 ) );
+    OUString aAppGroupname( SC_RESSTR( SCSTR_PRINTOPT_PRODNAME ) );
     aAppGroupname = aAppGroupname.replaceFirst( "%s", aOpt.GetModuleName( SvtModuleOptions::EModule::CALC ) );
     m_aUIProperties[nIdx++].Value = setGroupControlOpt("tabcontrol-page2", aAppGroupname, OUString());
 
     // show subgroup for pages
-    m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("pages", OUString(aStrings.GetString(0)), OUString());
+    m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("pages", SC_RESSTR( SCSTR_PRINTOPT_PAGES ), OUString());
 
     // create a bool option for empty pages
-    m_aUIProperties[nIdx++].Value = setBoolControlOpt("suppressemptypages", OUString( aStrings.GetString( 1 ) ),
+    m_aUIProperties[nIdx++].Value = setBoolControlOpt("suppressemptypages", SC_RESSTR( SCSTR_PRINTOPT_SUPPRESSEMPTY ),
                                                   ".HelpID:vcl:PrintDialog:IsSuppressEmptyPages:CheckBox",
                                                   "IsSuppressEmptyPages",
                                                   bSuppress);
     // show Subgroup for print content
     vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt;
     aPrintRangeOpt.maGroupHint = "PrintRange";
-    m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("printrange", OUString(aStrings.GetString(2)),
+    m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("printrange", SC_RESSTR( SCSTR_PRINTOPT_PRNTCONTENT ),
                                                       OUString(),
                                                       aPrintRangeOpt);
 
     // create a choice for the content to create
     uno::Sequence< OUString > aChoices( 3 ), aHelpIds( 3 ), aWidgetIds( 3 );
-    aChoices[0] = aStrings.GetString( 3 );
+    aChoices[0] = SC_RESSTR( SCSTR_PRINTOPT_ALLSHEETS );
     aHelpIds[0] = ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:0";
     aWidgetIds[0] = "printallsheets";
-    aChoices[1] = aStrings.GetString( 4 );
+    aChoices[1] = SC_RESSTR( SCSTR_PRINTOPT_SELECTEDSHEETS );
     aHelpIds[1] = ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:1";
     aWidgetIds[1] = "printselectedsheets";
-    aChoices[2] = aStrings.GetString( 5 );
+    aChoices[2] = SC_RESSTR( SCSTR_PRINTOPT_SELECTEDCELLS );
     aHelpIds[2] = ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:2";
     aWidgetIds[2] = "printselectedcells";
     m_aUIProperties[nIdx++].Value = setChoiceRadiosControlOpt(aWidgetIds, OUString(),
@@ -293,7 +288,7 @@ ScPrintUIOptions::ScPrintUIOptions()
 
     // show Subgroup for print range
     aPrintRangeOpt.mbInternalOnly = true;
-    m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("fromwhich", OUString(aStrings.GetString(6)),
+    m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("fromwhich", SC_RESSTR( SCSTR_PRINTOPT_FROMWHICH ),
                                                       OUString(),
                                                       aPrintRangeOpt);
 
@@ -302,10 +297,10 @@ ScPrintUIOptions::ScPrintUIOptions()
     aChoices.realloc( 2 );
     aHelpIds.realloc( 2 );
     aWidgetIds.realloc( 2 );
-    aChoices[0] = aStrings.GetString( 7 );
+    aChoices[0] = SC_RESSTR( SCSTR_PRINTOPT_ALLPAGES );
     aHelpIds[0] = ".HelpID:vcl:PrintDialog:PrintRange:RadioButton:0";
     aWidgetIds[0] = "printallpages";
-    aChoices[1] = aStrings.GetString( 8 );
+    aChoices[1] = SC_RESSTR( SCSTR_PRINTOPT_PAGES_ );
     aHelpIds[1] = ".HelpID:vcl:PrintDialog:PrintRange:RadioButton:1";
     aWidgetIds[1] = "printpages";
     m_aUIProperties[nIdx++].Value = setChoiceRadiosControlOpt(aWidgetIds, OUString(),


More information about the Libreoffice-commits mailing list