summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-04-07 10:02:18 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-04-09 20:51:44 +0200
commiteaf071397a1ff30536616f2ed76051f77fd38ed6 (patch)
treece55cdc75a0826c54b6b60458a028251f11fcb78 /sc
parent1e79befa61a08de7a1ddaccb6c435dbb8015c063 (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>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/documen3.cxx4
-rw-r--r--sc/source/core/tool/prnsave.cxx2
-rw-r--r--sc/source/filter/html/htmlexp.cxx16
-rw-r--r--sc/source/filter/orcus/xmlcontext.cxx6
-rw-r--r--sc/source/ui/app/inputhdl.cxx10
-rw-r--r--sc/source/ui/unoobj/docuno.cxx2
-rw-r--r--sc/source/ui/view/cellsh3.cxx2
-rw-r--r--sc/source/ui/view/formatsh.cxx2
-rw-r--r--sc/source/ui/view/gridwin.cxx22
-rw-r--r--sc/source/ui/view/tabcont.cxx2
-rw-r--r--sc/source/ui/view/tabvwshc.cxx4
-rw-r--r--sc/source/ui/view/viewfun2.cxx4
12 files changed, 38 insertions, 38 deletions
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();