diff options
Diffstat (limited to 'basctl/source/basicide/baside2b.cxx')
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index c570be643582..1f134d17a635 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -275,7 +275,6 @@ EditorWindow::~EditorWindow() pEditEngine->RemoveView(pEditView.get()); } - //delete aListBox; delete pCodeCompleteWnd; } @@ -438,8 +437,8 @@ void EditorWindow::MouseButtonUp( const MouseEvent &rEvt ) pEditView->MouseButtonUp( rEvt ); if (SfxBindings* pBindings = GetBindingsPtr()) { - pBindings->Invalidate( SID_COPY ); - pBindings->Invalidate( SID_CUT ); + /*pBindings->Invalidate( SID_COPY ); + pBindings->Invalidate( SID_CUT );*/ pBindings->Invalidate( SID_BASICIDE_STAT_POS ); } } @@ -484,25 +483,6 @@ bool EditorWindow::ImpCanModify() return bCanModify; } -std::vector< OUString > EditorWindow::Split( const OUString& sStr, const sal_Unicode& aChar ) -{ - std::vector< OUString > aRet; - OUString sTmp; - for( sal_Int32 i = 0; i < sStr.getLength(); ++i ) - { - if( sStr[i] != aChar) - sTmp += OUString(sStr[i]); - else - { - aRet.push_back(sTmp); - sTmp = OUString(""); - } - } - if(sTmp != OUString("")) - aRet.push_back(sTmp); - return aRet; -} - void EditorWindow::KeyInput( const KeyEvent& rKEvt ) { SvtMiscOptions aMiscOptions; @@ -528,7 +508,7 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified OUString aStr = aLine.copy( std::max(aLine.lastIndexOf(" "), aLine.lastIndexOf("\t"))+1 ); // variable name OUString sActSub = GetActualSubName( nLine ); - std::vector< OUString > aVect; //= Split( aStr, '.' ); + std::vector< OUString > aVect; HighlightPortions aPortions; aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); @@ -589,7 +569,8 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) } pCodeCompleteWnd->ResizeListBox(); pCodeCompleteWnd->Show(); - pCodeCompleteWnd->GrabFocus(); + //pCodeCompleteWnd->GrabFocus(); + pCodeCompleteWnd->SelectFirstEntry(); } } } @@ -2393,6 +2374,12 @@ CodeCompleteListBox::~CodeCompleteListBox() IMPL_LINK_NOARG(CodeCompleteListBox, ImplDoubleClickHdl) { + InsertSelectedEntry(); + return 0; +} + +void CodeCompleteListBox::InsertSelectedEntry() +{ if( GetEntry( GetSelectEntryPos() ) != OUString("") ) { pCodeCompleteWindow->pParent->GetEditView()->SetSelection( pCodeCompleteWindow->GetTextSelection() ); @@ -2401,7 +2388,6 @@ IMPL_LINK_NOARG(CodeCompleteListBox, ImplDoubleClickHdl) pCodeCompleteWindow->LoseFocus(); pCodeCompleteWindow->Hide(); } - return 0; } long CodeCompleteListBox::PreNotify( NotifyEvent& rNEvt ) @@ -2413,12 +2399,15 @@ long CodeCompleteListBox::PreNotify( NotifyEvent& rNEvt ) { case KEY_ESCAPE: pCodeCompleteWindow->pParent->GetEditView()->EnableCursor( true ); + pCodeCompleteWindow->LoseFocus(); pCodeCompleteWindow->Hide(); return 0; - default: - return ListBox::PreNotify( rNEvt ); + case KEY_RETURN: + InsertSelectedEntry(); + return 0; } } + return ListBox::PreNotify( rNEvt ); } CodeCompleteWindow::CodeCompleteWindow( EditorWindow* pPar ) @@ -2426,7 +2415,7 @@ CodeCompleteWindow::CodeCompleteWindow( EditorWindow* pPar ) pParent(pPar) { InitListBox(); - SetSizePixel( Size(150,150) ); + SetSizePixel( Size(150,150) ); //default, later it changes } void CodeCompleteWindow::InitListBox() @@ -2494,6 +2483,15 @@ void CodeCompleteWindow::ResizeListBox() } } +void CodeCompleteWindow::SelectFirstEntry() +{ + if( pListBox->GetEntryCount() > 0 ) + { + pListBox->SelectEntryPos( 0 ); + pListBox->GrabFocus(); + } +} + } // namespace basctl /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |