diff options
-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) |