diff options
36 files changed, 166 insertions, 165 deletions
diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx index 1dc1382643d0..8140864171eb 100644 --- a/include/vcl/filter/PDFiumLibrary.hxx +++ b/include/vcl/filter/PDFiumLibrary.hxx @@ -233,7 +233,7 @@ struct VCL_DLLPUBLIC PDFiumLibrary final // Tools -VCL_DLLPUBLIC OUString convertPdfDateToISO8601(OUString const& rInput); +VCL_DLLPUBLIC OUString convertPdfDateToISO8601(std::u16string_view rInput); } // namespace vcl::pdf diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index d217b786bd15..928f49c3d614 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1137,7 +1137,7 @@ public: bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& rVector ) const; - sal_Int32 HasGlyphs( const vcl::Font& rFont, const OUString& rStr, + sal_Int32 HasGlyphs( const vcl::Font& rFont, std::u16string_view rStr, sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const; tools::Long GetMinKashida() const; diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 34da05a642da..d1543df7dde2 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -1076,7 +1076,7 @@ The following structure describes the permissions used in PDF security @returns the new structure element's id for use in SetCurrentStructureElement */ - sal_Int32 BeginStructureElement( enum StructElement eType, const OUString& rAlias ); + sal_Int32 BeginStructureElement( enum StructElement eType, std::u16string_view rAlias ); /** end the current logical structure element Close the current structure element. The current element's diff --git a/include/vcl/textview.hxx b/include/vcl/textview.hxx index 9b7255db8638..903e1b4fae2a 100644 --- a/include/vcl/textview.hxx +++ b/include/vcl/textview.hxx @@ -105,7 +105,7 @@ class VCL_DLLPUBLIC TextView final : public vcl::unohelper::DragAndDropClient void ImpShowDDCursor(); bool ImplTruncateNewText( OUString& rNewText ) const; - bool ImplCheckTextLen( const OUString& rNewText ) const; + bool ImplCheckTextLen( std::u16string_view rNewText ) const; // DragAndDropClient virtual void dragGestureRecognized( const css::datatransfer::dnd::DragGestureEvent& dge ) override; diff --git a/vcl/inc/font/PhysicalFontCollection.hxx b/vcl/inc/font/PhysicalFontCollection.hxx index 595e9568d1af..d791f7b6927f 100644 --- a/vcl/inc/font/PhysicalFontCollection.hxx +++ b/vcl/inc/font/PhysicalFontCollection.hxx @@ -61,7 +61,7 @@ public: vcl::font::PhysicalFontFamily* FindFontFamily( vcl::font::FontSelectPattern& ) const; vcl::font::PhysicalFontFamily* FindFontFamilyByTokenNames(std::u16string_view rTokenStr) const; vcl::font::PhysicalFontFamily* FindFontFamilyByAttributes(ImplFontAttrs nSearchType, FontWeight, FontWidth, - FontItalic, const OUString& rSearchFamily) const; + FontItalic, std::u16string_view rSearchFamily) const; // suggest fonts for glyph fallback vcl::font::PhysicalFontFamily* GetGlyphFallbackFont( vcl::font::FontSelectPattern&, diff --git a/vcl/inc/fontattributes.hxx b/vcl/inc/fontattributes.hxx index 352ea10e3a1c..23fd15955404 100644 --- a/vcl/inc/fontattributes.hxx +++ b/vcl/inc/fontattributes.hxx @@ -66,7 +66,7 @@ public: void SetQuality( int nQuality ) { mnQuality = nQuality; } void IncreaseQualityBy( int nQualityAmount ) { mnQuality += nQualityAmount; } - void AddMapName( OUString const& ); + void AddMapName( std::u16string_view ); private: // device independent variables @@ -105,14 +105,14 @@ inline void FontAttributes::SetSymbolFlag( const bool bSymbolFlag ) } } -inline void FontAttributes::AddMapName( OUString const & aMapName ) +inline void FontAttributes::AddMapName( std::u16string_view aMapName ) { if( maMapNames.getLength() > 0 ) { maMapNames += ";"; } - if (aMapName.getLength() == 0) + if (aMapName.size() == 0) { SAL_WARN("vcl.fonts", "New map name is empty"); return; diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx index 5e25023fd452..942d57a26fbb 100644 --- a/vcl/inc/pdf/pdfwriter_impl.hxx +++ b/vcl/inc/pdf/pdfwriter_impl.hxx @@ -1278,7 +1278,7 @@ public: // notes void createNote( const tools::Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr ); // structure elements - sal_Int32 beginStructureElement( PDFWriter::StructElement eType, const OUString& rAlias ); + sal_Int32 beginStructureElement( PDFWriter::StructElement eType, std::u16string_view rAlias ); void endStructureElement(); bool setCurrentStructureElement( sal_Int32 nElement ); bool setStructureAttribute( enum PDFWriter::StructAttribute eAttr, enum PDFWriter::StructAttributeValue eVal ); diff --git a/vcl/inc/ppdparser.hxx b/vcl/inc/ppdparser.hxx index be5c64feab01..7999957b7e68 100644 --- a/vcl/inc/ppdparser.hxx +++ b/vcl/inc/ppdparser.hxx @@ -219,7 +219,7 @@ public: // helper function OUString translateKey( const OUString& i_rKey ) const; - OUString translateOption( const OUString& i_rKey, + OUString translateOption( std::u16string_view i_rKey, const OUString& i_rOption ) const; }; diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index 0210161b83d2..0ceb8dfa719f 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -143,7 +143,7 @@ private: void ApplyDXArray(const double*, const sal_Bool*); void Justify(DeviceCoordinate nNewWidth); - void ApplyAsianKerning(const OUString& rStr); + void ApplyAsianKerning(std::u16string_view rStr); void GetCharWidths(std::vector<DeviceCoordinate>& rCharWidths, const OUString& rStr) const; diff --git a/vcl/qa/cppunit/PDFiumLibraryTest.cxx b/vcl/qa/cppunit/PDFiumLibraryTest.cxx index ea662d2b3dae..c933273bc147 100644 --- a/vcl/qa/cppunit/PDFiumLibraryTest.cxx +++ b/vcl/qa/cppunit/PDFiumLibraryTest.cxx @@ -433,7 +433,7 @@ void PDFiumLibraryTest::testAnnotationsDifferentTypes() void PDFiumLibraryTest::testTools() { - OUString sConverted = vcl::pdf::convertPdfDateToISO8601("D:20200612201322+02'00"); + OUString sConverted = vcl::pdf::convertPdfDateToISO8601(u"D:20200612201322+02'00"); css::util::DateTime aDateTime; CPPUNIT_ASSERT(utl::ISO8601parseDateTime(sConverted, aDateTime)); diff --git a/vcl/qa/cppunit/physicalfontcollection.cxx b/vcl/qa/cppunit/physicalfontcollection.cxx index 0d79c0f8fde5..9bea5f7adf52 100644 --- a/vcl/qa/cppunit/physicalfontcollection.cxx +++ b/vcl/qa/cppunit/physicalfontcollection.cxx @@ -169,7 +169,7 @@ void VclPhysicalFontCollectionTest::testShouldFindNoFamilyWithWorthlessAttribute aFontCollection.FindOrCreateFontFamily(GetEnglishSearchFontName(u"Test Font Family Name")); CPPUNIT_ASSERT(!aFontCollection.FindFontFamilyByAttributes(ImplFontAttrs::None, WEIGHT_NORMAL, - WIDTH_NORMAL, ITALIC_NONE, "")); + WIDTH_NORMAL, ITALIC_NONE, u"")); } void VclPhysicalFontCollectionTest::testShouldFindCJKFamily() @@ -182,7 +182,7 @@ void VclPhysicalFontCollectionTest::testShouldFindCJKFamily() AddNormalFontFace(pFontFamily, u"시험"); vcl::font::PhysicalFontFamily* pCJKFamily = aFontCollection.FindFontFamilyByAttributes( - ImplFontAttrs::CJK, WEIGHT_NORMAL, WIDTH_NORMAL, ITALIC_NORMAL, ""); + ImplFontAttrs::CJK, WEIGHT_NORMAL, WIDTH_NORMAL, ITALIC_NORMAL, u""); CPPUNIT_ASSERT_MESSAGE("family not found", pCJKFamily); CPPUNIT_ASSERT_EQUAL_MESSAGE("cjk family not found", GetEnglishSearchFontName(u"시험"), pCJKFamily->GetSearchName()); @@ -197,7 +197,7 @@ void VclPhysicalFontCollectionTest::testShouldNotFindCJKFamily() CPPUNIT_ASSERT_MESSAGE("family found", !aFontCollection.FindFontFamilyByAttributes( - ImplFontAttrs::CJK, WEIGHT_NORMAL, WIDTH_NORMAL, ITALIC_NONE, "")); + ImplFontAttrs::CJK, WEIGHT_NORMAL, WIDTH_NORMAL, ITALIC_NONE, u"")); } void VclPhysicalFontCollectionTest::testShouldFindStarsymbolFamily() @@ -210,7 +210,7 @@ void VclPhysicalFontCollectionTest::testShouldFindStarsymbolFamily() CPPUNIT_ASSERT_MESSAGE("starsymbol created", pFontFamily); vcl::font::PhysicalFontFamily* pStarsymbolFamily = aFontCollection.FindFontFamilyByAttributes( - ImplFontAttrs::Symbol, WEIGHT_NORMAL, WIDTH_NORMAL, ITALIC_NORMAL, ""); + ImplFontAttrs::Symbol, WEIGHT_NORMAL, WIDTH_NORMAL, ITALIC_NORMAL, u""); CPPUNIT_ASSERT_MESSAGE("family not found", pStarsymbolFamily); CPPUNIT_ASSERT_EQUAL_MESSAGE("starsymbol family not found", OUString("starsymbol"), pStarsymbolFamily->GetSearchName()); @@ -229,7 +229,7 @@ void VclPhysicalFontCollectionTest::testShouldFindOpensymbolFamilyWithMultipleSy AddNormalFontFace(pWingDingsFontFamily, "wingdings"); vcl::font::PhysicalFontFamily* pStarsymbolFamily = aFontCollection.FindFontFamilyByAttributes( - ImplFontAttrs::Symbol, WEIGHT_NORMAL, WIDTH_NORMAL, ITALIC_NORMAL, ""); + ImplFontAttrs::Symbol, WEIGHT_NORMAL, WIDTH_NORMAL, ITALIC_NORMAL, u""); CPPUNIT_ASSERT_MESSAGE("family not found", pStarsymbolFamily); CPPUNIT_ASSERT_EQUAL_MESSAGE("opensymbol family not found", OUString("opensymbol"), pStarsymbolFamily->GetSearchName()); @@ -244,7 +244,7 @@ void VclPhysicalFontCollectionTest::testShouldFindSymboltypeFamily() AddNormalFontFace(pFontFamily, "testsymbol"); vcl::font::PhysicalFontFamily* pSymbolFamily = aFontCollection.FindFontFamilyByAttributes( - ImplFontAttrs::Symbol, WEIGHT_NORMAL, WIDTH_NORMAL, ITALIC_NORMAL, ""); + ImplFontAttrs::Symbol, WEIGHT_NORMAL, WIDTH_NORMAL, ITALIC_NORMAL, u""); CPPUNIT_ASSERT_MESSAGE("family not found", pSymbolFamily); CPPUNIT_ASSERT_EQUAL_MESSAGE("test symbol family not found", OUString("testsymbol"), pSymbolFamily->GetSearchName()); @@ -264,7 +264,7 @@ void VclPhysicalFontCollectionTest::testShouldFindSymbolFamilyByMatchType() pFontFamily->AddFontFace(new TestFontFace(aFontAttr, FONTID)); vcl::font::PhysicalFontFamily* pSymbolFamily = aFontCollection.FindFontFamilyByAttributes( - ImplFontAttrs::Symbol, WEIGHT_NORMAL, WIDTH_NORMAL, ITALIC_NORMAL, ""); + ImplFontAttrs::Symbol, WEIGHT_NORMAL, WIDTH_NORMAL, ITALIC_NORMAL, u""); CPPUNIT_ASSERT_MESSAGE("family not found", pSymbolFamily); CPPUNIT_ASSERT_EQUAL_MESSAGE("test symbol family not found", OUString("symbols"), pSymbolFamily->GetSearchName()); @@ -286,7 +286,7 @@ void VclPhysicalFontCollectionTest::testImpossibleSymbolFamily() CPPUNIT_ASSERT_MESSAGE("match for family not possible, but was found anyway", !aFontCollection.FindFontFamilyByAttributes(ImplFontAttrs::Normal, WEIGHT_NORMAL, WIDTH_NORMAL, - ITALIC_NORMAL, "")); + ITALIC_NORMAL, u"")); } void VclPhysicalFontCollectionTest::testShouldNotFindSymbolFamily() @@ -297,7 +297,7 @@ void VclPhysicalFontCollectionTest::testShouldNotFindSymbolFamily() CPPUNIT_ASSERT_MESSAGE( "Family found", !aFontCollection.FindFontFamilyByAttributes( - ImplFontAttrs::Normal, WEIGHT_NORMAL, WIDTH_NORMAL, ITALIC_NONE, "")); + ImplFontAttrs::Normal, WEIGHT_NORMAL, WIDTH_NORMAL, ITALIC_NONE, u"")); } void VclPhysicalFontCollectionTest::testShouldMatchFamilyName() @@ -313,7 +313,7 @@ void VclPhysicalFontCollectionTest::testShouldMatchFamilyName() CPPUNIT_ASSERT_MESSAGE("No family found", aFontCollection.FindFontFamilyByAttributes( ImplFontAttrs::Normal, WEIGHT_NORMAL, WIDTH_NORMAL, ITALIC_NONE, - "Matching family name")); + u"Matching family name")); } void VclPhysicalFontCollectionTest::testShouldMatchBrushScriptFamily() @@ -325,7 +325,7 @@ void VclPhysicalFontCollectionTest::testShouldMatchBrushScriptFamily() CPPUNIT_ASSERT_MESSAGE("Brush script family not found", aFontCollection.FindFontFamilyByAttributes(ImplFontAttrs::BrushScript, WEIGHT_NORMAL, WIDTH_NORMAL, - ITALIC_NONE, "")); + ITALIC_NONE, u"")); } void VclPhysicalFontCollectionTest::testShouldNotMatchBrushScriptFamily() @@ -338,7 +338,7 @@ void VclPhysicalFontCollectionTest::testShouldNotMatchBrushScriptFamily() CPPUNIT_ASSERT_MESSAGE("Brush script family found", !aFontCollection.FindFontFamilyByAttributes(ImplFontAttrs::BrushScript, WEIGHT_NORMAL, WIDTH_NORMAL, - ITALIC_NONE, "")); + ITALIC_NONE, u"")); } void VclPhysicalFontCollectionTest::testShouldMatchFixedFamily() @@ -397,9 +397,9 @@ void VclPhysicalFontCollectionTest::testShouldMatchSerifFamily() TestFontFace* pFontFace = new TestFontFace(aFontAttr, FONTID); pFontFamily->AddFontFace(pFontFace); - CPPUNIT_ASSERT_MESSAGE("Serif family not found", - aFontCollection.FindFontFamilyByAttributes( - ImplFontAttrs::Serif, WEIGHT_NORMAL, WIDTH_NORMAL, ITALIC_NONE, "")); + CPPUNIT_ASSERT_MESSAGE("Serif family not found", aFontCollection.FindFontFamilyByAttributes( + ImplFontAttrs::Serif, WEIGHT_NORMAL, + WIDTH_NORMAL, ITALIC_NONE, u"")); } void VclPhysicalFontCollectionTest::testShouldNotMatchSerifFamily() @@ -415,9 +415,9 @@ void VclPhysicalFontCollectionTest::testShouldNotMatchSerifFamily() TestFontFace* pFontFace = new TestFontFace(aFontAttr, FONTID); pFontFamily->AddFontFace(pFontFace); - CPPUNIT_ASSERT_MESSAGE("Serif family found", - !aFontCollection.FindFontFamilyByAttributes( - ImplFontAttrs::Serif, WEIGHT_NORMAL, WIDTH_NORMAL, ITALIC_NONE, "")); + CPPUNIT_ASSERT_MESSAGE("Serif family found", !aFontCollection.FindFontFamilyByAttributes( + ImplFontAttrs::Serif, WEIGHT_NORMAL, + WIDTH_NORMAL, ITALIC_NONE, u"")); } void VclPhysicalFontCollectionTest::testShouldMatchSansSerifFamily() @@ -436,7 +436,7 @@ void VclPhysicalFontCollectionTest::testShouldMatchSansSerifFamily() CPPUNIT_ASSERT_MESSAGE("SansSerif family not found", aFontCollection.FindFontFamilyByAttributes(ImplFontAttrs::SansSerif, WEIGHT_NORMAL, WIDTH_NORMAL, - ITALIC_NONE, "")); + ITALIC_NONE, u"")); } void VclPhysicalFontCollectionTest::testShouldNotMatchSansSerifFamily() @@ -453,7 +453,7 @@ void VclPhysicalFontCollectionTest::testShouldNotMatchSansSerifFamily() CPPUNIT_ASSERT_MESSAGE("SansSerif family found", !aFontCollection.FindFontFamilyByAttributes( ImplFontAttrs::SansSerif, WEIGHT_NORMAL, - WIDTH_NORMAL, ITALIC_NONE, "")); + WIDTH_NORMAL, ITALIC_NONE, u"")); } void VclPhysicalFontCollectionTest::testShouldMatchDecorativeFamily() @@ -472,7 +472,7 @@ void VclPhysicalFontCollectionTest::testShouldMatchDecorativeFamily() CPPUNIT_ASSERT_MESSAGE("Decorative family not found", aFontCollection.FindFontFamilyByAttributes(ImplFontAttrs::Decorative, WEIGHT_NORMAL, WIDTH_NORMAL, - ITALIC_NORMAL, "")); + ITALIC_NORMAL, u"")); } void VclPhysicalFontCollectionTest::testShouldFindTitlingFamily() @@ -484,7 +484,7 @@ void VclPhysicalFontCollectionTest::testShouldFindTitlingFamily() CPPUNIT_ASSERT_MESSAGE("Titling family not found", aFontCollection.FindFontFamilyByAttributes( ImplFontAttrs::Titling, WEIGHT_NORMAL, - WIDTH_NORMAL, ITALIC_NORMAL, "")); + WIDTH_NORMAL, ITALIC_NORMAL, u"")); } void VclPhysicalFontCollectionTest::testShouldFindCapitalsFamily() @@ -495,7 +495,7 @@ void VclPhysicalFontCollectionTest::testShouldFindCapitalsFamily() CPPUNIT_ASSERT_MESSAGE("All-caps family not found", aFontCollection.FindFontFamilyByAttributes( ImplFontAttrs::Capitals, WEIGHT_NORMAL, - WIDTH_NORMAL, ITALIC_NORMAL, "")); + WIDTH_NORMAL, ITALIC_NORMAL, u"")); } void VclPhysicalFontCollectionTest::testShouldFindFamilyName() @@ -520,7 +520,7 @@ void VclPhysicalFontCollectionTest::testShouldFindOtherStyleFamily() CPPUNIT_ASSERT_MESSAGE("Did not find font name", aFontCollection.FindFontFamilyByAttributes( ImplFontAttrs::OtherStyle, WEIGHT_NORMAL, - WIDTH_NORMAL, ITALIC_NORMAL, "")); + WIDTH_NORMAL, ITALIC_NORMAL, u"")); } void VclPhysicalFontCollectionTest::testShouldNotFindOtherStyleFamily() @@ -531,7 +531,7 @@ void VclPhysicalFontCollectionTest::testShouldNotFindOtherStyleFamily() CPPUNIT_ASSERT_MESSAGE("Found font name", !aFontCollection.FindFontFamilyByAttributes( ImplFontAttrs::OtherStyle, WEIGHT_NORMAL, - WIDTH_NORMAL, ITALIC_NORMAL, "")); + WIDTH_NORMAL, ITALIC_NORMAL, u"")); } void VclPhysicalFontCollectionTest::testShouldFindSchoolbookFamily() @@ -543,7 +543,7 @@ void VclPhysicalFontCollectionTest::testShouldFindSchoolbookFamily() CPPUNIT_ASSERT_MESSAGE("Did not find font name", aFontCollection.FindFontFamilyByAttributes( ImplFontAttrs::Schoolbook, WEIGHT_NORMAL, - WIDTH_NORMAL, ITALIC_NORMAL, "")); + WIDTH_NORMAL, ITALIC_NORMAL, u"")); } CPPUNIT_TEST_SUITE_REGISTRATION(VclPhysicalFontCollectionTest); diff --git a/vcl/qa/cppunit/physicalfontfamily.cxx b/vcl/qa/cppunit/physicalfontfamily.cxx index e3a02fb31de3..8b771822c6db 100644 --- a/vcl/qa/cppunit/physicalfontfamily.cxx +++ b/vcl/qa/cppunit/physicalfontfamily.cxx @@ -84,7 +84,7 @@ void VclPhysicalFontFamilyTest::testAddOneFontFace() FontAttributes aFontAttrs; aFontAttrs.SetFamilyName("Test font face"); - aFontAttrs.AddMapName("Alias name"); + aFontAttrs.AddMapName(u"Alias name"); aFontAttrs.SetFamilyType(FontFamily::FAMILY_ROMAN); aFontAttrs.SetPitch(FontPitch::PITCH_VARIABLE); aFontAttrs.SetItalic(FontItalic::ITALIC_NONE); @@ -111,7 +111,7 @@ void VclPhysicalFontFamilyTest::testAddTwoFontFaces() FontAttributes aFontAttrs; aFontAttrs.SetFamilyName("Test font face"); - aFontAttrs.AddMapName("Alias name"); + aFontAttrs.AddMapName(u"Alias name"); aFontAttrs.SetFamilyType(FontFamily::FAMILY_ROMAN); aFontAttrs.SetPitch(FontPitch::PITCH_VARIABLE); aFontAttrs.SetItalic(FontItalic::ITALIC_NONE); @@ -122,7 +122,7 @@ void VclPhysicalFontFamilyTest::testAddTwoFontFaces() aFamily.AddFontFace(new TestFontFace(aFontAttrs, 1)); aFontAttrs.SetFamilyName("Test font face"); - aFontAttrs.AddMapName("Alias name 2"); + aFontAttrs.AddMapName(u"Alias name 2"); aFontAttrs.SetFamilyType(FontFamily::FAMILY_ROMAN); aFontAttrs.SetPitch(FontPitch::PITCH_VARIABLE); aFontAttrs.SetItalic(FontItalic::ITALIC_NORMAL); diff --git a/vcl/source/bitmap/BitmapPopArtFilter.cxx b/vcl/source/bitmap/BitmapPopArtFilter.cxx index 39856cf8b6eb..91039feffddf 100644 --- a/vcl/source/bitmap/BitmapPopArtFilter.cxx +++ b/vcl/source/bitmap/BitmapPopArtFilter.cxx @@ -50,6 +50,7 @@ BitmapEx BitmapPopArtFilter::execute(BitmapEx const& rBitmapEx) const for (sal_Int32 nX = 0; nX < nWidth; nX++) { aPopArtTable[pWriteAcc->GetIndexFromData(pScanline, nX)].mnCount++; + assert(aPopArtTable[pWriteAcc->GetIndexFromData(pScanline, nX)].mnCount != 0); } } diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 052569ff01d0..0bd9ebab713e 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -368,8 +368,8 @@ bool ImplNumericGetValue( const OUString& rStr, sal_Int64& rValue, } void ImplUpdateSeparatorString( OUString& io_rText, - const OUString& rOldDecSep, std::u16string_view rNewDecSep, - const OUString& rOldThSep, std::u16string_view rNewThSep ) + std::u16string_view rOldDecSep, std::u16string_view rNewDecSep, + std::u16string_view rOldThSep, std::u16string_view rNewThSep ) { OUStringBuffer aBuf( io_rText.getLength() ); sal_Int32 nIndexDec = 0, nIndexTh = 0, nIndex = 0; @@ -385,13 +385,13 @@ void ImplUpdateSeparatorString( OUString& io_rText, { aBuf.append( pBuffer + nIndex, nIndexTh - nIndex ); aBuf.append( rNewThSep ); - nIndex = nIndexTh + rOldThSep.getLength(); + nIndex = nIndexTh + rOldThSep.size(); } else if( nIndexDec != -1 ) { aBuf.append( pBuffer + nIndex, nIndexDec - nIndex ); aBuf.append( rNewDecSep ); - nIndex = nIndexDec + rOldDecSep.getLength(); + nIndex = nIndexDec + rOldDecSep.size(); } else { @@ -403,8 +403,8 @@ void ImplUpdateSeparatorString( OUString& io_rText, io_rText = aBuf.makeStringAndClear(); } -void ImplUpdateSeparators( const OUString& rOldDecSep, std::u16string_view rNewDecSep, - const OUString& rOldThSep, std::u16string_view rNewThSep, +void ImplUpdateSeparators( std::u16string_view rOldDecSep, std::u16string_view rNewDecSep, + std::u16string_view rOldThSep, std::u16string_view rNewThSep, Edit* pEdit ) { bool bChangeDec = (rOldDecSep != rNewDecSep); @@ -930,11 +930,11 @@ static bool ImplMetricProcessKeyInput( const KeyEvent& rKEvt, return ImplNumericProcessKeyInput( rKEvt, false, bUseThousandSep, rWrapper ); } -static OUString ImplMetricGetUnitText(const OUString& rStr) +static OUString ImplMetricGetUnitText(std::u16string_view rStr) { // fetch unit text OUStringBuffer aStr; - for (sal_Int32 i = rStr.getLength()-1; i >= 0; --i) + for (sal_Int32 i = static_cast<sal_Int32>(rStr.size())-1; i >= 0; --i) { sal_Unicode c = rStr[i]; if ( (c == '\'') || (c == '\"') || (c == '%') || (c == 0x2032) || (c == 0x2033) || unicode::isAlpha(c) || unicode::isControl(c) ) @@ -978,7 +978,7 @@ namespace } } -static FieldUnit ImplMetricGetUnit(const OUString& rStr) +static FieldUnit ImplMetricGetUnit(std::u16string_view rStr) { OUString aStr = ImplMetricGetUnitText(rStr); return StringToMetric(aStr); diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index 89eaf795077c..bc84c381d3b7 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -325,13 +325,13 @@ static OUString ImplPatternReformat( const OUString& rStr, return aOutStr.makeStringAndClear(); } -static void ImplPatternMaxPos( const OUString& rStr, const OString& rEditMask, +static void ImplPatternMaxPos( std::u16string_view rStr, const OString& rEditMask, sal_uInt16 nFormatFlags, bool bSameMask, sal_Int32 nCursorPos, sal_Int32& rPos ) { // last position must not be longer than the contained string - sal_Int32 nMaxPos = rStr.getLength(); + sal_Int32 nMaxPos = rStr.size(); // if non empty literals are allowed ignore blanks at the end as well if ( bSameMask && !(nFormatFlags & PATTERN_FORMAT_EMPTYLITERALS) ) @@ -482,7 +482,7 @@ static sal_Int32 ImplPatternLeftPos(std::string_view rEditMask, sal_Int32 nCurso return nNewPos; } -static sal_Int32 ImplPatternRightPos( const OUString& rStr, const OString& rEditMask, +static sal_Int32 ImplPatternRightPos( std::u16string_view rStr, const OString& rEditMask, sal_uInt16 nFormatFlags, bool bSameMask, sal_Int32 nCursorPos ) { @@ -632,7 +632,7 @@ static bool ImplPatternProcessKeyInput( IEditImplementation& rEdit, const KeyEve nNewPos = ImplPatternLeftPos( rEditMask, nTempPos ); } else - nTempPos = ImplPatternRightPos( aStr.toString(), rEditMask, nFormatFlags, bSameMask, nNewPos ); + nTempPos = ImplPatternRightPos( aStr, rEditMask, nFormatFlags, bSameMask, nNewPos ); if ( nNewPos != nTempPos ) { diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx index c25b6d44ceb3..cc1c2be10a78 100644 --- a/vcl/source/edit/textdoc.cxx +++ b/vcl/source/edit/textdoc.cxx @@ -264,10 +264,10 @@ void TextNode::CollapseAttribs( sal_Int32 nIndex, sal_Int32 nDeleted ) maCharAttribs.ResortAttribs(); } -void TextNode::InsertText( sal_Int32 nPos, const OUString& rText ) +void TextNode::InsertText( sal_Int32 nPos, std::u16string_view rText ) { maText = maText.replaceAt( nPos, 0, rText ); - ExpandAttribs( nPos, rText.getLength() ); + ExpandAttribs( nPos, rText.size() ); } void TextNode::InsertText( sal_Int32 nPos, sal_Unicode c ) @@ -472,15 +472,15 @@ TextPaM TextDoc::InsertText( const TextPaM& rPaM, sal_Unicode c ) return aPaM; } -TextPaM TextDoc::InsertText( const TextPaM& rPaM, const OUString& rStr ) +TextPaM TextDoc::InsertText( const TextPaM& rPaM, std::u16string_view rStr ) { - SAL_WARN_IF( rStr.indexOf( 0x0A ) != -1, "vcl", "TextDoc::InsertText: Line separator in paragraph not allowed!" ); - SAL_WARN_IF( rStr.indexOf( 0x0D ) != -1, "vcl", "TextDoc::InsertText: Line separator in paragraph not allowed!" ); + SAL_WARN_IF( rStr.find( 0x0A ) != std::u16string_view::npos, "vcl", "TextDoc::InsertText: Line separator in paragraph not allowed!" ); + SAL_WARN_IF( rStr.find( 0x0D ) != std::u16string_view::npos, "vcl", "TextDoc::InsertText: Line separator in paragraph not allowed!" ); TextNode* pNode = maTextNodes[ rPaM.GetPara() ].get(); pNode->InsertText( rPaM.GetIndex(), rStr ); - TextPaM aPaM( rPaM.GetPara(), rPaM.GetIndex()+rStr.getLength() ); + TextPaM aPaM( rPaM.GetPara(), rPaM.GetIndex()+rStr.size() ); return aPaM; } diff --git a/vcl/source/edit/textdoc.hxx b/vcl/source/edit/textdoc.hxx index 9857c09f1033..babd9a248594 100644 --- a/vcl/source/edit/textdoc.hxx +++ b/vcl/source/edit/textdoc.hxx @@ -83,7 +83,7 @@ public: const TextCharAttribList& GetCharAttribs() const { return maCharAttribs; } TextCharAttribList& GetCharAttribs() { return maCharAttribs; } - void InsertText( sal_Int32 nPos, const OUString& rText ); + void InsertText( sal_Int32 nPos, std::u16string_view rText ); void InsertText( sal_Int32 nPos, sal_Unicode c ); void RemoveText( sal_Int32 nPos, sal_Int32 nChars ); @@ -109,7 +109,7 @@ public: void RemoveChars( const TextPaM& rPaM, sal_Int32 nChars ); TextPaM InsertText( const TextPaM& rPaM, sal_Unicode c ); - TextPaM InsertText( const TextPaM& rPaM, const OUString& rStr ); + TextPaM InsertText( const TextPaM& rPaM, std::u16string_view rStr ); TextPaM InsertParaBreak( const TextPaM& rPaM ); TextPaM ConnectParagraphs( TextNode* pLeft, const TextNode* pRight ); diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx index 78454f0ce495..128db7f7b088 100644 --- a/vcl/source/edit/textview.cxx +++ b/vcl/source/edit/textview.cxx @@ -504,7 +504,7 @@ bool TextView::KeyInput( const KeyEvent& rKeyEvent ) { if ( !mpImpl->mbReadOnly && !rKeyEvent.GetKeyCode().IsShift() && !rKeyEvent.GetKeyCode().IsMod1() && !rKeyEvent.GetKeyCode().IsMod2() && - ImplCheckTextLen( OUString('x') ) ) + ImplCheckTextLen( u"x" ) ) { aCurSel = mpImpl->mpTextEngine->ImpInsertText( aCurSel, '\t', !IsInsertMode() ); bModified = true; @@ -518,7 +518,7 @@ bool TextView::KeyInput( const KeyEvent& rKeyEvent ) // do not swallow Shift-RETURN, as this would disable multi-line entries // in dialogs & property editors if ( !mpImpl->mbReadOnly && !rKeyEvent.GetKeyCode().IsMod1() && - !rKeyEvent.GetKeyCode().IsMod2() && ImplCheckTextLen( OUString('x') ) ) + !rKeyEvent.GetKeyCode().IsMod2() && ImplCheckTextLen( u"x" ) ) { mpImpl->mpTextEngine->UndoActionStart(); aCurSel = mpImpl->mpTextEngine->ImpInsertParaBreak( aCurSel ); @@ -553,7 +553,7 @@ bool TextView::KeyInput( const KeyEvent& rKeyEvent ) if ( TextEngine::IsSimpleCharInput( rKeyEvent ) ) { sal_Unicode nCharCode = rKeyEvent.GetCharCode(); - if ( !mpImpl->mbReadOnly && ImplCheckTextLen( OUString(nCharCode) ) ) // otherwise swallow the character anyway + if ( !mpImpl->mbReadOnly && ImplCheckTextLen( OUStringChar(nCharCode) ) ) // otherwise swallow the character anyway { aCurSel = mpImpl->mpTextEngine->ImpInsertText( nCharCode, aCurSel, !IsInsertMode(), true ); bModified = true; @@ -1721,12 +1721,12 @@ bool TextView::ImplTruncateNewText( OUString& rNewText ) const return bTruncated; } -bool TextView::ImplCheckTextLen( const OUString& rNewText ) const +bool TextView::ImplCheckTextLen( std::u16string_view rNewText ) const { bool bOK = true; if ( mpImpl->mpTextEngine->GetMaxTextLen() ) { - sal_Int32 n = mpImpl->mpTextEngine->GetTextLen() + rNewText.getLength(); + sal_Int32 n = mpImpl->mpTextEngine->GetTextLen() + rNewText.size(); if ( n > mpImpl->mpTextEngine->GetMaxTextLen() ) { // calculate how much text is being deleted diff --git a/vcl/source/filter/FilterConfigItem.cxx b/vcl/source/filter/FilterConfigItem.cxx index 962d970bf4ab..05acd96ae3aa 100644 --- a/vcl/source/filter/FilterConfigItem.cxx +++ b/vcl/source/filter/FilterConfigItem.cxx @@ -22,6 +22,7 @@ #include <unotools/configmgr.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/propertyvalue.hxx> +#include <o3tl/string_view.hxx> #include <osl/diagnose.h> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/configuration/theDefaultProvider.hpp> @@ -42,9 +43,9 @@ using namespace ::com::sun::star::container ; using namespace ::com::sun::star::configuration; using namespace ::com::sun::star::task ; // XStatusIndicator -static bool ImpIsTreeAvailable( Reference< XMultiServiceFactory > const & rXCfgProv, const OUString& rTree ) +static bool ImpIsTreeAvailable( Reference< XMultiServiceFactory > const & rXCfgProv, std::u16string_view rTree ) { - bool bAvailable = !rTree.isEmpty(); + bool bAvailable = !rTree.empty(); if ( bAvailable ) { sal_Int32 nIdx{0}; @@ -53,7 +54,7 @@ static bool ImpIsTreeAvailable( Reference< XMultiServiceFactory > const & rXCfgP // creation arguments: nodepath PropertyValue aPathArgument = comphelper::makePropertyValue("nodepath", - rTree.getToken(0, '/', nIdx)); + OUString(o3tl::getToken(rTree, 0, '/', nIdx))); Sequence< Any > aArguments{ Any(aPathArgument) }; Reference< XInterface > xReadAccess; @@ -69,7 +70,7 @@ static bool ImpIsTreeAvailable( Reference< XMultiServiceFactory > const & rXCfgP } if ( xReadAccess.is() ) { - const sal_Int32 nEnd {rTree.getLength()}; + const sal_Int32 nEnd = rTree.size(); while (bAvailable && nIdx>=0 && nIdx<nEnd) { Reference< XHierarchicalNameAccess > xHierarchicalNameAccess @@ -79,7 +80,7 @@ static bool ImpIsTreeAvailable( Reference< XMultiServiceFactory > const & rXCfgP bAvailable = false; else { - const OUString aNode( rTree.getToken(0, '/', nIdx) ); + const OUString aNode( o3tl::getToken(rTree, 0, '/', nIdx) ); if ( !xHierarchicalNameAccess->hasByHierarchicalName( aNode ) ) bAvailable = false; else diff --git a/vcl/source/filter/svm/SvmConverter.cxx b/vcl/source/filter/svm/SvmConverter.cxx index 3be4063be853..063c6e45b505 100644 --- a/vcl/source/filter/svm/SvmConverter.cxx +++ b/vcl/source/filter/svm/SvmConverter.cxx @@ -250,10 +250,10 @@ namespace return std::min(remainingActions, nFollowingActionCount); } - void ClampRange(const OUString& rStr, sal_Int32& rIndex, sal_Int32& rLength, + void ClampRange(std::u16string_view rStr, sal_Int32& rIndex, sal_Int32& rLength, std::vector<sal_Int32>* pDXAry = nullptr) { - const sal_Int32 nStrLength = rStr.getLength(); + const sal_Int32 nStrLength = rStr.size(); if (rIndex < 0 || rIndex > nStrLength) { diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx index 22230ba4666e..2c287c8b693f 100644 --- a/vcl/source/filter/wmf/wmfwr.cxx +++ b/vcl/source/filter/wmf/wmfwr.cxx @@ -546,10 +546,10 @@ bool WMFWriter::WMFRecord_Escape_Unicode( const Point& rPoint, const OUString& r } void WMFWriter::WMFRecord_ExtTextOut( const Point& rPoint, - const OUString& rString, + std::u16string_view rString, o3tl::span<const sal_Int32> pDXAry ) { - sal_Int32 nOriginalTextLen = rString.getLength(); + sal_Int32 nOriginalTextLen = rString.size(); if ( (nOriginalTextLen <= 1) || pDXAry.empty() ) { @@ -561,7 +561,7 @@ void WMFWriter::WMFRecord_ExtTextOut( const Point& rPoint, TrueExtTextOut(rPoint, rString, aByteString, pDXAry); } -void WMFWriter::TrueExtTextOut( const Point& rPoint, const OUString& rString, +void WMFWriter::TrueExtTextOut( const Point& rPoint, std::u16string_view rString, const OString& rByteString, o3tl::span<const sal_Int32> pDXAry ) { WriteRecordHeader( 0, W_META_EXTTEXTOUT ); @@ -572,7 +572,7 @@ void WMFWriter::TrueExtTextOut( const Point& rPoint, const OUString& rString, if ( nNewTextLen & 1 ) pWMF->WriteUChar( 0 ); - sal_Int32 nOriginalTextLen = rString.getLength(); + sal_Int32 nOriginalTextLen = rString.size(); std::unique_ptr<sal_Int16[]> pConvertedDXAry(new sal_Int16[ nOriginalTextLen ]); sal_Int32 j = 0; pConvertedDXAry[ j++ ] = static_cast<sal_Int16>(ScaleWidth( pDXAry[ 0 ] )); diff --git a/vcl/source/filter/wmf/wmfwr.hxx b/vcl/source/filter/wmf/wmfwr.hxx index 7b0ce679e7dc..7da1cedc0424 100644 --- a/vcl/source/filter/wmf/wmfwr.hxx +++ b/vcl/source/filter/wmf/wmfwr.hxx @@ -143,9 +143,9 @@ private: void WMFRecord_Ellipse(const tools::Rectangle& rRect); void WMFRecord_Escape( sal_uInt32 nEsc, sal_uInt32 nLen, const sal_Int8* pData ); bool WMFRecord_Escape_Unicode( const Point& rPoint, const OUString& rStr, o3tl::span<const sal_Int32> pDXAry ); - void WMFRecord_ExtTextOut(const Point& rPoint, const OUString& rString, o3tl::span<const sal_Int32> pDXAry); + void WMFRecord_ExtTextOut(const Point& rPoint, std::u16string_view rString, o3tl::span<const sal_Int32> pDXAry); - void TrueExtTextOut(const Point& rPoint, const OUString& rString, + void TrueExtTextOut(const Point& rPoint, std::u16string_view rString, const OString& rByteString, o3tl::span<const sal_Int32> pDXAry); void TrueTextOut(const Point& rPoint, const OString& rString); void WMFRecord_LineTo(const Point & rPoint); diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx index 3abf7db3d668..5b00083104da 100644 --- a/vcl/source/font/PhysicalFontCollection.cxx +++ b/vcl/source/font/PhysicalFontCollection.cxx @@ -31,11 +31,11 @@ #include <font/PhysicalFontCollection.hxx> #include <font/fontsubstitution.hxx> -static ImplFontAttrs lcl_IsCJKFont( const OUString& rFontName ) +static ImplFontAttrs lcl_IsCJKFont( std::u16string_view rFontName ) { // Test, if Fontname includes CJK characters --> In this case we // mention that it is a CJK font - for(int i = 0; i < rFontName.getLength(); i++) + for(size_t i = 0; i < rFontName.size(); i++) { const sal_Unicode ch = rFontName[i]; // japanese @@ -378,7 +378,7 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyBySubstFontAttr(ut const FontItalic eSearchSlant = ITALIC_DONTKNOW; pFoundData = FindFontFamilyByAttributes( nSearchType, - eSearchWeight, eSearchWidth, eSearchSlant, "" ); + eSearchWeight, eSearchWidth, eSearchSlant, u"" ); if( pFoundData ) return pFoundData; @@ -413,7 +413,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByAttributes(ImplFontA FontWeight eSearchWeight, FontWidth eSearchWidth, FontItalic eSearchItalic, - OUString const& rSearchFamilyName ) const + std::u16string_view rSearchFamilyName ) const { if( (eSearchItalic != ITALIC_NONE) && (eSearchItalic != ITALIC_DONTKNOW) ) nSearchType |= ImplFontAttrs::Italic; @@ -545,7 +545,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByAttributes(ImplFontA } // match stripped family name - if( !rSearchFamilyName.isEmpty() && (rSearchFamilyName == pData->GetMatchFamilyName()) ) + if( !rSearchFamilyName.empty() && (rSearchFamilyName == pData->GetMatchFamilyName()) ) { nTestMatch += 1000000*3; } @@ -674,9 +674,9 @@ PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByAttributes(ImplFontA // test font name substrings // TODO: calculate name matching score using e.g. Levenstein distance - if( (rSearchFamilyName.getLength() >= 4) && + if( (rSearchFamilyName.size() >= 4) && (pData->GetMatchFamilyName().getLength() >= 4) && - ((rSearchFamilyName.indexOf( pData->GetMatchFamilyName() ) != -1) || + ((rSearchFamilyName.find( pData->GetMatchFamilyName() ) != std::u16string_view::npos) || (pData->GetMatchFamilyName().indexOf( rSearchFamilyName ) != -1)) ) { nTestMatch += 5000; diff --git a/vcl/source/font/PhysicalFontFamily.cxx b/vcl/source/font/PhysicalFontFamily.cxx index b95cbc117bd7..5171e291c5b5 100644 --- a/vcl/source/font/PhysicalFontFamily.cxx +++ b/vcl/source/font/PhysicalFontFamily.cxx @@ -59,11 +59,11 @@ void PhysicalFontFamily::CalcType( ImplFontAttrs& rType, FontWeight& rWeight, Fo } } -static ImplFontAttrs lcl_IsCJKFont( const OUString& rFontName ) +static ImplFontAttrs lcl_IsCJKFont( std::u16string_view rFontName ) { // Test, if Fontname includes CJK characters --> In this case we // mention that it is a CJK font - for(int i = 0; i < rFontName.getLength(); i++) + for(size_t i = 0; i < rFontName.size(); i++) { const sal_Unicode ch = rFontName[i]; // japanese diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx index 3e20c12f2720..ca9fb352eb74 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -389,7 +389,7 @@ void PDFWriter::CreateNote( const tools::Rectangle& rRect, const PDFNote& rNote, xImplementation->createNote( rRect, rNote, nPageNr ); } -sal_Int32 PDFWriter::BeginStructureElement( PDFWriter::StructElement eType, const OUString& rAlias ) +sal_Int32 PDFWriter::BeginStructureElement( PDFWriter::StructElement eType, std::u16string_view rAlias ) { return xImplementation->beginStructureElement( eType, rAlias ); } diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 38c8414fbeb4..5e6955a0a45b 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -10407,7 +10407,7 @@ bool PDFWriterImpl::checkEmitStructure() return bEmit; } -sal_Int32 PDFWriterImpl::beginStructureElement( PDFWriter::StructElement eType, const OUString& rAlias ) +sal_Int32 PDFWriterImpl::beginStructureElement( PDFWriter::StructElement eType, std::u16string_view rAlias ) { if( m_nCurrentPage < 0 ) return -1; @@ -10454,9 +10454,9 @@ sal_Int32 PDFWriterImpl::beginStructureElement( PDFWriter::StructElement eType, m_nCurrentStructElement = nNewId; // handle alias names - if( !rAlias.isEmpty() && eType != PDFWriter::NonStructElement ) + if( !rAlias.empty() && eType != PDFWriter::NonStructElement ) { - OStringBuffer aNameBuf( rAlias.getLength() ); + OStringBuffer aNameBuf( rAlias.size() ); appendName( rAlias, aNameBuf ); OString aAliasName( aNameBuf.makeStringAndClear() ); rEle.m_aAlias = aAliasName; diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index de5385f93ac2..4adef21660ba 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -414,9 +414,9 @@ static bool lcl_CanApplyAsianKerning(sal_Unicode cp) return (0x3000 == (cp & 0xFF00)) || (0xFF00 == (cp & 0xFF00)) || (0x2010 == (cp & 0xFFF0)); } -void GenericSalLayout::ApplyAsianKerning(const OUString& rStr) +void GenericSalLayout::ApplyAsianKerning(std::u16string_view rStr) { - const int nLength = rStr.getLength(); + const int nLength = rStr.size(); double nOffset = 0; for (std::vector<GlyphItem>::iterator pGlyphIter = m_GlyphItems.begin(), diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx index 25bf47767ec7..2d0219041ba2 100644 --- a/vcl/source/gdi/textlayout.cxx +++ b/vcl/source/gdi/textlayout.cxx @@ -148,9 +148,9 @@ namespace vcl namespace { - bool lcl_normalizeLength( const OUString& _rText, const sal_Int32 _nStartIndex, sal_Int32& _io_nLength ) + bool lcl_normalizeLength( std::u16string_view _rText, const sal_Int32 _nStartIndex, sal_Int32& _io_nLength ) { - sal_Int32 nTextLength = _rText.getLength(); + sal_Int32 nTextLength = _rText.size(); if ( _nStartIndex > nTextLength ) return false; if ( _nStartIndex + _io_nLength > nTextLength ) diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index a10ba5f29d36..51a8689e2610 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -1178,19 +1178,19 @@ bool OutputDevice::GetGlyphBoundRects( const Point& rOrigin, const OUString& rSt return (nLen == static_cast<int>(rVector.size())); } -sal_Int32 OutputDevice::HasGlyphs( const vcl::Font& rTempFont, const OUString& rStr, +sal_Int32 OutputDevice::HasGlyphs( const vcl::Font& rTempFont, std::u16string_view rStr, sal_Int32 nIndex, sal_Int32 nLen ) const { - if( nIndex >= rStr.getLength() ) + if( nIndex >= static_cast<sal_Int32>(rStr.size()) ) return nIndex; sal_Int32 nEnd; if( nLen == -1 ) - nEnd = rStr.getLength(); + nEnd = rStr.size(); else - nEnd = std::min( rStr.getLength(), nIndex + nLen ); + nEnd = std::min<sal_Int32>( rStr.size(), nIndex + nLen ); SAL_WARN_IF( nIndex >= nEnd, "vcl.gdi", "StartPos >= EndPos?" ); - SAL_WARN_IF( nEnd > rStr.getLength(), "vcl.gdi", "String too short" ); + SAL_WARN_IF( nEnd > static_cast<sal_Int32>(rStr.size()), "vcl.gdi", "String too short" ); // to get the map temporarily set font const vcl::Font aOrigFont = GetFont(); diff --git a/vcl/source/pdf/PDFiumTools.cxx b/vcl/source/pdf/PDFiumTools.cxx index 28fa53b837e1..cb392a8cb8da 100644 --- a/vcl/source/pdf/PDFiumTools.cxx +++ b/vcl/source/pdf/PDFiumTools.cxx @@ -12,50 +12,50 @@ namespace vcl::pdf { -OUString convertPdfDateToISO8601(OUString const& rInput) +OUString convertPdfDateToISO8601(std::u16string_view rInput) { - if (rInput.getLength() < 6) + if (rInput.size() < 6) return {}; - std::u16string_view prefix = rInput.subView(0, 2); + std::u16string_view prefix = rInput.substr(0, 2); if (prefix != u"D:") return {}; - std::u16string_view sYear = rInput.subView(2, 4); + std::u16string_view sYear = rInput.substr(2, 4); std::u16string_view sMonth(u"01"); - if (rInput.getLength() >= 8) - sMonth = rInput.subView(6, 2); + if (rInput.size() >= 8) + sMonth = rInput.substr(6, 2); std::u16string_view sDay(u"01"); - if (rInput.getLength() >= 10) - sDay = rInput.subView(8, 2); + if (rInput.size() >= 10) + sDay = rInput.substr(8, 2); std::u16string_view sHours(u"00"); - if (rInput.getLength() >= 12) - sHours = rInput.subView(10, 2); + if (rInput.size() >= 12) + sHours = rInput.substr(10, 2); std::u16string_view sMinutes(u"00"); - if (rInput.getLength() >= 14) - sMinutes = rInput.subView(12, 2); + if (rInput.size() >= 14) + sMinutes = rInput.substr(12, 2); std::u16string_view sSeconds(u"00"); - if (rInput.getLength() >= 16) - sSeconds = rInput.subView(14, 2); + if (rInput.size() >= 16) + sSeconds = rInput.substr(14, 2); OUString sTimeZoneMark("Z"); - if (rInput.getLength() >= 17) - sTimeZoneMark = rInput.subView(16, 1); + if (rInput.size() >= 17) + sTimeZoneMark = rInput.substr(16, 1); std::u16string_view sTimeZoneHours(u"00"); std::u16string_view sTimeZoneMinutes(u"00"); - if ((sTimeZoneMark == "+" || sTimeZoneMark == "-") && rInput.getLength() >= 22) + if ((sTimeZoneMark == "+" || sTimeZoneMark == "-") && rInput.size() >= 22) { - std::u16string_view sTimeZoneSeparator = rInput.subView(19, 1); + std::u16string_view sTimeZoneSeparator = rInput.substr(19, 1); if (sTimeZoneSeparator == u"'") { - sTimeZoneHours = rInput.subView(17, 2); - sTimeZoneMinutes = rInput.subView(20, 2); + sTimeZoneHours = rInput.substr(17, 2); + sTimeZoneMinutes = rInput.substr(20, 2); } } diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx index fa5c95346323..0b55d4c96857 100644 --- a/vcl/source/uitest/uiobject.cxx +++ b/vcl/source/uitest/uiobject.cxx @@ -135,12 +135,11 @@ vcl::Window* get_top_parent(vcl::Window* pWindow) return get_top_parent(pParent); } -std::vector<KeyEvent> generate_key_events_from_text(const OUString& rStr) +std::vector<KeyEvent> generate_key_events_from_text(std::u16string_view rStr) { std::vector<KeyEvent> aEvents; vcl::KeyCode aCode; - for (sal_Int32 i = 0, n = rStr.getLength(); - i != n; ++i) + for (size_t i = 0, n = rStr.size(); i != n; ++i) { aEvents.emplace_back(rStr[i], aCode); } diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index 89c28f08d502..161e4ff7863c 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -1141,14 +1141,14 @@ KeyEvent Window::GetActivationKey() const } /* namespace vcl */ -sal_Unicode getAccel( const OUString& rStr ) +sal_Unicode getAccel( std::u16string_view rStr ) { sal_Unicode nChar = 0; - sal_Int32 nPos = 0; + size_t nPos = 0; do { - nPos = rStr.indexOf( '~', nPos ); - if( nPos != -1 && nPos < rStr.getLength() ) + nPos = rStr.find( '~', nPos ); + if( nPos != std::u16string_view::npos && nPos < rStr.size() ) nChar = rStr[ ++nPos ]; else nChar = 0; diff --git a/vcl/source/window/dlgctrl.hxx b/vcl/source/window/dlgctrl.hxx index 805099b69bac..94af911c7818 100644 --- a/vcl/source/window/dlgctrl.hxx +++ b/vcl/source/window/dlgctrl.hxx @@ -29,6 +29,6 @@ vcl::Window* ImplFindDlgCtrlWindow( vcl::Window* pParent, vcl::Window* pWindow, vcl::Window* ImplFindAccelWindow( vcl::Window* pParent, sal_uInt16& rIndex, sal_Unicode cCharCode, sal_uInt16 nFormStart, sal_uInt16 nFormEnd, bool bCheckEnable = true ); -sal_Unicode getAccel( const OUString& rStr ); +sal_Unicode getAccel( std::u16string_view rStr ); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/print/printerjob.cxx b/vcl/unx/generic/print/printerjob.cxx index 233bd2195a8e..2355f34da4b5 100644 --- a/vcl/unx/generic/print/printerjob.cxx +++ b/vcl/unx/generic/print/printerjob.cxx @@ -263,10 +263,10 @@ static void WriteLocalTimePS( osl::File *rFile ) WritePS( rFile, "Unknown-Time" ); } -static bool isAscii( const OUString& rStr ) +static bool isAscii( std::u16string_view rStr ) { - sal_Int32 nLen = rStr.getLength(); - for( sal_Int32 i = 0; i < nLen; i++ ) + size_t nLen = rStr.size(); + for( size_t i = 0; i < nLen; i++ ) if( rStr[i] > 127 ) return false; return true; diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index 043d07bc2199..061cd5bc727d 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -94,42 +94,42 @@ namespace psp PPDTranslator() {} void insertValue( - const OUString& i_rKey, - const OUString& i_rOption, - const OUString& i_rValue, + std::u16string_view i_rKey, + std::u16string_view i_rOption, + std::u16string_view i_rValue, const OUString& i_rTranslation, const css::lang::Locale& i_rLocale ); - void insertOption( const OUString& i_rKey, - const OUString& i_rOption, + void insertOption( std::u16string_view i_rKey, + std::u16string_view i_rOption, const OUString& i_rTranslation, const css::lang::Locale& i_rLocale ) { - insertValue( i_rKey, i_rOption, OUString(), i_rTranslation, i_rLocale ); + insertValue( i_rKey, i_rOption, u"", i_rTranslation, i_rLocale ); } - void insertKey( const OUString& i_rKey, + void insertKey( std::u16string_view i_rKey, const OUString& i_rTranslation, const css::lang::Locale& i_rLocale = css::lang::Locale() ) { - insertValue( i_rKey, OUString(), OUString(), i_rTranslation, i_rLocale ); + insertValue( i_rKey, u"", u"", i_rTranslation, i_rLocale ); } OUString translateValue( - const OUString& i_rKey, - const OUString& i_rOption + std::u16string_view i_rKey, + std::u16string_view i_rOption ) const; - OUString translateOption( const OUString& i_rKey, - const OUString& i_rOption ) const + OUString translateOption( std::u16string_view i_rKey, + std::u16string_view i_rOption ) const { return translateValue( i_rKey, i_rOption ); } - OUString translateKey( const OUString& i_rKey ) const + OUString translateKey( std::u16string_view i_rKey ) const { - return translateValue( i_rKey, OUString() ); + return translateValue( i_rKey, u"" ); } }; @@ -167,21 +167,21 @@ namespace psp } void PPDTranslator::insertValue( - const OUString& i_rKey, - const OUString& i_rOption, - const OUString& i_rValue, + std::u16string_view i_rKey, + std::u16string_view i_rOption, + std::u16string_view i_rValue, const OUString& i_rTranslation, const css::lang::Locale& i_rLocale ) { - OUStringBuffer aKey( i_rKey.getLength() + i_rOption.getLength() + i_rValue.getLength() + 2 ); + OUStringBuffer aKey( i_rKey.size() + i_rOption.size() + i_rValue.size() + 2 ); aKey.append( i_rKey ); - if( !i_rOption.isEmpty() || !i_rValue.isEmpty() ) + if( !i_rOption.empty() || !i_rValue.empty() ) { aKey.append( ':' ); aKey.append( i_rOption ); } - if( !i_rValue.isEmpty() ) + if( !i_rValue.empty() ) { aKey.append( ':' ); aKey.append( i_rValue ); @@ -199,15 +199,15 @@ namespace psp } OUString PPDTranslator::translateValue( - const OUString& i_rKey, - const OUString& i_rOption + std::u16string_view i_rKey, + std::u16string_view i_rOption ) const { OUString aResult; - OUStringBuffer aKey( i_rKey.getLength() + i_rOption.getLength() + 2 ); + OUStringBuffer aKey( i_rKey.size() + i_rOption.size() + 2 ); aKey.append( i_rKey ); - if( !i_rOption.isEmpty() ) + if( !i_rOption.empty() ) { aKey.append( ':' ); aKey.append( i_rOption ); @@ -1556,7 +1556,7 @@ OUString PPDParser::translateKey( const OUString& i_rKey ) const return aResult; } -OUString PPDParser::translateOption( const OUString& i_rKey, +OUString PPDParser::translateOption( std::u16string_view i_rKey, const OUString& i_rOption ) const { OUString aResult( m_pTranslator->translateOption( i_rKey, i_rOption ) ); diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx index 21ccd7cfab1a..2c75546ff2b2 100644 --- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx +++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx @@ -697,24 +697,24 @@ uno::Sequence<OUString> SAL_CALL SalGtkFilePicker::getFiles() namespace { -bool lcl_matchFilter( const OUString& rFilter, const OUString& rExt ) +bool lcl_matchFilter( std::u16string_view rFilter, std::u16string_view rExt ) { const sal_Unicode cSep {';'}; - sal_Int32 nIdx {0}; + size_t nIdx {0}; for (;;) { - const sal_Int32 nBegin = rFilter.indexOf(rExt, nIdx); + const size_t nBegin = rFilter.find(rExt, nIdx); - if (nBegin<0) // not found + if (nBegin == std::u16string_view::npos) // not found break; // Let nIdx point to end of matched string, useful in order to // check string boundaries and also for a possible next iteration - nIdx = nBegin + rExt.getLength(); + nIdx = nBegin + rExt.size(); // Check if the found occurrence is an exact match: right side - if (nIdx<rFilter.getLength() && rFilter[nIdx]!=cSep) + if (nIdx < rFilter.size() && rFilter[nIdx]!=cSep) continue; // Check if the found occurrence is an exact match: left side @@ -802,7 +802,7 @@ uno::Sequence<OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() if ( m_pFilterVector) for (auto const& filter : *m_pFilterVector) { - if( lcl_matchFilter( filter.getFilter(), OUString::Concat("*.") + sExtension ) ) + if( lcl_matchFilter( filter.getFilter(), OUStringConcatenation(OUString::Concat("*.") + sExtension) ) ) { if( aNewFilter.isEmpty() ) aNewFilter = filter.getTitle(); |