[Libreoffice-commits] core.git: sw/source
Ahmed GHANMI
aghanmi at linagora.com
Mon Dec 4 21:22:22 UTC 2017
sw/source/uibase/app/docsh2.cxx | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
New commits:
commit 4b45c95556d19cf51aab3658e533a2aeaa023d10
Author: Ahmed GHANMI <aghanmi at linagora.com>
Date: Mon Dec 4 16:39:34 2017 +0100
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 at libreoffice.org>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
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;
}
More information about the Libreoffice-commits
mailing list