summaryrefslogtreecommitdiff
path: root/basctl/source/basicide/baside2b.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'basctl/source/basicide/baside2b.cxx')
-rw-r--r--basctl/source/basicide/baside2b.cxx73
1 files changed, 73 insertions, 0 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index a18e47538547..fe9da85b5697 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -502,6 +502,13 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
// see if there is an accelerator to be processed first
bool bDone = SfxViewShell::Current()->KeyInput( rKEvt );
+ //sal_Unicode aChar = rKEvt.GetKeyCode().GetCode();
+ if( pCodeCompleteWnd->IsVisible() )
+ {
+ std::cerr << "EditorWindow::KeyInput" << std::endl;
+ pCodeCompleteWnd->GetListBox()->KeyInput(rKEvt);
+ }
+
if( (rKEvt.GetKeyCode().GetCode() == KEY_SPACE ||
rKEvt.GetKeyCode().GetCode() == KEY_TAB ||
rKEvt.GetKeyCode().GetCode() == KEY_RETURN ) && CodeCompleteOptions::IsAutoCorrectKeywordsOn() )
@@ -757,6 +764,7 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
pCodeCompleteWnd->ResizeListBox();
pCodeCompleteWnd->SelectFirstEntry();
pEditView->GetWindow()->GrabFocus();
+ //pEditView->EnableCursor( true );
}
}
}
@@ -2538,6 +2546,7 @@ CodeCompleteListBox::CodeCompleteListBox( CodeCompleteWindow* pPar )
pCodeCompleteWindow( pPar )
{
SetDoubleClickHdl(LINK(this, CodeCompleteListBox, ImplDoubleClickHdl));
+ //SetSelectHdl(LINK(this, CodeCompleteListBox, ImplSelectionChangeHdl));
}
IMPL_LINK_NOARG(CodeCompleteListBox, ImplDoubleClickHdl)
@@ -2546,6 +2555,12 @@ IMPL_LINK_NOARG(CodeCompleteListBox, ImplDoubleClickHdl)
return 0;
}
+/*IMPL_LINK_NOARG(CodeCompleteListBox, ImplSelectionChangeHdl)
+{
+ pCodeCompleteWindow->pParent->GrabFocus();
+ return 0;
+}*/
+
void CodeCompleteListBox::InsertSelectedEntry()
{
if( !aFuncBuffer.toString().isEmpty() )
@@ -2586,6 +2601,7 @@ long CodeCompleteListBox::PreNotify( NotifyEvent& rNEvt )
{
if( rNEvt.GetType() == EVENT_KEYINPUT )
{
+ std::cerr << "CodeCompleteListBox::PreNotify" << std::endl;
KeyEvent aKeyEvt = *rNEvt.GetKeyEvent();
sal_Unicode aChar = aKeyEvt.GetKeyCode().GetCode();
if( ( aChar >= KEY_A ) && ( aChar <= KEY_Z ) )
@@ -2593,6 +2609,7 @@ long CodeCompleteListBox::PreNotify( NotifyEvent& rNEvt )
pCodeCompleteWindow->pParent->GetEditView()->InsertText( OUString(aKeyEvt.GetCharCode()) );
aFuncBuffer.append(aKeyEvt.GetCharCode());
SetVisibleEntries();
+ //pCodeCompleteWindow->pParent->GetEditView()->GetWindow()->GrabFocus();
return 0;
}
else
@@ -2629,9 +2646,13 @@ long CodeCompleteListBox::PreNotify( NotifyEvent& rNEvt )
case KEY_RETURN:
InsertSelectedEntry();
return 0;
+ /*case KEY_UP: case KEY_DOWN:
+ std::cerr << "up/down ke in PreNotify" << std::endl;
+ break;*/
}
}
}
+ //pCodeCompleteWindow->pParent->GrabFocus();
return ListBox::PreNotify( rNEvt );
}
@@ -2648,6 +2669,48 @@ void CodeCompleteListBox::SetVisibleEntries()
}
}
+void CodeCompleteListBox::KeyInput( const KeyEvent& rKeyEvt )
+{
+ std::cerr << "CodeCompleteListBox::KeyInput" << std::endl;
+ //pCodeCompleteWindow->pParent->GetEditView()->KeyInput( rKeyEvt );
+ sal_Unicode aChar = rKeyEvt.GetKeyCode().GetCode();
+ if( ( aChar >= KEY_A ) && ( aChar <= KEY_Z ) )
+ {
+ //pCodeCompleteWindow->pParent->GetEditView()->InsertText( OUString(rKeyEvt.GetCharCode()) );
+ aFuncBuffer.append(rKeyEvt.GetCharCode());
+ SetVisibleEntries();
+ }
+ else
+ {
+ switch( aChar )
+ {
+ case KEY_ESCAPE: // hide, do nothing
+ pCodeCompleteWindow->ClearAndHide();
+ break;
+ case KEY_TAB: case KEY_SPACE:
+ pCodeCompleteWindow->Hide();
+ pCodeCompleteWindow->pParent->GetEditView()->SetSelection( pCodeCompleteWindow->pParent->GetEditView()->CursorEndOfLine(pCodeCompleteWindow->GetTextSelection().GetStart()) );
+ pCodeCompleteWindow->pParent->GrabFocus();
+ break;
+ case KEY_BACKSPACE: case KEY_DELETE:
+ if( aFuncBuffer.toString() != OUString("") )
+ {
+ aFuncBuffer = aFuncBuffer.remove(aFuncBuffer.getLength()-1, 1);
+ SetVisibleEntries();
+ }
+ else
+ {
+ pCodeCompleteWindow->ClearAndHide();
+ }
+ break;
+ case KEY_RETURN:
+ InsertSelectedEntry();
+ break;
+ }
+ }
+ ListBox::KeyInput(rKeyEvt);
+}
+
CodeCompleteWindow::CodeCompleteWindow( EditorWindow* pPar )
: Window( pPar ),
pParent( pPar ),
@@ -2657,6 +2720,11 @@ pListBox( new CodeCompleteListBox(this) )
InitListBox();
}
+OUStringBuffer& CodeCompleteWindow::GetListBoxBuffer()
+{
+ return pListBox->aFuncBuffer;
+}
+
void CodeCompleteWindow::InitListBox()
{
pListBox->SetSizePixel( Size(150,150) ); //default, this will adopt the line length
@@ -2748,6 +2816,11 @@ void CodeCompleteWindow::ClearAndHide()
pParent->GrabFocus();
}
+void CodeCompleteWindow::SetVisibleEntries()
+{
+ pListBox->SetVisibleEntries();
+}
+
} // namespace basctl
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */