diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-04-07 10:02:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-04-09 20:51:44 +0200 |
commit | eaf071397a1ff30536616f2ed76051f77fd38ed6 (patch) | |
tree | ce55cdc75a0826c54b6b60458a028251f11fcb78 | |
parent | 1e79befa61a08de7a1ddaccb6c435dbb8015c063 (diff) |
new loplugin:unnecessarygetstr
which prevents constructing unnecessary temporaries via getStr()
Change-Id: I9ca70893a10e954b5ee0e6ad6098660ee24c2bef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150170
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
59 files changed, 314 insertions, 143 deletions
diff --git a/compilerplugins/clang/test/unnecessarygetstr.cxx b/compilerplugins/clang/test/unnecessarygetstr.cxx new file mode 100644 index 000000000000..68175872a4ea --- /dev/null +++ b/compilerplugins/clang/test/unnecessarygetstr.cxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <sal/config.h> + +#include <ostream> +#include <string_view> + +#include <rtl/strbuf.hxx> +#include <rtl/string.hxx> +#include <rtl/ustrbuf.hxx> +#include <rtl/ustring.hxx> +#include <sal/log.hxx> + +void f1(bool, const OString& s); +struct Foo +{ + void f1(bool, const OString& s); +}; +void test1(Foo& foo) +{ + OString s; + // expected-error@+1 {{unnecessary call to 'getStr' when passing to OString arg [loplugin:unnecessarygetstr]}} + f1(true, s.getStr()); + // expected-error@+1 {{unnecessary call to 'getStr' when passing to OString arg [loplugin:unnecessarygetstr]}} + foo.f1(true, s.getStr()); + + // avoid false + + OString aVal = "xx"; + OUString aCompText + = "xx" + OUString(aVal.getStr(), aVal.getLength(), RTL_TEXTENCODING_ASCII_US); + (void)aCompText; +} + +// call to param that takes string_view +void f2(bool, std::string_view); +struct Foo2 +{ + void f2(bool, std::string_view); +}; +void test2(Foo2& foo) +{ + OString s; + // expected-error@+1 {{unnecessary call to 'getStr' when passing to string_view arg [loplugin:unnecessarygetstr]}} + f2(true, s.getStr()); + // expected-error@+1 {{unnecessary call to 'getStr' when passing to string_view arg [loplugin:unnecessarygetstr]}} + foo.f2(true, s.getStr()); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/compilerplugins/clang/unnecessarygetstr.cxx b/compilerplugins/clang/unnecessarygetstr.cxx new file mode 100644 index 000000000000..7ef5de6932d1 --- /dev/null +++ b/compilerplugins/clang/unnecessarygetstr.cxx @@ -0,0 +1,122 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef LO_CLANG_SHARED_PLUGINS + +#include <cassert> +#include <stack> + +#include "check.hxx" +#include "plugin.hxx" + +// Find matches of +// +// foo(s.getStr()) +// +// (for the rtl string classes) that can be written as just +// +// foo(s) +// +// and warn about them, which prevents constructing unnecessary temporaries. + +namespace +{ +class UnnecessaryGetStr final : public loplugin::FilteringPlugin<UnnecessaryGetStr> +{ +public: + explicit UnnecessaryGetStr(loplugin::InstantiationData const& data) + : FilteringPlugin(data) + { + } + + bool VisitCallExpr(CallExpr* callExpr) + { + if (ignoreLocation(callExpr)) + return true; + const FunctionDecl* func = callExpr->getDirectCallee(); + if (!func) + return true; + unsigned const n = std::min(func->getNumParams(), callExpr->getNumArgs()); + for (unsigned i = 0; i != n; ++i) + { + auto arg = callExpr->getArg(i); + if (auto matTemp = dyn_cast<MaterializeTemporaryExpr>(arg)) + { + auto cxxConstruct = dyn_cast<CXXConstructExpr>(matTemp->IgnoreImplicit()); + if (!cxxConstruct || cxxConstruct->getNumArgs() < 1 + || cxxConstruct->getNumArgs() > 2) + continue; + auto const tc1 = loplugin::TypeCheck(cxxConstruct->getConstructor()->getParent()); + if (!(tc1.Class("OString").Namespace("rtl").GlobalNamespace() + || tc1.Class("OUString").Namespace("rtl").GlobalNamespace())) + continue; + auto e = dyn_cast<CXXMemberCallExpr>(cxxConstruct->getArg(0)->IgnoreImplicit()); + if (!e) + continue; + auto const t = e->getObjectType(); + auto const tc2 = loplugin::TypeCheck(t); + if (!(tc2.Class("OString").Namespace("rtl").GlobalNamespace() + || tc2.Class("OUString").Namespace("rtl").GlobalNamespace() + || tc2.Class("OStringBuffer").Namespace("rtl").GlobalNamespace() + || tc2.Class("OUStringBuffer").Namespace("rtl").GlobalNamespace())) + continue; + if (!loplugin::DeclCheck(e->getMethodDecl()).Function("getStr")) + continue; + report(DiagnosticsEngine::Warning, + "unnecessary call to 'getStr' when passing to OString arg", e->getExprLoc()) + << e->getSourceRange(); + } + else if (auto impCast = dyn_cast<ImplicitCastExpr>(arg)) + { + auto cxxConstruct = dyn_cast<CXXConstructExpr>(impCast->getSubExpr()); + if (!cxxConstruct || cxxConstruct->getNumArgs() < 1 + || cxxConstruct->getNumArgs() > 2) + continue; + auto const tc1 = loplugin::TypeCheck(cxxConstruct->getConstructor()->getParent()); + if (!(tc1.ClassOrStruct("basic_string_view").StdNamespace())) + continue; + auto e = dyn_cast<CXXMemberCallExpr>(cxxConstruct->getArg(0)->IgnoreImplicit()); + if (!e) + continue; + auto const t = e->getObjectType(); + auto const tc2 = loplugin::TypeCheck(t); + if (!(tc2.Class("OString").Namespace("rtl").GlobalNamespace() + || tc2.Class("OUString").Namespace("rtl").GlobalNamespace() + || tc2.Class("OStringBuffer").Namespace("rtl").GlobalNamespace() + || tc2.Class("OUStringBuffer").Namespace("rtl").GlobalNamespace())) + continue; + if (!loplugin::DeclCheck(e->getMethodDecl()).Function("getStr")) + continue; + report(DiagnosticsEngine::Warning, + "unnecessary call to 'getStr' when passing to string_view arg", + e->getExprLoc()) + << e->getSourceRange(); + } + } + return true; + } + + bool preRun() override { return compiler.getLangOpts().CPlusPlus; } + +private: + void run() override + { + if (preRun()) + { + TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); + } + } +}; + +loplugin::Plugin::Registration<UnnecessaryGetStr> unnecessarygetstr("unnecessarygetstr"); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx index f1c23ca482ad..6d7b6d4d9a77 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx @@ -509,8 +509,7 @@ DateTime SAL_CALL OResultSet::getTimestamp(sal_Int32 column) OString sVal = m_aRows[m_nRowPosition][column - 1]; // YY-MM-DD HH:MM:SS - std::vector<OString> dateAndTime - = lcl_split(std::string_view(sVal.getStr(), getDataLength(column)), ' '); + std::vector<OString> dateAndTime = lcl_split(sVal.subView(0, getDataLength(column)), ' '); auto dateParts = lcl_split(dateAndTime.at(0), '-'); auto timeParts = lcl_split(dateAndTime.at(1), ':'); diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx index 339a61cde4fd..f5df775dc515 100644 --- a/dbaccess/source/ui/misc/TokenWriter.cxx +++ b/dbaccess/source/ui/misc/TokenWriter.cxx @@ -721,7 +721,7 @@ void OHTMLImportExport::WriteTables() "=1"; IncIndent(1); - HTMLOutFuncs::Out_AsciiTag(*m_pStream, aStrOut.getStr()); + HTMLOutFuncs::Out_AsciiTag(*m_pStream, aStrOut); FontOn(); @@ -883,7 +883,7 @@ void OHTMLImportExport::WriteCell( sal_Int32 nFormat, sal_Int32 nWidthPixel, sal } } - HTMLOutFuncs::Out_AsciiTag(*m_pStream, aStrTD.getStr()); + HTMLOutFuncs::Out_AsciiTag(*m_pStream, aStrTD); FontOn(); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 17ab7b487398..cda953a928f4 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -5190,7 +5190,7 @@ static bool getFromTransferable( } datatransfer::DataFlavor aFlavor; - aFlavor.MimeType = OUString::fromUtf8(aMimeType.getStr()); + aFlavor.MimeType = OUString::fromUtf8(aMimeType); if (aMimeType == "text/plain;charset=utf-16") aFlavor.DataType = cppu::UnoType<OUString>::get(); else @@ -7005,7 +7005,7 @@ static char* lo_getFilterTypes(LibreOfficeKit* pThis) OUString aValue; if (it != std::cend(aValues) && (it->Value >>= aValue) && !aValue.isEmpty()) { - auto typeNode = aJson.startNode(rType.toUtf8().getStr()); + auto typeNode = aJson.startNode(rType.toUtf8()); aJson.put("MediaType", aValue.toUtf8()); } } diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 801fca0e0b21..c6af2f4cb1e0 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -524,7 +524,7 @@ void EditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor, bool bActivat return; static const OString aPayload = OString::boolean(true); - pImpEditView->mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, aPayload.getStr()); + pImpEditView->mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, aPayload); pImpEditView->mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible", aPayload); } } @@ -542,7 +542,7 @@ void EditView::HideCursor(bool bDeactivate) return; OString aPayload = OString::boolean(false); - pImpEditView->mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, aPayload.getStr()); + pImpEditView->mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, aPayload); pImpEditView->mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible", aPayload); } } diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 7d378af4da14..b28e4fdca501 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -422,7 +422,7 @@ void ImpEditView::lokSelectionCallback(const std::optional<tools::PolyPolygon> & if (mpLOKSpecialPositioning) aPayload += ":: " + sRefPoint; - mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, aPayload.getStr()); + mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, aPayload); tools::Rectangle& rEnd = aRectangles.back(); tools::Rectangle aEnd(rEnd.Right() - 1, rEnd.Top(), rEnd.Right(), rEnd.Bottom()); @@ -431,7 +431,7 @@ void ImpEditView::lokSelectionCallback(const std::optional<tools::PolyPolygon> & if (mpLOKSpecialPositioning) aPayload += ":: " + sRefPoint; - mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, aPayload.getStr()); + mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, aPayload); } if (mpOtherShell) @@ -442,7 +442,7 @@ void ImpEditView::lokSelectionCallback(const std::optional<tools::PolyPolygon> & } else { - mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangle.getStr()); + mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangle); mpViewShell->NotifyOtherViews(LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", sRectangle); } diff --git a/fpicker/source/office/commonpicker.cxx b/fpicker/source/office/commonpicker.cxx index 29ae5d08b6c9..8b7f2827df4a 100644 --- a/fpicker/source/office/commonpicker.cxx +++ b/fpicker/source/office/commonpicker.cxx @@ -452,7 +452,7 @@ namespace svt DBG_ASSERT( bKnownSetting, OString( "OCommonPicker::initialize: unknown argument \"" - + OString(sSettingName.getStr(), sSettingName.getLength(), osl_getThreadTextEncoding()) + + OUStringToOString(sSettingName, osl_getThreadTextEncoding()) + "\"!").getStr() ); } } diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index eb8d5b00cb11..7f9587b4c22b 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -153,7 +153,7 @@ void InitPoFile( //Add header to the po file PoOfstream aPoOutPut; - aPoOutPut.open(rOutPath.getStr()); + aPoOutPut.open(rOutPath); if (!aPoOutPut.isOpen()) { std::cerr diff --git a/oox/source/core/relationshandler.cxx b/oox/source/core/relationshandler.cxx index 07586cce0db7..5fb39fd4e140 100644 --- a/oox/source/core/relationshandler.cxx +++ b/oox/source/core/relationshandler.cxx @@ -40,12 +40,16 @@ namespace { 'file.xml' -> '_rels/file.xml.rels' '' -> '_rels/.rels' */ -OUString lclGetRelationsPath( const OUString& rFragmentPath ) +OUString lclGetRelationsPath( std::u16string_view rFragmentPath ) { - sal_Int32 nPathLen = ::std::max< sal_Int32 >( rFragmentPath.lastIndexOf( '/' ) + 1, 0 ); - return OUString::Concat(std::u16string_view(rFragmentPath.getStr(), nPathLen )) + // file path including slash + size_t nPathLen = rFragmentPath.rfind( '/' ); + if (nPathLen == std::u16string_view::npos) + nPathLen = 0; + else + ++nPathLen; + return OUString::Concat(rFragmentPath.substr(0, nPathLen)) + // file path including slash "_rels/" + // additional '_rels/' path - std::u16string_view(rFragmentPath.getStr() + nPathLen) + // file name after path + rFragmentPath.substr(nPathLen) + // file name after path ".rels"; // '.rels' suffix } diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 2f802a810ba1..72839483dae6 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -1376,7 +1376,7 @@ bool ScDocument::SearchAndReplace( { OString aPayload = OString::number(nTab); if (SfxViewShell* pViewShell = SfxViewShell::Current()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload); } } } @@ -1407,7 +1407,7 @@ bool ScDocument::SearchAndReplace( { OString aPayload = OString::number(nTab); if(SfxViewShell* pViewShell = SfxViewShell::Current()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload); } } } diff --git a/sc/source/core/tool/prnsave.cxx b/sc/source/core/tool/prnsave.cxx index ff4298e54724..abf49260017a 100644 --- a/sc/source/core/tool/prnsave.cxx +++ b/sc/source/core/tool/prnsave.cxx @@ -107,7 +107,7 @@ void ScPrintRangeSaver::GetPrintRangesInfo(tools::JsonWriter& rPrintRanges) cons (nLast == nIdx ? std::string_view("]") : std::string_view("], "))); } - rPrintRanges.putRaw(aRanges.getStr()); + rPrintRanges.putRaw(aRanges); } } diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index 98301ab7607f..f9bcd4e3e0bb 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -776,7 +776,7 @@ void ScHTMLExport::WriteTables() // BORDER=0, we do the styling of the cells in <TD> aByteStrOut.append(" " OOO_STRING_SVTOOLS_HTML_O_border "=\"0\""); - IncIndent(1); TAG_ON_LF( aByteStrOut.makeStringAndClear().getStr() ); + IncIndent(1); TAG_ON_LF( aByteStrOut.makeStringAndClear() ); // --- <COLGROUP> ---- { @@ -795,7 +795,7 @@ void ScHTMLExport::WriteTables() { if( nSpan != 0 ) { - TAG_ON(lcl_getColGroupString(nSpan, nWidth).getStr()); + TAG_ON(lcl_getColGroupString(nSpan, nWidth)); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_colgroup ); } nWidth = ToPixel( pDoc->GetColWidth( nCol, nTab ) ); @@ -807,7 +807,7 @@ void ScHTMLExport::WriteTables() } if( nSpan ) { - TAG_ON(lcl_getColGroupString(nSpan, nWidth).getStr()); + TAG_ON(lcl_getColGroupString(nSpan, nWidth)); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_colgroup ); } } @@ -871,7 +871,7 @@ void ScHTMLExport::WriteTables() " " OOO_STRING_SVTOOLS_HTML_O_clear "=" OOO_STRING_SVTOOLS_HTML_AL_left); - TAG_ON_LF( aByteStrOut.makeStringAndClear().getStr() ); + TAG_ON_LF( aByteStrOut.makeStringAndClear() ); } } @@ -1106,7 +1106,7 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC aStrTD.append(HTMLOutFuncs::CreateTableDataOptionsValNum(bValueData, fVal, nFormat, *pFormatter, &aNonConvertibleChars)); - TAG_ON(aStrTD.makeStringAndClear().getStr()); + TAG_ON(aStrTD.makeStringAndClear()); //write the note for this as the first thing in the tag ScPostIt* pNote = pDoc->HasNote(aPos) ? pDoc->GetNote(aPos) : nullptr; @@ -1115,7 +1115,7 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC //create the comment indicator OString aStr = OOO_STRING_SVTOOLS_HTML_anchor " " OOO_STRING_SVTOOLS_HTML_O_class "=\"comment-indicator\""; - TAG_ON(aStr.getStr()); + TAG_ON(aStr); TAG_OFF(OOO_STRING_SVTOOLS_HTML_anchor); OUT_LF(); @@ -1173,7 +1173,7 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC aStr.append(" " OOO_STRING_SVTOOLS_HTML_O_color "=" + lcl_makeHTMLColorTriplet(aColor)); } - TAG_ON(aStr.makeStringAndClear().getStr()); + TAG_ON(aStr.makeStringAndClear()); } OUString aURL; @@ -1193,7 +1193,7 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC { OString aURLStr = HTMLOutFuncs::ConvertStringToHTML(aURL, &aNonConvertibleChars); OString aStr = OOO_STRING_SVTOOLS_HTML_anchor " " OOO_STRING_SVTOOLS_HTML_O_href "=\"" + aURLStr + "\""; - TAG_ON(aStr.getStr()); + TAG_ON(aStr); } OUString aStrOut; diff --git a/sc/source/filter/orcus/xmlcontext.cxx b/sc/source/filter/orcus/xmlcontext.cxx index eadd4d2eec72..e9c844890978 100644 --- a/sc/source/filter/orcus/xmlcontext.cxx +++ b/sc/source/filter/orcus/xmlcontext.cxx @@ -236,8 +236,8 @@ void ScOrcusXMLContextImpl::importXML(const ScOrcusImportXMLParam& rParam) OUString aTabName; mrDoc.GetName(rLink.maPos.Tab(), aTabName); filter.set_cell_link( - rLink.maPath.getStr(), - OUStringToOString(aTabName, RTL_TEXTENCODING_UTF8).getStr(), + rLink.maPath, + aTabName.toUtf8(), rLink.maPos.Row(), rLink.maPos.Col()); } @@ -247,7 +247,7 @@ void ScOrcusXMLContextImpl::importXML(const ScOrcusImportXMLParam& rParam) OUString aTabName; mrDoc.GetName(rLink.maPos.Tab(), aTabName); filter.start_range( - OUStringToOString(aTabName, RTL_TEXTENCODING_UTF8).getStr(), + aTabName.toUtf8(), rLink.maPos.Row(), rLink.maPos.Col()); std::for_each(rLink.maFieldPaths.begin(), rLink.maFieldPaths.end(), diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index c8bb9fc0b727..8184bac0b946 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -338,7 +338,7 @@ void ScInputHandler::SendReferenceMarks( const SfxViewShell* pViewShell, OString aPayload = ss.str().c_str(); pViewShell->libreOfficeKitViewCallback( - LOK_CALLBACK_REFERENCE_MARKS, aPayload.getStr() ); + LOK_CALLBACK_REFERENCE_MARKS, aPayload ); } void ScInputHandler::InitRangeFinder( const OUString& rFormula ) @@ -1454,7 +1454,7 @@ void ScInputHandler::ShowFuncList( const ::std::vector< OUString > & rFuncStrVec aPayload[nLen - 1] = ']'; OString s = aPayload.makeStringAndClear(); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CALC_FUNCTION_LIST, s.getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CALC_FUNCTION_LIST, s); } // not tunnel tooltips in the lok case return; @@ -2739,7 +2739,7 @@ void ScInputHandler::DataChanged( bool bFromTopNotify, bool bSetModified ) if (pActiveViewSh) { // TODO: deprecated? - pActiveViewSh->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_FORMULA, aText.toUtf8().getStr()); + pActiveViewSh->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_FORMULA, aText.toUtf8()); } } } @@ -4259,7 +4259,7 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState, ScInputHandler::LOKSendFormulabarUpdate(pActiveView, pActiveViewSh, aString, aSel); // TODO: deprecated? - pActiveViewSh->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_FORMULA, aString.toUtf8().getStr()); + pActiveViewSh->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_FORMULA, aString.toUtf8()); } } @@ -4307,7 +4307,7 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState, } if (comphelper::LibreOfficeKit::isActive() && pActiveViewSh) - pActiveViewSh->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_ADDRESS, aPosStr.toUtf8().getStr()); + pActiveViewSh->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_ADDRESS, aPosStr.toUtf8()); } if (bStopEditing) { diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 39864bfcf5f4..563c84399256 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1010,7 +1010,7 @@ static void lcl_sendLOKDocumentBackground(const ScViewData* pViewData) const Color& rColor = rBackground.GetColor(); ScTabViewShell* pViewShell = pViewData->GetViewShell(); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR, rColor.AsRGBHexString().toUtf8().getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR, rColor.AsRGBHexString().toUtf8()); } void ScModelObj::setClientZoom(int nTilePixelWidth_, int nTilePixelHeight_, int nTileTwipWidth_, int nTileTwipHeight_) diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index 19911bf61a52..29711173777a 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -145,7 +145,7 @@ void lcl_lokGetWholeFunctionList() aPayload.append(" }"); OString s = aPayload.makeStringAndClear(); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CALC_FUNCTION_LIST, s.getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CALC_FUNCTION_LIST, s); } } // end namespace diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index b02c79a02957..91bafb695d94 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -1812,7 +1812,7 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet ) { OUString sPayload = ".uno:NumberFormat=" + aFormat; GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, - OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr()); + OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US)); } } else diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 899bbe9e38d6..d00d3c451d2f 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -2433,7 +2433,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) double fPPTX = pViewShell->GetViewData().GetPPTX(); int mouseX = aPos.X() / fPPTX; OString aMsg(aUrl.toUtf8() + " coordinates: " + aCursor + ", " + OString::number(mouseX)); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, aMsg.getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, aMsg); } else ScGlobal::OpenURL(aUrl, aTarget); } @@ -5024,7 +5024,7 @@ void ScGridWindow::notifyKitCellFollowJump( ) const { ScTabViewShell* pViewShell = mrViewData.GetViewShell(); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SC_FOLLOW_JUMP, getCellCursor().getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SC_FOLLOW_JUMP, getCellCursor()); } void ScGridWindow::UpdateListValPos( bool bVisible, const ScAddress& rPos ) @@ -5827,7 +5827,7 @@ void ScGridWindow::notifyKitCellCursor() const { ScTabViewShell* pViewShell = mrViewData.GetViewShell(); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, getCellCursor().getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, getCellCursor()); if (bListValButton && aListValPos == mrViewData.GetCurPos()) updateLOKValListButton(true, aListValPos); std::vector<tools::Rectangle> aRects; @@ -6119,8 +6119,8 @@ void ScGridWindow::UpdateKitSelection(const std::vector<tools::Rectangle>& rRect if (!aBoundingBox.IsEmpty()) sBoundingBoxString = aBoundingBox.toString(); OString aRectListString = rectanglesToString(rLogicRects); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, sBoundingBoxString.getStr()); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aRectListString.getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, sBoundingBoxString); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aRectListString); if (bInPrintTwips) { @@ -6147,7 +6147,7 @@ void ScGridWindow::UpdateKitSelection(const std::vector<tools::Rectangle>& rRect pGrid->GetPixelRectsFor(mrViewData.GetMarkData() /* ours */, aPixelRects); auto aOtherLogicRects = convertPixelToLogical(pOther->GetViewData(), aPixelRects, aDummyBBox); SfxLokHelper::notifyOtherView(pViewShell, pOther, LOK_CALLBACK_TEXT_VIEW_SELECTION, - "selection", rectanglesToString(aOtherLogicRects).getStr()); + "selection", rectanglesToString(aOtherLogicRects)); } } @@ -6189,8 +6189,8 @@ void ScGridWindow::updateOtherKitSelections() const if (!aBoundingBox.IsEmpty()) sBoundingBoxString = aBoundingBox.toString(); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, sBoundingBoxString.getStr()); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aRectsString.getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, sBoundingBoxString); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aRectsString); } else SfxLokHelper::notifyOtherView(it, pViewShell, LOK_CALLBACK_TEXT_VIEW_SELECTION, @@ -6220,7 +6220,7 @@ void updateLibreOfficeKitAutoFill(const ScViewData& rViewData, tools::Rectangle } ScTabViewShell* pViewShell = rViewData.GetViewShell(); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_AUTO_FILL_AREA, sRectangleString.getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_AUTO_FILL_AREA, sRectangleString); } } //end anonymous namespace @@ -6752,8 +6752,8 @@ void ScGridWindow::UpdateDragRectOverlay() if (!aBoundingBox.IsEmpty()) sBoundingBoxString = aBoundingBox.toString(); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, sBoundingBoxString.getStr()); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aRectsString.getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, sBoundingBoxString); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aRectsString); } } diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx index bbd5c26eff12..12fc1a7a6c67 100644 --- a/sc/source/ui/view/tabcont.cxx +++ b/sc/source/ui/view/tabcont.cxx @@ -437,7 +437,7 @@ void ScTabControl::SwitchToPageId(sal_uInt16 nId) { // notify LibreOfficeKit about changed page OString aPayload = OString::number(nId - 1); - pViewData->GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + pViewData->GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload); } } diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 020cc048005c..fcafe6755242 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -534,7 +534,7 @@ void ScTabViewShell::notifyAllViewsHeaderInvalidation(const SfxViewShell* pForVi if (pTabViewShell && pViewShell->GetDocId() == pForViewShell->GetDocId() && (nCurrentTabIndex == -1 || pTabViewShell->getPart() == nCurrentTabIndex)) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_HEADER, aPayload.getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_HEADER, aPayload); } pViewShell = SfxViewShell::GetNext(*pViewShell); } @@ -603,7 +603,7 @@ void ScTabViewShell::notifyAllViewsSheetGeomInvalidation(const SfxViewShell* pFo if (pTabViewShell && pViewShell->GetDocId() == pForViewShell->GetDocId() && (nCurrentTabIndex == -1 || pTabViewShell->getPart() == nCurrentTabIndex)) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY, aPayload.getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY, aPayload); } pViewShell = SfxViewShell::GetNext(*pViewShell); } diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 298a54d9ae01..222ee4a61e98 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -2114,7 +2114,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, GetFrameWin()->LeaveWait(); if (!bIsApi) { - GetViewData().GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, pSearchItem->GetSearchString().toUtf8().getStr()); + GetViewData().GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, pSearchItem->GetSearchString().toUtf8()); SvxSearchDialogWrapper::SetSearchLabel(SearchLabel::NotFound); } @@ -2197,7 +2197,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, boost::property_tree::write_json(aStream, aTree); OString aPayload = aStream.str().c_str(); SfxViewShell* pViewShell = GetViewData().GetViewShell(); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload); // Trigger LOK_CALLBACK_TEXT_SELECTION now. MarkDataChanged(); diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx index 0a7bb5e90801..4a897e7df7f2 100644 --- a/sd/source/ui/func/fusel.cxx +++ b/sd/source/ui/func/fusel.cxx @@ -280,7 +280,7 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt) if (comphelper::LibreOfficeKit::isActive()) { SfxViewShell& rSfxViewShell = mpViewShell->GetViewShellBase(); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, aVEvt.mpURLField->GetURL().toUtf8().getStr()); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, aVEvt.mpURLField->GetURL().toUtf8()); return true; } diff --git a/sd/source/ui/remotecontrol/Communicator.cxx b/sd/source/ui/remotecontrol/Communicator.cxx index 341051a3aa08..65e40925d8a7 100644 --- a/sd/source/ui/remotecontrol/Communicator.cxx +++ b/sd/source/ui/remotecontrol/Communicator.cxx @@ -78,7 +78,7 @@ void Communicator::execute() OUStringToOString( ::comphelper::DocumentInfo::getDocumentTitle( xFrame->getController()->getModel() ), RTL_TEXTENCODING_UTF8 ) + "\n\n"; - pTransmitter->addMessage( aBuffer.getStr(), Transmitter::PRIORITY_LOW ); + pTransmitter->addMessage( aBuffer, Transmitter::PRIORITY_LOW ); } else { diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index e5a231d4d405..37c650d4a465 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2505,7 +2505,7 @@ void SdXImpressDocument::getPostIts(::tools::JsonWriter& rJsonWriter) { sal_uInt32 nID = sd::getAnnotationId(xAnnotation); OString nodeName = "comment" + OString::number(nID); - auto commentNode = rJsonWriter.startNode(nodeName.getStr()); + auto commentNode = rJsonWriter.startNode(nodeName); rJsonWriter.put("id", nID); rJsonWriter.put("author", xAnnotation->getAuthor()); rJsonWriter.put("dateTime", utl::toISO8601(xAnnotation->getDateTime())); diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 00e495c8b1d4..9f107d1488cc 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -661,7 +661,7 @@ bool SdOutliner::SearchAndReplaceAll() std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); OString aPayload = aStream.str().c_str(); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload); } } @@ -672,7 +672,7 @@ bool SdOutliner::SearchAndReplaceAll() // Find-all, tiled rendering and we have at least one match. OString aPayload = OString::number(mnStartPageIndex); SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload); // Emit a selection callback here: // 1) The original one is no longer valid, as we there was a SET_PART in between @@ -685,7 +685,7 @@ bool SdOutliner::SearchAndReplaceAll() aRectangles.push_back(rSelection.m_aRectangles); } OString sRectangles = comphelper::string::join("; ", aRectangles); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangles.getStr()); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangles); } mnStartPageIndex = sal_uInt16(-1); @@ -780,7 +780,7 @@ void SdOutliner::sendLOKSearchResultCallback(const std::shared_ptr<sd::ViewShell // notify LibreOfficeKit about changed page OString aPayload = OString::number(maCurrentPosition.mnPageIndex); SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload); // also about search result selections boost::property_tree::ptree aTree; @@ -797,11 +797,11 @@ void SdOutliner::sendLOKSearchResultCallback(const std::shared_ptr<sd::ViewShell std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); aPayload = aStream.str().c_str(); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload); if (rVectorGraphicSearchContext.mbCurrentIsVectorGraphic) { - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangles.getStr()); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangles); } } else @@ -1403,7 +1403,7 @@ void SdOutliner::ShowEndOfSearchDialog() if (pViewShell) { SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, mpSearchItem->GetSearchString().toUtf8().getStr()); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, mpSearchItem->GetSearchString().toUtf8()); } } diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index c920b315466e..bff9f67872bd 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -999,7 +999,7 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage, bool bAllowChangeFocus) // notify LibreOfficeKit about changed page OString aPayload = OString::number(nSelectedPage); if (SfxViewShell* pViewShell = GetViewShell()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload); } rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetDoc() ) ); diff --git a/sdext/source/pdfimport/filterdet.cxx b/sdext/source/pdfimport/filterdet.cxx index f6356d8676e8..ef29e8a2c022 100644 --- a/sdext/source/pdfimport/filterdet.cxx +++ b/sdext/source/pdfimport/filterdet.cxx @@ -591,7 +591,7 @@ uno::Reference< io::XStream > getAdditionalStream( const OUString& { OString aIsoPwd = OUStringToOString( io_rPwd, RTL_TEXTENCODING_ISO_8859_1 ); - bAuthenticated = pPDFFile->setupDecryptionData( aIsoPwd.getStr() ); + bAuthenticated = pPDFFile->setupDecryptionData( aIsoPwd ); } if( ! bAuthenticated ) { @@ -616,7 +616,7 @@ uno::Reference< io::XStream > getAdditionalStream( const OUString& bEntered = getPassword( xIntHdl, io_rPwd, ! bEntered, aDocName ); OString aIsoPwd = OUStringToOString( io_rPwd, RTL_TEXTENCODING_ISO_8859_1 ); - bAuthenticated = pPDFFile->setupDecryptionData( aIsoPwd.getStr() ); + bAuthenticated = pPDFFile->setupDecryptionData( aIsoPwd ); } while( bEntered && ! bAuthenticated ); } diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index e3e1c3aa8d04..f75821788d0f 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -929,7 +929,7 @@ static bool checkEncryption( std::u16string_view i_rPa { OString aIsoPwd = OUStringToOString( io_rPwd, RTL_TEXTENCODING_ISO_8859_1 ); - bAuthenticated = pPDFFile->setupDecryptionData( aIsoPwd.getStr() ); + bAuthenticated = pPDFFile->setupDecryptionData( aIsoPwd ); } if( bAuthenticated ) bSuccess = true; @@ -943,7 +943,7 @@ static bool checkEncryption( std::u16string_view i_rPa bEntered = getPassword( i_xIHdl, io_rPwd, ! bEntered, i_rDocName ); OString aIsoPwd = OUStringToOString( io_rPwd, RTL_TEXTENCODING_ISO_8859_1 ); - bAuthenticated = pPDFFile->setupDecryptionData( aIsoPwd.getStr() ); + bAuthenticated = pPDFFile->setupDecryptionData( aIsoPwd ); } while( bEntered && ! bAuthenticated ); } diff --git a/sfx2/source/appl/openuriexternally.cxx b/sfx2/source/appl/openuriexternally.cxx index a8aed34fcfdf..680c2796bafa 100644 --- a/sfx2/source/appl/openuriexternally.cxx +++ b/sfx2/source/appl/openuriexternally.cxx @@ -58,7 +58,7 @@ void URITools::openURI(const OUString& sURI, bool bHandleSystemShellExecuteExcep if (SfxViewShell* pViewShell = SfxViewShell::Current()) { pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, - sURI.toUtf8().getStr()); + sURI.toUtf8()); } delete this; return; diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 72124835a410..203e81eaa3b5 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -723,13 +723,13 @@ static bool impl_showOnlineHelp(const OUString& rURL, weld::Widget* pDialogParen if(SfxViewShell* pViewShell = SfxViewShell::Current()) { pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, - aHelpLink.toUtf8().getStr()); + aHelpLink.toUtf8()); return true; } else if (GetpApp()) { GetpApp()->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, - aHelpLink.toUtf8().getStr()); + aHelpLink.toUtf8()); return true; } diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index bb2510a89435..e7b84138e436 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -1280,7 +1280,7 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra OUString payload = aBuffer.makeStringAndClear(); if (const SfxViewShell* pViewShell = pViewFrame->GetViewShell()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, payload.toUtf8().getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, payload.toUtf8()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index cdda49e10b72..3785585b44d8 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -1809,8 +1809,7 @@ bool SfxStoringHelper::FinishGUIStoreModel(::comphelper::SequenceAsHashMap::cons if ( SfxViewShell* pShell = SfxViewShell::Current() ) { OUString sURL = aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ); - pShell->libreOfficeKitViewCallback( LOK_CALLBACK_EXPORT_FILE, - OUStringToOString(sURL, RTL_TEXTENCODING_UTF8).getStr() ); + pShell->libreOfficeKitViewCallback( LOK_CALLBACK_EXPORT_FILE, sURL.toUtf8() ); } } diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index f8a47eabf79d..a9cff131655e 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -359,7 +359,7 @@ void SAL_CALL SfxInPlaceClient_Impl::activatingInplace() } OString str = (m_bNegativeX ? lcl_negateRectX(aRect) : aRect).toString() + ", \"INPLACE\""; - pViewShell->libreOfficeKitViewCallback( LOK_CALLBACK_GRAPHIC_SELECTION, str.getStr() ); + pViewShell->libreOfficeKitViewCallback( LOK_CALLBACK_GRAPHIC_SELECTION, str ); } } diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 6fb0d844fd47..513e9e2270b7 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -437,7 +437,7 @@ void SfxLokHelper::notifyOtherView(const SfxViewShell* pThisView, SfxViewShell c const OString aPayload = lcl_generateJSON(pThisView, rKey, rPayload); const int viewId = SfxLokHelper::getView(pThisView); - pOtherView->libreOfficeKitViewCallbackWithViewId(nType, aPayload.getStr(), viewId); + pOtherView->libreOfficeKitViewCallbackWithViewId(nType, aPayload, viewId); } void SfxLokHelper::notifyOtherView(const SfxViewShell* pThisView, SfxViewShell const* pOtherView, @@ -448,7 +448,7 @@ void SfxLokHelper::notifyOtherView(const SfxViewShell* pThisView, SfxViewShell c return; const int viewId = SfxLokHelper::getView(pThisView); - pOtherView->libreOfficeKitViewCallbackWithViewId(nType, lcl_generateJSON(pThisView, rTree).getStr(), viewId); + pOtherView->libreOfficeKitViewCallbackWithViewId(nType, lcl_generateJSON(pThisView, rTree), viewId); } void SfxLokHelper::notifyOtherViews(const SfxViewShell* pThisView, int nType, std::string_view rKey, @@ -475,7 +475,7 @@ void SfxLokHelper::notifyOtherViews(const SfxViewShell* pThisView, int nType, st viewId = SfxLokHelper::getView(pThisView); } - pViewShell->libreOfficeKitViewCallbackWithViewId(nType, aPayload.getStr(), viewId); + pViewShell->libreOfficeKitViewCallbackWithViewId(nType, aPayload, viewId); } pViewShell = SfxViewShell::GetNext(*pViewShell); @@ -506,7 +506,7 @@ void SfxLokHelper::notifyOtherViews(const SfxViewShell* pThisView, int nType, viewId = SfxLokHelper::getView(pThisView); } - pViewShell->libreOfficeKitViewCallbackWithViewId(nType, aPayload.getStr(), viewId); + pViewShell->libreOfficeKitViewCallbackWithViewId(nType, aPayload, viewId); } pViewShell = SfxViewShell::GetNext(*pViewShell); @@ -558,7 +558,7 @@ void SfxLokHelper::sendUnoStatus(const SfxViewShell* pShell, const SfxPoolItem* void SfxLokHelper::notifyViewRenderState(const SfxViewShell* pShell, vcl::ITiledRenderable* pDoc) { - pShell->libreOfficeKitViewCallback(LOK_CALLBACK_VIEW_RENDER_STATE, pDoc->getViewRenderState().getStr()); + pShell->libreOfficeKitViewCallback(LOK_CALLBACK_VIEW_RENDER_STATE, pDoc->getViewRenderState()); } void SfxLokHelper::notifyWindow(const SfxViewShell* pThisView, @@ -586,7 +586,7 @@ void SfxLokHelper::notifyWindow(const SfxViewShell* pThisView, aPayload.append('}'); const OString s = aPayload.makeStringAndClear(); - pThisView->libreOfficeKitViewCallback(LOK_CALLBACK_WINDOW, s.getStr()); + pThisView->libreOfficeKitViewCallback(LOK_CALLBACK_WINDOW, s); } void SfxLokHelper::notifyInvalidation(SfxViewShell const* pThisView, tools::Rectangle const* pRect) @@ -614,7 +614,7 @@ void SfxLokHelper::notifyDocumentSizeChanged(SfxViewShell const* pThisView, cons pThisView->libreOfficeKitViewInvalidateTilesCallback(&aRectangle, i, nMode); } } - pThisView->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, rPayload.getStr()); + pThisView->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, rPayload); } void SfxLokHelper::notifyDocumentSizeChangedAllViews(vcl::ITiledRenderable* pDoc, bool bInvalidateAll) @@ -697,11 +697,11 @@ void SfxLokHelper::notifyContextChange(const css::ui::ContextChangeEventObject& if (!pViewShell) return; - OString aBuffer = - OUStringToOString(rEvent.ApplicationName.replace(' ', '_'), RTL_TEXTENCODING_UTF8) + + OUString aBuffer = + rEvent.ApplicationName.replace(' ', '_') + " " + - OUStringToOString(rEvent.ContextName.replace(' ', '_'), RTL_TEXTENCODING_UTF8); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_CHANGED, aBuffer.getStr()); + rEvent.ContextName.replace(' ', '_'); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_CHANGED, aBuffer.toUtf8()); } void SfxLokHelper::notifyUpdate(SfxViewShell const* pThisView, int nType) diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk index 8e31cfdfc8f8..05d0d6f3d088 100644 --- a/solenv/CompilerTest_compilerplugins_clang.mk +++ b/solenv/CompilerTest_compilerplugins_clang.mk @@ -93,6 +93,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \ compilerplugins/clang/test/typedefparam \ compilerplugins/clang/test/typeidcomparison \ compilerplugins/clang/test/unnecessarycatchthrow \ + compilerplugins/clang/test/unnecessarygetstr \ compilerplugins/clang/test/unnecessaryoverride \ compilerplugins/clang/test/unnecessaryoverride-dtor \ compilerplugins/clang/test/unnecessaryparen \ diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 0cc5a385d149..e52e7eaa7cc1 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -2391,11 +2391,11 @@ void SmViewShell::SendCaretToLOK() const if (const auto& payload = getLOKPayload(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, nViewId)) { libreOfficeKitViewCallbackWithViewId(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, - payload->getStr(), nViewId); + *payload, nViewId); } if (const auto& payload = getLOKPayload(LOK_CALLBACK_TEXT_SELECTION, nViewId)) { - libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, payload->getStr()); + libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, *payload); } } diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index 1b6d3078da9f..708992e5a397 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -1022,7 +1022,7 @@ void SdrEditView::MergeAttrFromMarked(SfxItemSet& rAttr, bool bOnlyHardAttr) con if (!sPayload.isEmpty()) GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, - OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr()); + OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US)); } nWhich = aIter.NextWhich(); diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 873b09400416..00193bebfe44 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1149,7 +1149,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S { // We have a new selection, so both pViewShell and the // other views want to know about it. - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, sSelectionText.getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, sSelectionText); SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", sSelectionTextView); } diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 84b6bd93f674..049e5513febf 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -2380,8 +2380,8 @@ void SvxTableController::updateSelectionOverlay() if(SfxViewShell* pViewShell = SfxViewShell::Current()) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, aSelection.toString().getStr()); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aSelection.toString().getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, aSelection.toString()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aSelection.toString()); } } diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index 3dfd11265c2c..62cb65e2ccd3 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -169,8 +169,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf122878) for (sal_Int32 i = 1; i <= nFirstPageParaCount; ++i) { const OString xPath = "/root/page[1]/body/txt[" + OString::number(i) + "]/infos/bounds"; - const sal_Int32 nTxtBottom = getXPath(pXmlDoc, xPath.getStr(), "top").toInt32() - + getXPath(pXmlDoc, xPath.getStr(), "height").toInt32(); + const sal_Int32 nTxtBottom = getXPath(pXmlDoc, xPath, "top").toInt32() + + getXPath(pXmlDoc, xPath, "height").toInt32(); // No body paragraphs should overlap the table in the footer CPPUNIT_ASSERT_MESSAGE(OString("testing paragraph #" + OString::number(i)).getStr(), nTxtBottom <= nTblTop); diff --git a/sw/source/core/crsr/bookmark.cxx b/sw/source/core/crsr/bookmark.cxx index 8e29c521890d..7e792f805b8e 100644 --- a/sw/source/core/crsr/bookmark.cxx +++ b/sw/source/core/crsr/bookmark.cxx @@ -1024,13 +1024,13 @@ namespace sw::mark // Placeholder text sPayload.append("\"placeholderText\": \"" + OUStringToOString(SwResId(STR_DROP_DOWN_EMPTY_LIST), RTL_TEXTENCODING_UTF8) + "\"}}"); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_FORM_FIELD_BUTTON, sPayload.toString().getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_FORM_FIELD_BUTTON, sPayload.toString()); } void DropDownFieldmark::SendLOKHideMessage(const SfxViewShell* pViewShell) { - OString sPayload = "{\"action\": \"hide\", \"type\": \"drop-down\"}"; - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_FORM_FIELD_BUTTON, sPayload.getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_FORM_FIELD_BUTTON, + "{\"action\": \"hide\", \"type\": \"drop-down\"}"); } DateFieldmark::DateFieldmark(const SwPaM& rPaM) diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 95fc98b0e99a..e901616214e0 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -2446,7 +2446,7 @@ void SwCursorShell::ShowCursor() if (comphelper::LibreOfficeKit::isActive()) { const OString aPayload = OString::boolean(m_bSVCursorVis); - GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, aPayload.getStr()); + GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, aPayload); SfxLokHelper::notifyOtherViews(GetSfxViewShell(), LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible", aPayload); } @@ -2468,7 +2468,7 @@ void SwCursorShell::HideCursor() if (comphelper::LibreOfficeKit::isActive()) { OString aPayload = OString::boolean(m_bSVCursorVis); - GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, aPayload.getStr()); + GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, aPayload); SfxLokHelper::notifyOtherViews(GetSfxViewShell(), LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible", aPayload); } } diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 910ea2cc13aa..da9c043c6581 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -228,7 +228,7 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * pViewShell) { m_nPageLastTime = nPage; OString aPayload = OString::number(nPage - 1); - m_pCursorShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + m_pCursorShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload); } // This may get called often, so instead of sending data on each update, just notify @@ -986,7 +986,7 @@ void SwShellCursor::Show(SfxViewShell const * pViewShell) } else { - GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); + GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRect); SfxLokHelper::notifyOtherViews(GetShell()->GetSfxViewShell(), LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", sRect); } } diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 8ba792eb5a2f..43d7e43e8ae7 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -1082,7 +1082,7 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs ) sOut.append(OOO_STRING_SVTOOLS_HTML_doctype " " OOO_STRING_SVTOOLS_XHTML_doctype11); else sOut.append(OOO_STRING_SVTOOLS_HTML_doctype " " OOO_STRING_SVTOOLS_HTML_doctype5); - HTMLOutFuncs::Out_AsciiTag( Strm(), sOut.makeStringAndClear().getStr() ); // No GetNamespace() here. + HTMLOutFuncs::Out_AsciiTag( Strm(), sOut.makeStringAndClear() ); // No GetNamespace() here. // build prelude OutNewLine(); diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index 5b7e7bcd9137..086002ce712e 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -997,7 +997,7 @@ void SwModule::ConfigurationChanged( utl::ConfigurationBroadcaster* pBrdCst, Con if (bOnlyInvalidateCurrentView) { pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR, - aViewColors.m_aAppBackgroundColor.AsRGBHexString().toUtf8().getStr()); + aViewColors.m_aAppBackgroundColor.AsRGBHexString().toUtf8()); } } } diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index f57a68383360..d85c132c15bc 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -1521,7 +1521,7 @@ void SwTableShell::GetState(SfxItemSet &rSet) OUString sPayload = ".uno:TableRowHeight=" + sHeight; GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, - OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr()); + OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US)); } } break; @@ -1545,7 +1545,7 @@ void SwTableShell::GetState(SfxItemSet &rSet) OUString sPayload = ".uno:TableColumWidth=" + sWidth; GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, - OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr()); + OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US)); } break; diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 48f38beb99f7..a67f49cba35f 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -1017,10 +1017,9 @@ void SwView::Execute(SfxRequest &rReq) { if (comphelper::LibreOfficeKit::isActive()) { - OString aPayload(".uno:CurrentTrackedChangeId="); sal_uInt32 nRedlineId = pNext->GetId(); - aPayload += OString::number(nRedlineId); - libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload.getStr()); + OString aPayload(".uno:CurrentTrackedChangeId=" + OString::number(nRedlineId)); + libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload); } m_pWrtShell->SetInSelect(); @@ -1037,10 +1036,9 @@ void SwView::Execute(SfxRequest &rReq) { if (comphelper::LibreOfficeKit::isActive()) { - OString aPayload(".uno:CurrentTrackedChangeId="); sal_uInt32 nRedlineId = pPrev->GetId(); - aPayload += OString::number(nRedlineId); - libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload.getStr()); + OString aPayload(".uno:CurrentTrackedChangeId=" + OString::number(nRedlineId)); + libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload); } m_pWrtShell->SetInSelect(); diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx index cec4fb8b695f..55b5217e132e 100644 --- a/sw/source/uibase/uiview/viewsrch.cxx +++ b/sw/source/uibase/uiview/viewsrch.cxx @@ -120,7 +120,7 @@ static void lcl_emitSearchResultCallbacks(SvxSearchItem const * pSearchItem, SwW boost::property_tree::write_json(aStream, aTree); OString aPayload = aStream.str().c_str(); - pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); + pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload); if(bHighlightAll) { // FindAll disables this during find, do it once when done. @@ -264,7 +264,7 @@ void SwView::ExecSearch(SfxRequest& rReq) #if HAVE_FEATURE_DESKTOP if( !bQuiet ) { - m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, s_pSrchItem->GetSearchString().toUtf8().getStr()); + m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, s_pSrchItem->GetSearchString().toUtf8()); SvxSearchDialogWrapper::SetSearchLabel(SearchLabel::NotFound); } #endif @@ -373,7 +373,7 @@ void SwView::ExecSearch(SfxRequest& rReq) #if HAVE_FEATURE_DESKTOP if( !bQuiet ) { - m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, s_pSrchItem->GetSearchString().toUtf8().getStr()); + m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, s_pSrchItem->GetSearchString().toUtf8()); SvxSearchDialogWrapper::SetSearchLabel(SearchLabel::NotFound); } #endif @@ -542,7 +542,7 @@ bool SwView::SearchAndWrap(bool bApi) if( !bApi ) { #if HAVE_FEATURE_DESKTOP - m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, s_pSrchItem->GetSearchString().toUtf8().getStr()); + m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, s_pSrchItem->GetSearchString().toUtf8()); SvxSearchDialogWrapper::SetSearchLabel(SearchLabel::NotFound); #endif } @@ -597,7 +597,7 @@ bool SwView::SearchAndWrap(bool bApi) } else if(!bApi) { - m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, s_pSrchItem->GetSearchString().toUtf8().getStr()); + m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, s_pSrchItem->GetSearchString().toUtf8()); SvxSearchDialogWrapper::SetSearchLabel(SearchLabel::NotFound); } #endif diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx index 90c30345d649..2bd753569ab0 100644 --- a/sw/source/uibase/uiview/viewstat.cxx +++ b/sw/source/uibase/uiview/viewstat.cxx @@ -237,7 +237,7 @@ void SwView::GetState(SfxItemSet &rSet) { aPayload += "IsPortrait"; } - libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload.getStr()); + libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload); } } break; @@ -444,7 +444,7 @@ void SwView::GetState(SfxItemSet &rSet) SwRedlineTable::size_type nRedline = 0; if (pDoc->getIDocumentRedlineAccess().GetRedline(*pCursor->Start(), &nRedline)) aPayload += OString::number(nRedline); - libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload.getStr()); + libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload); } } break; diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index 3249b39e86eb..5136659b708d 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -572,7 +572,7 @@ void LoadURL( SwViewShell& rVSh, const OUString& rURL, LoadUrlFlags nFilter, // unless we are jumping to a TOC mark. if (comphelper::LibreOfficeKit::isActive() && !rURL.startsWith("#")) { - rVSh.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, rURL.toUtf8().getStr()); + rVSh.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, rURL.toUtf8()); return; } diff --git a/test/source/helper/transferable.cxx b/test/source/helper/transferable.cxx index 201b3c50e442..81b869be3c86 100644 --- a/test/source/helper/transferable.cxx +++ b/test/source/helper/transferable.cxx @@ -34,7 +34,7 @@ OString OOO_DLLPUBLIC_TEST getTextSelection( } datatransfer::DataFlavor aFlavor; - aFlavor.MimeType = OUString::fromUtf8(mimeType.getStr()); + aFlavor.MimeType = OUString::fromUtf8(mimeType); if (mimeType == "text/plain;charset=utf-16") aFlavor.DataType = cppu::UnoType<OUString>::get(); else diff --git a/test/source/lokcallback.cxx b/test/source/lokcallback.cxx index c426d4fd17fd..767448c771ca 100644 --- a/test/source/lokcallback.cxx +++ b/test/source/lokcallback.cxx @@ -160,7 +160,7 @@ void TestLokCallbackWrapper::flushLOKData() { std::optional<OString> payload = viewShell->getLOKPayload(type, m_viewId); if (payload) - libreOfficeKitViewCallback(type, payload->getStr()); + libreOfficeKitViewCallback(type, *payload); } for (const PerViewIdData& data : updatedTypesPerViewId) { @@ -170,7 +170,7 @@ void TestLokCallbackWrapper::flushLOKData() assert(viewShell != nullptr); std::optional<OString> payload = viewShell->getLOKPayload(data.type, data.viewId); if (payload) - libreOfficeKitViewCallbackWithViewId(data.type, payload->getStr(), data.viewId); + libreOfficeKitViewCallbackWithViewId(data.type, *payload, data.viewId); } } diff --git a/tools/source/xml/XmlWriter.cxx b/tools/source/xml/XmlWriter.cxx index 726b63966045..85fbbf99544e 100644 --- a/tools/source/xml/XmlWriter.cxx +++ b/tools/source/xml/XmlWriter.cxx @@ -134,7 +134,7 @@ void XmlWriter::attribute(const OString& name, const OString& value) void XmlWriter::attribute(const OString& name, std::u16string_view value) { - attribute(name, OUStringToOString(value, RTL_TEXTENCODING_UTF8).getStr()); + attribute(name, OUStringToOString(value, RTL_TEXTENCODING_UTF8)); } void XmlWriter::attribute(const OString& name, const sal_Int32 aNumber) diff --git a/ucb/source/ucp/ftp/ftpurl.cxx b/ucb/source/ucp/ftp/ftpurl.cxx index e36341ae18ac..67ac4e6564bd 100644 --- a/ucb/source/ucp/ftp/ftpurl.cxx +++ b/ucb/source/ucp/ftp/ftpurl.cxx @@ -713,13 +713,11 @@ OUString FTPURL::ren(const OUString& NewTitle) // post request OUString OldTitle = net_title(); OString renamefrom = "RNFR " + - OString(OldTitle.getStr(), - OldTitle.getLength(), + OUStringToOString(OldTitle, RTL_TEXTENCODING_UTF8); OString renameto = "RNTO " + - OString(NewTitle.getStr(), - NewTitle.getLength(), + OUStringToOString(NewTitle, RTL_TEXTENCODING_UTF8); struct curl_slist *slist = nullptr; diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index a55242ffae58..9b185b2701e5 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -194,7 +194,7 @@ JSDialogNotifyIdle::generateActionMessage(VclPtr<vcl::Window> pWindow, aJsonWriter->put("control_id", pWindow->get_id()); for (auto it = pData->begin(); it != pData->end(); it++) - aJsonWriter->put(it->first.getStr(), it->second); + aJsonWriter->put(it->first, it->second); } return aJsonWriter; diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 57aa6c49d829..d0eca8ab0acf 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -901,7 +901,7 @@ void Edit::ImplSetText( const OUString& rText, const Selection* pNewSelection ) { // we delete text by "selecting" the old text completely then calling InsertText; this is flicker free if ( ( rText.getLength() > mnMaxTextLen ) || - ( std::u16string_view(rText) == std::u16string_view(maText.getStr(), maText.getLength()) + ( std::u16string_view(rText) == std::u16string_view(maText) && (!pNewSelection || (*pNewSelection == maSelection)) ) ) return; @@ -2006,8 +2006,7 @@ void Edit::Command( const CommandEvent& rCEvt ) pPopup->EnableItem(pPopup->GetItemId(u"specialchar"), bEnableSpecialChar); pPopup->EnableItem( pPopup->GetItemId(u"undo"), - std::u16string_view(maUndoText) - != std::u16string_view(maText.getStr(), maText.getLength())); + std::u16string_view(maUndoText) != std::u16string_view(maText)); bool bAllSelected = maSelection.Min() == 0 && maSelection.Max() == maText.getLength(); pPopup->EnableItem(pPopup->GetItemId(u"selectall"), !bAllSelected); pPopup->ShowItem(pPopup->GetItemId(u"specialchar"), pImplFncGetSpecialChars != nullptr); diff --git a/vcl/source/window/DocWindow.cxx b/vcl/source/window/DocWindow.cxx index 6123246c5e48..971252553b9a 100644 --- a/vcl/source/window/DocWindow.cxx +++ b/vcl/source/window/DocWindow.cxx @@ -32,8 +32,7 @@ void DocWindow::SetPointer(PointerStyle nPointer) aPointerString = aIt->second; } - pWin->GetLOKNotifier()->libreOfficeKitViewCallback(LOK_CALLBACK_MOUSE_POINTER, - aPointerString.getStr()); + pWin->GetLOKNotifier()->libreOfficeKitViewCallback(LOK_CALLBACK_MOUSE_POINTER, aPointerString); } } // namespace vcl diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx index 6f92fae77db8..8859970980b9 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx @@ -737,14 +737,12 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam, parString[last++] = "System"; parString[last++] = "'" + urlParam->getByName( "System" ) + "'"; parString[last++] = "productname"; - parString[last++] = "'" + OString( - pDatabases->getProductName().getStr(), - pDatabases->getProductName().getLength(), + parString[last++] = "'" + OUStringToOString( + pDatabases->getProductName(), RTL_TEXTENCODING_UTF8 ) + "'"; parString[last++] = "productversion"; parString[last++] = "'" + - OString( pDatabases->getProductVersion().getStr(), - pDatabases->getProductVersion().getLength(), + OUStringToOString( pDatabases->getProductVersion(), RTL_TEXTENCODING_UTF8 ) + "'"; parString[last++] = "imgtheme"; @@ -829,9 +827,8 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam, OUString xslURL = pDatabases->getInstallPathAsURL(); - OString xslURLascii = OString( - xslURL.getStr(), - xslURL.getLength(), + OString xslURLascii = OUStringToOString( + xslURL, RTL_TEXTENCODING_UTF8) + "main_transform.xsl"; |