diff options
author | Ahmed GHANMI <aghanmi@linagora.com> | 2017-12-04 16:39:34 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-12-04 22:21:06 +0100 |
commit | 4b45c95556d19cf51aab3658e533a2aeaa023d10 (patch) | |
tree | c4cd914b3fb67c59c093e768de98e0dc226c0cff | |
parent | 6a49f78b36243ba1ed1dbf2f9bd893c7a660a983 (diff) |
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/45812
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | sw/source/uibase/app/docsh2.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 6fbae6d556ae..97982108de3a 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -1030,15 +1030,16 @@ void SwDocShell::Execute(SfxRequest& rReq) OUString sTmpl; aTemplateValue >>= sTmpl; - sal_Int32 nColonPos = sTmpl.indexOf( ':' ); - OUString sPrefix = sTmpl.copy( 0, nColonPos ); - if ( sPrefix == "Style" ) + OUString aStyle(SwResId(STR_FDLG_STYLE)); + OUString aOutline(SwResId(STR_FDLG_OUTLINE_LEVEL)); + + 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; } |