summaryrefslogtreecommitdiff
path: root/basctl/source
diff options
context:
space:
mode:
authorGergo Mocsi <gmocsi91@gmail.com>2013-07-24 17:27:02 +0200
committerGergo Mocsi <gmocsi91@gmail.com>2013-07-24 17:27:02 +0200
commitfd35319cbf96e215cf52db70d947ff0b5cf96948 (patch)
tree66fe50ea24117c90a44f75a3261e4449199d5d34 /basctl/source
parentc4373b6e3b07bbd0d633499da4e1afd692d03889 (diff)
GSOC work, cache implementation fix, code fixes
The CodeCompleteDataCache got a new implementation: global variables are stored separately. The "static const" OUString-s were removed from the class. Data extraction is only done when pressing the dot key. Change-Id: I3ff94c0c6eabe328761336d4c74744eb7efc6056
Diffstat (limited to 'basctl/source')
-rw-r--r--basctl/source/basicide/baside2b.cxx36
-rw-r--r--basctl/source/basicide/codecompleteoptionsdlg.cxx5
2 files changed, 11 insertions, 30 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 8c5f62126437..d561997fc227 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -502,10 +502,11 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
if( rKEvt.GetKeyCode().GetCode() == KEY_POINT && CodeCompleteOptions::IsCodeCompleteOn() )
{
rModulWindow.UpdateModule();
+ rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse(aCodeCompleteCache);
TextSelection aSel = GetEditView()->GetSelection();
sal_uLong nLine = aSel.GetStart().GetPara();
OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified
- OUString sActSub = GetActualSubName( nLine );
+ //OUString sActSub = GetActualSubName( nLine );
std::vector< OUString > aVect;
HighlightPortions aPortions;
@@ -517,9 +518,7 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
aVect.push_back( aLine.copy(r.nBegin, r.nEnd - r.nBegin) );
}
OUString sBaseName = aVect[0];//variable name
- OUString sVarType = aCodeCompleteCache.GetVariableType(sBaseName, CodeCompleteDataCache::GLOB_KEY);
- if( sVarType == CodeCompleteDataCache::NOT_FOUND )
- sVarType = aCodeCompleteCache.GetVariableType(sBaseName, sActSub);
+ OUString sVarType = aCodeCompleteCache.GetVarType( sBaseName );
Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), UNO_SET_THROW );
Reference< reflection::XIdlReflection > xRefl( xFactory->createInstance("com.sun.star.reflection.CoreReflection"), UNO_QUERY_THROW );
@@ -827,20 +826,10 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
{
ParagraphInsertedDeleted( rTextHint.GetValue(), true );
DoDelayedSyntaxHighlight( rTextHint.GetValue() );
- if( CodeCompleteOptions::IsCodeCompleteOn() )
- {
- rModulWindow.UpdateModule();
- aCodeCompleteCache.SetVars(rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse().GetVars());
- }
}
else if( rTextHint.GetId() == TEXT_HINT_PARAREMOVED )
{
ParagraphInsertedDeleted( rTextHint.GetValue(), false );
- if( CodeCompleteOptions::IsCodeCompleteOn() )
- {
- rModulWindow.UpdateModule();
- aCodeCompleteCache.SetVars(rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse().GetVars());
- }
}
else if( rTextHint.GetId() == TEXT_HINT_PARACONTENTCHANGED )
{
@@ -854,11 +843,6 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
pBindings->Invalidate( SID_COPY );
}
}
- else if( rTextHint.GetId() == TEXT_HINT_MODIFIED && CodeCompleteOptions::IsCodeCompleteOn() )
- {
- rModulWindow.UpdateModule();
- aCodeCompleteCache.SetVars(rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse().GetVars());
- }
}
}
@@ -876,12 +860,11 @@ OUString EditorWindow::GetActualSubName( sal_uLong nLine )
pMeth->GetLineRange(l1,l2);
if( (l1 <= nLine+1) && (nLine+1 <= l2) )
{
- //std::cerr << "sName: " << sName << std::endl;
return sName;
}
}
}
- return CodeCompleteDataCache::GLOB_KEY;
+ return OUString("");
}
void EditorWindow::SetScrollBarRanges()
@@ -2374,7 +2357,7 @@ IMPL_LINK_NOARG(CodeCompleteListBox, ImplDoubleClickHdl)
void CodeCompleteListBox::InsertSelectedEntry()
{
- if( aFuncBuffer.toString() != OUString("") )
+ if( !aFuncBuffer.toString().isEmpty() )
{
// if the user typed in something: remove, and insert
TextPaM aEnd(pCodeCompleteWindow->aTextSelection.GetEnd().GetPara(), pCodeCompleteWindow->GetTextSelection().GetEnd().GetIndex() + aFuncBuffer.getLength());
@@ -2382,7 +2365,7 @@ void CodeCompleteListBox::InsertSelectedEntry()
pCodeCompleteWindow->pParent->GetEditView()->SetSelection(TextSelection(aStart, aEnd));
pCodeCompleteWindow->pParent->GetEditView()->DeleteSelected();
- if( GetEntry( GetSelectEntryPos() ) != OUString("") )
+ if( !((OUString) GetEntry( GetSelectEntryPos() )).isEmpty() )
{//if the user selected something
pCodeCompleteWindow->pParent->GetEditView()->InsertText( (OUString) GetEntry(GetSelectEntryPos()), sal_True );
pCodeCompleteWindow->Hide();
@@ -2398,7 +2381,7 @@ void CodeCompleteListBox::InsertSelectedEntry()
}
else
{
- if( GetEntry( GetSelectEntryPos() ) != OUString("") )
+ if( !((OUString) GetEntry( GetSelectEntryPos() )).isEmpty() )
{//if the user selected something
pCodeCompleteWindow->pParent->GetEditView()->InsertText( (OUString) GetEntry(GetSelectEntryPos()), sal_True );
pCodeCompleteWindow->Hide();
@@ -2427,9 +2410,6 @@ long CodeCompleteListBox::PreNotify( NotifyEvent& rNEvt )
{
case KEY_ESCAPE: // hide, do nothing
pCodeCompleteWindow->ClearAndHide();
- /*pCodeCompleteWindow->Hide();
- pCodeCompleteWindow->pParent->GetEditView()->SetSelection( pCodeCompleteWindow->pParent->GetEditView()->CursorEndOfLine(pCodeCompleteWindow->GetTextSelection().GetStart()) );
- //pCodeCompleteWindow->pParent->GrabFocus();*/
return 0;
case KEY_TAB: case KEY_SPACE:
/* space, tab the user probably have typed in the whole
@@ -2522,7 +2502,7 @@ void CodeCompleteWindow::ResizeListBox()
aLongestEntry = pListBox->GetEntry( i );
}
- Size aSize = pListBox->GetOptimalSize();
+ Size aSize = pListBox->CalcSize( aLongestEntry.getLength(), std::min( (sal_uInt16) 4, pListBox->GetEntryCount()) );
const Font& aFont = pListBox->GetUnzoomedControlPointFont();
aSize.setHeight( aFont.GetSize().getHeight() * 16 );
diff --git a/basctl/source/basicide/codecompleteoptionsdlg.cxx b/basctl/source/basicide/codecompleteoptionsdlg.cxx
index a948ab60e142..96d1ca732f73 100644
--- a/basctl/source/basicide/codecompleteoptionsdlg.cxx
+++ b/basctl/source/basicide/codecompleteoptionsdlg.cxx
@@ -40,9 +40,9 @@ CodeCompleteOptionsDlg::CodeCompleteOptionsDlg( Window* pWindow )
pOkBtn->SetClickHdl( LINK( this, CodeCompleteOptionsDlg, OkHdl ) );
pCancelBtn->SetClickHdl( LINK( this, CodeCompleteOptionsDlg, CancelHdl ) );
- pCodeCompleteChk->Check(CodeCompleteOptions::IsCodeCompleteOn()); //set it on, if needed
+ pCodeCompleteChk->Check( CodeCompleteOptions::IsCodeCompleteOn() );
+ pAutocloseProcChk->Check( CodeCompleteOptions::IsProcedureAutoCompleteOn() );
- pAutocloseProcChk->Enable( false );
pAutocloseBracesChk->Enable( false );
pAutocloseQuotesChk->Enable( false );
}
@@ -54,6 +54,7 @@ CodeCompleteOptionsDlg::~CodeCompleteOptionsDlg()
IMPL_LINK_NOARG(CodeCompleteOptionsDlg, OkHdl)
{
CodeCompleteOptions::SetCodeCompleteOn( pCodeCompleteChk->IsChecked() );
+ CodeCompleteOptions::SetProcedureAutoCompleteOn( pCodeCompleteChk->IsChecked() );
Close();
return 0;
}