Kaydet (Commit) edcec5b1 authored tarafından Gergo Mocsi's avatar Gergo Mocsi

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
üst 70ab744c
...@@ -508,10 +508,11 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) ...@@ -508,10 +508,11 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
if( rKEvt.GetKeyCode().GetCode() == KEY_POINT && CodeCompleteOptions::IsCodeCompleteOn() ) if( rKEvt.GetKeyCode().GetCode() == KEY_POINT && CodeCompleteOptions::IsCodeCompleteOn() )
{ {
rModulWindow.UpdateModule(); rModulWindow.UpdateModule();
rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse(aCodeCompleteCache);
TextSelection aSel = GetEditView()->GetSelection(); TextSelection aSel = GetEditView()->GetSelection();
sal_uLong nLine = aSel.GetStart().GetPara(); sal_uLong nLine = aSel.GetStart().GetPara();
OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified
OUString sActSub = GetActualSubName( nLine ); //OUString sActSub = GetActualSubName( nLine );
std::vector< OUString > aVect; std::vector< OUString > aVect;
HighlightPortions aPortions; HighlightPortions aPortions;
...@@ -523,9 +524,7 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) ...@@ -523,9 +524,7 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
aVect.push_back( aLine.copy(r.nBegin, r.nEnd - r.nBegin) ); aVect.push_back( aLine.copy(r.nBegin, r.nEnd - r.nBegin) );
} }
OUString sBaseName = aVect[0];//variable name OUString sBaseName = aVect[0];//variable name
OUString sVarType = aCodeCompleteCache.GetVariableType(sBaseName, CodeCompleteDataCache::GLOB_KEY); OUString sVarType = aCodeCompleteCache.GetVarType( sBaseName );
if( sVarType == CodeCompleteDataCache::NOT_FOUND )
sVarType = aCodeCompleteCache.GetVariableType(sBaseName, sActSub);
Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), UNO_SET_THROW ); Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), UNO_SET_THROW );
Reference< reflection::XIdlReflection > xRefl( xFactory->createInstance("com.sun.star.reflection.CoreReflection"), UNO_QUERY_THROW ); Reference< reflection::XIdlReflection > xRefl( xFactory->createInstance("com.sun.star.reflection.CoreReflection"), UNO_QUERY_THROW );
...@@ -833,20 +832,10 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) ...@@ -833,20 +832,10 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
{ {
ParagraphInsertedDeleted( rTextHint.GetValue(), true ); ParagraphInsertedDeleted( rTextHint.GetValue(), true );
DoDelayedSyntaxHighlight( rTextHint.GetValue() ); DoDelayedSyntaxHighlight( rTextHint.GetValue() );
if( CodeCompleteOptions::IsCodeCompleteOn() )
{
rModulWindow.UpdateModule();
aCodeCompleteCache.SetVars(rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse().GetVars());
}
} }
else if( rTextHint.GetId() == TEXT_HINT_PARAREMOVED ) else if( rTextHint.GetId() == TEXT_HINT_PARAREMOVED )
{ {
ParagraphInsertedDeleted( rTextHint.GetValue(), false ); ParagraphInsertedDeleted( rTextHint.GetValue(), false );
if( CodeCompleteOptions::IsCodeCompleteOn() )
{
rModulWindow.UpdateModule();
aCodeCompleteCache.SetVars(rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse().GetVars());
}
} }
else if( rTextHint.GetId() == TEXT_HINT_PARACONTENTCHANGED ) else if( rTextHint.GetId() == TEXT_HINT_PARACONTENTCHANGED )
{ {
...@@ -860,11 +849,6 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) ...@@ -860,11 +849,6 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
pBindings->Invalidate( SID_COPY ); pBindings->Invalidate( SID_COPY );
} }
} }
else if( rTextHint.GetId() == TEXT_HINT_MODIFIED && CodeCompleteOptions::IsCodeCompleteOn() )
{
rModulWindow.UpdateModule();
aCodeCompleteCache.SetVars(rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse().GetVars());
}
} }
} }
...@@ -882,12 +866,11 @@ OUString EditorWindow::GetActualSubName( sal_uLong nLine ) ...@@ -882,12 +866,11 @@ OUString EditorWindow::GetActualSubName( sal_uLong nLine )
pMeth->GetLineRange(l1,l2); pMeth->GetLineRange(l1,l2);
if( (l1 <= nLine+1) && (nLine+1 <= l2) ) if( (l1 <= nLine+1) && (nLine+1 <= l2) )
{ {
//std::cerr << "sName: " << sName << std::endl;
return sName; return sName;
} }
} }
} }
return CodeCompleteDataCache::GLOB_KEY; return OUString("");
} }
void EditorWindow::SetScrollBarRanges() void EditorWindow::SetScrollBarRanges()
...@@ -2380,7 +2363,7 @@ IMPL_LINK_NOARG(CodeCompleteListBox, ImplDoubleClickHdl) ...@@ -2380,7 +2363,7 @@ IMPL_LINK_NOARG(CodeCompleteListBox, ImplDoubleClickHdl)
void CodeCompleteListBox::InsertSelectedEntry() void CodeCompleteListBox::InsertSelectedEntry()
{ {
if( aFuncBuffer.toString() != OUString("") ) if( !aFuncBuffer.toString().isEmpty() )
{ {
// if the user typed in something: remove, and insert // if the user typed in something: remove, and insert
TextPaM aEnd(pCodeCompleteWindow->aTextSelection.GetEnd().GetPara(), pCodeCompleteWindow->GetTextSelection().GetEnd().GetIndex() + aFuncBuffer.getLength()); TextPaM aEnd(pCodeCompleteWindow->aTextSelection.GetEnd().GetPara(), pCodeCompleteWindow->GetTextSelection().GetEnd().GetIndex() + aFuncBuffer.getLength());
...@@ -2388,7 +2371,7 @@ void CodeCompleteListBox::InsertSelectedEntry() ...@@ -2388,7 +2371,7 @@ void CodeCompleteListBox::InsertSelectedEntry()
pCodeCompleteWindow->pParent->GetEditView()->SetSelection(TextSelection(aStart, aEnd)); pCodeCompleteWindow->pParent->GetEditView()->SetSelection(TextSelection(aStart, aEnd));
pCodeCompleteWindow->pParent->GetEditView()->DeleteSelected(); pCodeCompleteWindow->pParent->GetEditView()->DeleteSelected();
if( GetEntry( GetSelectEntryPos() ) != OUString("") ) if( !((OUString) GetEntry( GetSelectEntryPos() )).isEmpty() )
{//if the user selected something {//if the user selected something
pCodeCompleteWindow->pParent->GetEditView()->InsertText( (OUString) GetEntry(GetSelectEntryPos()), sal_True ); pCodeCompleteWindow->pParent->GetEditView()->InsertText( (OUString) GetEntry(GetSelectEntryPos()), sal_True );
pCodeCompleteWindow->Hide(); pCodeCompleteWindow->Hide();
...@@ -2404,7 +2387,7 @@ void CodeCompleteListBox::InsertSelectedEntry() ...@@ -2404,7 +2387,7 @@ void CodeCompleteListBox::InsertSelectedEntry()
} }
else else
{ {
if( GetEntry( GetSelectEntryPos() ) != OUString("") ) if( !((OUString) GetEntry( GetSelectEntryPos() )).isEmpty() )
{//if the user selected something {//if the user selected something
pCodeCompleteWindow->pParent->GetEditView()->InsertText( (OUString) GetEntry(GetSelectEntryPos()), sal_True ); pCodeCompleteWindow->pParent->GetEditView()->InsertText( (OUString) GetEntry(GetSelectEntryPos()), sal_True );
pCodeCompleteWindow->Hide(); pCodeCompleteWindow->Hide();
...@@ -2433,9 +2416,6 @@ long CodeCompleteListBox::PreNotify( NotifyEvent& rNEvt ) ...@@ -2433,9 +2416,6 @@ long CodeCompleteListBox::PreNotify( NotifyEvent& rNEvt )
{ {
case KEY_ESCAPE: // hide, do nothing case KEY_ESCAPE: // hide, do nothing
pCodeCompleteWindow->ClearAndHide(); pCodeCompleteWindow->ClearAndHide();
/*pCodeCompleteWindow->Hide();
pCodeCompleteWindow->pParent->GetEditView()->SetSelection( pCodeCompleteWindow->pParent->GetEditView()->CursorEndOfLine(pCodeCompleteWindow->GetTextSelection().GetStart()) );
//pCodeCompleteWindow->pParent->GrabFocus();*/
return 0; return 0;
case KEY_TAB: case KEY_SPACE: case KEY_TAB: case KEY_SPACE:
/* space, tab the user probably have typed in the whole /* space, tab the user probably have typed in the whole
...@@ -2528,7 +2508,7 @@ void CodeCompleteWindow::ResizeListBox() ...@@ -2528,7 +2508,7 @@ void CodeCompleteWindow::ResizeListBox()
aLongestEntry = pListBox->GetEntry( i ); 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(); const Font& aFont = pListBox->GetUnzoomedControlPointFont();
aSize.setHeight( aFont.GetSize().getHeight() * 16 ); aSize.setHeight( aFont.GetSize().getHeight() * 16 );
......
...@@ -40,9 +40,9 @@ CodeCompleteOptionsDlg::CodeCompleteOptionsDlg( Window* pWindow ) ...@@ -40,9 +40,9 @@ CodeCompleteOptionsDlg::CodeCompleteOptionsDlg( Window* pWindow )
pOkBtn->SetClickHdl( LINK( this, CodeCompleteOptionsDlg, OkHdl ) ); pOkBtn->SetClickHdl( LINK( this, CodeCompleteOptionsDlg, OkHdl ) );
pCancelBtn->SetClickHdl( LINK( this, CodeCompleteOptionsDlg, CancelHdl ) ); 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 ); pAutocloseBracesChk->Enable( false );
pAutocloseQuotesChk->Enable( false ); pAutocloseQuotesChk->Enable( false );
} }
...@@ -54,6 +54,7 @@ CodeCompleteOptionsDlg::~CodeCompleteOptionsDlg() ...@@ -54,6 +54,7 @@ CodeCompleteOptionsDlg::~CodeCompleteOptionsDlg()
IMPL_LINK_NOARG(CodeCompleteOptionsDlg, OkHdl) IMPL_LINK_NOARG(CodeCompleteOptionsDlg, OkHdl)
{ {
CodeCompleteOptions::SetCodeCompleteOn( pCodeCompleteChk->IsChecked() ); CodeCompleteOptions::SetCodeCompleteOn( pCodeCompleteChk->IsChecked() );
CodeCompleteOptions::SetProcedureAutoCompleteOn( pCodeCompleteChk->IsChecked() );
Close(); Close();
return 0; return 0;
} }
......
...@@ -21,9 +21,6 @@ ...@@ -21,9 +21,6 @@
#include <iostream> #include <iostream>
#include <rtl/instance.hxx> #include <rtl/instance.hxx>
const OUString CodeCompleteDataCache::GLOB_KEY = OUString("global key");
const OUString CodeCompleteDataCache::NOT_FOUND = OUString("not found");
namespace namespace
{ {
class theCodeCompleteOptions: public ::rtl::Static< CodeCompleteOptions, theCodeCompleteOptions >{}; class theCodeCompleteOptions: public ::rtl::Static< CodeCompleteOptions, theCodeCompleteOptions >{};
...@@ -62,6 +59,12 @@ void CodeCompleteOptions::SetProcedureAutoCompleteOn( const bool& b ) ...@@ -62,6 +59,12 @@ void CodeCompleteOptions::SetProcedureAutoCompleteOn( const bool& b )
std::ostream& operator<< (std::ostream& aStream, const CodeCompleteDataCache& aCache) std::ostream& operator<< (std::ostream& aStream, const CodeCompleteDataCache& aCache)
{ {
aStream << "Global variables" << std::endl;
for(CodeCompleteVarTypes::const_iterator aIt = aCache.aGlobalVars.begin(); aIt != aCache.aGlobalVars.end(); ++aIt )
{
aStream << aIt->first << "," << aIt->second << std::endl;
}
aStream << "Local variables" << std::endl;
for( CodeCompleteVarScopes::const_iterator aIt = aCache.aVarScopes.begin(); aIt != aCache.aVarScopes.end(); ++aIt ) for( CodeCompleteVarScopes::const_iterator aIt = aCache.aVarScopes.begin(); aIt != aCache.aVarScopes.end(); ++aIt )
{ {
aStream << aIt->first << std::endl; aStream << aIt->first << std::endl;
...@@ -80,32 +83,61 @@ const CodeCompleteVarScopes& CodeCompleteDataCache::GetVars() const ...@@ -80,32 +83,61 @@ const CodeCompleteVarScopes& CodeCompleteDataCache::GetVars() const
return aVarScopes; return aVarScopes;
} }
void CodeCompleteDataCache::InsertProcedure( const OUString& sProcName, const CodeCompleteVarTypes& aVarTypes )
{
aVarScopes.insert( CodeCompleteVarScopes::value_type(sProcName, aVarTypes) );
}
void CodeCompleteDataCache::SetVars( const CodeCompleteVarScopes& aScopes ) void CodeCompleteDataCache::SetVars( const CodeCompleteVarScopes& aScopes )
{ {
aVarScopes = aScopes; aVarScopes = aScopes;
} }
OUString CodeCompleteDataCache::GetVariableType( const OUString& sVarName, const OUString& sProcName ) const void CodeCompleteDataCache::print() const
{ {
CodeCompleteVarScopes::const_iterator aIt = aVarScopes.find( sProcName ); std::cerr << *this << std::endl;
if( aIt == aVarScopes.end() )//procedure does not exist }
return CodeCompleteDataCache::NOT_FOUND;
void CodeCompleteDataCache::Clear()
{
aVarScopes.clear();
}
void CodeCompleteDataCache::InsertGlobalVar( const OUString& sVarName, const OUString& sVarType )
{
aGlobalVars.insert( CodeCompleteVarTypes::value_type(sVarName, sVarType) );
}
CodeCompleteVarTypes aVarTypes = aIt->second; void CodeCompleteDataCache::InsertLocalVar( const OUString& sProcName, const OUString& sVarName, const OUString& sVarType )
CodeCompleteVarTypes::const_iterator aOtherIt = aVarTypes.find( sVarName ); {
if( aOtherIt == aVarTypes.end() ) CodeCompleteVarScopes::const_iterator aIt = aVarScopes.find( sProcName );
return CodeCompleteDataCache::NOT_FOUND; if( aIt == aVarScopes.end() ) //new procedure
{
CodeCompleteVarTypes aTypes;
aTypes.insert( CodeCompleteVarTypes::value_type(sVarName, sVarType) );
aVarScopes.insert( CodeCompleteVarScopes::value_type(sProcName, aTypes) );
}
else else
return aOtherIt->second; {
CodeCompleteVarTypes aTypes = aVarScopes[ sProcName ];
aTypes.insert( CodeCompleteVarTypes::value_type(sVarName, sVarType) );
aVarScopes[ sProcName ] = aTypes;
}
} }
void CodeCompleteDataCache::print() const OUString CodeCompleteDataCache::GetVarType( const OUString& sVarName )
{ {
std::cerr << *this << std::endl; for( CodeCompleteVarScopes::const_iterator aIt = aVarScopes.begin(); aIt != aVarScopes.end(); ++aIt )
{
CodeCompleteVarTypes aTypes = aIt->second;
for( CodeCompleteVarTypes::const_iterator aOtherIt = aTypes.begin(); aOtherIt != aTypes.end(); ++aOtherIt )
{
if( aOtherIt->first == sVarName )
return aOtherIt->second;
}
}
//not a local, search global scope
for( CodeCompleteVarTypes::const_iterator aIt = aGlobalVars.begin(); aIt != aGlobalVars.end(); ++aIt )
{
if( aIt->first == sVarName )
return aIt->second;
}
return OUString(""); //not found
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -90,9 +90,6 @@ typedef ::std::map< sal_Int16, Any, ::std::less< sal_Int16 > > OutParamMap; ...@@ -90,9 +90,6 @@ typedef ::std::map< sal_Int16, Any, ::std::less< sal_Int16 > > OutParamMap;
::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar ); ::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar );
void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue ); void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue );
/*const OUString CodeCompleteDataCache::GLOB_KEY = OUString("global key");
const OUString CodeCompleteDataCache::NOT_FOUND = OUString("not found");*/
class DocObjectWrapper : public DocObjectWrapper_BASE class DocObjectWrapper : public DocObjectWrapper_BASE
{ {
Reference< XAggregation > m_xAggProxy; Reference< XAggregation > m_xAggProxy;
...@@ -672,7 +669,6 @@ void SbModule::EndDefinitions( sal_Bool bNewState ) ...@@ -672,7 +669,6 @@ void SbModule::EndDefinitions( sal_Bool bNewState )
{ {
if( p->bInvalid ) if( p->bInvalid )
{ {
std::cerr << "invalid definition: " << p->GetName() << std::endl;
pMethods->Remove( p ); pMethods->Remove( p );
} }
else else
...@@ -941,12 +937,15 @@ void SbModule::SetSource32( const OUString& r ) ...@@ -941,12 +937,15 @@ void SbModule::SetSource32( const OUString& r )
} }
// Definition of the method // Definition of the method
SbMethod* pMeth = NULL; SbMethod* pMeth = NULL;
OUString sMethName;
if( eEndTok != NIL ) if( eEndTok != NIL )
{ {
sal_uInt16 nLine1 = aTok.GetLine(); sal_uInt16 nLine1 = aTok.GetLine();
if( aTok.Next() == SYMBOL ) if( aTok.Next() == SYMBOL )
{ {
OUString aName_( aTok.GetSym() ); OUString aName_( aTok.GetSym() );
//std::cerr << "method name: " << aName_ << std::endl;
sMethName = aName_;
SbxDataType t = aTok.GetType(); SbxDataType t = aTok.GetType();
if( t == SbxVARIANT && eEndTok == ENDSUB ) if( t == SbxVARIANT && eEndTok == ENDSUB )
{ {
...@@ -970,12 +969,25 @@ void SbModule::SetSource32( const OUString& r ) ...@@ -970,12 +969,25 @@ void SbModule::SetSource32( const OUString& r )
if( aTok.Next() == eEndTok ) if( aTok.Next() == eEndTok )
{ {
pMeth->nLine2 = aTok.GetLine(); pMeth->nLine2 = aTok.GetLine();
//std::cerr << "there is end for "<< sMethName << std::endl;
break; break;
} }
} }
if( aTok.IsEof() ) if( aTok.IsEof() )
{ {
pMeth->nLine2 = aTok.GetLine(); pMeth->nLine2 = aTok.GetLine();
std::cerr << "EOF reached, no end for "<< sMethName <<", line " << aTok.GetLine() << std::endl;
//std::cerr << "write end to: " << aOUSource.getLength() / pMeth->nLine2 << std::endl;
sal_Int32 nPos=0;
sal_Int32 nCounter = 0;
std::cerr << "source length: " << aOUSource.getLength() << std::endl;
for(sal_uInt32 i=0; i < aOUSource.getLength() ; ++i)
{
nPos++;
if( aOUSource[i] == '\n' && nCounter != aTok.GetLine() )
nCounter++;
}
std::cerr << "newline index: " << nPos << std::endl;
} }
} }
} }
...@@ -1783,9 +1795,8 @@ IMPL_LINK( ErrorHdlResetter, BasicErrorHdl, StarBASIC *, /*pBasic*/) ...@@ -1783,9 +1795,8 @@ IMPL_LINK( ErrorHdlResetter, BasicErrorHdl, StarBASIC *, /*pBasic*/)
return 0; return 0;
} }
CodeCompleteDataCache SbModule::GetCodeCompleteDataFromParse() void SbModule::GetCodeCompleteDataFromParse(CodeCompleteDataCache& aCache)
{ {
CodeCompleteDataCache aCache;
ErrorHdlResetter aErrHdl; ErrorHdlResetter aErrHdl;
SbxBase::ResetError(); SbxBase::ResetError();
...@@ -1794,7 +1805,8 @@ CodeCompleteDataCache SbModule::GetCodeCompleteDataFromParse() ...@@ -1794,7 +1805,8 @@ CodeCompleteDataCache SbModule::GetCodeCompleteDataFromParse()
while( pParser->Parse() ) {} while( pParser->Parse() ) {}
SbiSymPool* pPool = pParser->pPool; SbiSymPool* pPool = pParser->pPool;
CodeCompleteVarTypes aGlobVarTypes; //CodeCompleteVarTypes aGlobVarTypes;
aCache.Clear();
for( sal_uInt16 i = 0; i < pPool->GetSize(); ++i ) for( sal_uInt16 i = 0; i < pPool->GetSize(); ++i )
{ {
SbiSymDef* pSymDef = pPool->Get(i); SbiSymDef* pSymDef = pPool->Get(i);
...@@ -1802,13 +1814,13 @@ CodeCompleteDataCache SbModule::GetCodeCompleteDataFromParse() ...@@ -1802,13 +1814,13 @@ CodeCompleteDataCache SbModule::GetCodeCompleteDataFromParse()
{ {
if( !pParser->aGblStrings.Find( pSymDef->GetTypeId() ).isEmpty() ) if( !pParser->aGblStrings.Find( pSymDef->GetTypeId() ).isEmpty() )
{ {
//std::cerr << "global " << pSymDef->GetName() << std::endl; //aGlobVarTypes.insert( CodeCompleteVarTypes::value_type( pSymDef->GetName(), pParser->aGblStrings.Find( pSymDef->GetTypeId() ) ) );
aGlobVarTypes.insert( CodeCompleteVarTypes::value_type( pSymDef->GetName(), pParser->aGblStrings.Find( pSymDef->GetTypeId() ) ) ); aCache.InsertGlobalVar( pSymDef->GetName(), pParser->aGblStrings.Find(pSymDef->GetTypeId()) );
} }
} }
SbiSymPool& pChildPool = pSymDef->GetPool(); SbiSymPool& pChildPool = pSymDef->GetPool();
CodeCompleteVarTypes aLocVarTypes; //CodeCompleteVarTypes aLocVarTypes;
for(sal_uInt16 j = 0; j < pChildPool.GetSize(); ++j ) for(sal_uInt16 j = 0; j < pChildPool.GetSize(); ++j )
{ {
SbiSymDef* pChildSymDef = pChildPool.Get(j); SbiSymDef* pChildSymDef = pChildPool.Get(j);
...@@ -1816,17 +1828,16 @@ CodeCompleteDataCache SbModule::GetCodeCompleteDataFromParse() ...@@ -1816,17 +1828,16 @@ CodeCompleteDataCache SbModule::GetCodeCompleteDataFromParse()
{ {
if( !pParser->aGblStrings.Find( pChildSymDef->GetTypeId() ).isEmpty() ) if( !pParser->aGblStrings.Find( pChildSymDef->GetTypeId() ).isEmpty() )
{ {
//std::cerr << "local " << pChildSymDef->GetName() << std::endl; //aLocVarTypes.insert( CodeCompleteVarTypes::value_type( pChildSymDef->GetName(), pParser->aGblStrings.Find( pChildSymDef->GetTypeId() ) ) );
aLocVarTypes.insert( CodeCompleteVarTypes::value_type( pChildSymDef->GetName(), pParser->aGblStrings.Find( pChildSymDef->GetTypeId() ) ) ); aCache.InsertLocalVar( pSymDef->GetName(), pChildSymDef->GetName(), pParser->aGblStrings.Find(pChildSymDef->GetTypeId()) );
} }
} }
} }
aCache.InsertProcedure( pSymDef->GetName(), aLocVarTypes ); //aCache.InsertProcedure( pSymDef->GetName(), aLocVarTypes );
} }
aCache.InsertProcedure( CodeCompleteDataCache::GLOB_KEY, aGlobVarTypes ); //aCache.InsertProcedure( CodeCompleteDataCache::GLOB_KEY, aGlobVarTypes );
delete pParser; delete pParser;
return aCache;
} }
SbxArrayRef SbModule::GetMethods() SbxArrayRef SbModule::GetMethods()
......
...@@ -33,6 +33,7 @@ typedef boost::unordered_map< OUString, OUString, OUStringHash > CodeCompleteVar ...@@ -33,6 +33,7 @@ typedef boost::unordered_map< OUString, OUString, OUStringHash > CodeCompleteVar
typedef boost::unordered_map< OUString, CodeCompleteVarTypes, OUStringHash > CodeCompleteVarScopes; typedef boost::unordered_map< OUString, CodeCompleteVarTypes, OUStringHash > CodeCompleteVarScopes;
/* procedure, CodeCompleteVarTypes */ /* procedure, CodeCompleteVarTypes */
class BASIC_DLLPUBLIC CodeCompleteOptions class BASIC_DLLPUBLIC CodeCompleteOptions
{ {
/* /*
...@@ -63,11 +64,9 @@ class BASIC_DLLPUBLIC CodeCompleteDataCache ...@@ -63,11 +64,9 @@ class BASIC_DLLPUBLIC CodeCompleteDataCache
* */ * */
private: private:
CodeCompleteVarScopes aVarScopes; CodeCompleteVarScopes aVarScopes;
CodeCompleteVarTypes aGlobalVars;
public: public:
static const OUString GLOB_KEY;
static const OUString NOT_FOUND;
CodeCompleteDataCache(){} CodeCompleteDataCache(){}
virtual ~CodeCompleteDataCache(){} virtual ~CodeCompleteDataCache(){}
...@@ -76,9 +75,11 @@ public: ...@@ -76,9 +75,11 @@ public:
void SetVars( const CodeCompleteVarScopes& aScopes ); void SetVars( const CodeCompleteVarScopes& aScopes );
const CodeCompleteVarScopes& GetVars() const; const CodeCompleteVarScopes& GetVars() const;
void InsertProcedure( const OUString& sProcName, const CodeCompleteVarTypes& aVarTypes ); void InsertGlobalVar( const OUString& sVarName, const OUString& sVarType );
OUString GetVariableType( const OUString& sVarName, const OUString& sProcName ) const; void InsertLocalVar( const OUString& sProcName, const OUString& sVarName, const OUString& sVarType );
OUString GetVarType( const OUString& sVarName );
void print() const; // wrapper for operator<<, prints to std::cerr void print() const; // wrapper for operator<<, prints to std::cerr
void Clear();
}; };
#endif // CODECOMPLETECACHE_H #endif // CODECOMPLETECACHE_H
......
...@@ -152,7 +152,8 @@ public: ...@@ -152,7 +152,8 @@ public:
void RemoveVars(); void RemoveVars();
::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > GetUnoModule(); ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > GetUnoModule();
bool createCOMWrapperForIface( ::com::sun::star::uno::Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject ); bool createCOMWrapperForIface( ::com::sun::star::uno::Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject );
CodeCompleteDataCache GetCodeCompleteDataFromParse(); //CodeCompleteDataCache GetCodeCompleteDataFromParse();
void GetCodeCompleteDataFromParse(CodeCompleteDataCache& aCache);
SbxArrayRef GetMethods(); SbxArrayRef GetMethods();
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment