diff options
author | Gergo Mocsi <gmocsi91@gmail.com> | 2013-07-23 12:42:37 +0200 |
---|---|---|
committer | Gergo Mocsi <gmocsi91@gmail.com> | 2013-09-02 18:16:47 +0200 |
commit | 61ee2598b18890eb5798a3943fbedd22a24e7aea (patch) | |
tree | 81ba813855079ba888902514511e94ccf0b036c0 /basic/source | |
parent | b0b511e9b5b18069b6f4dc9565e2a485d05e1cdd (diff) |
GSOC work, code complete option, menu entry fixes
Menu entry is added under View->Enable Code Completition when in Experimental mode.
Fixed the call of funtion SbModule::GetCodeCompleteDataFromParse() to be called only when code completition is enabled.
Replaced the occurences of SvtMiscOptions to CodeCompleteOptions.
Change-Id: If0520123ab5f612d7d24fb98f8e9bf6881af76cb
Diffstat (limited to 'basic/source')
-rw-r--r-- | basic/source/classes/codecompletecache.cxx | 32 | ||||
-rw-r--r-- | basic/source/classes/sbxmod.cxx | 1 | ||||
-rw-r--r-- | basic/source/comp/dim.cxx | 16 | ||||
-rw-r--r-- | basic/source/inc/codegen.hxx | 1 |
4 files changed, 46 insertions, 4 deletions
diff --git a/basic/source/classes/codecompletecache.cxx b/basic/source/classes/codecompletecache.cxx index 62811339a123..77a0204eaf30 100644 --- a/basic/source/classes/codecompletecache.cxx +++ b/basic/source/classes/codecompletecache.cxx @@ -19,10 +19,42 @@ #include <basic/codecompletecache.hxx> #include <iostream> +#include <rtl/instance.hxx> const OUString CodeCompleteDataCache::GLOB_KEY = OUString("global key"); const OUString CodeCompleteDataCache::NOT_FOUND = OUString("not found"); +namespace +{ + class theCodeCompleteOptions: public ::rtl::Static< CodeCompleteOptions, theCodeCompleteOptions >{}; +} + +CodeCompleteOptions::CodeCompleteOptions() +: bIsCodeCompleteOn( false ) +{ +} + +bool CodeCompleteOptions::IsCodeCompleteOn() +{ + /*if( !theCodeCompleteOptions::get().aMiscOptions.IsExperimentalMode() ) + return false; + else*/ + return theCodeCompleteOptions::get().aMiscOptions.IsExperimentalMode() && theCodeCompleteOptions::get().bIsCodeCompleteOn; +} + +void CodeCompleteOptions::SetCodeCompleteOn( const bool& b ) +{ + if( !theCodeCompleteOptions::get().aMiscOptions.IsExperimentalMode() ) + theCodeCompleteOptions::get().bIsCodeCompleteOn = false; + else + theCodeCompleteOptions::get().bIsCodeCompleteOn = b; +} + +bool CodeCompleteOptions::IsExtendedTypeDeclaration() +{ + return CodeCompleteOptions::IsCodeCompleteOn(); +} + std::ostream& operator<< (std::ostream& aStream, const CodeCompleteDataCache& aCache) { for( CodeCompleteVarScopes::const_iterator aIt = aCache.aVarScopes.begin(); aIt != aCache.aVarScopes.end(); ++aIt ) diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index f09291deaf00..8182f6e92900 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -1783,7 +1783,6 @@ IMPL_LINK( ErrorHdlResetter, BasicErrorHdl, StarBASIC *, /*pBasic*/) CodeCompleteDataCache SbModule::GetCodeCompleteDataFromParse() { CodeCompleteDataCache aCache; - ErrorHdlResetter aErrHdl; SbxBase::ResetError(); diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx index 8da4d1e13c3c..9a030ccff85a 100644 --- a/basic/source/comp/dim.cxx +++ b/basic/source/comp/dim.cxx @@ -28,6 +28,7 @@ #include "com/sun/star/reflection/XInterfaceMemberTypeDescription.hpp" #include "com/sun/star/reflection/XIdlMethod.hpp" #include "com/sun/star/uno/Exception.hpp" +#include <basic/codecompletecache.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -207,7 +208,7 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) bool bSwitchPool = false; bool bPersistantGlobal = false; SbiToken eFirstTok = eCurTok; - SvtMiscOptions aMiscOptions; + if( pProc && ( eCurTok == GLOBAL || eCurTok == PUBLIC || eCurTok == PRIVATE ) ) Error( SbERR_NOT_IN_SUBR, eCurTok ); if( eCurTok == PUBLIC || eCurTok == GLOBAL ) @@ -404,9 +405,18 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) if( !bCompatible && !pDef->IsNew() ) { OUString aTypeName( aGblStrings.Find( pDef->GetTypeId() ) ); - if( rTypeArray->Find( aTypeName, SbxCLASS_OBJECT ) == NULL && (aMiscOptions.IsExperimentalMode() && !IsUnoInterface(aTypeName))) + /*std::cerr <<"CodeCompleteOptions::IsExtendedTypeDeclaration():" << CodeCompleteOptions::IsExtendedTypeDeclaration() << std::endl; + std::cerr << "IsUnoInterface("<<aTypeName<<"):"<< IsUnoInterface(aTypeName) << std::endl; + std::cerr << "finally: " << (CodeCompleteOptions::IsExtendedTypeDeclaration() && !IsUnoInterface(aTypeName)) << std::endl;*/ + if( rTypeArray->Find( aTypeName, SbxCLASS_OBJECT ) == NULL ) { - Error( SbERR_UNDEF_TYPE, aTypeName ); + if(!CodeCompleteOptions::IsExtendedTypeDeclaration()) + Error( SbERR_UNDEF_TYPE, aTypeName ); + else + { + if(!IsUnoInterface(aTypeName)) + Error( SbERR_UNDEF_TYPE, aTypeName ); + } } } diff --git a/basic/source/inc/codegen.hxx b/basic/source/inc/codegen.hxx index f2537193e1ab..c2478d7e91a8 100644 --- a/basic/source/inc/codegen.hxx +++ b/basic/source/inc/codegen.hxx @@ -24,6 +24,7 @@ class SbiParser; class SbModule; #include "opcodes.hxx" #include "buffer.hxx" +#include <basic/codecompletecache.hxx> class SbiCodeGen { SbiParser* pParser; // for error messages, line, column etc. |