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
This commit is contained in:
@@ -42,7 +42,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include "basic/basmgr.hxx"
|
||||||
namespace basctl
|
namespace basctl
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -405,13 +405,23 @@ Sequence< OUString > GetMethodNames( const ScriptDocument& rDocument, const OUSt
|
|||||||
OUString aOUSource;
|
OUString aOUSource;
|
||||||
if ( rDocument.getModule( rLibName, rModName, aOUSource ) )
|
if ( rDocument.getModule( rLibName, rModName, aOUSource ) )
|
||||||
{
|
{
|
||||||
SbModuleRef xModule = new SbModule( rModName );
|
BasicManager* pBasMgr = rDocument.getBasicManager();
|
||||||
xModule->SetSource32( aOUSource );
|
StarBASIC* pSb = pBasMgr ? pBasMgr->GetLib( rLibName ) : NULL;
|
||||||
sal_uInt16 nCount = xModule->GetMethods()->Count();
|
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;
|
sal_uInt16 nRealCount = nCount;
|
||||||
for ( sal_uInt16 i = 0; i < nCount; i++ )
|
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() )
|
if( pMethod->IsHidden() )
|
||||||
--nRealCount;
|
--nRealCount;
|
||||||
}
|
}
|
||||||
@@ -420,7 +430,7 @@ Sequence< OUString > GetMethodNames( const ScriptDocument& rDocument, const OUSt
|
|||||||
sal_uInt16 iTarget = 0;
|
sal_uInt16 iTarget = 0;
|
||||||
for ( sal_uInt16 i = 0 ; i < nCount; ++i )
|
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() )
|
if( pMethod->IsHidden() )
|
||||||
continue;
|
continue;
|
||||||
SAL_WARN_IF( !pMethod, "basctl.basicide","Method not found! (NULL)" );
|
SAL_WARN_IF( !pMethod, "basctl.basicide","Method not found! (NULL)" );
|
||||||
@@ -445,9 +455,18 @@ bool HasMethod (
|
|||||||
OUString aOUSource;
|
OUString aOUSource;
|
||||||
if ( rDocument.hasModule( rLibName, rModName ) && rDocument.getModule( rLibName, rModName, aOUSource ) )
|
if ( rDocument.hasModule( rLibName, rModName ) && rDocument.getModule( rLibName, rModName, aOUSource ) )
|
||||||
{
|
{
|
||||||
SbModuleRef xModule = new SbModule( rModName );
|
// Check if we really need to scan the source ( again )
|
||||||
xModule->SetSource32( aOUSource );
|
BasicManager* pBasMgr = rDocument.getBasicManager();
|
||||||
SbxArray* pMethods = xModule->GetMethods();
|
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 )
|
if ( pMethods )
|
||||||
{
|
{
|
||||||
SbMethod* pMethod = (SbMethod*)pMethods->Find( rMethName, SbxCLASS_METHOD );
|
SbMethod* pMethod = (SbMethod*)pMethods->Find( rMethName, SbxCLASS_METHOD );
|
||||||
|
Reference in New Issue
Block a user