diff options
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 13 | ||||
-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 |
5 files changed, 30 insertions, 40 deletions
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index ea488b95eb23..83e30ffce918 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; @@ -350,17 +351,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 aba40ff66f90..395c4b5c4a0d 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> @@ -5895,9 +5896,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; @@ -5905,14 +5905,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 @@ -5926,7 +5921,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 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); } } |