From a85565653d770418f1f5a8bbfd13dfbe890ac7bb Mon Sep 17 00:00:00 2001
From: Mark Hung <marklh9@gmail.com>
Date: Fri, 10 Aug 2018 18:33:20 +0800
Subject: tdf#118825 move basegfx::internal::putNumberCharWithSpace

to anonymous namespace.

While basegfx::internal::putNumberCharWithSpace is only used in
exportToSvgD, move it into the anonymous in the same file for
later enhancement.

Change-Id: I6534ac39b2095ed2ba12acc114c75737ad8dacb6
Reviewed-on: https://gerrit.libreoffice.org/58847
Tested-by: Jenkins
Reviewed-by: Mark Hung <marklh9@gmail.com>
---
 basegfx/source/inc/stringconversiontools.hxx   |  5 ---
 basegfx/source/polygon/b2dsvgpolypolygon.cxx   | 62 +++++++++++++++++---------
 basegfx/source/tools/stringconversiontools.cxx | 20 ---------
 3 files changed, 40 insertions(+), 47 deletions(-)

(limited to 'basegfx')

diff --git a/basegfx/source/inc/stringconversiontools.hxx b/basegfx/source/inc/stringconversiontools.hxx
index 27ae7310d2f9..d4600617bb4b 100644
--- a/basegfx/source/inc/stringconversiontools.hxx
+++ b/basegfx/source/inc/stringconversiontools.hxx
@@ -58,11 +58,6 @@ namespace basegfx
                                  const OUString& rStr,
                                  const sal_Int32 nLen);
 
-        void putNumberCharWithSpace(OUStringBuffer& rStr,
-                                    double          fValue,
-                                    double          fOldValue,
-                                    bool            bUseRelativeCoordinates);
-
     } // namespace internal
 } // namespace basegfx
 
diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx
index 049354621975..a0ff38155a26 100644
--- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx
@@ -43,6 +43,24 @@ void putCommandChar(OUStringBuffer& rBuffer,sal_Unicode& rLastSVGCommand, sal_Un
     }
 }
 
+void putNumberChar(OUStringBuffer& rStr,double fValue, double fOldValue, bool bUseRelativeCoordinates)
+{
+    if (bUseRelativeCoordinates)
+        fValue -= fOldValue;
+
+    const sal_Int32 aLen(rStr.getLength());
+    if (aLen)
+    {
+        if (basegfx::internal::isOnNumberChar(rStr[aLen - 1], false) &&
+            fValue >= 0.0 )
+        {
+            rStr.append(' ');
+        }
+    }
+
+    rStr.append(fValue);
+}
+
 }
 
 namespace basegfx
@@ -741,8 +759,8 @@ namespace basegfx
 
                     // Write 'moveto' and the 1st coordinates, set aLastSVGCommand to 'lineto'
                     putCommandChar(aResult, aLastSVGCommand, 'M', bUseRelativeCoordinatesForFirstPoint);
-                    basegfx::internal::putNumberCharWithSpace(aResult, aEdgeStart.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinatesForFirstPoint);
-                    basegfx::internal::putNumberCharWithSpace(aResult, aEdgeStart.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinatesForFirstPoint);
+                    putNumberChar(aResult, aEdgeStart.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinatesForFirstPoint);
+                    putNumberChar(aResult, aEdgeStart.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinatesForFirstPoint);
                     aLastSVGCommand =  bUseRelativeCoordinatesForFirstPoint ? 'l' : 'L';
                     aCurrentSVGPosition = aEdgeStart;
 
