Kaydet (Commit) 4b45c955 authored tarafından Ahmed GHANMI's avatar Ahmed GHANMI Kaydeden (comit) Michael Stahl

tdf#113876: fix hardcoded compare strings

Checks of listbox values are hardcoded in english so we replaced
the hardcoded compare with "SwResId" function which give us
the string in correspondant language and in addition with
"startsWith" function we check if the string is in the listbox's
item of user choice.

Change-Id: I3cc23b43750c82672454aa6812dfad1437ede7fc
Reviewed-on: https://gerrit.libreoffice.org/45812Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst 6a49f78b
...@@ -1030,15 +1030,16 @@ void SwDocShell::Execute(SfxRequest& rReq) ...@@ -1030,15 +1030,16 @@ void SwDocShell::Execute(SfxRequest& rReq)
OUString sTmpl; OUString sTmpl;
aTemplateValue >>= sTmpl; aTemplateValue >>= sTmpl;
sal_Int32 nColonPos = sTmpl.indexOf( ':' ); OUString aStyle(SwResId(STR_FDLG_STYLE));
OUString sPrefix = sTmpl.copy( 0, nColonPos ); OUString aOutline(SwResId(STR_FDLG_OUTLINE_LEVEL));
if ( sPrefix == "Style" )
if ( sTmpl.startsWith(aStyle) )
{ {
aTemplateName = sTmpl.copy( 7 ); //get string behind "Style: " aTemplateName = sTmpl.copy( aStyle.getLength() ); //get string behind "Style: "
} }
else if ( sPrefix == "Outline" ) else if ( sTmpl.startsWith(aOutline) )
{ {
nTemplateOutlineLevel = ( sTmpl.copy( 15 )).toInt32(); //get string behind "Outline: Leve "; nTemplateOutlineLevel = sTmpl.copy(aOutline.getLength()).toInt32(); //get string behind "Outline: Level ";
bCreateByOutlineLevel = true; bCreateByOutlineLevel = true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment