incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1373703 - in /incubator/ooo/trunk/main/sw/source/filter: inc/msfilter.hxx ww8/writerwordglue.cxx
Date Thu, 16 Aug 2012 02:30:17 GMT
Author: leidb
Date: Thu Aug 16 02:30:17 2012
New Revision: 1373703

URL: http://svn.apache.org/viewvc?rev=1373703&view=rev
Log:
#120158# fix Time format is different than MS Office issue

Reported by: Yan Ji
Patch by: Chen Zuo Jun
Review by: Lei De Bin 

Modified:
    incubator/ooo/trunk/main/sw/source/filter/inc/msfilter.hxx
    incubator/ooo/trunk/main/sw/source/filter/ww8/writerwordglue.cxx

Modified: incubator/ooo/trunk/main/sw/source/filter/inc/msfilter.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/inc/msfilter.hxx?rev=1373703&r1=1373702&r2=1373703&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/inc/msfilter.hxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/inc/msfilter.hxx Thu Aug 16 02:30:17 2012
@@ -117,6 +117,11 @@ namespace sw
                 <a href="mailto:mmaher@openoffice.org">Martin Maher</a
         */
         sal_uLong MSDateTimeFormatToSwFormat(String& rParams, SvNumberFormatter *pFormatter,
sal_uInt16 &rLang, bool bHijri);
+		/*Used to identify if the previous is AM time field*/
+		sal_Bool IsPreviousAM(String& rParams, xub_StrLen nPos);
+
+		/*Used to identify if the next is PM time field*/
+		sal_Bool IsNextPM(String& rParams, xub_StrLen nPos);
 
         /** Used by MSDateTimeFormatToSwFormat to identify AM time fields
 

Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/writerwordglue.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/writerwordglue.cxx?rev=1373703&r1=1373702&r2=1373703&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/writerwordglue.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/writerwordglue.cxx Thu Aug 16 02:30:17 2012
@@ -875,8 +875,9 @@ namespace sw
                     }
                     else if (nChar == '/')
                     {
-                        // MM We have to escape '/' in case it's used as a char
-                        rParams.Replace(nI, 1, CREATE_CONST_ASC("\\/"));
+						if(!(IsPreviousAM(rParams, nI) && IsNextPM(rParams, nI)))
+                            // MM We have to escape '/' in case it's used as a char
+                            rParams.Replace(nI, 1, CREATE_CONST_ASC("\\/"));
                         // rParams.Insert( nI, '\\' );
                         nI++;
                         nLen++;
@@ -1015,6 +1016,34 @@ namespace sw
             return nKey;
         }
 
+		sal_Bool IsPreviousAM(String& rParams, xub_StrLen nPos){
+			xub_StrLen nPos1 = nPos - 1;
+			xub_StrLen nPos2 = nPos - 2;
+
+			if(nPos1 > nPos || nPos2 > nPos){
+				return sal_False;
+			}else{
+				return (
+					(rParams.GetChar(nPos1) == 'M'||rParams.GetChar(nPos1) == 'm')&&
+					(rParams.GetChar(nPos2) == 'A'||rParams.GetChar(nPos2) == 'a')
+					);
+			}
+		}
+		sal_Bool IsNextPM(String& rParams, xub_StrLen nPos){
+			xub_StrLen nPos1 = nPos + 1;
+			xub_StrLen nPos2 = nPos + 2;
+
+
+			if(nPos1 >= rParams.Len() - 1 || nPos2 > rParams.Len() - 1){
+				return sal_False;
+			}else{
+				return (
+					(rParams.GetChar(nPos1) == 'P'||rParams.GetChar(nPos1) == 'p')&&
+					(rParams.GetChar(nPos2) == 'M'||rParams.GetChar(nPos2) == 'm')
+					);
+			}
+
+		}
         bool IsNotAM(String& rParams, xub_StrLen nPos)
         {
             return (



Mime
View raw message