Author: alg
Date: Wed Oct  8 11:03:03 2014
New Revision: 1630069

URL: http://svn.apache.org/r1630069
Log:
i125447 corrected some string to number conversion tools to correct svg:d 
imports

Modified:
    openoffice/trunk/main/basegfx/source/inc/stringconversiontools.hxx
    openoffice/trunk/main/basegfx/source/tools/stringconversiontools.cxx

Modified: openoffice/trunk/main/basegfx/source/inc/stringconversiontools.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/basegfx/source/inc/stringconversiontools.hxx?rev=1630069&r1=1630068&r2=1630069&view=diff
==============================================================================
--- openoffice/trunk/main/basegfx/source/inc/stringconversiontools.hxx 
(original)
+++ openoffice/trunk/main/basegfx/source/inc/stringconversiontools.hxx Wed Oct  
8 11:03:03 2014
@@ -38,19 +38,19 @@ namespace basegfx
                                         const ::rtl::OUString& rStr, 
                                         const sal_Int32                nLen);
 
-        inline bool lcl_isOnNumberChar(const sal_Unicode aChar, bool 
bSignAllowed = true)
+        inline bool lcl_isOnNumberChar(const sal_Unicode aChar, bool 
bSignAllowed = true, bool bDotAllowed = true)
         {
             const bool bPredicate( (sal_Unicode('0') <= aChar && 
sal_Unicode('9') >= aChar)
                                     || (bSignAllowed && sal_Unicode('+') == 
aChar)
-                                    || (bSignAllowed && sal_Unicode('-') == 
aChar) );
+                                    || (bSignAllowed && sal_Unicode('-') == 
aChar) 
+                                    || (bDotAllowed && sal_Unicode('.') == 
aChar));
 
             return bPredicate;
         }
 
-        inline bool lcl_isOnNumberChar(const ::rtl::OUString& rStr, const 
sal_Int32 nPos, bool bSignAllowed = true)
+        inline bool lcl_isOnNumberChar(const ::rtl::OUString& rStr, const 
sal_Int32 nPos, bool bSignAllowed = true, bool bDotAllowed = true)
         {
-            return lcl_isOnNumberChar(rStr[nPos],
-                                        bSignAllowed);
+            return lcl_isOnNumberChar(rStr[nPos], bSignAllowed, bDotAllowed);
         }
 
         bool lcl_getDoubleChar(double&                                         
o_fRetval,

Modified: openoffice/trunk/main/basegfx/source/tools/stringconversiontools.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/basegfx/source/tools/stringconversiontools.cxx?rev=1630069&r1=1630068&r2=1630069&view=diff
==============================================================================
--- openoffice/trunk/main/basegfx/source/tools/stringconversiontools.cxx 
(original)
+++ openoffice/trunk/main/basegfx/source/tools/stringconversiontools.cxx Wed 
Oct  8 11:03:03 2014
@@ -51,37 +51,53 @@ namespace basegfx
             }
         }
 
-        bool lcl_getDoubleChar(double&                                         
o_fRetval,
-                                sal_Int32&                             
io_rPos, 
-                                const ::rtl::OUString&         rStr)
+        bool lcl_getDoubleChar(double& o_fRetval, sal_Int32& io_rPos, const 
::rtl::OUString& rStr)
         {
             sal_Unicode aChar( rStr[io_rPos] );
             ::rtl::OUStringBuffer sNumberString;
 
+            // sign
             if(sal_Unicode('+') == aChar || sal_Unicode('-') == aChar)
             {
                 sNumberString.append(rStr[io_rPos]);
                 aChar = rStr[++io_rPos];
             }
 
-            while((sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
-                    || sal_Unicode('.') == aChar)
+            // numbers before point
+            while(sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
+            {
+                sNumberString.append(rStr[io_rPos]);
+                aChar = rStr[++io_rPos];
+            }
+
+            // point
+            if(sal_Unicode('.') == aChar)
+            {
+                sNumberString.append(rStr[io_rPos]);
+                aChar = rStr[++io_rPos];
+            }
+
+            // numbers after point
+            while(sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
             {
                 sNumberString.append(rStr[io_rPos]);
                 aChar = rStr[++io_rPos];
             }
 
+            // 'e'
             if(sal_Unicode('e') == aChar || sal_Unicode('E') == aChar)
             {
                 sNumberString.append(rStr[io_rPos]);
                 aChar = rStr[++io_rPos];
-    
+
+                // sign for 'e'
                 if(sal_Unicode('+') == aChar || sal_Unicode('-') == aChar)
                 {
                     sNumberString.append(rStr[io_rPos]);
                     aChar = rStr[++io_rPos];
                 }
 
+                // number for 'e'
                 while(sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
                 {
                     sNumberString.append(rStr[io_rPos]);
@@ -153,34 +169,53 @@ namespace basegfx
         {
             bool bSignAllowed(true);
 
-            while(io_rPos < nLen && lcl_isOnNumberChar(rStr, io_rPos, 
bSignAllowed))
+            while(io_rPos < nLen && lcl_isOnNumberChar(rStr, io_rPos, 
bSignAllowed, true))
             {
                 bSignAllowed = false;
                 ++io_rPos;
             }
         }
 
-        void lcl_skipDouble(sal_Int32&                                 
io_rPos, 
-                            const ::rtl::OUString&     rStr)
+        void lcl_skipDouble(sal_Int32& io_rPos, const ::rtl::OUString& rStr)
         {
             sal_Unicode aChar( rStr[io_rPos] );
 
+            // sign
             if(sal_Unicode('+') == aChar || sal_Unicode('-') == aChar)
+            {
                 aChar = rStr[++io_rPos];
+            }
+
+            // numbers before point
+            while(sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
+            {
+                aChar = rStr[++io_rPos];
+            }
+
+            // point
+            if(sal_Unicode('.') == aChar)
+            {
+                aChar = rStr[++io_rPos];
+            }
 
-            while((sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
-                    || sal_Unicode('.') == aChar)
+            // numbers after point
+            while(sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
             {
                 aChar = rStr[++io_rPos];
             }
 
+            // 'e'
             if(sal_Unicode('e') == aChar || sal_Unicode('E') == aChar)
             {
                 aChar = rStr[++io_rPos];
-    
+
+                // sign of 'e'
                 if(sal_Unicode('+') == aChar || sal_Unicode('-') == aChar)
+                {
                     aChar = rStr[++io_rPos];
+                }
 
+                // numbers for 'e'
                 while(sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
                 {
                     aChar = rStr[++io_rPos];
@@ -199,7 +234,7 @@ namespace basegfx
             const sal_Int32 aLen( rStr.getLength() );
             if(aLen)
             {
-                if( lcl_isOnNumberChar(rStr.charAt(aLen - 1), false) && 
+                if( lcl_isOnNumberChar(rStr.charAt(aLen - 1), false, true) && 
                     fValue >= 0.0 )
                 {
                     rStr.append( sal_Unicode(' ') );


Reply via email to