Blob Blame History Raw
From eacd7a0d10a02292f723031080884a8914fc496f Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Thu, 8 Oct 2015 08:37:12 +0200
Subject: [PATCH 195/398] editeng, sw, sc: use comphelper::string::join()

(cherry picked from commit 1cb13d87b5d887718f6d81a842444b7251dc64cf)

Change-Id: I9b0a32271a965bc4089720ccb61b26b67ceab7b2
---
 sc/source/ui/view/gridwin.cxx | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index cfc0b5e27dd1..1320e27cb104 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -134,6 +134,7 @@
 #include <svx/sdr/overlay/overlaymanager.hxx>
 #include <vcl/svapp.hxx>
 #include <svx/sdr/overlay/overlayselection.hxx>
+#include <comphelper/string.hxx>
 
 #define LOK_USE_UNSTABLE_API
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
@@ -5899,9 +5900,8 @@ static void updateLibreOfficeKitSelection(ScViewData* pViewData, ScDrawLayer* pD
     double nPPTY = pViewData->GetPPTY();
 
     Rectangle aBoundingBox;
-    std::stringstream ss;
+    std::vector<OString> aRectangles;
 
-    bool bIsFirst = true;
     for (auto aRectangle : rRectangles)
     {
         aRectangle.Right() += 1;
@@ -5909,14 +5909,9 @@ static void updateLibreOfficeKitSelection(ScViewData* pViewData, ScDrawLayer* pD
 
         aBoundingBox.Union(aRectangle);
 
-        if (bIsFirst)
-            bIsFirst = false;
-        else
-            ss << "; ";
-
         Rectangle aRect(aRectangle.Left() / nPPTX, aRectangle.Top() / nPPTY,
                 aRectangle.Right() / nPPTX, aRectangle.Bottom() / nPPTY);
-        ss << aRect.toString().getStr();
+        aRectangles.push_back(aRect.toString());
     }
 
     // selection start handle
@@ -5930,7 +5925,7 @@ static void updateLibreOfficeKitSelection(ScViewData* pViewData, ScDrawLayer* pD
     pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr());
 
     // the selection itself
-    pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, ss.str().c_str());
+    pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, comphelper::string::join("; ", aRectangles).getStr());
 }
 
 void ScGridWindow::UpdateCursorOverlay()
-- 
2.12.0