summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-02-22 12:59:26 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-03-08 07:06:13 +0100
commit7840effb1d5efd1fd7f6798c7c504b05292a7793 (patch)
tree845e03d4c2cfad1d5bbcaaf9dc3ec1aeece7c864 /sc/source
parentbf35f2b36fc00f9b37397422b2ee425c6a697540 (diff)
use more string_view
found by tweaking the stringview loplugin Change-Id: I92203ba99642bef7951ffa146184c5562cb31d09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163744 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/filter/html/htmlexp.cxx7
-rw-r--r--sc/source/ui/dbgui/csvgrid.cxx6
-rw-r--r--sc/source/ui/docshell/impex.cxx12
-rw-r--r--sc/source/ui/inc/csvgrid.hxx2
-rw-r--r--sc/source/ui/inc/impex.hxx4
5 files changed, 16 insertions, 15 deletions
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index 4413d668b428..6b55d066f727 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -50,6 +50,7 @@
#include <stdio.h>
#include <osl/diagnose.h>
#include <o3tl/unit_conversion.hxx>
+#include <o3tl/string_view.hxx>
#include <htmlexp.hxx>
#include <global.hxx>
@@ -378,7 +379,7 @@ void ScHTMLExport::WriteHeader()
for(sal_Int32 nPos {0};;)
{
rStrm.WriteChar( '\"' );
- OUT_STR( rList.getToken( 0, ';', nPos ) );
+ OUT_STR( o3tl::getToken( rList, 0, ';', nPos ) );
rStrm.WriteChar( '\"' );
if (nPos<0)
break;
@@ -896,7 +897,7 @@ void ScHTMLExport::WriteTables()
}
if ( bAll )
- OUT_COMMENT( "**************************************************************************" );
+ OUT_COMMENT( u"**************************************************************************" );
}
}
@@ -1250,7 +1251,7 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC
for (sal_Int32 nPos {0};;)
{
OString aTmpStr = HTMLOutFuncs::ConvertStringToHTML(
- rList.getToken( 0, ';', nPos ),
+ o3tl::getToken( rList, 0, ';', nPos ),
&aNonConvertibleChars);
aStr.append(aTmpStr);
if (nPos<0)
diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx
index f81e510fdae7..869dde5ca95b 100644
--- a/sc/source/ui/dbgui/csvgrid.cxx
+++ b/sc/source/ui/dbgui/csvgrid.cxx
@@ -833,7 +833,7 @@ void ScCsvGrid::ImplSetTextLineSep(
InvalidateGfx();
}
-void ScCsvGrid::ImplSetTextLineFix( sal_Int32 nLine, const OUString& rTextLine )
+void ScCsvGrid::ImplSetTextLineFix( sal_Int32 nLine, std::u16string_view rTextLine )
{
if( nLine < GetFirstVisLine() ) return;
@@ -848,7 +848,7 @@ void ScCsvGrid::ImplSetTextLineFix( sal_Int32 nLine, const OUString& rTextLine )
std::vector<OUString>& rStrVec = maTexts[ nLineIx ];
rStrVec.clear();
sal_uInt32 nColCount = GetColumnCount();
- sal_Int32 nStrLen = rTextLine.getLength();
+ sal_Int32 nStrLen = rTextLine.size();
sal_Int32 nStrIx = 0;
for( sal_uInt32 nColIx = 0; (nColIx < nColCount) && (nStrIx < nStrLen); ++nColIx )
{
@@ -856,7 +856,7 @@ void ScCsvGrid::ImplSetTextLineFix( sal_Int32 nLine, const OUString& rTextLine )
sal_Int32 nLastIx = nStrIx;
ScImportExport::CountVisualWidth( rTextLine, nLastIx, nColWidth );
sal_Int32 nLen = std::min( CSV_MAXSTRLEN, nLastIx - nStrIx );
- rStrVec.push_back( rTextLine.copy( nStrIx, nLen ) );
+ rStrVec.push_back( OUString(rTextLine.substr( nStrIx, nLen )) );
nStrIx = nStrIx + nLen;
}
InvalidateGfx();
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 2f587c58c533..6606f3479dcb 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -495,12 +495,12 @@ bool ScImportExport::ExportStream( SvStream& rStrm, const OUString& rBaseURL, So
// tdf#104927
// http://www.unicode.org/reports/tr11/
-sal_Int32 ScImportExport::CountVisualWidth(const OUString& rStr, sal_Int32& nIdx, sal_Int32 nMaxWidth)
+sal_Int32 ScImportExport::CountVisualWidth(std::u16string_view rStr, sal_Int32& nIdx, sal_Int32 nMaxWidth)
{
sal_Int32 nWidth = 0;
- while(nIdx < rStr.getLength() && nWidth < nMaxWidth)
+ while(nIdx < static_cast<sal_Int32>(rStr.size()) && nWidth < nMaxWidth)
{
- sal_uInt32 nCode = rStr.iterateCodePoints(&nIdx);
+ sal_uInt32 nCode = o3tl::iterateCodePoints(rStr, &nIdx);
auto nEaWidth = u_getIntPropertyValue(nCode, UCHAR_EAST_ASIAN_WIDTH);
if (nEaWidth == U_EA_FULLWIDTH || nEaWidth == U_EA_WIDE)
@@ -509,10 +509,10 @@ sal_Int32 ScImportExport::CountVisualWidth(const OUString& rStr, sal_Int32& nIdx
nWidth += 1;
}
- if (nIdx < rStr.getLength())
+ if (nIdx < static_cast<sal_Int32>(rStr.size()))
{
sal_Int32 nTmpIdx = nIdx;
- sal_uInt32 nCode = rStr.iterateCodePoints(&nTmpIdx);
+ sal_uInt32 nCode = o3tl::iterateCodePoints(rStr, &nTmpIdx);
if (u_getIntPropertyValue(nCode, UCHAR_DEFAULT_IGNORABLE_CODE_POINT))
nIdx = nTmpIdx;
@@ -520,7 +520,7 @@ sal_Int32 ScImportExport::CountVisualWidth(const OUString& rStr, sal_Int32& nIdx
return nWidth;
}
-sal_Int32 ScImportExport::CountVisualWidth(const OUString& rStr)
+sal_Int32 ScImportExport::CountVisualWidth(std::u16string_view rStr)
{
sal_Int32 nIdx = 0;
return CountVisualWidth(rStr, nIdx, SAL_MAX_INT32);
diff --git a/sc/source/ui/inc/csvgrid.hxx b/sc/source/ui/inc/csvgrid.hxx
index c83df6c8b64e..683070b04eb7 100644
--- a/sc/source/ui/inc/csvgrid.hxx
+++ b/sc/source/ui/inc/csvgrid.hxx
@@ -237,7 +237,7 @@ public:
sal_Int32 nLine, const OUString& rTextLine,
const OUString& rSepChars, sal_Unicode cTextSep, bool bMergeSep, bool bRemoveSpace = false );
/** Fills all cells of a line with the passed text (fixed width mode). */
- void ImplSetTextLineFix( sal_Int32 nLine, const OUString& rTextLine );
+ void ImplSetTextLineFix( sal_Int32 nLine, std::u16string_view rTextLine );
/** Returns the text of the specified cell. */
OUString GetCellText( sal_uInt32 nColIndex, sal_Int32 nLine ) const;
diff --git a/sc/source/ui/inc/impex.hxx b/sc/source/ui/inc/impex.hxx
index 200997d206d6..827fd7f73fc6 100644
--- a/sc/source/ui/inc/impex.hxx
+++ b/sc/source/ui/inc/impex.hxx
@@ -118,12 +118,12 @@ public:
@param nMaxWidth the maximum width to count.
@return the sum of the width of counted characters.
**/
- static sal_Int32 CountVisualWidth(const OUString& rStr, sal_Int32& nIdx, sal_Int32 nMaxWidth);
+ static sal_Int32 CountVisualWidth(std::u16string_view rStr, sal_Int32& nIdx, sal_Int32 nMaxWidth);
/** ScImportExport::CountVisualWidth
@return the sum of the visual width of the whole string.
**/
- static sal_Int32 CountVisualWidth(const OUString& rStr);
+ static sal_Int32 CountVisualWidth(std::u16string_view rStr);
//! only if stream is only used in own (!) memory
static void SetNoEndianSwap( SvStream& rStrm );