summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--basctl/source/basicide/baside2.hxx4
-rw-r--r--basctl/source/basicide/baside2b.cxx16
-rw-r--r--basctl/source/basicide/codecompleteoptionsdlg.cxx5
-rw-r--r--basic/source/classes/codecompletecache.cxx7
-rw-r--r--include/vcl/lstbox.hxx2
-rw-r--r--include/vcl/quickselectionengine.hxx2
-rw-r--r--vcl/inc/ilstbox.hxx1
-rw-r--r--vcl/source/control/ilstbox.cxx4
-rw-r--r--vcl/source/control/lstbox.cxx4
-rw-r--r--vcl/source/control/quickselectionengine.cxx77
10 files changed, 81 insertions, 41 deletions
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 8737091ce614..42904b2478a9 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -476,10 +476,6 @@ class CodeCompleteListBox: public ListBox
{
friend class CodeCompleteWindow;
private:
- std::vector< OUString > aEntryVect;
- /* vector to hold all entries for showing/hiding
- * when typing a letter/word
- * */
OUStringBuffer aFuncBuffer;
/* a buffer to build up function name when typing
* a function name, used for showing/hiding listbox values
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 28ed40d957ed..8ae1d5ba7d97 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -2431,6 +2431,10 @@ long CodeCompleteListBox::PreNotify( NotifyEvent& rNEvt )
pCodeCompleteWindow->pParent->GetEditView()->DeleteSelected();
SetVisibleEntries();
}
+ else
+ {
+ pCodeCompleteWindow->ClearAndHide();
+ }
return 0;
case KEY_RETURN:
InsertSelectedEntry();
@@ -2443,12 +2447,13 @@ long CodeCompleteListBox::PreNotify( NotifyEvent& rNEvt )
void CodeCompleteListBox::SetVisibleEntries()
{
- Clear();
- for( unsigned int j=0; j < aEntryVect.size(); ++j )
+ for(sal_uInt16 i=0; i< GetEntryCount(); ++i)
{
- if( aEntryVect[j].startsWithIgnoreAsciiCase(aFuncBuffer.toString()) )
+ OUString sEntry = (OUString) GetEntry(i);
+ if( sEntry.startsWithIgnoreAsciiCase( aFuncBuffer.toString() ) )
{
- InsertEntry(aEntryVect[j]);
+ SelectEntry(sEntry);
+ break;
}
}
}
@@ -2467,18 +2472,17 @@ void CodeCompleteWindow::InitListBox()
pListBox->SetSizePixel( Size(150,150) ); //default, this will adopt the line length
pListBox->Show();
pListBox->GrabFocus();
+ pListBox->EnableQuickSelection( false );
}
void CodeCompleteWindow::InsertEntry( const OUString& aStr )
{
pListBox->InsertEntry( aStr );
- pListBox->aEntryVect.push_back( aStr );
}
void CodeCompleteWindow::ClearListBox()
{
pListBox->Clear();
- pListBox->aEntryVect.clear();
pListBox->aFuncBuffer.makeStringAndClear();
}
diff --git a/basctl/source/basicide/codecompleteoptionsdlg.cxx b/basctl/source/basicide/codecompleteoptionsdlg.cxx
index 96d1ca732f73..6dcde740f214 100644
--- a/basctl/source/basicide/codecompleteoptionsdlg.cxx
+++ b/basctl/source/basicide/codecompleteoptionsdlg.cxx
@@ -41,8 +41,9 @@ CodeCompleteOptionsDlg::CodeCompleteOptionsDlg( Window* pWindow )
pCancelBtn->SetClickHdl( LINK( this, CodeCompleteOptionsDlg, CancelHdl ) );
pCodeCompleteChk->Check( CodeCompleteOptions::IsCodeCompleteOn() );
- pAutocloseProcChk->Check( CodeCompleteOptions::IsProcedureAutoCompleteOn() );
+ //pAutocloseProcChk->Check( CodeCompleteOptions::IsProcedureAutoCompleteOn() );
+ pAutocloseProcChk->Enable( false );
pAutocloseBracesChk->Enable( false );
pAutocloseQuotesChk->Enable( false );
}
@@ -54,7 +55,7 @@ CodeCompleteOptionsDlg::~CodeCompleteOptionsDlg()
IMPL_LINK_NOARG(CodeCompleteOptionsDlg, OkHdl)
{
CodeCompleteOptions::SetCodeCompleteOn( pCodeCompleteChk->IsChecked() );
- CodeCompleteOptions::SetProcedureAutoCompleteOn( pCodeCompleteChk->IsChecked() );
+ //CodeCompleteOptions::SetProcedureAutoCompleteOn( pCodeCompleteChk->IsChecked() );
Close();
return 0;
}
diff --git a/basic/source/classes/codecompletecache.cxx b/basic/source/classes/codecompletecache.cxx
index cb5d4dbff4f7..952e4ee7538a 100644
--- a/basic/source/classes/codecompletecache.cxx
+++ b/basic/source/classes/codecompletecache.cxx
@@ -125,11 +125,8 @@ OUString CodeCompleteDataCache::GetVarType( const OUString& sVarName )
for( CodeCompleteVarScopes::const_iterator aIt = aVarScopes.begin(); aIt != aVarScopes.end(); ++aIt )
{
CodeCompleteVarTypes aTypes = aIt->second;
- for( CodeCompleteVarTypes::const_iterator aOtherIt = aTypes.begin(); aOtherIt != aTypes.end(); ++aOtherIt )
- {
- if( aOtherIt->first == sVarName )
- return aOtherIt->second;
- }
+ if( aTypes[sVarName] != OUString("") )
+ return aTypes[sVarName];
}
//not a local, search global scope
for( CodeCompleteVarTypes::const_iterator aIt = aGlobalVars.begin(); aIt != aGlobalVars.end(); ++aIt )
diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx
index 0e754be399ae..3680522ff539 100644
--- a/include/vcl/lstbox.hxx
+++ b/include/vcl/lstbox.hxx
@@ -230,6 +230,8 @@ public:
void setMaxWidthChars(sal_Int32 nWidth);
virtual bool set_property(const OString &rKey, const OString &rValue);
+
+ void EnableQuickSelection( const bool& b );
};
// ----------------
diff --git a/include/vcl/quickselectionengine.hxx b/include/vcl/quickselectionengine.hxx
index 3bfa7a9e34d4..1be7622cacbe 100644
--- a/include/vcl/quickselectionengine.hxx
+++ b/include/vcl/quickselectionengine.hxx
@@ -75,9 +75,11 @@ namespace vcl
bool HandleKeyEvent( const KeyEvent& _rKEvt );
void Reset();
+ void SetEnabled( const bool& b );
private:
::std::auto_ptr< QuickSelectionEngine_Data > m_pData;
+ bool bEnabled;
private:
QuickSelectionEngine(); // never implemented
diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx
index cc42ccf4cfdf..9edb315b9c6e 100644
--- a/vcl/inc/ilstbox.hxx
+++ b/vcl/inc/ilstbox.hxx
@@ -382,6 +382,7 @@ public:
bool GetEdgeBlending() const { return mbEdgeBlending; }
void SetEdgeBlending(bool bNew) { mbEdgeBlending = bNew; }
+ void EnableQuickSelection( const bool& b );
protected:
// ISearchableStringList
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index 03da1f7a754c..a5bc8bfd80ec 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -666,6 +666,10 @@ struct ImplEntryMetrics
};
// -----------------------------------------------------------------------
+void ImplListBoxWindow::EnableQuickSelection( const bool& b )
+{
+ maQuickSelectionEngine.SetEnabled( b );
+}
void ImplListBoxWindow::ImplUpdateEntryMetrics( ImplEntryType& rEntry )
{
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index 1a95d2a5726c..175e86d62135 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -38,6 +38,10 @@
#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
+void ListBox::EnableQuickSelection( const bool& b )
+{
+ mpImplLB->GetMainWindow()->EnableQuickSelection(b);
+}
ListBox::ListBox( WindowType nType ) : Control( nType )
{
diff --git a/vcl/source/control/quickselectionengine.cxx b/vcl/source/control/quickselectionengine.cxx
index 5ee2cfaf2981..f265bf400e9c 100644
--- a/vcl/source/control/quickselectionengine.cxx
+++ b/vcl/source/control/quickselectionengine.cxx
@@ -96,7 +96,8 @@ namespace vcl
}
QuickSelectionEngine::QuickSelectionEngine( ISearchableStringList& _entryList )
- :m_pData( new QuickSelectionEngine_Data( _entryList ) )
+ :m_pData( new QuickSelectionEngine_Data( _entryList ) ),
+ bEnabled( true )
{
}
@@ -104,11 +105,14 @@ namespace vcl
{
}
- bool QuickSelectionEngine::HandleKeyEvent( const KeyEvent& _keyEvent )
+ void QuickSelectionEngine::SetEnabled( const bool& b )
{
- sal_Unicode c = _keyEvent.GetCharCode();
+ bEnabled = b;
+ }
- if ( ( c >= 32 ) && ( c != 127 ) && !_keyEvent.GetKeyCode().IsMod2() )
+ bool QuickSelectionEngine::HandleKeyEvent( const KeyEvent& _keyEvent )
+ {
+ if( bEnabled )
{
m_pData->sCurrentSearchString += OUString(c);
OSL_TRACE( "QuickSelectionEngine::HandleKeyEvent: searching for %s", OUStringToOString(m_pData->sCurrentSearchString, RTL_TEXTENCODING_UTF8).getStr() );
@@ -125,34 +129,59 @@ namespace vcl
}
OUString aSearchTemp( m_pData->sCurrentSearchString );
+ sal_Unicode c = _keyEvent.GetCharCode();
- StringEntryIdentifier pMatchingEntry = findMatchingEntry( aSearchTemp, *m_pData );
- OSL_TRACE( "QuickSelectionEngine::HandleKeyEvent: found %p", 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
+ if ( ( c >= 32 ) && ( c != 127 ) && !_keyEvent.GetKeyCode().IsMod2() )
{
- lcl_reset( *m_pData );
+ m_pData->sCurrentSearchString += c;
+ OSL_TRACE( "QuickSelectionEngine::HandleKeyEvent: searching for %s", OUStringToOString(m_pData->sCurrentSearchString, RTL_TEXTENCODING_UTF8).getStr() );
+
+ if ( m_pData->sCurrentSearchString.Len() == 1 )
+ { // first character in the search -> remmeber
+ m_pData->aSingleSearchChar.reset( c );
+ }
+ else if ( m_pData->sCurrentSearchString.Len() > 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 );
+ OSL_TRACE( "QuickSelectionEngine::HandleKeyEvent: found %p", 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 true;
+ return false;
+ }
+ else
+ {
+ return false;
}
- return false;
}
void QuickSelectionEngine::Reset()
{
- lcl_reset( *m_pData );
+ if( bEnabled )
+ lcl_reset( *m_pData );
}
} // namespace vcl