diff options
author | Noel Power <noel.power@suse.com> | 2013-06-27 13:58:48 +0100 |
---|---|---|
committer | Noel Power <noel.power@suse.com> | 2013-06-27 15:53:01 +0100 |
commit | 21eeeccfa64a4c03554c1fe3715d38c1695245ab (patch) | |
tree | a1efc3e1c0440ae1a02c9788206d97b1c882fee4 /basctl | |
parent | 153bdc99b1c162723557513b993343c211d804b8 (diff) |
tweak object catalog to improve switching modules in large Libraries
object catalog when updated updates ( all ) entries and was parsing
the source for every method in every module
Change-Id: Id68e3c24d597d29a86d3507a7dc20745c96dd2a2
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/basobj2.cxx | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx index 7e62558930c8..1b1689b97ff5 100644 --- a/basctl/source/basicide/basobj2.cxx +++ b/basctl/source/basicide/basobj2.cxx @@ -42,7 +42,7 @@ #include <vector> #include <algorithm> #include <memory> - +#include "basic/basmgr.hxx" namespace basctl { @@ -405,13 +405,23 @@ Sequence< OUString > GetMethodNames( const ScriptDocument& rDocument, const OUSt OUString aOUSource; if ( rDocument.getModule( rLibName, rModName, aOUSource ) ) { - SbModuleRef xModule = new SbModule( rModName ); - xModule->SetSource32( aOUSource ); - sal_uInt16 nCount = xModule->GetMethods()->Count(); + BasicManager* pBasMgr = rDocument.getBasicManager(); + StarBASIC* pSb = pBasMgr ? pBasMgr->GetLib( rLibName ) : NULL; + SbModule* pMod = pSb ? pSb->FindModule( rModName ) : NULL; + + SbModuleRef xModule; + if ( !pMod ) + { + xModule = new SbModule( rModName ); + xModule->SetSource32( aOUSource ); + pMod = xModule; + } + + sal_uInt16 nCount = pMod->GetMethods()->Count(); sal_uInt16 nRealCount = nCount; for ( sal_uInt16 i = 0; i < nCount; i++ ) { - SbMethod* pMethod = (SbMethod*)xModule->GetMethods()->Get( i ); + SbMethod* pMethod = (SbMethod*)pMod->GetMethods()->Get( i ); if( pMethod->IsHidden() ) --nRealCount; } @@ -420,7 +430,7 @@ Sequence< OUString > GetMethodNames( const ScriptDocument& rDocument, const OUSt sal_uInt16 iTarget = 0; for ( sal_uInt16 i = 0 ; i < nCount; ++i ) { - SbMethod* pMethod = (SbMethod*)xModule->GetMethods()->Get( i ); + SbMethod* pMethod = (SbMethod*)pMod->GetMethods()->Get( i ); if( pMethod->IsHidden() ) continue; SAL_WARN_IF( !pMethod, "basctl.basicide","Method not found! (NULL)" ); @@ -445,9 +455,18 @@ bool HasMethod ( OUString aOUSource; if ( rDocument.hasModule( rLibName, rModName ) && rDocument.getModule( rLibName, rModName, aOUSource ) ) { - SbModuleRef xModule = new SbModule( rModName ); - xModule->SetSource32( aOUSource ); - SbxArray* pMethods = xModule->GetMethods(); + // Check if we really need to scan the source ( again ) + BasicManager* pBasMgr = rDocument.getBasicManager(); + StarBASIC* pSb = pBasMgr ? pBasMgr->GetLib( rLibName ) : NULL; + SbModule* pMod = pSb ? pSb->FindModule( rModName ) : NULL; + SbModuleRef xModule; + if ( !pMod ) + { + xModule = new SbModule( rModName ); + xModule->SetSource32( aOUSource ); + pMod = xModule; + } + SbxArray* pMethods = pMod->GetMethods(); if ( pMethods ) { SbMethod* pMethod = (SbMethod*)pMethods->Find( rMethName, SbxCLASS_METHOD ); |