summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-12-26 10:03:40 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2021-12-26 20:36:26 +0100
commita23a7eea5cfcdc50d09be248828cb1e6293e5ebb (patch)
treee415782b558350673175f80836d022c4882c9a7d /vcl
parentcc517c687de7205487936d40b64481107656f239 (diff)
Avoid OUStringBuffer::toString where possible
Change-Id: I99abbe97a48b2077e28d6221fb70036e5e412657 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127479 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/edit.cxx10
-rw-r--r--vcl/source/control/field2.cxx12
2 files changed, 13 insertions, 9 deletions
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 46d9f67dc240..ceb238feaf52 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -692,12 +692,13 @@ void Edit::ImplDelete( const Selection& rSelection, sal_uInt8 nDirection, sal_uI
{
if ( nMode == EDIT_DELMODE_RESTOFWORD )
{
- i18n::Boundary aBoundary = xBI->getWordBoundary( maText.toString(), aSelection.Min(),
+ const OUString sText = maText.toString();
+ i18n::Boundary aBoundary = xBI->getWordBoundary( sText, aSelection.Min(),
GetSettings().GetLanguageTag().getLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, true );
auto startPos = aBoundary.startPos;
if ( startPos == aSelection.Min() )
{
- aBoundary = xBI->previousWord( maText.toString(), aSelection.Min(),
+ aBoundary = xBI->previousWord( sText, aSelection.Min(),
GetSettings().GetLanguageTag().getLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES );
startPos = std::max(aBoundary.startPos, sal_Int32(0));
}
@@ -1561,10 +1562,11 @@ bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
{
if ( bWord )
{
- i18n::Boundary aBoundary = xBI->getWordBoundary( maText.toString(), aSel.Max(),
+ const OUString sText = maText.toString();
+ i18n::Boundary aBoundary = xBI->getWordBoundary( sText, aSel.Max(),
GetSettings().GetLanguageTag().getLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, true );
if ( aBoundary.startPos == aSel.Max() )
- aBoundary = xBI->previousWord( maText.toString(), aSel.Max(),
+ aBoundary = xBI->previousWord( sText, aSel.Max(),
GetSettings().GetLanguageTag().getLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES );
aSel.Max() = aBoundary.startPos;
}
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index 3af74c6d92b9..f1e24cd2fb6b 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -647,12 +647,13 @@ static bool ImplPatternProcessKeyInput( IEditImplementation& rEdit, const KeyEve
}
}
- if ( aOldStr != aStr.toString() )
+ OUString sStr = aStr.makeStringAndClear();
+ if ( aOldStr != sStr )
{
if ( bSameMask )
- aStr = ImplPatternReformat( aStr.toString(), rEditMask, rLiteralMask, nFormatFlags );
+ sStr = ImplPatternReformat( sStr, rEditMask, rLiteralMask, nFormatFlags );
rbInKeyInput = true;
- rEdit.SetText( aStr.toString(), Selection( nNewPos ) );
+ rEdit.SetText( sStr, Selection( nNewPos ) );
rEdit.SetModified();
rbInKeyInput = false;
}
@@ -776,8 +777,9 @@ static bool ImplPatternProcessKeyInput( IEditImplementation& rEdit, const KeyEve
if ( !bError )
{
rbInKeyInput = true;
- Selection aNewSel( ImplPatternRightPos( aStr.toString(), rEditMask, nFormatFlags, bSameMask, nNewPos ) );
- rEdit.SetText( aStr.toString(), aNewSel );
+ const OUString sStr = aStr.makeStringAndClear();
+ Selection aNewSel( ImplPatternRightPos( sStr, rEditMask, nFormatFlags, bSameMask, nNewPos ) );
+ rEdit.SetText( sStr, aNewSel );
rEdit.SetModified();
rbInKeyInput = false;
}