From be53870adbae52613f35496296cac7b0dff66aa8 Mon Sep 17 00:00:00 2001 From: Muhammet Kara Date: Fri, 29 Jul 2016 10:35:56 +0300 Subject: tdf#91665 l10n: Replace string list by separate strings in SmPrintUIOptions 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: I58c927790287b36c0cb204c815a2788bd7cf1e02 Reviewed-on: https://gerrit.libreoffice.org/27665 Tested-by: Jenkins Reviewed-by: Noel Grandin --- starmath/inc/starmath.hrc | 10 +++++++- starmath/source/smres.src | 57 +++++++++++++++++++++++++++++++++----------- starmath/source/unomodel.cxx | 23 +++++++----------- 3 files changed, 61 insertions(+), 29 deletions(-) diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc index 8805c60c04bd..ef15e8c6ab6d 100644 --- a/starmath/inc/starmath.hrc +++ b/starmath/inc/starmath.hrc @@ -77,7 +77,15 @@ #define SID_ELEMENTSDOCKINGWINDOW (SID_SMA_START + 126) #define SID_AUTO_CLOSE_BRACKETS (SID_SMA_START + 127) -#define RID_PRINTUIOPTIONS (RID_APP_START + 11) +#define RID_PRINTUIOPT_PRODNAME (RID_APP_START + 11) +#define RID_PRINTUIOPT_CONTENTS (RID_APP_START + 12) +#define RID_PRINTUIOPT_TITLE (RID_APP_START + 13) +#define RID_PRINTUIOPT_FRMLTXT (RID_APP_START + 14) +#define RID_PRINTUIOPT_BORDERS (RID_APP_START + 15) +#define RID_PRINTUIOPT_SIZE (RID_APP_START + 16) +#define RID_PRINTUIOPT_ORIGSIZE (RID_APP_START + 17) +#define RID_PRINTUIOPT_FITTOPAGE (RID_APP_START + 18) +#define RID_PRINTUIOPT_SCALING (RID_APP_START + 19) #define RID_MATH_TOOLBOX (RID_APP_START + 50) diff --git a/starmath/source/smres.src b/starmath/source/smres.src index 50ba4a756a24..a11baf467826 100644 --- a/starmath/source/smres.src +++ b/starmath/source/smres.src @@ -231,20 +231,49 @@ String RID_ERR_RIGHTEXPECTED Text [ en-US ] = "'RIGHT' expected" ; }; -StringArray RID_PRINTUIOPTIONS -{ - ItemList [en-US] = - { - < "%PRODUCTNAME %s"; >; - < "Contents"; >; - < "~Title"; >; - < "~Formula text"; >; - < "B~orders"; >; - < "Size"; >; - < "O~riginal size"; >; - < "Fit to ~page"; >; - < "~Scaling"; >; - }; +String RID_PRINTUIOPT_PRODNAME +{ + Text [ en-US ] = "%PRODUCTNAME %s" ; +}; + +String RID_PRINTUIOPT_CONTENTS +{ + Text [ en-US ] = "Contents" ; +}; + +String RID_PRINTUIOPT_TITLE +{ + Text [ en-US ] = "~Title" ; +}; + +String RID_PRINTUIOPT_FRMLTXT +{ + Text [ en-US ] = "~Formula text" ; +}; + +String RID_PRINTUIOPT_BORDERS +{ + Text [ en-US ] = "B~orders" ; +}; + +String RID_PRINTUIOPT_SIZE +{ + Text [ en-US ] = "Size" ; +}; + +String RID_PRINTUIOPT_ORIGSIZE +{ + Text [ en-US ] = "O~riginal size" ; +}; + +String RID_PRINTUIOPT_FITTOPAGE +{ + Text [ en-US ] = "Fit to ~page" ; +}; + +String RID_PRINTUIOPT_SCALING +{ + Text [ en-US ] = "~Scaling" ; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index e8a966954b43..efe052e24983 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -63,11 +63,6 @@ using namespace ::com::sun::star::script; SmPrintUIOptions::SmPrintUIOptions() { - ResStringArray aLocalizedStrings( SmResId( RID_PRINTUIOPTIONS ) ); - SAL_WARN_IF( aLocalizedStrings.Count() < 9, "starmath", "resource incomplete" ); - if( aLocalizedStrings.Count() < 9 ) // bad resource ? - return; - SmModule *pp = SM_MOD(); SmMathConfig *pConfig = pp->GetConfig(); SAL_WARN_IF( !pConfig, "starmath", "SmConfig not found" ); @@ -87,37 +82,37 @@ SmPrintUIOptions::SmPrintUIOptions() // create Section for formula (results in an extra tab page in dialog) SvtModuleOptions aOpt; OUString aAppGroupname( - aLocalizedStrings.GetString( 0 ). + SM_RESSTR( RID_PRINTUIOPT_PRODNAME ). replaceFirst( "%s", aOpt.GetModuleName( SvtModuleOptions::EModule::MATH ) ) ); m_aUIProperties[nIdx++].Value = setGroupControlOpt("tabcontrol-page2", aAppGroupname, ".HelpID:vcl:PrintDialog:TabPage:AppPage"); // create subgroup for print options - m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("contents", aLocalizedStrings.GetString(1), OUString()); + m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("contents", SM_RESSTR( RID_PRINTUIOPT_CONTENTS ), OUString()); // create a bool option for title row (matches to SID_PRINTTITLE) - m_aUIProperties[nIdx++].Value = setBoolControlOpt("title", aLocalizedStrings.GetString( 2 ), + m_aUIProperties[nIdx++].Value = setBoolControlOpt("title", SM_RESSTR( RID_PRINTUIOPT_TITLE ), ".HelpID:vcl:PrintDialog:TitleRow:CheckBox", PRTUIOPT_TITLE_ROW, pConfig->IsPrintTitle()); // create a bool option for formula text (matches to SID_PRINTTEXT) - m_aUIProperties[nIdx++].Value = setBoolControlOpt("formulatext", aLocalizedStrings.GetString( 3 ), + m_aUIProperties[nIdx++].Value = setBoolControlOpt("formulatext", SM_RESSTR( RID_PRINTUIOPT_FRMLTXT ), ".HelpID:vcl:PrintDialog:FormulaText:CheckBox", PRTUIOPT_FORMULA_TEXT, pConfig->IsPrintFormulaText()); // create a bool option for border (matches to SID_PRINTFRAME) - m_aUIProperties[nIdx++].Value = setBoolControlOpt("borders", aLocalizedStrings.GetString( 4 ), + m_aUIProperties[nIdx++].Value = setBoolControlOpt("borders", SM_RESSTR( RID_PRINTUIOPT_BORDERS ), ".HelpID:vcl:PrintDialog:Border:CheckBox", PRTUIOPT_BORDER, pConfig->IsPrintFrame()); // create subgroup for print format - m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("size", aLocalizedStrings.GetString(5), OUString()); + m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("size", SM_RESSTR( RID_PRINTUIOPT_SIZE ), OUString()); // create a radio button group for print format (matches to SID_PRINTSIZE) Sequence< OUString > aChoices{ - aLocalizedStrings.GetString( 6 ), - aLocalizedStrings.GetString( 7 ), - aLocalizedStrings.GetString( 8 ) + SM_RESSTR( RID_PRINTUIOPT_ORIGSIZE ), + SM_RESSTR( RID_PRINTUIOPT_FITTOPAGE ), + SM_RESSTR( RID_PRINTUIOPT_SCALING ) }; Sequence< OUString > aHelpIds{ ".HelpID:vcl:PrintDialog:PrintFormat:RadioButton:0", -- cgit v1.2.3