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 <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Muhammet Kara
2016-07-29 10:35:56 +03:00
committed by Noel Grandin
parent 82111a5f82
commit be53870adb
3 changed files with 60 additions and 28 deletions

View File

@@ -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)

View File

@@ -231,20 +231,49 @@ String RID_ERR_RIGHTEXPECTED
Text [ en-US ] = "'RIGHT' expected" ;
};
StringArray RID_PRINTUIOPTIONS
String RID_PRINTUIOPT_PRODNAME
{
ItemList [en-US] =
{
< "%PRODUCTNAME %s"; >;
< "Contents"; >;
< "~Title"; >;
< "~Formula text"; >;
< "B~orders"; >;
< "Size"; >;
< "O~riginal size"; >;
< "Fit to ~page"; >;
< "~Scaling"; >;
};
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: */

View File

@@ -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",