summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/address.hxx2
-rw-r--r--sc/inc/docuno.hxx2
-rw-r--r--sc/inc/global.hxx2
-rw-r--r--sc/inc/rangeutl.hxx20
-rw-r--r--sc/inc/scmod.hxx2
-rw-r--r--sc/inc/validat.hxx2
-rw-r--r--sc/qa/unit/uicalc/uicalc.cxx84
-rw-r--r--sc/source/core/data/dpobject.cxx26
-rw-r--r--sc/source/core/data/dptabres.cxx4
-rw-r--r--sc/source/core/data/global.cxx4
-rw-r--r--sc/source/core/data/validat.cxx4
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx8
-rw-r--r--sc/source/core/tool/address.cxx4
-rw-r--r--sc/source/core/tool/compiler.cxx10
-rw-r--r--sc/source/core/tool/interpr1.cxx6
-rw-r--r--sc/source/core/tool/rangeutl.cxx30
-rw-r--r--sc/source/filter/excel/excel.cxx6
-rw-r--r--sc/source/filter/excel/xepivot.cxx4
-rw-r--r--sc/source/filter/excel/xeroot.cxx6
-rw-r--r--sc/source/filter/excel/xihelper.cxx10
-rw-r--r--sc/source/filter/inc/addressconverter.hxx12
-rw-r--r--sc/source/filter/inc/drawingfragment.hxx2
-rw-r--r--sc/source/filter/inc/formulaparser.hxx4
-rw-r--r--sc/source/filter/inc/numberformatsbuffer.hxx4
-rw-r--r--sc/source/filter/inc/richstring.hxx4
-rw-r--r--sc/source/filter/inc/stylesbuffer.hxx2
-rw-r--r--sc/source/filter/inc/xeroot.hxx2
-rw-r--r--sc/source/filter/inc/xihelper.hxx2
-rw-r--r--sc/source/filter/oox/addressconverter.cxx45
-rw-r--r--sc/source/filter/oox/defnamesbuffer.cxx7
-rw-r--r--sc/source/filter/oox/drawingfragment.cxx24
-rw-r--r--sc/source/filter/oox/formulaparser.cxx20
-rw-r--r--sc/source/filter/oox/numberformatsbuffer.cxx35
-rw-r--r--sc/source/filter/oox/pagesettings.cxx18
-rw-r--r--sc/source/filter/oox/richstring.cxx16
-rw-r--r--sc/source/filter/oox/stylesbuffer.cxx4
-rw-r--r--sc/source/filter/oox/worksheetfragment.cxx6
-rw-r--r--sc/source/filter/xml/XMLStylesExportHelper.cxx8
-rw-r--r--sc/source/filter/xml/XMLStylesExportHelper.hxx4
-rw-r--r--sc/source/filter/xml/XMLTableShapeResizer.cxx4
-rw-r--r--sc/source/filter/xml/XMLTableShapeResizer.hxx2
-rw-r--r--sc/source/filter/xml/celltextparacontext.cxx6
-rw-r--r--sc/source/filter/xml/celltextparacontext.hxx2
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx4
-rw-r--r--sc/source/filter/xml/xmlcelli.hxx2
-rw-r--r--sc/source/filter/xml/xmlimprt.cxx14
-rw-r--r--sc/source/filter/xml/xmlimprt.hxx4
-rw-r--r--sc/source/filter/xml/xmlsorti.cxx8
-rw-r--r--sc/source/filter/xml/xmlsorti.hxx2
-rw-r--r--sc/source/ui/app/inputhdl.cxx18
-rw-r--r--sc/source/ui/app/scmod.cxx4
-rw-r--r--sc/source/ui/inc/inputhdl.hxx2
-rw-r--r--sc/source/ui/inc/tpformula.hxx2
-rw-r--r--sc/source/ui/optdlg/tpformula.cxx6
-rw-r--r--sc/source/ui/pagedlg/areasdlg.cxx19
-rw-r--r--sc/source/ui/uitest/uiobject.cxx8
-rw-r--r--sc/source/ui/unoobj/docuno.cxx2
57 files changed, 286 insertions, 278 deletions
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index c3171c8f8a84..85a581f5c765 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -973,6 +973,6 @@ inline OUString ScColToAlpha( SCCOL nCol )
}
/// get column number of A..IV... string
-bool AlphaToCol(const ScDocument& rDoc, SCCOL& rCol, const OUString& rStr);
+bool AlphaToCol(const ScDocument& rDoc, SCCOL& rCol, std::u16string_view rStr);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 420975ace5d7..cb1fd2049bb5 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -519,7 +519,7 @@ private:
SCCOL nEndCol;
rtl::Reference<ScTableColumnObj> GetObjectByIndex_Impl(sal_Int32 nIndex) const;
- rtl::Reference<ScTableColumnObj> GetObjectByName_Impl(const OUString& aName) const;
+ rtl::Reference<ScTableColumnObj> GetObjectByName_Impl(std::u16string_view aName) const;
public:
ScTableColumnsObj(ScDocShell* pDocSh, SCTAB nT,
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 3be19f89dcc1..1e42e6060d0e 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -642,7 +642,7 @@ public:
bool bForceSep = false );
/** Returns true, if the first and last character of the string is cQuote. */
- SC_DLLPUBLIC static bool IsQuoted( const OUString& rString, sal_Unicode cQuote );
+ SC_DLLPUBLIC static bool IsQuoted( std::u16string_view rString, sal_Unicode cQuote );
/** Inserts the character cQuote at beginning and end of rString.
@param bEscapeEmbedded If <TRUE/>, embedded quote characters are
diff --git a/sc/inc/rangeutl.hxx b/sc/inc/rangeutl.hxx
index 4524226e43ca..852c82b11bb4 100644
--- a/sc/inc/rangeutl.hxx
+++ b/sc/inc/rangeutl.hxx
@@ -98,23 +98,23 @@ public:
sal_Unicode cSeparator = ' ');
static sal_Int32 IndexOf(
- const OUString& rString,
+ std::u16string_view rString,
sal_Unicode cSearchChar,
sal_Int32 nOffset,
sal_Unicode cQuote = '\'');
static sal_Int32 IndexOfDifferent(
- const OUString& rString,
+ std::u16string_view rString,
sal_Unicode cSearchChar,
sal_Int32 nOffset );
static sal_Int32 GetTokenCount(
- const OUString& rString,
+ std::u16string_view rString,
sal_Unicode cSeparator = ' ');
static void GetTokenByOffset(
OUString& rToken,
- const OUString& rString,
+ std::u16string_view rString,
sal_Int32& nOffset,
sal_Unicode cSeparator = ' ',
sal_Unicode cQuote = '\'');
@@ -126,7 +126,7 @@ public:
/// String to Range core
static bool GetAddressFromString(
ScAddress& rAddress,
- const OUString& rAddressStr,
+ std::u16string_view rAddressStr,
const ScDocument& rDocument,
formula::FormulaGrammar::AddressConvention eConv,
sal_Int32& nOffset,
@@ -134,7 +134,7 @@ public:
sal_Unicode cQuote = '\'');
static bool GetRangeFromString(
ScRange& rRange,
- const OUString& rRangeStr,
+ std::u16string_view rRangeStr,
const ScDocument& rDocument,
formula::FormulaGrammar::AddressConvention eConv,
sal_Int32& nOffset,
@@ -142,7 +142,7 @@ public:
sal_Unicode cQuote = '\'');
static bool GetRangeListFromString(
ScRangeList& rRangeList,
- const OUString& rRangeListStr,
+ std::u16string_view rRangeListStr,
const ScDocument& rDocument,
formula::FormulaGrammar::AddressConvention eConv,
sal_Unicode cSeparator = ' ',
@@ -150,7 +150,7 @@ public:
static bool GetAreaFromString(
ScArea& rArea,
- const OUString& rRangeStr,
+ std::u16string_view rRangeStr,
const ScDocument& rDocument,
formula::FormulaGrammar::AddressConvention eConv,
sal_Int32& nOffset,
@@ -159,7 +159,7 @@ public:
/// String to Range API
static bool GetRangeFromString(
css::table::CellRangeAddress& rRange,
- const OUString& rRangeStr,
+ std::u16string_view rRangeStr,
const ScDocument& rDocument,
formula::FormulaGrammar::AddressConvention eConv,
sal_Int32& nOffset,
@@ -224,7 +224,7 @@ public:
/// XML Range to Calc Range
static void GetStringFromXMLRangeString(
OUString& rString,
- const OUString& rXMLRange,
+ std::u16string_view rXMLRange,
const ScDocument& rDoc );
/// String to RangeData core
diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index 919f4c22056d..cd82dd485246 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -210,7 +210,7 @@ public:
// communication with function-autopilot
void InputGetSelection( sal_Int32& rStart, sal_Int32& rEnd );
void InputSetSelection( sal_Int32 nStart, sal_Int32 nEnd );
- void InputReplaceSelection( const OUString& rStr );
+ void InputReplaceSelection( std::u16string_view aStr );
void InputTurnOffWinEngine();
void ActivateInputWindow( const OUString* pStr = nullptr,
bool bMatrix = false );
diff --git a/sc/inc/validat.hxx b/sc/inc/validat.hxx
index b0709dc0da14..79eb9b75a334 100644
--- a/sc/inc/validat.hxx
+++ b/sc/inc/validat.hxx
@@ -190,7 +190,7 @@ private:
properly initialized ScValidationDataIsNumeric struct, see
implementation.
*/
- bool IsDataValidTextLen( const OUString& rTest, const ScAddress& rPos,
+ bool IsDataValidTextLen( std::u16string_view rTest, const ScAddress& rPos,
ScValidationDataIsNumeric* pDataNumeric ) const;
};
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 9fe6a43a408c..4ab84cc3c467 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -79,16 +79,18 @@ void ScUiCalcTest::tearDown()
test::BootstrapFixture::tearDown();
}
-static void lcl_AssertCurrentCursorPosition(const ScDocument& rDoc, const OUString& rStr)
+static void lcl_AssertCurrentCursorPosition(const ScDocument& rDoc, std::u16string_view rStr)
{
ScAddress aAddr;
sal_Int32 nOffset = 0;
ScRangeStringConverter::GetAddressFromString(aAddr, rStr, rDoc,
formula::FormulaGrammar::CONV_OOO, nOffset);
- CPPUNIT_ASSERT_EQUAL_MESSAGE(OUString("Incorrect Column in position " + rStr).toUtf8().getStr(),
- aAddr.Col(), ScDocShell::GetViewData()->GetCurX());
- CPPUNIT_ASSERT_EQUAL_MESSAGE(OUString("Incorrect Row in position " + rStr).toUtf8().getStr(),
- aAddr.Row(), ScDocShell::GetViewData()->GetCurY());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ OUString(OUString::Concat("Incorrect Column in position ") + rStr).toUtf8().getStr(),
+ aAddr.Col(), ScDocShell::GetViewData()->GetCurX());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ OUString(OUString::Concat("Incorrect Row in position ") + rStr).toUtf8().getStr(),
+ aAddr.Row(), ScDocShell::GetViewData()->GetCurY());
}
static void lcl_SelectObjectByName(std::u16string_view rObjName)
@@ -1215,7 +1217,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf140151)
Scheduler::ProcessEventsToIdle();
// Without the fix in place, the current cursor position wouldn't have changed
- lcl_AssertCurrentCursorPosition(*pDoc, "B111");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"B111");
#endif
}
@@ -1235,7 +1237,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf68290)
Scheduler::ProcessEventsToIdle();
}
- lcl_AssertCurrentCursorPosition(*pDoc, "M3");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"M3");
}
CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf132057)
@@ -1244,13 +1246,13 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf132057)
ScDocument* pDoc = pModelObj->GetDocument();
CPPUNIT_ASSERT(pDoc);
- lcl_AssertCurrentCursorPosition(*pDoc, "AU43");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"AU43");
pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RETURN);
Scheduler::ProcessEventsToIdle();
// Without the fix in place, the cursor would have jumped to cell BM1
- lcl_AssertCurrentCursorPosition(*pDoc, "G39");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"G39");
}
CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf122232)
@@ -1260,17 +1262,17 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf122232)
CPPUNIT_ASSERT(pDoc);
//Start with from C6. Press tabulator to reach G6.
- lcl_AssertCurrentCursorPosition(*pDoc, "C6");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"C6");
pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_TAB);
pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_TAB);
Scheduler::ProcessEventsToIdle();
- lcl_AssertCurrentCursorPosition(*pDoc, "G6");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"G6");
//without the fix, cursor would jump to C29 instead of C7.
pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN);
Scheduler::ProcessEventsToIdle();
- lcl_AssertCurrentCursorPosition(*pDoc, "C7");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"C7");
}
CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf123052)
@@ -1365,7 +1367,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf146994)
CPPUNIT_ASSERT(pDoc);
goToCell("B3");
- lcl_AssertCurrentCursorPosition(*pDoc, "B3");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"B3");
dispatchCommand(mxComponent, ".uno:Copy", {});
@@ -1373,7 +1375,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf146994)
pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RIGHT);
Scheduler::ProcessEventsToIdle();
- lcl_AssertCurrentCursorPosition(*pDoc, "D3");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"D3");
dispatchCommand(mxComponent, ".uno:Paste", {});
@@ -1436,7 +1438,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf117706)
dispatchCommand(mxComponent, ".uno:GoDown", {});
dispatchCommand(mxComponent, ".uno:GoDown", {});
- lcl_AssertCurrentCursorPosition(*pDoc, "A3");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"A3");
dispatchCommand(mxComponent, ".uno:SelectRow", {});
Scheduler::ProcessEventsToIdle();
@@ -1564,7 +1566,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testMultiRangeCol)
dispatchCommand(mxComponent, ".uno:GoRight", {});
dispatchCommand(mxComponent, ".uno:GoRight", {});
- lcl_AssertCurrentCursorPosition(*pDoc, "C1");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"C1");
dispatchCommand(mxComponent, ".uno:SelectColumn", {});
Scheduler::ProcessEventsToIdle();
@@ -1746,7 +1748,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf117458)
ScInputOptions aInputOption = pMod->GetInputOptions();
sal_uInt16 bOldStatus = aInputOption.GetMoveDir();
- lcl_AssertCurrentCursorPosition(*pDoc, "A1");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"A1");
aInputOption.SetMoveDir(DIR_BOTTOM);
pMod->SetInputOptions(aInputOption);
@@ -1754,7 +1756,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf117458)
pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN);
Scheduler::ProcessEventsToIdle();
- lcl_AssertCurrentCursorPosition(*pDoc, "A2");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"A2");
aInputOption.SetMoveDir(DIR_TOP);
pMod->SetInputOptions(aInputOption);
@@ -1762,7 +1764,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf117458)
pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN);
Scheduler::ProcessEventsToIdle();
- lcl_AssertCurrentCursorPosition(*pDoc, "A1");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"A1");
aInputOption.SetMoveDir(DIR_RIGHT);
pMod->SetInputOptions(aInputOption);
@@ -1770,7 +1772,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf117458)
pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN);
Scheduler::ProcessEventsToIdle();
- lcl_AssertCurrentCursorPosition(*pDoc, "B1");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"B1");
aInputOption.SetMoveDir(DIR_LEFT);
pMod->SetInputOptions(aInputOption);
@@ -1778,7 +1780,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf117458)
pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN);
Scheduler::ProcessEventsToIdle();
- lcl_AssertCurrentCursorPosition(*pDoc, "A1");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"A1");
// Restore previous status
aInputOption.SetMoveDir(bOldStatus);
@@ -2064,25 +2066,25 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf131455)
ScDocument* pDoc = pModelObj->GetDocument();
CPPUNIT_ASSERT(pDoc);
- lcl_AssertCurrentCursorPosition(*pDoc, "A5");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"A5");
dispatchCommand(mxComponent, ".uno:GoRight", {});
- lcl_AssertCurrentCursorPosition(*pDoc, "B5");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"B5");
dispatchCommand(mxComponent, ".uno:GoRight", {});
- lcl_AssertCurrentCursorPosition(*pDoc, "E5");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"E5");
dispatchCommand(mxComponent, ".uno:GoRight", {});
- lcl_AssertCurrentCursorPosition(*pDoc, "F5");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"F5");
dispatchCommand(mxComponent, ".uno:GoRight", {});
- lcl_AssertCurrentCursorPosition(*pDoc, "I5");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"I5");
dispatchCommand(mxComponent, ".uno:GoRight", {});
- lcl_AssertCurrentCursorPosition(*pDoc, "J5");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"J5");
dispatchCommand(mxComponent, ".uno:GoRight", {});
- lcl_AssertCurrentCursorPosition(*pDoc, "M5");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"M5");
//Cursor can't move forward to the right
for (size_t i = 0; i < 5; ++i)
{
dispatchCommand(mxComponent, ".uno:GoRight", {});
- lcl_AssertCurrentCursorPosition(*pDoc, "N5");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"N5");
}
CPPUNIT_ASSERT_EQUAL(sal_Int16(0), ScDocShell::GetViewData()->GetTabNo());
@@ -2090,7 +2092,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf131455)
dispatchCommand(mxComponent, ".uno:JumpToNextTable", {});
CPPUNIT_ASSERT_EQUAL(sal_Int16(1), ScDocShell::GetViewData()->GetTabNo());
- lcl_AssertCurrentCursorPosition(*pDoc, "A4");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"A4");
// Go to row 9
for (size_t i = 0; i < 6; ++i)
@@ -2098,7 +2100,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf131455)
dispatchCommand(mxComponent, ".uno:GoDown", {});
}
- lcl_AssertCurrentCursorPosition(*pDoc, "A10");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"A10");
dispatchCommand(mxComponent, ".uno:SelectRow", {});
dispatchCommand(mxComponent, ".uno:DeleteRows", {});
@@ -2106,13 +2108,13 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf131455)
dispatchCommand(mxComponent, ".uno:JumpToPrevTable", {});
CPPUNIT_ASSERT_EQUAL(sal_Int16(0), ScDocShell::GetViewData()->GetTabNo());
- lcl_AssertCurrentCursorPosition(*pDoc, "N5");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"N5");
//Cursor can't move forward to the right
for (size_t i = 0; i < 5; ++i)
{
dispatchCommand(mxComponent, ".uno:GoRight", {});
- lcl_AssertCurrentCursorPosition(*pDoc, "N5");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"N5");
}
}
@@ -2156,7 +2158,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf124816)
// OFFSET() was changed as of tdf#85551 and here result of that test
// document is now Err:502 instead of 0.
const OUString aExpectedResult("Err:502");
- lcl_AssertCurrentCursorPosition(*pDoc, "D10");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"D10");
CPPUNIT_ASSERT_EQUAL(aExpectedResult, pDoc->GetString(ScAddress(3, 9, 0)));
//Without the fix, it would crash
@@ -2172,7 +2174,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf124815)
ScDocument* pDoc = pModelObj->GetDocument();
CPPUNIT_ASSERT(pDoc);
- lcl_AssertCurrentCursorPosition(*pDoc, "A1");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"A1");
CPPUNIT_ASSERT_EQUAL(OUString("Rakennukset"), pDoc->GetString(ScAddress(2, 0, 0)));
//Without the fix, it would crash
@@ -2285,11 +2287,11 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf83901)
ScDocument* pDoc = pModelObj->GetDocument();
CPPUNIT_ASSERT(pDoc);
- lcl_AssertCurrentCursorPosition(*pDoc, "A1");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"A1");
insertStringToCell(*pModelObj, "A2", u"=ROW(A3)");
CPPUNIT_ASSERT_EQUAL(3.0, pDoc->GetValue(ScAddress(0, 1, 0)));
- lcl_AssertCurrentCursorPosition(*pDoc, "A3");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"A3");
dispatchCommand(mxComponent, ".uno:SelectRow", {});
dispatchCommand(mxComponent, ".uno:InsertRowsBefore", {});
@@ -2467,7 +2469,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf138428)
ScDocument* pDoc = pModelObj->GetDocument();
CPPUNIT_ASSERT(pDoc);
- lcl_AssertCurrentCursorPosition(*pDoc, "A1");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"A1");
// Add a new comment
uno::Sequence<beans::PropertyValue> aArgs
@@ -2481,7 +2483,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf138428)
dispatchCommand(mxComponent, ".uno:Copy", {});
dispatchCommand(mxComponent, ".uno:GoRight", {});
- lcl_AssertCurrentCursorPosition(*pDoc, "B1");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"B1");
dispatchCommand(mxComponent, ".uno:Paste", {});
@@ -2949,14 +2951,14 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf107952)
// - Expected: 1
// - Actual : 3
// - Incorrect Column in position B1
- lcl_AssertCurrentCursorPosition(*pDoc, "B1");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"B1");
goToCell("D10");
dispatchCommand(mxComponent, ".uno:Redo", {});
Scheduler::ProcessEventsToIdle();
- lcl_AssertCurrentCursorPosition(*pDoc, "B1");
+ lcl_AssertCurrentCursorPosition(*pDoc, u"B1");
}
CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf150766)
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 571ae37e70d6..66e336a9d6d1 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -1458,7 +1458,7 @@ OUString ScDPObject::GetFormattedString(std::u16string_view rDimName, const doub
namespace {
-bool dequote( const OUString& rSource, sal_Int32 nStartPos, sal_Int32& rEndPos, OUString& rResult )
+bool dequote( std::u16string_view rSource, sal_Int32 nStartPos, sal_Int32& rEndPos, OUString& rResult )
{
// nStartPos has to point to opening quote
@@ -1468,7 +1468,7 @@ bool dequote( const OUString& rSource, sal_Int32 nStartPos, sal_Int32& rEndPos,
{
OUStringBuffer aBuffer;
sal_Int32 nPos = nStartPos + 1;
- const sal_Int32 nLen = rSource.getLength();
+ const sal_Int32 nLen = rSource.size();
while ( nPos < nLen )
{
@@ -1506,7 +1506,7 @@ struct ScGetPivotDataFunctionEntry
sal_Int16 eFunc;
};
-bool parseFunction( const OUString& rList, sal_Int32 nStartPos, sal_Int32& rEndPos, sal_Int16& rFunc )
+bool parseFunction( std::u16string_view rList, sal_Int32 nStartPos, sal_Int32& rEndPos, sal_Int16& rFunc )
{
static const ScGetPivotDataFunctionEntry aFunctions[] =
{
@@ -1528,7 +1528,7 @@ bool parseFunction( const OUString& rList, sal_Int32 nStartPos, sal_Int32& rEndP
{ "StdDevp", sheet::GeneralFunction2::STDEVP }
};
- const sal_Int32 nListLen = rList.getLength();
+ const sal_Int32 nListLen = rList.size();
while (nStartPos < nListLen && rList[nStartPos] == ' ')
++nStartPos;
@@ -1540,10 +1540,10 @@ bool parseFunction( const OUString& rList, sal_Int32 nStartPos, sal_Int32& rEndP
bParsed = dequote( rList, nStartPos, nFuncEnd, aFuncStr );
else
{
- nFuncEnd = rList.indexOf(']', nStartPos);
+ nFuncEnd = rList.find(']', nStartPos);
if (nFuncEnd >= 0)
{
- aFuncStr = rList.copy(nStartPos, nFuncEnd - nStartPos);
+ aFuncStr = rList.substr(nStartPos, nFuncEnd - nStartPos);
bParsed = true;
}
}
@@ -1570,10 +1570,10 @@ bool parseFunction( const OUString& rList, sal_Int32 nStartPos, sal_Int32& rEndP
return bFound;
}
-bool extractAtStart( const OUString& rList, sal_Int32& rMatched, bool bAllowBracket, sal_Int16* pFunc,
+bool extractAtStart( std::u16string_view rList, sal_Int32& rMatched, bool bAllowBracket, sal_Int16* pFunc,
OUString& rDequoted )
{
- sal_Int32 nMatchList = 0;
+ size_t nMatchList = 0;
sal_Unicode cFirst = rList[0];
bool bParsed = false;
if ( cFirst == '\'' || cFirst == '[' )
@@ -1590,7 +1590,7 @@ bool extractAtStart( const OUString& rList, sal_Int32& rMatched, bool bAllowBrac
// skip spaces after the opening bracket
sal_Int32 nStartPos = 1;
- const sal_Int32 nListLen = rList.getLength();
+ const sal_Int32 nListLen = rList.size();
while (nStartPos < nListLen && rList[nStartPos] == ' ')
++nStartPos;
@@ -1621,11 +1621,11 @@ bool extractAtStart( const OUString& rList, sal_Int32& rMatched, bool bAllowBrac
{
// implicit quoting to the closing bracket
- sal_Int32 nClosePos = rList.indexOf(']', nStartPos);
+ sal_Int32 nClosePos = rList.find(']', nStartPos);
if (nClosePos >= 0)
{
sal_Int32 nNameEnd = nClosePos;
- sal_Int32 nSemiPos = rList.indexOf(';', nStartPos);
+ sal_Int32 nSemiPos = rList.find(';', nStartPos);
if (nSemiPos >= 0 && nSemiPos < nClosePos && pFunc)
{
sal_Int32 nFuncEnd = 0;
@@ -1633,7 +1633,7 @@ bool extractAtStart( const OUString& rList, sal_Int32& rMatched, bool bAllowBrac
nNameEnd = nSemiPos;
}
- aDequoted = rList.copy(nStartPos, nNameEnd - nStartPos);
+ aDequoted = rList.substr(nStartPos, nNameEnd - nStartPos);
// spaces before the closing bracket or semicolon
aDequoted = comphelper::string::stripEnd(aDequoted, ' ');
nQuoteEnd = nClosePos + 1;
@@ -1654,7 +1654,7 @@ bool extractAtStart( const OUString& rList, sal_Int32& rMatched, bool bAllowBrac
// look for following space or end of string
bool bValid = false;
- if ( sal::static_int_cast<sal_Int32>(nMatchList) >= rList.getLength() )
+ if ( nMatchList >= rList.size() )
bValid = true;
else
{
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index 1037eac1c013..1a4020e56e91 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -1297,10 +1297,10 @@ void ScDPResultMember::ProcessData( const vector< SCROW >& aChildMembers, const
* Parse subtotal string and replace all occurrences of '?' with the caption
* string. Do ensure that escaped characters are not translated.
*/
-static OUString lcl_parseSubtotalName(const OUString& rSubStr, std::u16string_view rCaption)
+static OUString lcl_parseSubtotalName(std::u16string_view rSubStr, std::u16string_view rCaption)
{
OUStringBuffer aNewStr;
- sal_Int32 n = rSubStr.getLength();
+ sal_Int32 n = rSubStr.size();
bool bEscaped = false;
for (sal_Int32 i = 0; i < n; ++i)
{
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index a7b63ce1eb40..b0a91cb397d8 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -710,9 +710,9 @@ OUString ScGlobal::addToken(std::u16string_view rTokenList, std::u16string_view
return aBuf.makeStringAndClear();
}
-bool ScGlobal::IsQuoted( const OUString& rString, sal_Unicode cQuote )
+bool ScGlobal::IsQuoted( std::u16string_view rString, sal_Unicode cQuote )
{
- return (rString.getLength() >= 2) && (rString[0] == cQuote) && (rString[ rString.getLength() - 1 ] == cQuote);
+ return (rString.size() >= 2) && (rString[0] == cQuote) && (rString[ rString.size() - 1 ] == cQuote);
}
void ScGlobal::AddQuotes( OUString& rString, sal_Unicode cQuote, bool bEscapeEmbedded )
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index c4ee30152af2..79f21d8de202 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -490,12 +490,12 @@ struct ScValidationDataIsNumeric
}
};
-bool ScValidationData::IsDataValidTextLen( const OUString& rTest, const ScAddress& rPos,
+bool ScValidationData::IsDataValidTextLen( std::u16string_view rTest, const ScAddress& rPos,
ScValidationDataIsNumeric* pDataNumeric ) const
{
sal_Int32 nLen;
if (!pDataNumeric)
- nLen = rTest.getLength();
+ nLen = rTest.size();
else
{
if (!pDataNumeric->mpFormatter)
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 9c36b701cfa8..4d61b00ed36b 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -99,12 +99,12 @@ bool AllStringsAreNull(const rtl_uString* const* pStringArray, size_t nLength)
return true;
}
-OUString LimitedString( const OUString& str )
+OUString LimitedString( std::u16string_view str )
{
- if( str.getLength() < 20 )
- return "\"" + str + "\"";
+ if( str.size() < 20 )
+ return OUString::Concat("\"") + str + "\"";
else
- return OUString::Concat("\"") + str.subView( 0, 20 ) + "\"...";
+ return OUString::Concat("\"") + str.substr( 0, 20 ) + "\"...";
}
const int MAX_PEEK_ELEMENTS = 5;
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index ca1010a393bd..f704290e340d 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -2508,10 +2508,10 @@ OUString ScRefAddress::GetRefString( const ScDocument& rDoc, SCTAB nActTab,
return aAdr.Format(nFlags, &rDoc, rDetails);
}
-bool AlphaToCol(const ScDocument& rDoc, SCCOL& rCol, const OUString& rStr)
+bool AlphaToCol(const ScDocument& rDoc, SCCOL& rCol, std::u16string_view rStr)
{
SCCOL nResult = 0;
- sal_Int32 nStop = rStr.getLength();
+ sal_Int32 nStop = rStr.size();
sal_Int32 nPos = 0;
sal_Unicode c;
const SCCOL nMaxCol = rDoc.MaxCol();
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index e310794d1297..e55a7e923c19 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -491,20 +491,20 @@ return;
/* ~ */ t[126]|= ScCharFlags::Word;
}
-static bool lcl_isValidQuotedText( const OUString& rFormula, sal_Int32 nSrcPos, ParseResult& rRes )
+static bool lcl_isValidQuotedText( std::u16string_view rFormula, size_t nSrcPos, ParseResult& rRes )
{
// Tokens that start at ' can have anything in them until a final '
// but '' marks an escaped '
// We've earlier guaranteed that a string containing '' will be
// surrounded by '
- if (nSrcPos < rFormula.getLength() && rFormula[nSrcPos] == '\'')
+ if (nSrcPos < rFormula.size() && rFormula[nSrcPos] == '\'')
{
- sal_Int32 nPos = nSrcPos+1;
- while (nPos < rFormula.getLength())
+ size_t nPos = nSrcPos+1;
+ while (nPos < rFormula.size())
{
if (rFormula[nPos] == '\'')
{
- if ( (nPos+1 == rFormula.getLength()) || (rFormula[nPos+1] != '\'') )
+ if ( (nPos+1 == rFormula.size()) || (rFormula[nPos+1] != '\'') )
{
rRes.TokenType = KParseType::SINGLE_QUOTE_NAME;
rRes.EndPos = nPos+1;
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index d46844964255..0785318da871 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -9164,12 +9164,12 @@ static sal_Int32 lcl_getLengthB( std::u16string_view str, sal_Int32 nPos )
}
return length;
}
-static sal_Int32 getLengthB(const OUString &str)
+static sal_Int32 getLengthB(std::u16string_view str)
{
- if(str.isEmpty())
+ if(str.empty())
return 0;
else
- return lcl_getLengthB( str, str.getLength() );
+ return lcl_getLengthB( str, str.size() );
}
void ScInterpreter::ScLenB()
{
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index 6eb1cf52ff48..6ca967c3dff3 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -372,12 +372,12 @@ void ScRangeStringConverter::AssignString(
}
sal_Int32 ScRangeStringConverter::IndexOf(
- const OUString& rString,
+ std::u16string_view rString,
sal_Unicode cSearchChar,
sal_Int32 nOffset,
sal_Unicode cQuote )
{
- sal_Int32 nLength = rString.getLength();
+ sal_Int32 nLength = rString.size();
sal_Int32 nIndex = nOffset;
bool bQuoted = false;
bool bExitLoop = false;
@@ -394,11 +394,11 @@ sal_Int32 ScRangeStringConverter::IndexOf(
}
sal_Int32 ScRangeStringConverter::IndexOfDifferent(
- const OUString& rString,
+ std::u16string_view rString,
sal_Unicode cSearchChar,
sal_Int32 nOffset )
{
- sal_Int32 nLength = rString.getLength();
+ sal_Int32 nLength = rString.size();
sal_Int32 nIndex = nOffset;
bool bExitLoop = false;
@@ -413,12 +413,12 @@ sal_Int32 ScRangeStringConverter::IndexOfDifferent(
void ScRangeStringConverter::GetTokenByOffset(
OUString& rToken,
- const OUString& rString,
+ std::u16string_view rString,
sal_Int32& nOffset,
sal_Unicode cSeparator,
sal_Unicode cQuote)
{
- sal_Int32 nLength = rString.getLength();
+ sal_Int32 nLength = rString.size();
if( nOffset == -1 || nOffset >= nLength )
{
rToken.clear();
@@ -429,7 +429,7 @@ void ScRangeStringConverter::GetTokenByOffset(
sal_Int32 nTokenEnd = IndexOf( rString, cSeparator, nOffset, cQuote );
if( nTokenEnd < 0 )
nTokenEnd = nLength;
- rToken = rString.copy( nOffset, nTokenEnd - nOffset );
+ rToken = rString.substr( nOffset, nTokenEnd - nOffset );
sal_Int32 nNextBegin = IndexOfDifferent( rString, cSeparator, nTokenEnd );
nOffset = (nNextBegin < 0) ? nLength : nNextBegin;
@@ -444,7 +444,7 @@ void ScRangeStringConverter::AppendTableName(OUStringBuffer& rBuf, const OUStrin
rBuf.append(aQuotedTab);
}
-sal_Int32 ScRangeStringConverter::GetTokenCount( const OUString& rString, sal_Unicode cSeparator )
+sal_Int32 ScRangeStringConverter::GetTokenCount( std::u16string_view rString, sal_Unicode cSeparator )
{
OUString sToken;
sal_Int32 nCount = 0;
@@ -460,7 +460,7 @@ sal_Int32 ScRangeStringConverter::GetTokenCount( const OUString& rString, sal_Un
bool ScRangeStringConverter::GetAddressFromString(
ScAddress& rAddress,
- const OUString& rAddressStr,
+ std::u16string_view rAddressStr,
const ScDocument& rDocument,
FormulaGrammar::AddressConvention eConv,
sal_Int32& nOffset,
@@ -482,7 +482,7 @@ bool ScRangeStringConverter::GetAddressFromString(
bool ScRangeStringConverter::GetRangeFromString(
ScRange& rRange,
- const OUString& rRangeStr,
+ std::u16string_view rRangeStr,
const ScDocument& rDocument,
FormulaGrammar::AddressConvention eConv,
sal_Int32& nOffset,
@@ -551,14 +551,14 @@ bool ScRangeStringConverter::GetRangeFromString(
bool ScRangeStringConverter::GetRangeListFromString(
ScRangeList& rRangeList,
- const OUString& rRangeListStr,
+ std::u16string_view rRangeListStr,
const ScDocument& rDocument,
FormulaGrammar::AddressConvention eConv,
sal_Unicode cSeparator,
sal_Unicode cQuote )
{
bool bRet = true;
- OSL_ENSURE( !rRangeListStr.isEmpty(), "ScXMLConverter::GetRangeListFromString - empty string!" );
+ OSL_ENSURE( !rRangeListStr.empty(), "ScXMLConverter::GetRangeListFromString - empty string!" );
sal_Int32 nOffset = 0;
while( nOffset >= 0 )
{
@@ -578,7 +578,7 @@ bool ScRangeStringConverter::GetRangeListFromString(
bool ScRangeStringConverter::GetAreaFromString(
ScArea& rArea,
- const OUString& rRangeStr,
+ std::u16string_view rRangeStr,
const ScDocument& rDocument,
FormulaGrammar::AddressConvention eConv,
sal_Int32& nOffset,
@@ -600,7 +600,7 @@ bool ScRangeStringConverter::GetAreaFromString(
bool ScRangeStringConverter::GetRangeFromString(
table::CellRangeAddress& rRange,
- const OUString& rRangeStr,
+ std::u16string_view rRangeStr,
const ScDocument& rDocument,
FormulaGrammar::AddressConvention eConv,
sal_Int32& nOffset,
@@ -803,7 +803,7 @@ static void lcl_appendCellRangeAddress(
}
}
-void ScRangeStringConverter::GetStringFromXMLRangeString( OUString& rString, const OUString& rXMLRange, const ScDocument& rDoc )
+void ScRangeStringConverter::GetStringFromXMLRangeString( OUString& rString, std::u16string_view rXMLRange, const ScDocument& rDoc )
{
FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention();
const sal_Unicode cSepNew = ScCompiler::GetNativeSymbolChar(ocSep);
diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx
index 08d1730be436..2236c433400d 100644
--- a/sc/source/filter/excel/excel.cxx
+++ b/sc/source/filter/excel/excel.cxx
@@ -52,13 +52,13 @@
using namespace css;
-static void lcl_getListOfStreams(SotStorage * pStorage, comphelper::SequenceAsHashMap& aStreamsData, const OUString& sPrefix)
+static void lcl_getListOfStreams(SotStorage * pStorage, comphelper::SequenceAsHashMap& aStreamsData, std::u16string_view sPrefix)
{
SvStorageInfoList aElements;
pStorage->FillInfoList(&aElements);
for (const auto & aElement : aElements)
{
- OUString sStreamFullName = sPrefix.getLength() ? sPrefix + "/" + aElement.GetName() : aElement.GetName();
+ OUString sStreamFullName = sPrefix.size() ? OUString::Concat(sPrefix) + "/" + aElement.GetName() : aElement.GetName();
if (aElement.IsStorage())
{
tools::SvRef<SotStorage> xSubStorage = pStorage->OpenSotStorage(aElement.GetName(), StreamMode::STD_READ | StreamMode::SHARE_DENYALL);
@@ -99,7 +99,7 @@ static tools::SvRef<SotStorage> lcl_DRMDecrypt(const SfxMedium& rMedium, const t
}
comphelper::SequenceAsHashMap aStreamsData;
- lcl_getListOfStreams(rStorage.get(), aStreamsData, "");
+ lcl_getListOfStreams(rStorage.get(), aStreamsData, u"");
try {
uno::Sequence<beans::NamedValue> aStreams = aStreamsData.getAsConstNamedValueList();
diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx
index 34564e30ef17..a8aab5b694d3 100644
--- a/sc/source/filter/excel/xepivot.cxx
+++ b/sc/source/filter/excel/xepivot.cxx
@@ -455,12 +455,12 @@ void XclExpPCField::InsertOrigItem( XclExpPCItem* pNewItem )
mnTypeFlags |= pNewItem->GetTypeFlag();
}
-void XclExpPCField::InsertOrigTextItem( const OUString& rText )
+void XclExpPCField::InsertOrigTextItem( const OUString& aText )
{
size_t nPos = 0;
bool bFound = false;
// #i76047# maximum item text length in pivot cache is 255
- OUString aShortText = rText.copy( 0, ::std::min(rText.getLength(), EXC_PC_MAXSTRLEN ) );
+ OUString aShortText = aText.copy( 0, ::std::min(aText.getLength(), EXC_PC_MAXSTRLEN ) );
for( size_t nSize = maOrigItemList.GetSize(); !bFound && (nPos < nSize); ++nPos )
if( (bFound = maOrigItemList.GetRecord( nPos )->EqualsText( aShortText )) )
InsertItemArrayIndex( nPos );
diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx
index 2c27e252a8f8..38884c48415c 100644
--- a/sc/source/filter/excel/xeroot.cxx
+++ b/sc/source/filter/excel/xeroot.cxx
@@ -307,11 +307,11 @@ bool XclExpRoot::IsDocumentEncrypted() const
return GetEncryptionData().hasElements();
}
-uno::Sequence< beans::NamedValue > XclExpRoot::GenerateEncryptionData( const OUString& aPass )
+uno::Sequence< beans::NamedValue > XclExpRoot::GenerateEncryptionData( std::u16string_view aPass )
{
uno::Sequence< beans::NamedValue > aEncryptionData;
- if ( !aPass.isEmpty() && aPass.getLength() < 16 )
+ if ( !aPass.empty() && aPass.size() < 16 )
{
rtlRandomPool aRandomPool = rtl_random_createPool ();
sal_uInt8 pnDocId[16];
@@ -320,7 +320,7 @@ uno::Sequence< beans::NamedValue > XclExpRoot::GenerateEncryptionData( const OUS
rtl_random_destroyPool( aRandomPool );
sal_uInt16 pnPasswd[16] = {};
- for( sal_Int32 nChar = 0; nChar < aPass.getLength(); ++nChar )
+ for( size_t nChar = 0; nChar < aPass.size(); ++nChar )
pnPasswd[nChar] = aPass[nChar];
::msfilter::MSCodec_Std97 aCodec;
diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx
index ef38c5b65089..3552e8d65f1b 100644
--- a/sc/source/filter/excel/xihelper.cxx
+++ b/sc/source/filter/excel/xihelper.cxx
@@ -754,13 +754,13 @@ void XclImpUrlHelper::DecodeUrl(
OSL_ENSURE( aTabName.isEmpty(), "XclImpUrlHelper::DecodeUrl - sheet name ignored" );
}
-bool XclImpUrlHelper::DecodeLink( OUString& rApplic, OUString& rTopic, const OUString& rEncUrl )
+bool XclImpUrlHelper::DecodeLink( OUString& rApplic, OUString& rTopic, std::u16string_view aEncUrl )
{
- sal_Int32 nPos = rEncUrl.indexOf( EXC_DDE_DELIM );
- if( (nPos > 0) && (nPos + 1 < rEncUrl.getLength()) )
+ size_t nPos = aEncUrl.find( EXC_DDE_DELIM );
+ if( nPos != std::u16string_view::npos && (nPos > 0) && (nPos + 1 < aEncUrl.size()) )
{
- rApplic = rEncUrl.copy( 0, nPos );
- rTopic = rEncUrl.copy( nPos + 1 );
+ rApplic = aEncUrl.substr( 0, nPos );
+ rTopic = aEncUrl.substr( nPos + 1 );
return true;
}
return false;
diff --git a/sc/source/filter/inc/addressconverter.hxx b/sc/source/filter/inc/addressconverter.hxx
index e014167839d0..19c1b001be0d 100644
--- a/sc/source/filter/inc/addressconverter.hxx
+++ b/sc/source/filter/inc/addressconverter.hxx
@@ -118,7 +118,7 @@ public:
*/
static bool parseOoxAddress2d(
sal_Int32& ornColumn, sal_Int32& ornRow,
- const OUString& rString,
+ std::u16string_view aString,
sal_Int32 nStart = 0,
sal_Int32 nLength = SAL_MAX_INT32 );
@@ -145,7 +145,7 @@ public:
static bool parseOoxRange2d(
sal_Int32& ornStartColumn, sal_Int32& ornStartRow,
sal_Int32& ornEndColumn, sal_Int32& ornEndRow,
- const OUString& rString,
+ std::u16string_view aString,
sal_Int32 nStart = 0 );
/** Returns the biggest valid cell address in the own Calc document. */
@@ -345,7 +345,7 @@ public:
*/
static bool convertToCellRangeUnchecked(
ScRange& orRange,
- const OUString& rString,
+ std::u16string_view aString,
sal_Int16 nSheet );
/** Tries to convert the passed string to a cell range address.
@@ -356,7 +356,7 @@ public:
bAllowOverflow is set to true, the range will be cropped to these
limits. Example: the range string "A1:ZZ100000" may be converted to
the range A1:IV65536.
- @param rString Cell range string in A1 notation.
+ @param aString Cell range string in A1 notation.
@param nSheet Sheet index to be inserted into orRange (will be checked).
@param bAllowOverflow true = Allow ranges that start inside the
supported sheet limits but may end outside of these limits. The
@@ -374,7 +374,7 @@ public:
*/
bool convertToCellRange(
ScRange& orRange,
- const OUString& rString,
+ std::u16string_view aString,
sal_Int16 nSheet,
bool bAllowOverflow, bool bTrackOverflow );
@@ -448,7 +448,7 @@ public:
*/
void convertToCellRangeList(
ScRangeList& orRanges,
- const OUString& rString,
+ std::u16string_view aString,
sal_Int16 nSheet,
bool bTrackOverflow );
diff --git a/sc/source/filter/inc/drawingfragment.hxx b/sc/source/filter/inc/drawingfragment.hxx
index f93a13bc2059..b9fda07553f5 100644
--- a/sc/source/filter/inc/drawingfragment.hxx
+++ b/sc/source/filter/inc/drawingfragment.hxx
@@ -167,7 +167,7 @@ public:
private:
/** Converts the passed VML textbox text color to an OLE color. */
- sal_uInt32 convertControlTextColor( const OUString& rTextColor ) const;
+ sal_uInt32 convertControlTextColor( std::u16string_view aTextColor ) const;
/** Converts the passed VML textbox font to an ActiveX form control font. */
void convertControlFontData(
::oox::ole::AxFontData& rAxFontData, sal_uInt32& rnOleTextColor,
diff --git a/sc/source/filter/inc/formulaparser.hxx b/sc/source/filter/inc/formulaparser.hxx
index 3a2030227ac7..32cab7caed3a 100644
--- a/sc/source/filter/inc/formulaparser.hxx
+++ b/sc/source/filter/inc/formulaparser.hxx
@@ -114,13 +114,13 @@ public:
SequenceInputStream& rStrm ) const;
/** Converts the passed XML formula to an OLE link target. */
- OUString importOleTargetLink( const OUString& rFormulaString );
+ OUString importOleTargetLink( std::u16string_view aFormulaString );
/** Imports and converts an OLE link target from the passed stream. */
OUString importOleTargetLink( SequenceInputStream& rStrm );
/** Converts the passed formula to a macro name for a drawing shape. */
- OUString importMacroName( const OUString& rFormulaString );
+ OUString importMacroName( std::u16string_view aFormulaString );
private:
::std::unique_ptr< FormulaParserImpl > mxImpl;
diff --git a/sc/source/filter/inc/numberformatsbuffer.hxx b/sc/source/filter/inc/numberformatsbuffer.hxx
index 28157acc03e0..10ec0de1ce9e 100644
--- a/sc/source/filter/inc/numberformatsbuffer.hxx
+++ b/sc/source/filter/inc/numberformatsbuffer.hxx
@@ -57,7 +57,7 @@ public:
explicit NumberFormat( const WorkbookHelper& rHelper );
/** Sets the passed format code. */
- void setFormatCode( const OUString& rFmtCode );
+ void setFormatCode( std::u16string_view aFmtCode );
/** Sets the passed format code, encoded in UTF-8. */
void setFormatCode(
const css::lang::Locale& rLocale,
@@ -86,7 +86,7 @@ public:
explicit NumberFormatsBuffer( const WorkbookHelper& rHelper );
/** Inserts a new number format. */
- NumberFormatRef createNumFmt( sal_uInt32 nNumFmtId, const OUString& rFmtCode );
+ NumberFormatRef createNumFmt( sal_uInt32 nNumFmtId, std::u16string_view aFmtCode );
/** Inserts a new number format code. */
NumberFormatRef importNumFmt( const AttributeList& rAttribs );
diff --git a/sc/source/filter/inc/richstring.hxx b/sc/source/filter/inc/richstring.hxx
index 1e3cf921b326..7c233507b419 100644
--- a/sc/source/filter/inc/richstring.hxx
+++ b/sc/source/filter/inc/richstring.hxx
@@ -243,9 +243,9 @@ private:
RichStringPhoneticRef createPhonetic();
/** Create base text portions from the passed string and character formatting. */
- void createTextPortions( const OUString& rText, FontPortionModelList& rPortions );
+ void createTextPortions( std::u16string_view aText, FontPortionModelList& rPortions );
/** Create phonetic text portions from the passed string and portion data. */
- void createPhoneticPortions( const OUString& rText, PhoneticPortionModelList& rPortions, sal_Int32 nBaseLen );
+ void createPhoneticPortions( std::u16string_view aText, PhoneticPortionModelList& rPortions, sal_Int32 nBaseLen );
private:
typedef RefVector< RichStringPhonetic > PhoneticVector;
diff --git a/sc/source/filter/inc/stylesbuffer.hxx b/sc/source/filter/inc/stylesbuffer.hxx
index 3eb25592aeb8..a687a14d3b31 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -791,7 +791,7 @@ public:
/** Creates a new empty font object. */
FontRef createFont();
/** Creates a number format. */
- NumberFormatRef createNumFmt( sal_Int32 nNumFmtId, const OUString& rFmtCode );
+ NumberFormatRef createNumFmt( sal_Int32 nNumFmtId, std::u16string_view aFmtCode );
sal_Int32 nextFreeNumFmtId();
/** Creates a new empty border object. */
BorderRef createBorder();
diff --git a/sc/source/filter/inc/xeroot.hxx b/sc/source/filter/inc/xeroot.hxx
index ea65aba7ea35..421a389a3737 100644
--- a/sc/source/filter/inc/xeroot.hxx
+++ b/sc/source/filter/inc/xeroot.hxx
@@ -175,7 +175,7 @@ public:
bool IsDocumentEncrypted() const;
- static css::uno::Sequence< css::beans::NamedValue > GenerateEncryptionData( const OUString& aPass );
+ static css::uno::Sequence< css::beans::NamedValue > GenerateEncryptionData( std::u16string_view aPass );
css::uno::Sequence< css::beans::NamedValue > GetEncryptionData() const;
static css::uno::Sequence< css::beans::NamedValue > GenerateDefaultEncryptionData();
diff --git a/sc/source/filter/inc/xihelper.hxx b/sc/source/filter/inc/xihelper.hxx
index dda6456d59cf..d887df2cd4da 100644
--- a/sc/source/filter/inc/xihelper.hxx
+++ b/sc/source/filter/inc/xihelper.hxx
@@ -286,7 +286,7 @@ public:
@descr For DDE links: Decodes to application name and topic.
For OLE object links: Decodes to class name and document URL.
@return true = decoding was successful, returned strings are valid (not empty). */
- static bool DecodeLink( OUString& rApplic, OUString& rTopic, const OUString& rEncUrl );
+ static bool DecodeLink( OUString& rApplic, OUString& rTopic, std::u16string_view aEncUrl );
};
// Cached values ==============================================================
diff --git a/sc/source/filter/oox/addressconverter.cxx b/sc/source/filter/oox/addressconverter.cxx
index b13a4a5cd896..0d6e52f13f9d 100644
--- a/sc/source/filter/oox/addressconverter.cxx
+++ b/sc/source/filter/oox/addressconverter.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <convuno.hxx>
+#include <o3tl/string_view.hxx>
#include <osl/diagnose.h>
#include <oox/core/filterbase.hxx>
#include <oox/helper/binaryinputstream.hxx>
@@ -79,14 +80,14 @@ AddressConverter::AddressConverter( const WorkbookHelper& rHelper ) :
bool AddressConverter::parseOoxAddress2d(
sal_Int32& ornColumn, sal_Int32& ornRow,
- const OUString& rString, sal_Int32 nStart, sal_Int32 nLength )
+ std::u16string_view aString, sal_Int32 nStart, sal_Int32 nLength )
{
ornColumn = ornRow = 0;
- if( (nStart < 0) || (nStart >= rString.getLength()) || (nLength < 2) )
+ if( (nStart < 0) || (nStart >= sal_Int32(aString.size())) || (nLength < 2) )
return false;
- const sal_Unicode* pcChar = rString.getStr() + nStart;
- const sal_Unicode* pcEndChar = pcChar + ::std::min( nLength, rString.getLength() - nStart );
+ const sal_Unicode* pcChar = aString.data() + nStart;
+ const sal_Unicode* pcEndChar = pcChar + ::std::min( nLength, sal_Int32(aString.size() - nStart) );
enum { STATE_COL, STATE_ROW } eState = STATE_COL;
while( pcChar < pcEndChar )
@@ -197,22 +198,22 @@ bool AddressConverter::parseOoxAddress2d( sal_Int32& ornColumn, sal_Int32& ornRo
bool AddressConverter::parseOoxRange2d(
sal_Int32& ornStartColumn, sal_Int32& ornStartRow,
sal_Int32& ornEndColumn, sal_Int32& ornEndRow,
- const OUString& rString, sal_Int32 nStart )
+ std::u16string_view aString, sal_Int32 nStart )
{
ornStartColumn = ornStartRow = ornEndColumn = ornEndRow = 0;
- if( (nStart < 0) || (nStart >= rString.getLength()) )
+ if( (nStart < 0) || (nStart >= sal_Int32(aString.size())) )
return false;
- sal_Int32 nEnd = nStart + ( rString.getLength() - nStart );
- sal_Int32 nColonPos = rString.indexOf( ':', nStart );
- if( (nStart < nColonPos) && (nColonPos + 1 < nEnd) )
+ sal_Int32 nEnd = nStart + ( aString.size() - nStart );
+ size_t nColonPos = aString.find( ':', nStart );
+ if( nColonPos != std::u16string_view::npos && (nStart < sal_Int32(nColonPos)) && (sal_Int32(nColonPos + 1) < nEnd) )
{
return
- parseOoxAddress2d( ornStartColumn, ornStartRow, rString, nStart, nColonPos - nStart ) &&
- parseOoxAddress2d( ornEndColumn, ornEndRow, rString, nColonPos + 1, SAL_MAX_INT32 - nColonPos - 1 );
+ parseOoxAddress2d( ornStartColumn, ornStartRow, aString, nStart, nColonPos - nStart ) &&
+ parseOoxAddress2d( ornEndColumn, ornEndRow, aString, nColonPos + 1, SAL_MAX_INT32 - nColonPos - 1 );
}
- if( parseOoxAddress2d( ornStartColumn, ornStartRow, rString, nStart ) )
+ if( parseOoxAddress2d( ornStartColumn, ornStartRow, aString, nStart ) )
{
ornEndColumn = ornStartColumn;
ornEndRow = ornStartRow;
@@ -373,7 +374,7 @@ bool AddressConverter::validateCellRange( ScRange& orRange, bool bAllowOverflow,
}
bool AddressConverter::convertToCellRangeUnchecked( ScRange& orRange,
- const OUString& rString, sal_Int16 nSheet )
+ std::u16string_view aString, sal_Int16 nSheet )
{
orRange.aStart.SetTab( nSheet );
orRange.aEnd.SetTab( nSheet );
@@ -381,7 +382,7 @@ bool AddressConverter::convertToCellRangeUnchecked( ScRange& orRange,
sal_Int32 aStartRow = orRange.aStart.Row();
sal_Int32 aEndCol = orRange.aEnd.Col();
sal_Int32 aEndRow = orRange.aEnd.Row();
- bool bReturnValue = parseOoxRange2d( aStartCol, aStartRow, aEndCol, aEndRow, rString );
+ bool bReturnValue = parseOoxRange2d( aStartCol, aStartRow, aEndCol, aEndRow, aString );
orRange.aStart.SetCol( aStartCol );
orRange.aStart.SetRow( aStartRow );
orRange.aEnd.SetCol( aEndCol );
@@ -390,10 +391,10 @@ bool AddressConverter::convertToCellRangeUnchecked( ScRange& orRange,
}
bool AddressConverter::convertToCellRange( ScRange& orRange,
- const OUString& rString, sal_Int16 nSheet, bool bAllowOverflow, bool bTrackOverflow )
+ std::u16string_view aString, sal_Int16 nSheet, bool bAllowOverflow, bool bTrackOverflow )
{
return
- convertToCellRangeUnchecked( orRange, rString, nSheet ) &&
+ convertToCellRangeUnchecked( orRange, aString, nSheet ) &&
validateCellRange( orRange, bAllowOverflow, bTrackOverflow );
}
@@ -423,15 +424,15 @@ void AddressConverter::validateCellRangeList( ScRangeList& orRanges, bool bTrack
}
void AddressConverter::convertToCellRangeList( ScRangeList& orRanges,
- const OUString& rString, sal_Int16 nSheet, bool bTrackOverflow )
+ std::u16string_view aString, sal_Int16 nSheet, bool bTrackOverflow )
{
- sal_Int32 nPos = 0;
- sal_Int32 nLen = rString.getLength();
+ size_t nPos = 0;
+ size_t nLen = aString.size();
ScRange aRange;
- while( (0 <= nPos) && (nPos < nLen) )
+ while( nPos != std::u16string_view::npos && (nPos < nLen) )
{
- OUString aToken = rString.getToken( 0, ' ', nPos );
- if( !aToken.isEmpty() && convertToCellRange( aRange, aToken, nSheet, true, bTrackOverflow ) )
+ std::u16string_view aToken = o3tl::getToken(aString, u' ', nPos );
+ if( !aToken.empty() && convertToCellRange( aRange, aToken, nSheet, true, bTrackOverflow ) )
orRanges.push_back(aRange);
}
}
diff --git a/sc/source/filter/oox/defnamesbuffer.cxx b/sc/source/filter/oox/defnamesbuffer.cxx
index 72f28cd4edd3..8cae1fb737bd 100644
--- a/sc/source/filter/oox/defnamesbuffer.cxx
+++ b/sc/source/filter/oox/defnamesbuffer.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/sheet/NamedRangeFlag.hpp>
#include <com/sun/star/sheet/XPrintAreas.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <o3tl/string_view.hxx>
#include <osl/diagnose.h>
#include <rtl/ustrbuf.hxx>
#include <oox/helper/binaryinputstream.hxx>
@@ -90,15 +91,15 @@ OUString lclGetPrefixedName( sal_Unicode cBuiltinId )
}
/** returns the built-in name identifier from a prefixed built-in name, e.g. '_xlnm.Print_Area'. */
-sal_Unicode lclGetBuiltinIdFromPrefixedName( const OUString& rModelName )
+sal_Unicode lclGetBuiltinIdFromPrefixedName( std::u16string_view aModelName )
{
- if( rModelName.matchIgnoreAsciiCase( spcOoxPrefix ) )
+ if( o3tl::matchIgnoreAsciiCase( aModelName, spcOoxPrefix ) )
{
for( sal_Unicode cBuiltinId = 0; cBuiltinId < SAL_N_ELEMENTS( sppcBaseNames ); ++cBuiltinId )
{
OUString aBaseName = lclGetBaseName( cBuiltinId );
sal_Int32 nBaseNameLen = aBaseName.getLength();
- if( (rModelName.getLength() == spcOoxPrefix.getLength() + nBaseNameLen) && rModelName.matchIgnoreAsciiCase( aBaseName, spcOoxPrefix.getLength() ) )
+ if( (sal_Int32(aModelName.size()) == spcOoxPrefix.getLength() + nBaseNameLen) && o3tl::matchIgnoreAsciiCase( aModelName, aBaseName, spcOoxPrefix.getLength() ) )
return cBuiltinId;
}
}
diff --git a/sc/source/filter/oox/drawingfragment.cxx b/sc/source/filter/oox/drawingfragment.cxx
index 936d72c82bed..205e9983d3e7 100644
--- a/sc/source/filter/oox/drawingfragment.cxx
+++ b/sc/source/filter/oox/drawingfragment.cxx
@@ -694,29 +694,29 @@ void VmlDrawing::notifyXShapeInserted( const Reference< XShape >& rxShape,
// private --------------------------------------------------------------------
-sal_uInt32 VmlDrawing::convertControlTextColor( const OUString& rTextColor ) const
+sal_uInt32 VmlDrawing::convertControlTextColor( std::u16string_view aTextColor ) const
{
// color attribute not present or 'auto' - use passed default color
- if( rTextColor.isEmpty() || rTextColor.equalsIgnoreAsciiCase( "auto" ) )
+ if( aTextColor.empty() || o3tl::equalsIgnoreAsciiCase( aTextColor, u"auto" ) )
return AX_SYSCOLOR_WINDOWTEXT;
- if( rTextColor[ 0 ] == '#' )
+ if( aTextColor[ 0 ] == '#' )
{
// RGB colors in the format '#RRGGBB'
- if( rTextColor.getLength() == 7 )
- return OleHelper::encodeOleColor( o3tl::toUInt32(rTextColor.subView( 1 ), 16) );
+ if( aTextColor.size() == 7 )
+ return OleHelper::encodeOleColor( o3tl::toUInt32(aTextColor.substr( 1 ), 16) );
// RGB colors in the format '#RGB'
- if( rTextColor.getLength() == 4 )
+ if( aTextColor.size() == 4 )
{
- sal_Int32 nR = o3tl::toUInt32(rTextColor.subView( 1, 1 ), 16) * 0x11;
- sal_Int32 nG = o3tl::toUInt32(rTextColor.subView( 2, 1 ), 16) * 0x11;
- sal_Int32 nB = o3tl::toUInt32(rTextColor.subView( 3, 1 ), 16) * 0x11;
+ sal_Int32 nR = o3tl::toUInt32(aTextColor.substr( 1, 1 ), 16) * 0x11;
+ sal_Int32 nG = o3tl::toUInt32(aTextColor.substr( 2, 1 ), 16) * 0x11;
+ sal_Int32 nB = o3tl::toUInt32(aTextColor.substr( 3, 1 ), 16) * 0x11;
return OleHelper::encodeOleColor( (nR << 16) | (nG << 8) | nB );
}
OSL_ENSURE( false, OStringBuffer( "VmlDrawing::convertControlTextColor - invalid color name '" ).
- append( OUStringToOString( rTextColor, RTL_TEXTENCODING_ASCII_US ) ).append( '\'' ).getStr() );
+ append( OUStringToOString( aTextColor, RTL_TEXTENCODING_ASCII_US ) ).append( '\'' ).getStr() );
return AX_SYSCOLOR_WINDOWTEXT;
}
@@ -724,7 +724,7 @@ sal_uInt32 VmlDrawing::convertControlTextColor( const OUString& rTextColor ) con
/* Predefined color names or system color names (resolve to RGB to detect
valid color name). */
- sal_Int32 nColorToken = AttributeConversion::decodeToken( rTextColor );
+ sal_Int32 nColorToken = AttributeConversion::decodeToken( aTextColor );
::Color nRgbValue = Color::getVmlPresetColor( nColorToken, API_RGB_TRANSPARENT );
if( nRgbValue == API_RGB_TRANSPARENT )
nRgbValue = rGraphicHelper.getSystemColor( nColorToken );
@@ -732,7 +732,7 @@ sal_uInt32 VmlDrawing::convertControlTextColor( const OUString& rTextColor ) con
return OleHelper::encodeOleColor( nRgbValue );
// try palette color
- return OleHelper::encodeOleColor( rGraphicHelper.getPaletteColor( rTextColor.toInt32() ) );
+ return OleHelper::encodeOleColor( rGraphicHelper.getPaletteColor( o3tl::toInt32(aTextColor) ) );
}
void VmlDrawing::convertControlFontData( AxFontData& rAxFontData, sal_uInt32& rnOleTextColor, const ::oox::vml::TextFontModel& rFontModel ) const
diff --git a/sc/source/filter/oox/formulaparser.cxx b/sc/source/filter/oox/formulaparser.cxx
index c4582cef0884..f4eb7419b7cb 100644
--- a/sc/source/filter/oox/formulaparser.cxx
+++ b/sc/source/filter/oox/formulaparser.cxx
@@ -1733,15 +1733,15 @@ namespace {
/** Extracts the reference identifier and the remaining data from a formula in
the format '[RefID]Remaining'. */
-bool lclExtractRefId( sal_Int32& rnRefId, OUString& rRemainder, const OUString& rFormulaString )
+bool lclExtractRefId( sal_Int32& rnRefId, OUString& rRemainder, std::u16string_view aFormulaString )
{
- if( (rFormulaString.getLength() >= 4) && (rFormulaString[ 0 ] == '[') )
+ if( (aFormulaString.size() >= 4) && (aFormulaString[ 0 ] == '[') )
{
- sal_Int32 nBracketClose = rFormulaString.indexOf( ']', 1 );
- if( nBracketClose >= 2 )
+ size_t nBracketClose = aFormulaString.find( ']', 1 );
+ if( nBracketClose != std::u16string_view::npos && nBracketClose >= 2 )
{
- rnRefId = o3tl::toInt32(rFormulaString.subView( 1, nBracketClose - 1 ));
- rRemainder = rFormulaString.copy( nBracketClose + 1 );
+ rnRefId = o3tl::toInt32(aFormulaString.substr( 1, nBracketClose - 1 ));
+ rRemainder = aFormulaString.substr( nBracketClose + 1 );
return !rRemainder.isEmpty();
}
}
@@ -1770,11 +1770,11 @@ ApiTokenSequence FormulaParser::importFormula( const ScAddress& rBaseAddress, Fo
return mxImpl->importBiff12Formula( rBaseAddress, eType, rStrm );
}
-OUString FormulaParser::importOleTargetLink( const OUString& rFormulaString )
+OUString FormulaParser::importOleTargetLink( std::u16string_view aFormulaString )
{
sal_Int32 nRefId = -1;
OUString aRemainder;
- if( lclExtractRefId( nRefId, aRemainder, rFormulaString ) && (aRemainder.getLength() >= 3) &&
+ if( lclExtractRefId( nRefId, aRemainder, aFormulaString ) && (aRemainder.getLength() >= 3) &&
(aRemainder[ 0 ] == '!') && (aRemainder[ 1 ] == '\'') && (aRemainder[ aRemainder.getLength() - 1 ] == '\'') )
return mxImpl->resolveOleTarget( nRefId, false );
return OUString();
@@ -1797,7 +1797,7 @@ OUString FormulaParser::importOleTargetLink( SequenceInputStream& rStrm )
return aTargetLink;
}
-OUString FormulaParser::importMacroName( const OUString& rFormulaString )
+OUString FormulaParser::importMacroName( std::u16string_view aFormulaString )
{
/* Valid macros are either sheet macros or VBA macros. OOXML and all BIFF
documents store defined names for sheet macros, but OOXML documents do
@@ -1823,7 +1823,7 @@ OUString FormulaParser::importMacroName( const OUString& rFormulaString )
*/
sal_Int32 nRefId = -1;
OUString aRemainder;
- if( lclExtractRefId( nRefId, aRemainder, rFormulaString ) && (aRemainder.getLength() > 1) && (aRemainder[ 0 ] == '!') )
+ if( lclExtractRefId( nRefId, aRemainder, aFormulaString ) && (aRemainder.getLength() > 1) && (aRemainder[ 0 ] == '!') )
{
/* In BIFF12 documents, the reference identifier is always the
one-based index of the external link as it is in OOXML documents
diff --git a/sc/source/filter/oox/numberformatsbuffer.cxx b/sc/source/filter/oox/numberformatsbuffer.cxx
index af8230604b75..5bc5466e2c7e 100644
--- a/sc/source/filter/oox/numberformatsbuffer.cxx
+++ b/sc/source/filter/oox/numberformatsbuffer.cxx
@@ -33,6 +33,7 @@
#include <officecfg/System.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/string.hxx>
+#include <o3tl/string_view.hxx>
#include <osl/diagnose.h>
#include <osl/thread.h>
#include <rtl/ustrbuf.hxx>
@@ -1876,26 +1877,28 @@ NumberFormatFinalizer::NumberFormatFinalizer( const WorkbookHelper& rHelper ) :
OSL_ENSURE( mxNumFmts.is(), "NumberFormatFinalizer::NumberFormatFinalizer - cannot get number formats" );
}
-sal_Int32 lclPosToken ( const OUString& sFormat, std::u16string_view sSearch, sal_Int32 nStartPos )
+sal_Int32 lclPosToken ( std::u16string_view sFormat, std::u16string_view sSearch, sal_Int32 nStartPos )
{
- sal_Int32 nLength = sFormat.getLength();
+ sal_Int32 nLength = sFormat.size();
for ( sal_Int32 i = nStartPos; i < nLength && i >= 0 ; i++ )
{
+ size_t nFind = i;
switch(sFormat[i])
{
case '\"' : // skip text
- i = sFormat.indexOf('\"',i+1);
+ nFind = sFormat.find('\"',i+1);
break;
case '[' : // skip condition
- i = sFormat.indexOf(']',i+1);
+ nFind = sFormat.find(']',i+1);
break;
default :
- if ( sFormat.match(sSearch, i) )
+ if ( o3tl::starts_with(sFormat.substr(i), sSearch) )
return i;
break;
}
- if ( i < 0 )
- i--;
+ if ( nFind == std::u16string_view::npos )
+ return -2;
+ i = nFind;
}
return -2;
}
@@ -1907,27 +1910,27 @@ NumberFormat::NumberFormat( const WorkbookHelper& rHelper ) :
{
}
-void NumberFormat::setFormatCode( const OUString& rFmtCode )
+void NumberFormat::setFormatCode( std::u16string_view aFmtCode )
{
// Special case for fraction code '\ ?/?', it is passed to us in xml, the '\' is not
// an escape character but merely should be telling the formatter to display the next
// char in the format ( afaics it does that anyhow )
sal_Int32 nPosEscape = 0;
sal_Int32 nErase = 0;
- sal_Int32 nLastIndex = rFmtCode.getLength() - 1;
- OUStringBuffer sFormat(rFmtCode);
+ sal_Int32 nLastIndex = sal_Int32(aFmtCode.size()) - 1;
+ OUStringBuffer sFormat(aFmtCode);
- while ( ( nPosEscape = lclPosToken( rFmtCode, u"\\ ", nPosEscape ) ) > 0 )
+ while ( ( nPosEscape = lclPosToken( aFmtCode, u"\\ ", nPosEscape ) ) > 0 )
{
sal_Int32 nPos = nPosEscape + 2;
- while ( nPos < nLastIndex && ( rFmtCode[nPos] == '?' || rFmtCode[nPos] == '#' || rFmtCode[nPos] == '0' ) )
+ while ( nPos < nLastIndex && ( aFmtCode[nPos] == '?' || aFmtCode[nPos] == '#' || aFmtCode[nPos] == '0' ) )
nPos++;
- if ( nPos < nLastIndex && rFmtCode[nPos] == '/' )
+ if ( nPos < nLastIndex && aFmtCode[nPos] == '/' )
{
sFormat.remove(nPosEscape - nErase, 1);
nErase ++;
} // tdf#81939 preserve other escape characters
- nPosEscape = lclPosToken( rFmtCode, u";", nPosEscape ); // skip to next format
+ nPosEscape = lclPosToken( aFmtCode, u";", nPosEscape ); // skip to next format
}
maModel.maFmtCode = sFormat.makeStringAndClear();
}
@@ -1986,14 +1989,14 @@ NumberFormatsBuffer::NumberFormatsBuffer( const WorkbookHelper& rHelper )
insertBuiltinFormats();
}
-NumberFormatRef NumberFormatsBuffer::createNumFmt( sal_uInt32 nNumFmtId, const OUString& rFmtCode )
+NumberFormatRef NumberFormatsBuffer::createNumFmt( sal_uInt32 nNumFmtId, std::u16string_view aFmtCode )
{
NumberFormatRef xNumFmt;
xNumFmt = std::make_shared<NumberFormat>( *this );
maNumFmts[ nNumFmtId ] = xNumFmt;
if ( nNumFmtId > mnHighestId )
mnHighestId = nNumFmtId;
- xNumFmt->setFormatCode( rFmtCode );
+ xNumFmt->setFormatCode( aFmtCode );
return xNumFmt;
}
diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx
index 28cf7c742000..021f1c266352 100644
--- a/sc/source/filter/oox/pagesettings.cxx
+++ b/sc/source/filter/oox/pagesettings.cxx
@@ -423,9 +423,9 @@ private:
/** Sets the passed font name if it is valid. */
void convertFontName( const OUString& rStyle );
/** Converts a font style given as string. */
- void convertFontStyle( std::u16string_view rStyle );
+ void convertFontStyle( std::u16string_view aStyle );
/** Converts a font color given as string. */
- void convertFontColor( const OUString& rColor );
+ void convertFontColor( std::u16string_view aColor );
/** Finalizes current portion: sets font attributes and updates text height data. */
void finalizePortion();
@@ -641,7 +641,7 @@ double HeaderFooterParser::parse( const Reference<sheet::XHeaderFooterContent>&
{
setAttributes();
// eat the following 6 characters
- convertFontColor( OUString( pcChar + 1, 6 ) );
+ convertFontColor( std::u16string_view( pcChar + 1, 6 ) );
pcChar += 6;
}
break;
@@ -846,17 +846,17 @@ void HeaderFooterParser::convertFontStyle( std::u16string_view rStyle )
}
}
-void HeaderFooterParser::convertFontColor( const OUString& rColor )
+void HeaderFooterParser::convertFontColor( std::u16string_view aColor )
{
- OSL_ENSURE( rColor.getLength() == 6, "HeaderFooterParser::convertFontColor - invalid font color code" );
- if( (rColor[ 2 ] == '+') || (rColor[ 2 ] == '-') )
+ OSL_ENSURE( aColor.size() == 6, "HeaderFooterParser::convertFontColor - invalid font color code" );
+ if( (aColor[ 2 ] == '+') || (aColor[ 2 ] == '-') )
// theme color: TTSNNN (TT = decimal theme index, S = +/-, NNN = decimal tint/shade in percent)
maFontModel.maColor.setTheme(
- o3tl::toInt32(rColor.subView( 0, 2 )),
- static_cast< double >( o3tl::toInt32(rColor.subView( 2 )) ) / 100.0 );
+ o3tl::toInt32(aColor.substr( 0, 2 )),
+ static_cast< double >( o3tl::toInt32(aColor.substr( 2 )) ) / 100.0 );
else
// RGB color: RRGGBB
- maFontModel.maColor.setRgb( ::Color(ColorTransparency, rColor.toUInt32( 16 )) );
+ maFontModel.maColor.setRgb( ::Color(ColorTransparency, o3tl::toUInt32( aColor, 16 )) );
}
void HeaderFooterParser::finalizePortion()
diff --git a/sc/source/filter/oox/richstring.cxx b/sc/source/filter/oox/richstring.cxx
index 8ac24b0ccd01..a9b272d62a9a 100644
--- a/sc/source/filter/oox/richstring.cxx
+++ b/sc/source/filter/oox/richstring.cxx
@@ -535,13 +535,13 @@ RichStringPhoneticRef RichString::createPhonetic()
return xPhonetic;
}
-void RichString::createTextPortions( const OUString& rText, FontPortionModelList& rPortions )
+void RichString::createTextPortions( std::u16string_view aText, FontPortionModelList& rPortions )
{
maTextPortions.clear();
- if( rText.isEmpty() )
+ if( aText.empty() )
return;
- sal_Int32 nStrLen = rText.getLength();
+ sal_Int32 nStrLen = aText.size();
// add leading and trailing string position to ease the following loop
if( rPortions.empty() || (rPortions.front().mnPos > 0) )
rPortions.insert( rPortions.begin(), FontPortionModel( 0 ) );
@@ -555,19 +555,19 @@ void RichString::createTextPortions( const OUString& rText, FontPortionModelList
if( (0 < nPortionLen) && (aIt->mnPos + nPortionLen <= nStrLen) )
{
RichStringPortion& rPortion = getPortion(createPortion());
- rPortion.setText( rText.copy( aIt->mnPos, nPortionLen ) );
+ rPortion.setText( OUString(aText.substr( aIt->mnPos, nPortionLen )) );
rPortion.setFontId( aIt->mnFontId );
}
}
}
-void RichString::createPhoneticPortions( const OUString& rText, PhoneticPortionModelList& rPortions, sal_Int32 nBaseLen )
+void RichString::createPhoneticPortions( std::u16string_view aText, PhoneticPortionModelList& rPortions, sal_Int32 nBaseLen )
{
maPhonPortions.clear();
- if( rText.isEmpty())
+ if( aText.empty())
return;
- sal_Int32 nStrLen = rText.getLength();
+ sal_Int32 nStrLen = aText.size();
// no portions - assign phonetic text to entire base text
if( rPortions.empty() )
rPortions.push_back( PhoneticPortionModel( 0, 0, nBaseLen ) );
@@ -582,7 +582,7 @@ void RichString::createPhoneticPortions( const OUString& rText, PhoneticPortionM
if( (0 < nPortionLen) && (aIt->mnPos + nPortionLen <= nStrLen) )
{
RichStringPhoneticRef xPhonetic = createPhonetic();
- xPhonetic->setText( rText.copy( aIt->mnPos, nPortionLen ) );
+ xPhonetic->setText( OUString(aText.substr( aIt->mnPos, nPortionLen )) );
xPhonetic->setBaseRange( aIt->mnBasePos, aIt->mnBasePos + aIt->mnBaseLen );
}
}
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index c0c7f34eac91..1819257383e1 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -2724,9 +2724,9 @@ FontRef StylesBuffer::createFont()
return xFont;
}
-NumberFormatRef StylesBuffer::createNumFmt( sal_Int32 nNumFmtId, const OUString& rFmtCode )
+NumberFormatRef StylesBuffer::createNumFmt( sal_Int32 nNumFmtId, std::u16string_view aFmtCode )
{
- return maNumFmts.createNumFmt( nNumFmtId, rFmtCode );
+ return maNumFmts.createNumFmt( nNumFmtId, aFmtCode );
}
sal_Int32 StylesBuffer::nextFreeNumFmtId()
diff --git a/sc/source/filter/oox/worksheetfragment.cxx b/sc/source/filter/oox/worksheetfragment.cxx
index 9d368b23f2a2..30156058e7b0 100644
--- a/sc/source/filter/oox/worksheetfragment.cxx
+++ b/sc/source/filter/oox/worksheetfragment.cxx
@@ -206,12 +206,12 @@ ContextHandlerRef DataValidationsContext::onCreateContext( sal_Int32 nElement, c
namespace {
// Convert strings like 1,"2,3",4 to form "1","2,3","4"
-OUString NormalizeOoxList(const OUString& aList)
+OUString NormalizeOoxList(std::u16string_view aList)
{
OUStringBuffer aResult("\"");
bool bInsideQuotes = false;
- const sal_Int32 nLen = aList.getLength();
- for (sal_Int32 i = 0; i < nLen; ++i)
+ const size_t nLen = aList.size();
+ for (size_t i = 0; i < nLen; ++i)
{
sal_Unicode ch = aList[i];
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index 81c30e4241e8..67a9cffeaff9 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx
@@ -702,9 +702,9 @@ bool ScFormatRangeStyles::AddStyleName(OUString const & rString, sal_Int32& rInd
}
}
-sal_Int32 ScFormatRangeStyles::GetIndexOfStyleName(std::u16string_view rString, const OUString& rPrefix, bool& bIsAutoStyle)
+sal_Int32 ScFormatRangeStyles::GetIndexOfStyleName(std::u16string_view rString, std::u16string_view rPrefix, bool& bIsAutoStyle)
{
- sal_Int32 nPrefixLength(rPrefix.getLength());
+ sal_Int32 nPrefixLength(rPrefix.size());
std::u16string_view sTemp(rString.substr(nPrefixLength));
sal_Int32 nIndex(o3tl::toInt32(sTemp));
if (nIndex > 0 && o3tl::make_unsigned(nIndex-1) < aAutoStyleNames.size() && aAutoStyleNames.at(nIndex - 1) == rString)
@@ -914,9 +914,9 @@ sal_Int32 ScColumnRowStylesBase::AddStyleName(const OUString & rString)
return aStyleNames.size() - 1;
}
-sal_Int32 ScColumnRowStylesBase::GetIndexOfStyleName(std::u16string_view rString, const OUString& rPrefix)
+sal_Int32 ScColumnRowStylesBase::GetIndexOfStyleName(std::u16string_view rString, std::u16string_view rPrefix)
{
- sal_Int32 nPrefixLength(rPrefix.getLength());
+ sal_Int32 nPrefixLength(rPrefix.size());
std::u16string_view sTemp(rString.substr(nPrefixLength));
sal_Int32 nIndex(o3tl::toInt32(sTemp));
if (nIndex > 0 && o3tl::make_unsigned(nIndex-1) < aStyleNames.size() && aStyleNames.at(nIndex - 1) == rString)
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.hxx b/sc/source/filter/xml/XMLStylesExportHelper.hxx
index 844ffc4185a1..9a8b9a240a80 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.hxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.hxx
@@ -172,7 +172,7 @@ public:
void SetColDefaults(const ScMyDefaultStyleList* pDefaults) { pColDefaults = pDefaults; }
void AddNewTable(const sal_Int32 nTable);
bool AddStyleName(const OUString& rString, sal_Int32& rIndex, const bool bIsAutoStyle = true);
- sal_Int32 GetIndexOfStyleName(std::u16string_view rString, const OUString& rPrefix, bool& bIsAutoStyle);
+ sal_Int32 GetIndexOfStyleName(std::u16string_view rString, std::u16string_view rPrefix, bool& bIsAutoStyle);
// does not delete ranges
sal_Int32 GetStyleNameIndex(const sal_Int32 nTable, const sal_Int32 nColumn, const sal_Int32 nRow,
bool& bIsAutoStyle) const;
@@ -197,7 +197,7 @@ public:
virtual void AddNewTable(const sal_Int32 nTable, const sal_Int32 nFields) = 0;
sal_Int32 AddStyleName(const OUString & rString);
- sal_Int32 GetIndexOfStyleName(std::u16string_view rString, const OUString& rPrefix);
+ sal_Int32 GetIndexOfStyleName(std::u16string_view rString, std::u16string_view rPrefix);
OUString& GetStyleNameByIndex(const sal_Int32 nIndex);
};
diff --git a/sc/source/filter/xml/XMLTableShapeResizer.cxx b/sc/source/filter/xml/XMLTableShapeResizer.cxx
index 0ff302346f29..31ee2568f55b 100644
--- a/sc/source/filter/xml/XMLTableShapeResizer.cxx
+++ b/sc/source/filter/xml/XMLTableShapeResizer.cxx
@@ -54,9 +54,9 @@ bool ScMyOLEFixer::IsOLE(const uno::Reference< drawing::XShape >& rShape)
void ScMyOLEFixer::CreateChartListener(ScDocument& rDoc,
const OUString& rName,
- const OUString& rRangeList)
+ std::u16string_view rRangeList)
{
- if (rRangeList.isEmpty())
+ if (rRangeList.empty())
{
rDoc.AddOLEObjectToCollection(rName);
return;
diff --git a/sc/source/filter/xml/XMLTableShapeResizer.hxx b/sc/source/filter/xml/XMLTableShapeResizer.hxx
index 2455db7e824a..5bd213def13f 100644
--- a/sc/source/filter/xml/XMLTableShapeResizer.hxx
+++ b/sc/source/filter/xml/XMLTableShapeResizer.hxx
@@ -42,7 +42,7 @@ class ScMyOLEFixer
void CreateChartListener(ScDocument& rDoc,
const OUString& rName,
- const OUString& rRangeList);
+ std::u16string_view rRangeList);
public:
explicit ScMyOLEFixer(ScXMLImport& rImport);
~ScMyOLEFixer();
diff --git a/sc/source/filter/xml/celltextparacontext.cxx b/sc/source/filter/xml/celltextparacontext.cxx
index b8c204dbe2d4..26293e7d8db9 100644
--- a/sc/source/filter/xml/celltextparacontext.cxx
+++ b/sc/source/filter/xml/celltextparacontext.cxx
@@ -82,9 +82,9 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLCellTextParaContex
return nullptr;
}
-void ScXMLCellTextParaContext::PushSpan(const OUString& rSpan, const OUString& rStyleName)
+void ScXMLCellTextParaContext::PushSpan(std::u16string_view aSpan, const OUString& rStyleName)
{
- mrParentCxt.PushParagraphSpan(rSpan, rStyleName);
+ mrParentCxt.PushParagraphSpan(aSpan, rStyleName);
}
void ScXMLCellTextParaContext::PushFieldSheetName(const OUString& rStyleName)
@@ -344,7 +344,7 @@ void ScXMLCellFieldSContext::PushSpaces()
if (mnCount > 0)
{
if (mnCount == 1)
- mrParentCxt.PushSpan(" ", maStyleName);
+ mrParentCxt.PushSpan(u" ", maStyleName);
else
{
OUStringBuffer aBuf( mnCount);
diff --git a/sc/source/filter/xml/celltextparacontext.hxx b/sc/source/filter/xml/celltextparacontext.hxx
index 65b1036d645e..8a230c56f1bd 100644
--- a/sc/source/filter/xml/celltextparacontext.hxx
+++ b/sc/source/filter/xml/celltextparacontext.hxx
@@ -29,7 +29,7 @@ public:
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
- void PushSpan(const OUString& rSpan, const OUString& rStyleName);
+ void PushSpan(std::u16string_view aSpan, const OUString& rStyleName);
void PushFieldSheetName(const OUString& rStyleName);
void PushFieldDate(const OUString& rStyleName);
void PushFieldTitle(const OUString& rStyleName);
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 89994f2e61e5..7ae3aaaa6e35 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -310,10 +310,10 @@ bool cellExists( const ScDocument& rDoc, const ScAddress& rCellPos )
}
-void ScXMLTableRowCellContext::PushParagraphSpan(const OUString& rSpan, const OUString& rStyleName)
+void ScXMLTableRowCellContext::PushParagraphSpan(std::u16string_view rSpan, const OUString& rStyleName)
{
sal_Int32 nBegin = maParagraph.getLength();
- sal_Int32 nEnd = nBegin + rSpan.getLength();
+ sal_Int32 nEnd = nBegin + rSpan.size();
maParagraph.append(rSpan);
PushFormat(nBegin, nEnd, rStyleName);
diff --git a/sc/source/filter/xml/xmlcelli.hxx b/sc/source/filter/xml/xmlcelli.hxx
index 74fe71029a9e..73d839e69244 100644
--- a/sc/source/filter/xml/xmlcelli.hxx
+++ b/sc/source/filter/xml/xmlcelli.hxx
@@ -136,7 +136,7 @@ public:
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
- void PushParagraphSpan(const OUString& rSpan, const OUString& rStyleName);
+ void PushParagraphSpan(std::u16string_view rSpan, const OUString& rStyleName);
void PushParagraphFieldDate(const OUString& rStyleName);
void PushParagraphFieldSheetName(const OUString& rStyleName);
void PushParagraphFieldDocTitle(const OUString& rStyleName);
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 5f654392c478..467b8820db55 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -844,7 +844,7 @@ sal_Int32 ScXMLImport::SetCurrencySymbol(const sal_Int32 nKey, std::u16string_vi
return nKey;
}
-bool ScXMLImport::IsCurrencySymbol(const sal_Int32 nNumberFormat, const OUString& sCurrentCurrency, std::u16string_view sBankSymbol)
+bool ScXMLImport::IsCurrencySymbol(const sal_Int32 nNumberFormat, std::u16string_view sCurrentCurrency, std::u16string_view sBankSymbol)
{
uno::Reference <util::XNumberFormatsSupplier> xNumberFormatsSupplier(GetNumberFormatsSupplier());
if (xNumberFormatsSupplier.is())
@@ -869,7 +869,7 @@ bool ScXMLImport::IsCurrencySymbol(const sal_Int32 nNumberFormat, const OUString
// sCurrentCurrency is the ISO code obtained through
// XMLNumberFormatAttributesExportHelper::GetCellType()
// and sBankSymbol is the currency symbol.
- if (sCurrentCurrency.getLength() == 3 && sBankSymbol == sTemp)
+ if (sCurrentCurrency.size() == 3 && sBankSymbol == sTemp)
return true;
// #i61657# This may be a legacy currency symbol that changed in the meantime.
if (SvNumberFormatter::GetLegacyOnlyCurrencyEntry( sCurrentCurrency, sBankSymbol) != nullptr)
@@ -1185,14 +1185,14 @@ void SAL_CALL ScXMLImport::startDocument()
UnlockSolarMutex();
}
-sal_Int32 ScXMLImport::GetRangeType(const OUString& sRangeType)
+sal_Int32 ScXMLImport::GetRangeType(std::u16string_view sRangeType)
{
sal_Int32 nRangeType(0);
OUStringBuffer sBuffer;
- sal_Int32 i = 0;
- while (i <= sRangeType.getLength())
+ size_t i = 0;
+ while (i <= sRangeType.size())
{
- if ((i == sRangeType.getLength()) || (sRangeType[i] == ' '))
+ if ((i == sRangeType.size()) || (sRangeType[i] == ' '))
{
OUString sTemp = sBuffer.makeStringAndClear();
if (sTemp == "repeat-column")
@@ -1204,7 +1204,7 @@ sal_Int32 ScXMLImport::GetRangeType(const OUString& sRangeType)
else if (sTemp == SC_PRINT_RANGE)
nRangeType |= sheet::NamedRangeFlag::PRINT_AREA;
}
- else if (i < sRangeType.getLength())
+ else if (i < sRangeType.size())
sBuffer.append(sRangeType[i]);
++i;
}
diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx
index 79c2dd9e4d75..4481b5ebdb40 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -249,7 +249,7 @@ public:
ScMyStylesImportHelper* GetStylesImportHelper() { return pStylesImportHelper.get(); }
sal_Int32 SetCurrencySymbol(const sal_Int32 nKey, std::u16string_view rCurrency);
- bool IsCurrencySymbol(const sal_Int32 nNumberFormat, const OUString& sCurrencySymbol, std::u16string_view sBankSymbol);
+ bool IsCurrencySymbol(const sal_Int32 nNumberFormat, std::u16string_view sCurrencySymbol, std::u16string_view sBankSymbol);
void SetType(const css::uno::Reference <css::beans::XPropertySet>& rProperties,
sal_Int32& rNumberFormat,
const sal_Int16 nCellType,
@@ -300,7 +300,7 @@ public:
void SetRangeOverflowType(ErrCode nType);
- static sal_Int32 GetRangeType(const OUString& sRangeType);
+ static sal_Int32 GetRangeType(std::u16string_view sRangeType);
void SetNamedRanges();
void SetSheetNamedRanges();
void SetLabelRanges();
diff --git a/sc/source/filter/xml/xmlsorti.cxx b/sc/source/filter/xml/xmlsorti.cxx
index 4d33341df002..a405d4a2c815 100644
--- a/sc/source/filter/xml/xmlsorti.cxx
+++ b/sc/source/filter/xml/xmlsorti.cxx
@@ -163,7 +163,7 @@ void SAL_CALL ScXMLSortContext::endFastElement( sal_Int32 /*nElement*/ )
pDatabaseRangeContext->SetSortSequence(aSortDescriptor);
}
-void ScXMLSortContext::AddSortField(std::u16string_view sFieldNumber, const OUString& sDataType, std::u16string_view sOrder)
+void ScXMLSortContext::AddSortField(std::u16string_view sFieldNumber, std::u16string_view sDataType, std::u16string_view sOrder)
{
util::SortField aSortField;
aSortField.Field = o3tl::toInt32(sFieldNumber);
@@ -171,13 +171,13 @@ void ScXMLSortContext::AddSortField(std::u16string_view sFieldNumber, const OUSt
aSortField.SortAscending = true;
else
aSortField.SortAscending = false;
- if (sDataType.getLength() > 8)
+ if (sDataType.size() > 8)
{
- std::u16string_view sTemp = sDataType.subView(0, 8);
+ std::u16string_view sTemp = sDataType.substr(0, 8);
if (sTemp == u"UserList")
{
bEnabledUserList = true;
- sTemp = sDataType.subView(8);
+ sTemp = sDataType.substr(8);
nUserListIndex = static_cast<sal_Int16>(o3tl::toInt32(sTemp));
}
else
diff --git a/sc/source/filter/xml/xmlsorti.hxx b/sc/source/filter/xml/xmlsorti.hxx
index 5b927f2d5b8c..cc5e99e93de8 100644
--- a/sc/source/filter/xml/xmlsorti.hxx
+++ b/sc/source/filter/xml/xmlsorti.hxx
@@ -56,7 +56,7 @@ public:
virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
- void AddSortField(std::u16string_view sFieldNumber, const OUString& sDataType, std::u16string_view sOrder);
+ void AddSortField(std::u16string_view sFieldNumber, std::u16string_view sDataType, std::u16string_view sOrder);
};
class ScXMLSortByContext : public ScXMLImportContext
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index ecca9785185c..0d8274e3cc59 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -159,7 +159,7 @@ OUString getExactMatch(const ScTypedCaseStrSet& rDataSet, const OUString& rStrin
// This assumes that rResults is a sorted ring w.r.t ScTypedStrData::LessCaseInsensitive() or
// in the reverse direction, whose origin is specified by nRingOrigin.
-sal_Int32 getLongestCommonPrefixLength(const std::vector<OUString>& rResults, const OUString& rUserEntry, sal_Int32 nRingOrigin)
+sal_Int32 getLongestCommonPrefixLength(const std::vector<OUString>& rResults, std::u16string_view aUserEntry, sal_Int32 nRingOrigin)
{
sal_Int32 nResults = rResults.size();
if (!nResults)
@@ -168,7 +168,7 @@ sal_Int32 getLongestCommonPrefixLength(const std::vector<OUString>& rResults, co
if (nResults == 1)
return rResults[0].getLength();
- sal_Int32 nMinLen = rUserEntry.getLength();
+ sal_Int32 nMinLen = aUserEntry.size();
sal_Int32 nLastIdx = nRingOrigin ? nRingOrigin - 1 : nResults - 1;
const OUString& rFirst = rResults[nRingOrigin];
const OUString& rLast = rResults[nLastIdx];
@@ -3005,12 +3005,12 @@ void ScInputHandler::SetMode( ScInputMode eNewMode, const OUString* pInitText, S
/**
* @return true if rString only contains digits (no autocorrect then)
*/
-static bool lcl_IsNumber(const OUString& rString)
+static bool lcl_IsNumber(std::u16string_view aString)
{
- sal_Int32 nLen = rString.getLength();
- for (sal_Int32 i=0; i<nLen; i++)
+ size_t nLen = aString.size();
+ for (size_t i=0; i<nLen; i++)
{
- sal_Unicode c = rString[i];
+ sal_Unicode c = aString[i];
if ( c < '0' || c > '9' )
return false;
}
@@ -4551,7 +4551,7 @@ void ScInputHandler::InputSetSelection( sal_Int32 nStart, sal_Int32 nEnd )
bModified = true;
}
-void ScInputHandler::InputReplaceSelection( const OUString& rStr )
+void ScInputHandler::InputReplaceSelection( std::u16string_view aStr )
{
if (!pRefViewSh)
pRefViewSh = pActiveViewSh;
@@ -4559,13 +4559,13 @@ void ScInputHandler::InputReplaceSelection( const OUString& rStr )
OSL_ENSURE(nFormSelEnd>=nFormSelStart,"Selection broken...");
sal_Int32 nOldLen = nFormSelEnd - nFormSelStart;
- sal_Int32 nNewLen = rStr.getLength();
+ sal_Int32 nNewLen = aStr.size();
OUStringBuffer aBuf(aFormText);
if (nOldLen)
aBuf.remove(nFormSelStart, nOldLen);
if (nNewLen)
- aBuf.insert(nFormSelStart, rStr);
+ aBuf.insert(nFormSelStart, aStr);
aFormText = aBuf.makeStringAndClear();
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index e777e1b5d325..18aa0845088c 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1462,11 +1462,11 @@ void ScModule::InputSetSelection( sal_Int32 nStart, sal_Int32 nEnd )
pHdl->InputSetSelection( nStart, nEnd );
}
-void ScModule::InputReplaceSelection( const OUString& rStr )
+void ScModule::InputReplaceSelection( std::u16string_view aStr )
{
ScInputHandler* pHdl = GetInputHdl();
if (pHdl)
- pHdl->InputReplaceSelection( rStr );
+ pHdl->InputReplaceSelection( aStr );
}
void ScModule::InputTurnOffWinEngine()
diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx
index 067798b7cd8b..1506a0c2a2b3 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -257,7 +257,7 @@ public:
// Communication with the autopilot function
void InputGetSelection ( sal_Int32& rStart, sal_Int32& rEnd );
void InputSetSelection ( sal_Int32 nStart, sal_Int32 nEnd );
- void InputReplaceSelection ( const OUString& rStr );
+ void InputReplaceSelection ( std::u16string_view aStr );
void InputTurnOffWinEngine();
bool IsFormulaMode() const { return bFormulaMode; }
diff --git a/sc/source/ui/inc/tpformula.hxx b/sc/source/ui/inc/tpformula.hxx
index abc14f4fde58..f920c7bb8be7 100644
--- a/sc/source/ui/inc/tpformula.hxx
+++ b/sc/source/ui/inc/tpformula.hxx
@@ -43,7 +43,7 @@ private:
void UpdateCustomCalcRadioButtons(bool bDefault);
void LaunchCustomCalcSettings();
- bool IsValidSeparator(const OUString& rSep, bool bArray) const;
+ bool IsValidSeparator(std::u16string_view aSep, bool bArray) const;
DECL_LINK(ButtonHdl, weld::Button&, void);
DECL_LINK(ToggleHdl, weld::Toggleable&, void);
diff --git a/sc/source/ui/optdlg/tpformula.cxx b/sc/source/ui/optdlg/tpformula.cxx
index 8f5855cc916f..1d894fffe8e3 100644
--- a/sc/source/ui/optdlg/tpformula.cxx
+++ b/sc/source/ui/optdlg/tpformula.cxx
@@ -130,13 +130,13 @@ void ScTpFormulaOptions::LaunchCustomCalcSettings()
}
}
-bool ScTpFormulaOptions::IsValidSeparator(const OUString& rSep, bool bArray) const
+bool ScTpFormulaOptions::IsValidSeparator(std::u16string_view aSep, bool bArray) const
{
- if (rSep.getLength() != 1)
+ if (aSep.size() != 1)
// Must be one-character long.
return false;
- const sal_Unicode c = rSep[0];
+ const sal_Unicode c = aSep[0];
if (c == mnDecSep)
// decimal separator is not allowed.
diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx
index e02e384ff852..b90a3a664ba2 100644
--- a/sc/source/ui/pagedlg/areasdlg.cxx
+++ b/sc/source/ui/pagedlg/areasdlg.cxx
@@ -19,6 +19,7 @@
#include <rangelst.hxx>
+#include <o3tl/string_view.hxx>
#include <sfx2/dispatch.hxx>
#include <svl/stritem.hxx>
#include <vcl/svapp.hxx>
@@ -62,7 +63,7 @@ namespace
// global functions (->at the end of the file):
-static bool lcl_CheckRepeatString( const OUString& rStr, const ScDocument& rDoc, bool bIsRow, ScRange* pRange );
+static bool lcl_CheckRepeatString( std::u16string_view aStr, const ScDocument& rDoc, bool bIsRow, ScRange* pRange );
static void lcl_GetRepeatRangeString( std::optional<ScRange> oRange, const ScDocument& rDoc, bool bIsRow, OUString& rStr );
#if 0
@@ -630,23 +631,23 @@ static bool lcl_CheckOne_XL_A1( const ScDocument& rDoc, const OUString& rStr, bo
return lcl_CheckOne_OOO(rDoc, rStr, bIsRow, rVal);
}
-static bool lcl_CheckOne_XL_R1C1( const ScDocument& rDoc, const OUString& rStr, bool bIsRow, SCCOLROW& rVal )
+static bool lcl_CheckOne_XL_R1C1( const ScDocument& rDoc, std::u16string_view aStr, bool bIsRow, SCCOLROW& rVal )
{
- sal_Int32 nLen = rStr.getLength();
+ sal_Int32 nLen = aStr.size();
if (nLen <= 1)
// There must be at least two characters.
return false;
const sal_Unicode preUpper = bIsRow ? 'R' : 'C';
const sal_Unicode preLower = bIsRow ? 'r' : 'c';
- if (rStr[0] != preUpper && rStr[0] != preLower)
+ if (aStr[0] != preUpper && aStr[0] != preLower)
return false;
- OUString aNumStr = rStr.copy(1);
+ std::u16string_view aNumStr = aStr.substr(1);
if (!CharClass::isAsciiNumeric(aNumStr))
return false;
- sal_Int32 nNum = aNumStr.toInt32();
+ sal_Int32 nNum = o3tl::toInt32(aNumStr);
if (nNum <= 0)
return false;
@@ -677,7 +678,7 @@ static bool lcl_CheckRepeatOne( const ScDocument& rDoc, const OUString& rStr, fo
return false;
}
-static bool lcl_CheckRepeatString( const OUString& rStr, const ScDocument& rDoc, bool bIsRow, ScRange* pRange )
+static bool lcl_CheckRepeatString( std::u16string_view aStr, const ScDocument& rDoc, bool bIsRow, ScRange* pRange )
{
// Row: [valid row] rsep [valid row]
// Col: [valid col] rsep [valid col]
@@ -696,11 +697,11 @@ static bool lcl_CheckRepeatString( const OUString& rStr, const ScDocument& rDoc,
OUString aBuf;
SCCOLROW nVal = 0;
- sal_Int32 nLen = rStr.getLength();
+ sal_Int32 nLen = aStr.size();
bool bEndPos = false;
for( sal_Int32 i = 0; i < nLen; ++i )
{
- const sal_Unicode c = rStr[i];
+ const sal_Unicode c = aStr[i];
if (c == rsep)
{
if (bEndPos)
diff --git a/sc/source/ui/uitest/uiobject.cxx b/sc/source/ui/uitest/uiobject.cxx
index 58722b50e831..e0671110fecc 100644
--- a/sc/source/ui/uitest/uiobject.cxx
+++ b/sc/source/ui/uitest/uiobject.cxx
@@ -35,19 +35,19 @@
namespace {
-ScAddress get_address_from_string(const ScDocument& rDoc, const OUString& rStr)
+ScAddress get_address_from_string(const ScDocument& rDoc, std::u16string_view aStr)
{
ScAddress aAddr;
sal_Int32 nOffset = 0;
- ScRangeStringConverter::GetAddressFromString(aAddr, rStr, rDoc, formula::FormulaGrammar::CONV_OOO, nOffset);
+ ScRangeStringConverter::GetAddressFromString(aAddr, aStr, rDoc, formula::FormulaGrammar::CONV_OOO, nOffset);
return aAddr;
}
-ScRange get_range_from_string(const ScDocument& rDoc, const OUString& rStr)
+ScRange get_range_from_string(const ScDocument& rDoc, std::u16string_view aStr)
{
ScRange aRange;
sal_Int32 nOffset = 0;
- ScRangeStringConverter::GetRangeFromString(aRange, rStr, rDoc, formula::FormulaGrammar::CONV_OOO, nOffset);
+ ScRangeStringConverter::GetRangeFromString(aRange, aStr, rDoc, formula::FormulaGrammar::CONV_OOO, nOffset);
return aRange;
}
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index ebca0e7148c6..802d8ad3cd3c 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -4009,7 +4009,7 @@ rtl::Reference<ScTableColumnObj> ScTableColumnsObj::GetObjectByIndex_Impl(sal_In
return nullptr; // wrong index
}
-rtl::Reference<ScTableColumnObj> ScTableColumnsObj::GetObjectByName_Impl(const OUString& aName) const
+rtl::Reference<ScTableColumnObj> ScTableColumnsObj::GetObjectByName_Impl(std::u16string_view aName) const
{
SCCOL nCol = 0;
if (pDocShell && ::AlphaToCol(pDocShell->GetDocument(), nCol, aName))