@@ -799,18 +817,18 @@ namespace basegfx
                                 {
                                     putCommandChar(aResult, aLastSVGCommand, 'T', bUseRelativeCoordinates);
 
-                                    basegfx::internal::putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
-                                    basegfx::internal::putNumberCharWithSpace(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
+                                    putNumberChar(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
+                                    putNumberChar(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
                                     aCurrentSVGPosition = aEdgeEnd;
                                 }
                                 else
                                 {
                                     putCommandChar(aResult, aLastSVGCommand, 'Q', bUseRelativeCoordinates);
 
-                                    basegfx::internal::putNumberCharWithSpace(aResult, aLeft.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
-                                    basegfx::internal::putNumberCharWithSpace(aResult, aLeft.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
-                                    basegfx::internal::putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
-                                    basegfx::internal::putNumberCharWithSpace(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
+                                    putNumberChar(aResult, aLeft.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
+                                    putNumberChar(aResult, aLeft.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
+                                    putNumberChar(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
+                                    putNumberChar(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
                                     aCurrentSVGPosition = aEdgeEnd;
                                 }
                             }
@@ -821,22 +839,22 @@ namespace basegfx
                                 {
                                     putCommandChar(aResult, aLastSVGCommand, 'S', bUseRelativeCoordinates);
 
-                                    basegfx::internal::putNumberCharWithSpace(aResult, aControlEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
-                                    basegfx::internal::putNumberCharWithSpace(aResult, aControlEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
-                                    basegfx::internal::putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
-                                    basegfx::internal::putNumberCharWithSpace(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
+                                    putNumberChar(aResult, aControlEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
+                                    putNumberChar(aResult, aControlEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
+                                    putNumberChar(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
+                                    putNumberChar(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
                                     aCurrentSVGPosition = aEdgeEnd;
                                 }
                                 else
                                 {
                                     putCommandChar(aResult, aLastSVGCommand, 'C', bUseRelativeCoordinates);
 
-                                    basegfx::internal::putNumberCharWithSpace(aResult, aControlEdgeStart.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
-                                    basegfx::internal::putNumberCharWithSpace(aResult, aControlEdgeStart.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
-                                    basegfx::internal::putNumberCharWithSpace(aResult, aControlEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
-                                    basegfx::internal::putNumberCharWithSpace(aResult, aControlEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
-                                    basegfx::internal::putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
-                                    basegfx::internal::putNumberCharWithSpace(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
+                                    putNumberChar(aResult, aControlEdgeStart.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
+                                    putNumberChar(aResult, aControlEdgeStart.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
+                                    putNumberChar(aResult, aControlEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
+                                    putNumberChar(aResult, aControlEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
+                                    putNumberChar(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
+                                    putNumberChar(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
                                     aCurrentSVGPosition = aEdgeEnd;
                                 }
                             }
@@ -863,7 +881,7 @@ namespace basegfx
                                     // export as vertical line
                                     putCommandChar(aResult, aLastSVGCommand, 'V', bUseRelativeCoordinates);
 
-                                    basegfx::internal::putNumberCharWithSpace(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
+                                    putNumberChar(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
                                     aCurrentSVGPosition = aEdgeEnd;
                                 }
                                 else if(bYEqual)
@@ -871,7 +889,7 @@ namespace basegfx
                                     // export as horizontal line
                                     putCommandChar(aResult, aLastSVGCommand, 'H', bUseRelativeCoordinates);
 
-                                    basegfx::internal::putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
+                                    putNumberChar(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
                                     aCurrentSVGPosition = aEdgeEnd;
                                 }
                                 else
@@ -879,8 +897,8 @@ namespace basegfx
                                     // export as line
                                     putCommandChar(aResult, aLastSVGCommand, 'L', bUseRelativeCoordinates);
 
-                                    basegfx::internal::putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
-                                    basegfx::internal::putNumberCharWithSpace(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
+                                    putNumberChar(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
+                                    putNumberChar(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
                                     aCurrentSVGPosition = aEdgeEnd;
                                 }
                             }
diff --git a/basegfx/source/tools/stringconversiontools.cxx b/basegfx/source/tools/stringconversiontools.cxx
index c657d4687bcf..b14fce0fb557 100644
--- a/basegfx/source/tools/stringconversiontools.cxx
+++ b/basegfx/source/tools/stringconversiontools.cxx
@@ -159,26 +159,6 @@ namespace basegfx
             return true;
         }
 
-        void putNumberCharWithSpace(OUStringBuffer& rStr,
-                                    double          fValue,
-                                    double          fOldValue,
-                                    bool            bUseRelativeCoordinates )
-        {
-            if( bUseRelativeCoordinates )
-                fValue -= fOldValue;
-
-            const sal_Int32 aLen( rStr.getLength() );
-            if(aLen)
-            {
-                if( isOnNumberChar(rStr[aLen - 1], false) &&
-                    fValue >= 0.0 )
-                {
-                    rStr.append( ' ' );
-                }
-            }
-
-            rStr.append(fValue);
-        }
     } // namespace internal
 }
 
-- 
cgit