diff options
Diffstat (limited to 'basctl/source')
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 24 | ||||
-rw-r--r-- | basctl/source/basicide/codecompleteoptionsdlg.cxx | 5 |
2 files changed, 25 insertions, 4 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 8ae1d5ba7d97..a6acaea0f1ea 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -505,6 +505,29 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) // see if there is an accelerator to be processed first bool bDone = SfxViewShell::Current()->KeyInput( rKEvt ); + if( rKEvt.GetKeyCode().GetCode() == KEY_RETURN && CodeCompleteOptions::IsProcedureAutoCompleteOn() ) + {//autoclose implementation + TextSelection aSel = GetEditView()->GetSelection(); + sal_uLong nLine = aSel.GetStart().GetPara(); + OUString sActSub = GetActualSubName( nLine ); + IncompleteProcedures aProcData = rModulWindow.GetSbModule()->GetIncompleteProcedures(); + for( unsigned int i = 0; i < aProcData.size(); ++i ) + { + if( aProcData[i].sProcName == sActSub ) + {//found the procedure to autocomplete + TextPaM aEnd( aProcData[i].nLine, 0 ); + TextPaM aStart( aProcData[i].nLine, 0 ); + GetEditView()->SetSelection( TextSelection( aStart, aEnd ) ); + if( aProcData[i].aType == AutocompleteType::ACSUB ) + GetEditView()->InsertText( OUString("\nEnd Sub\n") ); + if( aProcData[i].aType == AutocompleteType::ACFUNC ) + GetEditView()->InsertText( OUString("\nEnd Function\n") ); + GetEditView()->SetSelection( aSel ); + break; + } + } + } + if( rKEvt.GetKeyCode().GetCode() == KEY_POINT && CodeCompleteOptions::IsCodeCompleteOn() ) { rModulWindow.UpdateModule(); @@ -512,7 +535,6 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) TextSelection aSel = GetEditView()->GetSelection(); sal_uLong nLine = aSel.GetStart().GetPara(); OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified - //OUString sActSub = GetActualSubName( nLine ); std::vector< OUString > aVect; HighlightPortions aPortions; diff --git a/basctl/source/basicide/codecompleteoptionsdlg.cxx b/basctl/source/basicide/codecompleteoptionsdlg.cxx index 6dcde740f214..0f4ab3a8cac8 100644 --- a/basctl/source/basicide/codecompleteoptionsdlg.cxx +++ b/basctl/source/basicide/codecompleteoptionsdlg.cxx @@ -41,9 +41,8 @@ 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 ); } @@ -55,7 +54,7 @@ CodeCompleteOptionsDlg::~CodeCompleteOptionsDlg() IMPL_LINK_NOARG(CodeCompleteOptionsDlg, OkHdl) { CodeCompleteOptions::SetCodeCompleteOn( pCodeCompleteChk->IsChecked() ); - //CodeCompleteOptions::SetProcedureAutoCompleteOn( pCodeCompleteChk->IsChecked() ); + CodeCompleteOptions::SetProcedureAutoCompleteOn( pAutocloseProcChk->IsChecked() ); Close(); return 0; } |