diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-17 11:30:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-17 12:34:52 +0200 |
commit | 3cb8e9e211c30089516f56f465176d3a959631f9 (patch) | |
tree | 187dee1288b0838e3acb63eef02fae552fdd6d56 /vcl/source/control/edit.cxx | |
parent | 434d92a51409b0847ee7d313b50fc547b7615bff (diff) |
loplugin:buriedassign in vcl
Change-Id: I529052c1ba7591d91d3848080af8b06e077b6f14
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92409
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/control/edit.cxx')
-rw-r--r-- | vcl/source/control/edit.cxx | 86 |
1 files changed, 46 insertions, 40 deletions
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index d177eb1fb7bc..f9ef8642a8a9 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -813,50 +813,53 @@ void Edit::ImplInsertText( const OUString& rStr, const Selection* pNewSel, bool aSelection.Min() > 0 && /* first char needs not to be checked */ xBI.is() && i18n::ScriptType::COMPLEX == xBI->getScriptType( rStr, 0 ); - uno::Reference < i18n::XExtendedInputSequenceChecker > xISC; - if (bIsInputSequenceChecking && (xISC = ImplGetInputSequenceChecker()).is()) - { - sal_Unicode cChar = rStr[0]; - sal_Int32 nTmpPos = aSelection.Min(); - sal_Int16 nCheckMode = officecfg::Office::Common::I18N::CTL::CTLSequenceCheckingRestricted::get()? - i18n::InputSequenceCheckMode::STRICT : i18n::InputSequenceCheckMode::BASIC; - - // the text that needs to be checked is only the one - // before the current cursor position - const OUString aOldText( maText.getStr(), nTmpPos); - OUString aTmpText( aOldText ); - if (officecfg::Office::Common::I18N::CTL::CTLSequenceCheckingTypeAndReplace::get()) + if (bIsInputSequenceChecking) + { + uno::Reference < i18n::XExtendedInputSequenceChecker > xISC = ImplGetInputSequenceChecker(); + if (xISC.is()) { - xISC->correctInputSequence( aTmpText, nTmpPos - 1, cChar, nCheckMode ); + sal_Unicode cChar = rStr[0]; + sal_Int32 nTmpPos = aSelection.Min(); + sal_Int16 nCheckMode = officecfg::Office::Common::I18N::CTL::CTLSequenceCheckingRestricted::get()? + i18n::InputSequenceCheckMode::STRICT : i18n::InputSequenceCheckMode::BASIC; + + // the text that needs to be checked is only the one + // before the current cursor position + const OUString aOldText( maText.getStr(), nTmpPos); + OUString aTmpText( aOldText ); + if (officecfg::Office::Common::I18N::CTL::CTLSequenceCheckingTypeAndReplace::get()) + { + xISC->correctInputSequence( aTmpText, nTmpPos - 1, cChar, nCheckMode ); - // find position of first character that has changed - sal_Int32 nOldLen = aOldText.getLength(); - sal_Int32 nTmpLen = aTmpText.getLength(); - const sal_Unicode *pOldTxt = aOldText.getStr(); - const sal_Unicode *pTmpTxt = aTmpText.getStr(); - sal_Int32 nChgPos = 0; - while ( nChgPos < nOldLen && nChgPos < nTmpLen && - pOldTxt[nChgPos] == pTmpTxt[nChgPos] ) - ++nChgPos; + // find position of first character that has changed + sal_Int32 nOldLen = aOldText.getLength(); + sal_Int32 nTmpLen = aTmpText.getLength(); + const sal_Unicode *pOldTxt = aOldText.getStr(); + const sal_Unicode *pTmpTxt = aTmpText.getStr(); + sal_Int32 nChgPos = 0; + while ( nChgPos < nOldLen && nChgPos < nTmpLen && + pOldTxt[nChgPos] == pTmpTxt[nChgPos] ) + ++nChgPos; - const OUString aChgText( aTmpText.copy( nChgPos ) ); + const OUString aChgText( aTmpText.copy( nChgPos ) ); - // remove text from first pos to be changed to current pos - maText.remove( nChgPos, nTmpPos - nChgPos ); + // remove text from first pos to be changed to current pos + maText.remove( nChgPos, nTmpPos - nChgPos ); - if (!aChgText.isEmpty()) - { - aNewText = aChgText; - aSelection.Min() = nChgPos; // position for new text to be inserted + if (!aChgText.isEmpty()) + { + aNewText = aChgText; + aSelection.Min() = nChgPos; // position for new text to be inserted + } + else + aNewText.clear(); } else - aNewText.clear(); - } - else - { - // should the character be ignored (i.e. not get inserted) ? - if (!xISC->checkInputSequence( aOldText, nTmpPos - 1, cChar, nCheckMode )) - aNewText.clear(); + { + // should the character be ignored (i.e. not get inserted) ? + if (!xISC->checkInputSequence( aOldText, nTmpPos - 1, cChar, nCheckMode )) + aNewText.clear(); + } } } @@ -1821,10 +1824,13 @@ void Edit::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawF void Edit::ImplInvalidateOutermostBorder( vcl::Window* pWin ) { // allow control to show focused state - vcl::Window *pInvalWin = pWin, *pBorder = pWin; - while( ( pBorder = pInvalWin->GetWindow( GetWindowType::Border ) ) != pInvalWin && pBorder && - pInvalWin->ImplGetFrame() == pBorder->ImplGetFrame() ) + vcl::Window *pInvalWin = pWin; + for (;;) { + vcl::Window* pBorder = pInvalWin->GetWindow( GetWindowType::Border ); + if (pBorder == pInvalWin || !pBorder || + pInvalWin->ImplGetFrame() != pBorder->ImplGetFrame() ) + break; pInvalWin = pBorder; } |