diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2013-10-13 21:45:17 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2013-10-13 21:46:54 +0200 |
commit | dfbef666bb8ab76f0a062ef44dc5d166dece49cf (patch) | |
tree | 8cfc12223af93426312ded27cb966ceeb70f7111 /sw | |
parent | c24855bc6a3a94846094c0714a477a299a60280d (diff) |
Prefer OUString primitives to handwritten code
Change-Id: I5be917b92eab92be32d8f1cf672ecf4a67b35383
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/writerwordglue.cxx | 40 |
1 files changed, 8 insertions, 32 deletions
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index a65175d04490..a4d995c981e7 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -966,42 +966,18 @@ namespace sw return nKey; } - sal_Bool IsPreviousAM(OUString& rParams, sal_Int32 nPos){ - sal_uInt16 nPos1 = nPos - 1; - sal_uInt16 nPos2 = nPos - 2; - - if(nPos1 > nPos || nPos2 > nPos){ - return sal_False; - }else{ - return ( - ( rParams[nPos1] == 'M' || rParams[nPos1] == 'm' ) && - ( rParams[nPos2] == 'A' || rParams[nPos2] == 'a' ) - ); - } + sal_Bool IsPreviousAM(OUString& rParams, sal_Int32 nPos) + { + return nPos>=2 && rParams.matchIgnoreAsciiCase("am", nPos-2); } - sal_Bool IsNextPM(OUString& rParams, sal_Int32 nPos){ - sal_Int32 nPos1 = nPos + 1; - sal_Int32 nPos2 = nPos + 2; - - if(nPos1 >= rParams.getLength() - 1 || nPos2 > rParams.getLength() - 1){ - return sal_False; - }else{ - return ( - ( rParams[nPos1] == 'P' || rParams[nPos1] == 'p' ) && - ( rParams[nPos2] == 'M' || rParams[nPos2] == 'm' ) - ); - } - + sal_Bool IsNextPM(OUString& rParams, sal_Int32 nPos) + { + return nPos+2<rParams.getLength() && rParams.matchIgnoreAsciiCase("pm", nPos+1); } bool IsNotAM(OUString& rParams, sal_Int32 nPos) { - return ( - (nPos == rParams.getLength() - 1) || - ( - (rParams[nPos+1] != 'M') && - (rParams[nPos+1] != 'm') - ) - ); + ++nPos; + return nPos>=rParams.getLength() || (rParams[nPos]!='M' && rParams[nPos]!='m'); } void SwapQuotesInField(OUString &rFmt) |