summaryrefslogtreecommitdiff
path: root/basctl/source/basicide
diff options
context:
space:
mode:
authorGergo Mocsi <gmocsi91@gmail.com>2013-07-31 17:08:18 +0200
committerGergo Mocsi <gmocsi91@gmail.com>2013-07-31 17:08:18 +0200
commitbc7e841728c820de6d2fade0c052e53da4a87bcf (patch)
treee776da9fe4082e8a9db411cd4e9c302e45ed8e7b /basctl/source/basicide
parentcbe6c15c676641a51c5504613eb939fec846e670 (diff)
GSOC work, ListBox appearance fix (at the borders) + code fixes
ListBox appearance fixed at the borders: a) bottom: it it placed over the current line (not under) b) right side: listbox's right side is adjusted to the window's right side Coed fixes: CodeCompleteOptions now intializes itself from the configuration file BasicIDE.xcs Added a checkbox for enabling extended types in the options dialog. Cursor is visible when the listbox is active. Fixed the small issue when deleting a character. Change-Id: I68b80143de245cebfce65cdd8af37ea4694aa81b
Diffstat (limited to 'basctl/source/basicide')
-rw-r--r--basctl/source/basicide/baside2b.cxx23
-rw-r--r--basctl/source/basicide/codecompleteoptionsdlg.cxx29
-rw-r--r--basctl/source/basicide/codecompleteoptionsdlg.hxx3
3 files changed, 46 insertions, 9 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 3aebafdfa0e3..7b550ba388e4 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -746,6 +746,7 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
pCodeCompleteWnd->Show();
pCodeCompleteWnd->ResizeListBox();
pCodeCompleteWnd->SelectFirstEntry();
+ pEditView->GetWindow()->GrabFocus();
}
}
}
@@ -2605,7 +2606,7 @@ long CodeCompleteListBox::PreNotify( NotifyEvent& rNEvt )
{
TextPaM aEnd(pCodeCompleteWindow->aTextSelection.GetEnd().GetPara(), pCodeCompleteWindow->GetTextSelection().GetEnd().GetIndex() + aFuncBuffer.getLength());
TextPaM aStart(pCodeCompleteWindow->aTextSelection.GetEnd().GetPara(), pCodeCompleteWindow->GetTextSelection().GetEnd().GetIndex() + aFuncBuffer.getLength()-1);
- aFuncBuffer.stripEnd(aFuncBuffer[aFuncBuffer.getLength()-1]);
+ aFuncBuffer = aFuncBuffer.remove(aFuncBuffer.getLength()-1, 1);
pCodeCompleteWindow->pParent->GetEditView()->SetSelection(TextSelection(aStart, aEnd));
pCodeCompleteWindow->pParent->GetEditView()->DeleteSelected();
SetVisibleEntries();
@@ -2689,9 +2690,27 @@ void CodeCompleteWindow::ResizeListBox()
Size aSize = pListBox->CalcSize( aLongestEntry.getLength(), std::min( (sal_uInt16) 4, pListBox->GetEntryCount()) );
const Font& aFont = pListBox->GetUnzoomedControlPointFont();
+ Rectangle aVisArea( pParent->GetEditView()->GetStartDocPos(), pParent->GetOutputSizePixel() );
aSize.setHeight( aFont.GetSize().getHeight() * 16 );
aSize.setWidth( pListBox->CalcSize(aLongestEntry.getLength(), pListBox->GetEntryCount()).getWidth() );
-
+ Point aBottomPoint = aVisArea.BottomRight();
+ Point aTopPoint = aVisArea.TopRight();
+ long nYDiff = std::abs((aBottomPoint.Y() - aTopPoint.Y()) - GetPosPixel().Y());
+
+ if( (nYDiff + aFont.GetSize().getHeight()) < aSize.Height() )
+ {//bottom part is clipped, fix the visibility by placing it over the line (not under)
+ //std::cerr << "clipped at the bottom" << std::endl;
+ Point aPos = GetPosPixel();
+ aPos.Y() = aPos.Y() - (aSize.getHeight() + aFont.GetSize().getHeight());
+ SetPosPixel(aPos);
+ }
+ long nXDiff = std::abs(aTopPoint.X() - GetPosPixel().X());
+ if( nXDiff < aSize.Width() )
+ {//clipped at the right side, move it a bit left
+ Point aPos = GetPosPixel();
+ aPos.X() = aPos.X() - aSize.Width() + nXDiff;
+ SetPosPixel(aPos);
+ }
pListBox->SetSizePixel( aSize );
aSize.setWidth( aSize.getWidth() + 1 );
aSize.setHeight( aSize.getHeight() + 1 );
diff --git a/basctl/source/basicide/codecompleteoptionsdlg.cxx b/basctl/source/basicide/codecompleteoptionsdlg.cxx
index 130f3617715c..e8537c616528 100644
--- a/basctl/source/basicide/codecompleteoptionsdlg.cxx
+++ b/basctl/source/basicide/codecompleteoptionsdlg.cxx
@@ -39,16 +39,15 @@ CodeCompleteOptionsDlg::CodeCompleteOptionsDlg( Window* pWindow )
get(pAutocloseParenChk, "autoclose_paren");
get(pAutocloseQuotesChk, "autoclose_quotes");
get(pAutoCorrectSpellingChk, "autocorrect_spelling");
+ get(pUseExtendedTypesChk, "extendedtypes_enable");
pOkBtn->SetClickHdl( LINK( this, CodeCompleteOptionsDlg, OkHdl ) );
pCancelBtn->SetClickHdl( LINK( this, CodeCompleteOptionsDlg, CancelHdl ) );
- LoadConfig();
- /*pCodeCompleteChk->Check( CodeCompleteOptions::IsCodeCompleteOn() );
- pAutocloseProcChk->Check( CodeCompleteOptions::IsProcedureAutoCompleteOn() );
- pAutocloseQuotesChk->Check( CodeCompleteOptions::IsAutoCloseQuotesOn() );
- pAutocloseParenChk->Check( CodeCompleteOptions::IsAutoCloseParenthesisOn() );
- pAutoCorrectSpellingChk->Check( CodeCompleteOptions::IsAutoCorrectSpellingOn() );*/
+ pCodeCompleteChk->SetToggleHdl( LINK(this, CodeCompleteOptionsDlg, CodeCompleteHdl) );
+ pUseExtendedTypesChk->SetToggleHdl( LINK(this, CodeCompleteOptionsDlg, ExtendedTypesHdl) );
+
+ LoadConfig();
}
@@ -63,6 +62,7 @@ IMPL_LINK_NOARG(CodeCompleteOptionsDlg, OkHdl)
CodeCompleteOptions::SetAutoCloseQuotesOn( pAutocloseQuotesChk->IsChecked() );
CodeCompleteOptions::SetAutoCloseParenthesisOn( pAutocloseParenChk->IsChecked() );
CodeCompleteOptions::SetAutoCorrectSpellingOn( pAutoCorrectSpellingChk->IsChecked() );
+ CodeCompleteOptions::SetExtendedTypeDeclaration( pAutoCorrectSpellingChk->IsChecked() );
SaveConfig();
Close();
@@ -75,6 +75,18 @@ IMPL_LINK_NOARG(CodeCompleteOptionsDlg, CancelHdl)
return 0;
}
+IMPL_LINK_NOARG(CodeCompleteOptionsDlg, ExtendedTypesHdl)
+{
+ pCodeCompleteChk->Check( pUseExtendedTypesChk->IsChecked() );
+ return 0;
+}
+
+IMPL_LINK_NOARG(CodeCompleteOptionsDlg, CodeCompleteHdl)
+{
+ pUseExtendedTypesChk->Check( pCodeCompleteChk->IsChecked() );
+ return 0;
+}
+
short CodeCompleteOptionsDlg::Execute()
{
return ModalDialog::Execute();
@@ -83,6 +95,7 @@ short CodeCompleteOptionsDlg::Execute()
void CodeCompleteOptionsDlg::LoadConfig()
{
bool bProcClose = officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::get();
+ bool bExtended = officecfg::Office::BasicIDE::Autocomplete::UseExtended::get();
bool bCodeCompleteOn = officecfg::Office::BasicIDE::Autocomplete::CodeComplete::get();
bool bParenClose = officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::get();
bool bQuoteClose = officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::get();
@@ -93,13 +106,15 @@ void CodeCompleteOptionsDlg::LoadConfig()
pAutocloseQuotesChk->Check( bQuoteClose );
pAutocloseParenChk->Check( bParenClose );
pAutoCorrectSpellingChk->Check( bCorrect );
+ pUseExtendedTypesChk->Check( bExtended );
}
void CodeCompleteOptionsDlg::SaveConfig()
{
- boost::shared_ptr< comphelper::ConfigurationChanges > batch(comphelper::ConfigurationChanges::create());
+ boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::set( pAutocloseProcChk->IsChecked(), batch );
officecfg::Office::BasicIDE::Autocomplete::CodeComplete::set( pCodeCompleteChk->IsChecked(), batch );
+ officecfg::Office::BasicIDE::Autocomplete::UseExtended::set( pUseExtendedTypesChk->IsChecked(), batch );
officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::set( pAutocloseParenChk->IsChecked(), batch );
officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::set( pAutocloseQuotesChk->IsChecked(), batch );
officecfg::Office::BasicIDE::Autocomplete::AutoCorrectSpelling::set( pAutoCorrectSpellingChk->IsChecked(), batch );
diff --git a/basctl/source/basicide/codecompleteoptionsdlg.hxx b/basctl/source/basicide/codecompleteoptionsdlg.hxx
index 6314841daaed..781118b5c510 100644
--- a/basctl/source/basicide/codecompleteoptionsdlg.hxx
+++ b/basctl/source/basicide/codecompleteoptionsdlg.hxx
@@ -37,9 +37,12 @@ private:
CheckBox* pAutocloseParenChk;
CheckBox* pAutocloseQuotesChk;
CheckBox* pAutoCorrectSpellingChk;
+ CheckBox* pUseExtendedTypesChk;
DECL_LINK(OkHdl, void*);
DECL_LINK(CancelHdl, void*);
+ DECL_LINK(ExtendedTypesHdl, void*);
+ DECL_LINK(CodeCompleteHdl, void*);
void LoadConfig();
void SaveConfig();