summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-02-26 20:01:27 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-02-27 08:29:00 +0100
commit95234b33bbf7793ff5f0c65fec9db6caebc6a94d (patch)
treeb72f16d3115a3613031cb3c68a761b9cf192c812 /vcl
parent0aa0fda64057647219954480ac1bab86b0f0e433 (diff)
loplugin:singlevalfields
Change-Id: I3aa19805fab937cd9516ce8127753a0f599c73c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89611 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/field.cxx3
-rw-r--r--vcl/source/control/quickselectionengine.cxx87
2 files changed, 40 insertions, 50 deletions
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 3f5ba183f9c0..9d5cb9ca08f5 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -551,7 +551,6 @@ NumericFormatter::NumericFormatter(Edit* pEdit)
, mnLast(mnMax)
, mnDecimalDigits(0)
, mbThousandSep(true)
- , mbShowTrailingZeros(true)
{
ReformatAll();
}
@@ -594,7 +593,7 @@ void NumericFormatter::SetValue( sal_Int64 nNewValue )
OUString NumericFormatter::CreateFieldText( sal_Int64 nValue ) const
{
- return ImplGetLocaleDataWrapper().getNum( nValue, GetDecimalDigits(), IsUseThousandSep(), IsShowTrailingZeros() );
+ return ImplGetLocaleDataWrapper().getNum( nValue, GetDecimalDigits(), IsUseThousandSep(), /*ShowTrailingZeros*/true );
}
void NumericFormatter::ImplSetUserValue( sal_Int64 nNewValue, Selection const * pNewSelection )
diff --git a/vcl/source/control/quickselectionengine.cxx b/vcl/source/control/quickselectionengine.cxx
index d5434108582a..e3b060896d5e 100644
--- a/vcl/source/control/quickselectionengine.cxx
+++ b/vcl/source/control/quickselectionengine.cxx
@@ -97,8 +97,7 @@ namespace vcl
}
QuickSelectionEngine::QuickSelectionEngine( ISearchableStringList& _entryList )
- :m_pData( new QuickSelectionEngine_Data( _entryList ) ),
- bEnabled( true )
+ :m_pData( new QuickSelectionEngine_Data( _entryList ) )
{
}
@@ -108,61 +107,53 @@ namespace vcl
bool QuickSelectionEngine::HandleKeyEvent( const KeyEvent& _keyEvent )
{
- if( bEnabled )
+ sal_Unicode c = _keyEvent.GetCharCode();
+
+ if ( ( c >= 32 ) && ( c != 127 ) && !_keyEvent.GetKeyCode().IsMod2() )
{
- sal_Unicode c = _keyEvent.GetCharCode();
+ m_pData->sCurrentSearchString += OUStringChar(c);
+ SAL_INFO( "vcl", "QuickSelectionEngine::HandleKeyEvent: searching for " << m_pData->sCurrentSearchString );
- if ( ( c >= 32 ) && ( c != 127 ) && !_keyEvent.GetKeyCode().IsMod2() )
+ if ( m_pData->sCurrentSearchString.getLength() == 1 )
+ { // first character in the search -> remember
+ m_pData->aSingleSearchChar = c;
+ }
+ else if ( m_pData->sCurrentSearchString.getLength() > 1 )
{
- m_pData->sCurrentSearchString += OUStringChar(c);
- SAL_INFO( "vcl", "QuickSelectionEngine::HandleKeyEvent: searching for " << m_pData->sCurrentSearchString );
-
- if ( m_pData->sCurrentSearchString.getLength() == 1 )
- { // first character in the search -> remember
- m_pData->aSingleSearchChar = c;
- }
- else if ( m_pData->sCurrentSearchString.getLength() > 1 )
- {
- if ( !!m_pData->aSingleSearchChar && ( *m_pData->aSingleSearchChar != c ) )
- // we already have a "single char", but the current one is different -> reset
- m_pData->aSingleSearchChar.reset();
- }
-
- OUString aSearchTemp( m_pData->sCurrentSearchString );
-
- StringEntryIdentifier pMatchingEntry = findMatchingEntry( aSearchTemp, *m_pData );
- SAL_INFO( "vcl", "QuickSelectionEngine::HandleKeyEvent: found " << pMatchingEntry );
- if ( !pMatchingEntry && (aSearchTemp.getLength() > 1) && !!m_pData->aSingleSearchChar )
- {
- // if there's only one letter in the search string, use a different search mode
- aSearchTemp = OUString(*m_pData->aSingleSearchChar);
- pMatchingEntry = findMatchingEntry( aSearchTemp, *m_pData );
- }
-
- if ( pMatchingEntry )
- {
- m_pData->rEntryList.SelectEntry( pMatchingEntry );
- m_pData->aSearchTimeout.Start();
- }
- else
- {
- lcl_reset( *m_pData );
- }
-
- return true;
+ if ( !!m_pData->aSingleSearchChar && ( *m_pData->aSingleSearchChar != c ) )
+ // we already have a "single char", but the current one is different -> reset
+ m_pData->aSingleSearchChar.reset();
}
- return false;
- }
- else
- {
- return false;
+
+ OUString aSearchTemp( m_pData->sCurrentSearchString );
+
+ StringEntryIdentifier pMatchingEntry = findMatchingEntry( aSearchTemp, *m_pData );
+ SAL_INFO( "vcl", "QuickSelectionEngine::HandleKeyEvent: found " << pMatchingEntry );
+ if ( !pMatchingEntry && (aSearchTemp.getLength() > 1) && !!m_pData->aSingleSearchChar )
+ {
+ // if there's only one letter in the search string, use a different search mode
+ aSearchTemp = OUString(*m_pData->aSingleSearchChar);
+ pMatchingEntry = findMatchingEntry( aSearchTemp, *m_pData );
+ }
+
+ if ( pMatchingEntry )
+ {
+ m_pData->rEntryList.SelectEntry( pMatchingEntry );
+ m_pData->aSearchTimeout.Start();
+ }
+ else
+ {
+ lcl_reset( *m_pData );
+ }
+
+ return true;
}
+ return false;
}
void QuickSelectionEngine::Reset()
{
- if( bEnabled )
- lcl_reset( *m_pData );
+ lcl_reset( *m_pData );
}
} // namespace vcl