diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-10-08 08:37:12 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-10-08 08:37:58 +0200 |
commit | 1cb13d87b5d887718f6d81a842444b7251dc64cf (patch) | |
tree | e83682166d2ed0a978351715d27f47f586bd4cfa /sw/source | |
parent | fce720b3e4691eb3b7deef1d005d76b23123a5cb (diff) |
editeng, sw, sc: use comphelper::string::join()
Change-Id: I9b0a32271a965bc4089720ccb61b26b67ceab7b2
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/crsr/crsrsh.cxx | 16 | ||||
-rw-r--r-- | sw/source/core/crsr/viscrs.cxx | 20 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewsrch.cxx | 12 |
3 files changed, 22 insertions, 26 deletions
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index ffd4a823ba38..4ddf5eb390f3 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -64,6 +64,7 @@ #include <IDocumentLayoutAccess.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <comphelper/lok.hxx> +#include <comphelper/string.hxx> using namespace com::sun::star; using namespace util; @@ -1204,14 +1205,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 01a2da7e6e73..13793608e9b7 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 3427fe4b55e6..9667fdc6aab2 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); } } |