diff options
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 15 | ||||
-rw-r--r-- | basctl/source/basicide/codecompleteoptionsdlg.cxx | 6 | ||||
-rw-r--r-- | basctl/source/basicide/codecompleteoptionsdlg.hxx | 2 | ||||
-rw-r--r-- | basctl/uiconfig/basicide/ui/codecompleteoptionsdlg.ui | 4 |
4 files changed, 21 insertions, 6 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 7578f85241b2..d39f06139a8e 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -522,6 +522,21 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) } } + if( rKEvt.GetCharCode() == '(' && CodeCompleteOptions::IsAutoCloseParenthesisOn() ) + {//autoclose parenthesis + TextSelection aSel = GetEditView()->GetSelection(); + sal_uLong nLine = aSel.GetStart().GetPara(); + OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified + + if( aLine.getLength() > 0 && aLine[aSel.GetEnd().GetIndex()-1] != '(' ) + { + GetEditView()->InsertText(OUString(")")); + //leave the cursor on it's place: inside the parenthesis + TextPaM aEnd(nLine, aSel.GetEnd().GetIndex()); + GetEditView()->SetSelection( TextSelection( aEnd, aEnd ) ); + } + } + if( rKEvt.GetKeyCode().GetCode() == KEY_RETURN && CodeCompleteOptions::IsProcedureAutoCompleteOn() ) {//autoclose implementation TextSelection aSel = GetEditView()->GetSelection(); diff --git a/basctl/source/basicide/codecompleteoptionsdlg.cxx b/basctl/source/basicide/codecompleteoptionsdlg.cxx index ac2793f767e4..ff4398b1e816 100644 --- a/basctl/source/basicide/codecompleteoptionsdlg.cxx +++ b/basctl/source/basicide/codecompleteoptionsdlg.cxx @@ -34,7 +34,7 @@ CodeCompleteOptionsDlg::CodeCompleteOptionsDlg( Window* pWindow ) get(pCodeCompleteChk, "codecomplete_enable"); get(pAutocloseProcChk, "autoclose_proc"); - get(pAutocloseBracesChk, "autoclose_braces"); + get(pAutocloseParenChk, "autoclose_paren"); get(pAutocloseQuotesChk, "autoclose_quotes"); pOkBtn->SetClickHdl( LINK( this, CodeCompleteOptionsDlg, OkHdl ) ); @@ -43,8 +43,7 @@ CodeCompleteOptionsDlg::CodeCompleteOptionsDlg( Window* pWindow ) pCodeCompleteChk->Check( CodeCompleteOptions::IsCodeCompleteOn() ); pAutocloseProcChk->Check( CodeCompleteOptions::IsProcedureAutoCompleteOn() ); pAutocloseQuotesChk->Check( CodeCompleteOptions::IsAutoCloseQuotesOn() ); - - pAutocloseBracesChk->Enable( false ); + pAutocloseParenChk->Check( CodeCompleteOptions::IsAutoCloseParenthesisOn() ); } CodeCompleteOptionsDlg::~CodeCompleteOptionsDlg() @@ -56,6 +55,7 @@ IMPL_LINK_NOARG(CodeCompleteOptionsDlg, OkHdl) CodeCompleteOptions::SetCodeCompleteOn( pCodeCompleteChk->IsChecked() ); CodeCompleteOptions::SetProcedureAutoCompleteOn( pAutocloseProcChk->IsChecked() ); CodeCompleteOptions::SetAutoCloseQuotesOn( pAutocloseQuotesChk->IsChecked() ); + CodeCompleteOptions::SetAutoCloseParenthesisOn( pAutocloseParenChk->IsChecked() ); Close(); return 0; } diff --git a/basctl/source/basicide/codecompleteoptionsdlg.hxx b/basctl/source/basicide/codecompleteoptionsdlg.hxx index 9549b99a09f3..2154c8a00347 100644 --- a/basctl/source/basicide/codecompleteoptionsdlg.hxx +++ b/basctl/source/basicide/codecompleteoptionsdlg.hxx @@ -34,7 +34,7 @@ private: CheckBox* pCodeCompleteChk; CheckBox* pAutocloseProcChk; - CheckBox* pAutocloseBracesChk; + CheckBox* pAutocloseParenChk; CheckBox* pAutocloseQuotesChk; DECL_LINK(OkHdl, void*); diff --git a/basctl/uiconfig/basicide/ui/codecompleteoptionsdlg.ui b/basctl/uiconfig/basicide/ui/codecompleteoptionsdlg.ui index 83256b52ebae..1c0d86ccb2df 100644 --- a/basctl/uiconfig/basicide/ui/codecompleteoptionsdlg.ui +++ b/basctl/uiconfig/basicide/ui/codecompleteoptionsdlg.ui @@ -145,8 +145,8 @@ </packing> </child> <child> - <object class="GtkCheckButton" id="autoclose_braces"> - <property name="label" translatable="yes">Autoclose Braces</property> + <object class="GtkCheckButton" id="autoclose_paren"> + <property name="label" translatable="yes">Autoclose Parenthesis</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> |