diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-04-24 11:37:48 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-04-24 18:04:50 +0200 |
commit | 5c1561561a859c561fb2321420f1abb7f1cedde3 (patch) | |
tree | 7a96cf8b32bd4c088298df3c4067f0d81f549057 /sfx2 | |
parent | 5e6d8efbf3fb456ca370df04b21d2e340d9831ad (diff) |
loplugin:unnecessarygetstr extend to more std::string checking
suggested by mike kaganski
Change-Id: I5f5f254142767aca45a6101abdd84a0163ca6a34
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150936
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/dispatch.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/autoredactdialog.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/view/lokhelper.cxx | 8 |
5 files changed, 13 insertions, 13 deletions
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index f9b8ac53ea66..b1bb3c7aed27 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1852,7 +1852,7 @@ void SfxDispatcher::ExecutePopup( const OUString& rResName, vcl::Window* pWin, c std::stringstream aStream; boost::property_tree::write_json(aStream, aRoot, true); if (SfxViewShell* pViewShell = xImp->pFrame->GetViewShell()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, aStream.str().c_str()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, OString(aStream.str())); } else { diff --git a/sfx2/source/doc/autoredactdialog.cxx b/sfx2/source/doc/autoredactdialog.cxx index f84af9622f95..665e5c0ec781 100644 --- a/sfx2/source/doc/autoredactdialog.cxx +++ b/sfx2/source/doc/autoredactdialog.cxx @@ -402,7 +402,7 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, LoadHdl, sfx2::FileDialogHelper*, void) try { // Create path string, and read JSON from file - std::string sPathStr(OUStringToOString(sTargetsFile, RTL_TEXTENCODING_UTF8).getStr()); + std::string sPathStr(OUStringToOString(sTargetsFile, RTL_TEXTENCODING_UTF8)); boost::property_tree::ptree aTargetsJSON; @@ -459,7 +459,7 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, SaveHdl, sfx2::FileDialogHelper*, void) aTargetsTree.add_child("RedactionTargets", aTargetsArray); // Create path string, and write JSON to file - std::string sPathStr(OUStringToOString(sTargetsFile, RTL_TEXTENCODING_UTF8).getStr()); + std::string sPathStr(OUStringToOString(sTargetsFile, RTL_TEXTENCODING_UTF8)); boost::property_tree::write_json(sPathStr, aTargetsTree); } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 2d7b0c31ef6e..78c4fd01f667 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -465,7 +465,7 @@ static void sendErrorToLOK(ErrCode error) std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); - SfxViewShell::Current()->libreOfficeKitViewCallback(LOK_CALLBACK_ERROR, aStream.str().c_str()); + SfxViewShell::Current()->libreOfficeKitViewCallback(LOK_CALLBACK_ERROR, OString(aStream.str())); } namespace diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 1bd5dc58ee86..b967cbb10369 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -227,7 +227,7 @@ void SidebarController::disposeDecks() const std::string hide = UnoNameFromDeckId(msCurrentDeckId, GetCurrentContext()); if (!hide.empty()) pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, - (hide + "=false").c_str()); + OString(hide + "=false")); } if (mpParentWindow) @@ -802,13 +802,13 @@ void SidebarController::SwitchToDeck ( const std::string hide = UnoNameFromDeckId(msCurrentDeckId, GetCurrentContext()); if (!hide.empty()) pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, - (hide + "=false").c_str()); + OString(hide + "=false")); } const std::string show = UnoNameFromDeckId(rDeckDescriptor.msId, GetCurrentContext()); if (!show.empty()) pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, - (show + "=true").c_str()); + OString(show + "=true")); } } @@ -1320,7 +1320,7 @@ void SidebarController::UpdateDeckOpenState() const std::string uno = UnoNameFromDeckId(msCurrentDeckId, GetCurrentContext()); if (!uno.empty()) pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, - (uno + "=true").c_str()); + OString(uno + "=true")); } } } @@ -1358,7 +1358,7 @@ void SidebarController::UpdateDeckOpenState() const std::string uno = UnoNameFromDeckId(msCurrentDeckId, GetCurrentContext()); if (!uno.empty()) pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, - (uno + "=false").c_str()); + OString(uno + "=false")); } } } diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 513e9e2270b7..6f7f9ee60dd2 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -18,6 +18,7 @@ #include <com/sun/star/ui/ContextChangeEventObject.hpp> #include <comphelper/processfactory.hxx> +#include <o3tl/string_view.hxx> #include <rtl/strbuf.hxx> #include <vcl/lok.hxx> #include <vcl/svapp.hxx> @@ -408,8 +409,7 @@ static OString lcl_generateJSON(const SfxViewShell* pView, const boost::property aMessageProps.put("mode", pView->getEditMode()); std::stringstream aStream; boost::property_tree::write_json(aStream, aMessageProps, false /* pretty */); - const std::string aString = aStream.str(); - return OString(aString.c_str(), aString.size()).trim(); + return OString(o3tl::trim(aStream.str())); } static inline OString lcl_generateJSON(const SfxViewShell* pView, int nViewId, std::string_view rKey, @@ -552,7 +552,7 @@ void SfxLokHelper::sendUnoStatus(const SfxViewShell* pShell, const SfxPoolItem* std::stringstream aStream; boost::property_tree::write_json(aStream, aItem); - pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aStream.str().c_str()); + pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, OString(aStream.str())); } } @@ -969,7 +969,7 @@ void SfxLokHelper::notifyMediaUpdate(boost::property_tree::ptree& json) boost::property_tree::write_json(aStream, json, /*pretty=*/ false); const std::string str = aStream.str(); - SfxLokHelper::notifyAllViews(LOK_CALLBACK_MEDIA_SHAPE, str.c_str()); + SfxLokHelper::notifyAllViews(LOK_CALLBACK_MEDIA_SHAPE, OString(str)); } bool SfxLokHelper::testInPlaceComponentMouseEventHit(SfxViewShell* pViewShell, int nType, int nX, |