diff options
author | Gergo Mocsi <gmocsi91@gmail.com> | 2013-08-19 13:53:38 +0200 |
---|---|---|
committer | Gergo Mocsi <gmocsi91@gmail.com> | 2013-09-02 18:17:00 +0200 |
commit | 67596f4cc67cab14ccd3005be1f1c7c9ef6df557 (patch) | |
tree | d67f9e863da8157db459eed7443d7749d0d9390a /basic | |
parent | GSOC work, small code fixes (diff) | |
download | core-67596f4cc67cab14ccd3005be1f1c7c9ef6df557.tar.gz core-67596f4cc67cab14ccd3005be1f1c7c9ef6df557.zip |
GSOC work, autocorrect procedures+variables
Fixed some small issue with the right arrow key in the ListBox.
Autocorrection now correct all variable types and procedure names.
Change-Id: Iff1abaf10c621aef04772837faa272bb6f987e37
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/classes/codecompletecache.cxx | 6 | ||||
-rw-r--r-- | basic/source/classes/sbxmod.cxx | 29 |
2 files changed, 9 insertions, 26 deletions
diff --git a/basic/source/classes/codecompletecache.cxx b/basic/source/classes/codecompletecache.cxx index 9d78455cf2b9..a5b9ce6a8601 100644 --- a/basic/source/classes/codecompletecache.cxx +++ b/basic/source/classes/codecompletecache.cxx @@ -182,20 +182,20 @@ OUString CodeCompleteDataCache::GetVarType( const OUString& sVarName ) const return OUString(""); //not found } -OUString CodeCompleteDataCache::GetCorrectCaseVarName( const OUString& sVarName ) const +OUString CodeCompleteDataCache::GetCorrectCaseVarName( const OUString& sVarName, const OUString& sActProcName ) const { 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.equalsIgnoreAsciiCase( sVarName ) ) + if( aOtherIt->first.equalsIgnoreAsciiCase( sVarName ) && aIt->first.equalsIgnoreAsciiCase( sActProcName ) ) { return aOtherIt->first; } } } - //not a local, search global scope + // search global scope for( CodeCompleteVarTypes::const_iterator aIt = aGlobalVars.begin(); aIt != aGlobalVars.end(); ++aIt ) { if( aIt->first.equalsIgnoreAsciiCase( sVarName ) ) diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index a3fa77931e1c..567d26fa0993 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -1790,40 +1790,23 @@ void SbModule::GetCodeCompleteDataFromParse(CodeCompleteDataCache& aCache) while( pParser->Parse() ) {} SbiSymPool* pPool = pParser->pPool; - //CodeCompleteVarTypes aGlobVarTypes; aCache.Clear(); for( sal_uInt16 i = 0; i < pPool->GetSize(); ++i ) { SbiSymDef* pSymDef = pPool->Get(i); - //std::cerr << "i: " << i << ", type: " << pSymDef->GetType() << std::endl; - if( pSymDef->GetType() == SbxOBJECT ) - { - if( !pParser->aGblStrings.Find( pSymDef->GetTypeId() ).isEmpty() ) - { - //aGlobVarTypes.insert( CodeCompleteVarTypes::value_type( pSymDef->GetName(), pParser->aGblStrings.Find( pSymDef->GetTypeId() ) ) ); - aCache.InsertGlobalVar( pSymDef->GetName(), pParser->aGblStrings.Find(pSymDef->GetTypeId()) ); - } - } + //std::cerr << "i: " << i << ", type: " << pSymDef->GetType() << "; name:" << pSymDef->GetName() << std::endl; + if( (pSymDef->GetType() != SbxEMPTY) || (pSymDef->GetType() != SbxNULL) ) + aCache.InsertGlobalVar( pSymDef->GetName(), pParser->aGblStrings.Find(pSymDef->GetTypeId()) ); SbiSymPool& pChildPool = pSymDef->GetPool(); - //CodeCompleteVarTypes aLocVarTypes; for(sal_uInt16 j = 0; j < pChildPool.GetSize(); ++j ) { SbiSymDef* pChildSymDef = pChildPool.Get(j); - //std::cerr << "j: " << j << ", type: " << pChildSymDef->GetType() << std::endl; - if( pChildSymDef->GetType() == SbxOBJECT ) - { - if( !pParser->aGblStrings.Find( pChildSymDef->GetTypeId() ).isEmpty() ) - { - //aLocVarTypes.insert( CodeCompleteVarTypes::value_type( pChildSymDef->GetName(), pParser->aGblStrings.Find( pChildSymDef->GetTypeId() ) ) ); - aCache.InsertLocalVar( pSymDef->GetName(), pChildSymDef->GetName(), pParser->aGblStrings.Find(pChildSymDef->GetTypeId()) ); - } - } + //std::cerr << "j: " << j << ", type: " << pChildSymDef->GetType() << "; name:" << pChildSymDef->GetName() << std::endl; + if( (pChildSymDef->GetType() != SbxEMPTY) || (pChildSymDef->GetType() != SbxNULL) ) + aCache.InsertLocalVar( pSymDef->GetName(), pChildSymDef->GetName(), pParser->aGblStrings.Find(pChildSymDef->GetTypeId()) ); } - //aCache.InsertProcedure( pSymDef->GetName(), aLocVarTypes ); } - //aCache.InsertProcedure( CodeCompleteDataCache::GLOB_KEY, aGlobVarTypes ); - delete pParser; } |