diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-01-28 12:38:01 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-01-28 17:32:18 +0100 |
commit | 943060836339f9640c612e9724f20e79db616e6e (patch) | |
tree | 3dc6e7748aef3ef0f2fca86979792162daa443fc /vcl/source | |
parent | d249bd5a3dfe13052ce9aa91bad94ec7d60604d4 (diff) |
simplify code, use more subView()
Change-Id: I569c7f34acbdf8451cd5c9acf1abd334637072d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110051
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/control/field.cxx | 14 | ||||
-rw-r--r-- | vcl/source/control/field2.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/longcurr.cxx | 2 | ||||
-rw-r--r-- | vcl/source/edit/texteng.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/menu.cxx | 7 |
5 files changed, 13 insertions, 16 deletions
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 65bd69bb528e..fa9cf9760a78 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -187,23 +187,23 @@ bool ImplNumericGetValue( const OUString& rStr, sal_Int64& rValue, // If in "a b/c" format. if(nFracNumPos != -1 ) { - aStr1.append(std::u16string_view(aStr).substr(0, nFracNumPos)); - aStrNum.append(std::u16string_view(aStr).substr(nFracNumPos+1, nFracDivPos-nFracNumPos-1)); - aStrDenom.append(std::u16string_view(aStr).substr(nFracDivPos+1)); + aStr1.append(aStr.subView(0, nFracNumPos)); + aStrNum.append(aStr.subView(nFracNumPos+1, nFracDivPos-nFracNumPos-1)); + aStrDenom.append(aStr.subView(nFracDivPos+1)); } // "a/b" format, or not a fraction at all else { - aStrNum.append(std::u16string_view(aStr).substr(0, nFracDivPos)); - aStrDenom.append(std::u16string_view(aStr).substr(nFracDivPos+1)); + aStrNum.append(aStr.subView(0, nFracDivPos)); + aStrDenom.append(aStr.subView(nFracDivPos+1)); } } // parse decimal strings else if ( nDecPos >= 0) { - aStr1.append(std::u16string_view(aStr).substr(0, nDecPos)); - aStr2.append(std::u16string_view(aStr).substr(nDecPos+1)); + aStr1.append(aStr.subView(0, nDecPos)); + aStr2.append(aStr.subView(nDecPos+1)); } else aStr1 = aStr; diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index 7bf0afd853e8..e303c18e74af 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -744,7 +744,7 @@ static bool ImplPatternProcessKeyInput( IEditImplementation& rEdit, const KeyEve { // possibly extend string until cursor position if ( aStr.getLength() < nNewPos ) - aStr.append( std::u16string_view(rLiteralMask).substr(aStr.getLength(), nNewPos-aStr.getLength()) ); + aStr.append( rLiteralMask.subView(aStr.getLength(), nNewPos-aStr.getLength()) ); if ( nNewPos < aStr.getLength() ) aStr.insert( cChar, nNewPos ); else if ( nNewPos < rEditMask.getLength() ) diff --git a/vcl/source/control/longcurr.cxx b/vcl/source/control/longcurr.cxx index e141ce610741..8750ef96f191 100644 --- a/vcl/source/control/longcurr.cxx +++ b/vcl/source/control/longcurr.cxx @@ -120,7 +120,7 @@ bool ImplCurrencyGetValue( const OUString& rStr, BigInt& rValue, if ( nDecPos != -1 ) { aStr1 = aStr.subView( 0, nDecPos ); - aStr2.append(std::u16string_view(aStr).substr(nDecPos+1)); + aStr2.append(aStr.subView(nDecPos+1)); } else aStr1 = aStr; diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index a61c67b0c69d..1959151ffee1 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -269,7 +269,7 @@ OUString TextEngine::GetTextLines( LineEnd aSeparator ) const for ( size_t nL = 0; nL < nLines; ++nL ) { TextLine& rLine = pTEParaPortion->GetLines()[nL]; - aText.append( std::u16string_view(pTEParaPortion->GetNode()->GetText()).substr(rLine.GetStart(), rLine.GetEnd() - rLine.GetStart()) ); + aText.append( pTEParaPortion->GetNode()->GetText().subView(rLine.GetStart(), rLine.GetEnd() - rLine.GetStart()) ); if ( pSep && ( ( (nP+1) < nParas ) || ( (nL+1) < nLines ) ) ) aText.append(pSep); } @@ -406,7 +406,7 @@ OUString TextEngine::GetText( const TextSelection& rSel, LineEnd aSeparator ) co if ( nNode == nEndPara ) // may also be == nStart! nEndPos = aSel.GetEnd().GetIndex(); - aText.append(std::u16string_view(pNode->GetText()).substr(nStartPos, nEndPos-nStartPos)); + aText.append(pNode->GetText().subView(nStartPos, nEndPos-nStartPos)); if ( nNode < nEndPara ) aText.append(pSep); } diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 825616b3d0aa..3cffab6e3b20 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -1668,11 +1668,8 @@ static OUString getShortenedString( const OUString& i_rLong, vcl::RenderContext { if (nPos < aNonMnem.getLength() && i_rLong[nPos+1] == aNonMnem[nPos]) { - OUStringBuffer aBuf( i_rLong.getLength() ); - aBuf.append( std::u16string_view(aNonMnem).substr(0, nPos) ); - aBuf.append( '~' ); - aBuf.append( std::u16string_view(aNonMnem).substr(nPos) ); - aNonMnem = aBuf.makeStringAndClear(); + OUString aTmp = OUString::Concat(aNonMnem.subView(0, nPos)) + "~" + aNonMnem.subView(nPos); + aNonMnem = aTmp; } } return aNonMnem; |