summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editeng/source/editeng/impedit.cxx9
-rw-r--r--sc/source/ui/view/gridwin.cxx13
-rw-r--r--sw/source/core/crsr/crsrsh.cxx16
-rw-r--r--sw/source/core/crsr/viscrs.cxx20
-rw-r--r--sw/source/uibase/uiview/viewsrch.cxx12
5 files changed, 30 insertions, 40 deletions
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 08d990b2d2ef..7fac1135499d 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -46,6 +46,7 @@
#include <sot/exchange.hxx>
#include <sot/formats.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <comphelper/string.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -351,17 +352,15 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou
libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr());
}
- std::stringstream ss;
+ std::vector<OString> v;
for (size_t i = 0; i < aRectangles.size(); ++i)
{
Rectangle& rRectangle = aRectangles[i];
- if (i)
- ss << "; ";
if (bMm100ToTwip)
rRectangle = OutputDevice::LogicToLogic(rRectangle, MAP_100TH_MM, MAP_TWIP);
- ss << rRectangle.toString().getStr();
+ v.push_back(rRectangle.toString().getStr());
}
- sRectangle = ss.str().c_str();
+ sRectangle = comphelper::string::join("; ", v);
}
libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangle.getStr());
}
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()
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index b23843cd5f63..9a1118222c95 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -65,6 +65,7 @@
#include <IDocumentLayoutAccess.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <comphelper/lok.hxx>
+#include <comphelper/string.hxx>
using namespace com::sun::star;
using namespace util;
@@ -1205,14 +1206,19 @@ OUString SwCrsrShell::getPageRectangles()
{
CurrShell aCurr(this);
SwRootFrm* pLayout = GetLayout();
- std::stringstream ss;
+ std::vector<OString> v;
for (const SwFrm* pFrm = pLayout->GetLower(); pFrm; pFrm = pFrm->GetNext())
{
- if (pFrm != pLayout->GetLower())
- ss << "; ";
- ss << pFrm->Frm().Left() << ", " << pFrm->Frm().Top() << ", " << pFrm->Frm().Width() << ", " << pFrm->Frm().Height();
+ std::vector<OString> aRectangle
+ {
+ OString::number(pFrm->Frm().Left()),
+ OString::number(pFrm->Frm().Top()),
+ OString::number(pFrm->Frm().Width()),
+ OString::number(pFrm->Frm().Height())
+ };
+ v.push_back(comphelper::string::join(", ", aRectangle));
}
- return OUString::fromUtf8(ss.str().c_str());
+ return OUString::fromUtf8(comphelper::string::join("; ", v).getStr());
}
/// go to the next SSelection
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 808756159545..ff37421674c5 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -55,6 +55,7 @@
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <comphelper/lok.hxx>
+#include <comphelper/string.hxx>
#include <paintfrm.hxx>
// Here static members are defined. They will get changed on alteration of the
@@ -392,15 +393,13 @@ void SwSelPaintRects::Show(std::vector<OString>* pSelectionRectangles)
}
}
- std::stringstream ss;
+ std::vector<OString> aRect;
for (size_type i = 0; i < size(); ++i)
{
const SwRect& rRect = (*this)[i];
- if (i)
- ss << "; ";
- ss << rRect.SVRect().toString().getStr();
+ aRect.push_back(rRect.SVRect().toString());
}
- OString sRect = ss.str().c_str();
+ OString sRect = comphelper::string::join("; ", aRect);
if (!pSelectionRectangles)
{
if (comphelper::LibreOfficeKit::isViewCallback())
@@ -606,20 +605,15 @@ void SwShellCrsr::Show()
if (comphelper::LibreOfficeKit::isActive())
{
- std::stringstream ss;
- bool bFirst = true;
+ std::vector<OString> aRect;
for (size_t i = 0; i < aSelectionRectangles.size(); ++i)
{
const OString& rSelectionRectangle = aSelectionRectangles[i];
if (rSelectionRectangle.isEmpty())
continue;
- if (bFirst)
- bFirst = false;
- else
- ss << "; ";
- ss << rSelectionRectangle.getStr();
+ aRect.push_back(rSelectionRectangle);
}
- OString sRect = ss.str().c_str();
+ OString sRect = comphelper::string::join("; ", aRect);
if (comphelper::LibreOfficeKit::isViewCallback())
GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr());
else
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index c8d3e7a571ea..6879dadd0b98 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -60,6 +60,7 @@
#include <unocrsr.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <comphelper/lok.hxx>
+#include <comphelper/string.hxx>
#include <view.hrc>
#include <SwRewriter.hxx>
@@ -118,20 +119,15 @@ static void lcl_emitSearchResultCallbacks(sal_uInt16 nFound, SvxSearchItem* pSea
{
std::vector<OString> aSelectionRectangles;
pShellCrsr->SwSelPaintRects::Show(&aSelectionRectangles);
- std::stringstream ss;
- bool bFirst = true;
+ std::vector<OString> aRect;
for (size_t i = 0; i < aSelectionRectangles.size(); ++i)
{
const OString& rSelectionRectangle = aSelectionRectangles[i];
if (rSelectionRectangle.isEmpty())
continue;
- if (bFirst)
- bFirst = false;
- else
- ss << "; ";
- ss << rSelectionRectangle.getStr();
+ aRect.push_back(rSelectionRectangle);
}
- OString sRect = ss.str().c_str();
+ OString sRect = comphelper::string::join("; ", aRect);
aMatches.push_back(sRect);
}
}