diff options
author | Andreas Bregas <ab@openoffice.org> | 2002-01-09 15:43:05 +0000 |
---|---|---|
committer | Andreas Bregas <ab@openoffice.org> | 2002-01-09 15:43:05 +0000 |
commit | 650fa9de257e897519e1411e7b88c3886fec06a7 (patch) | |
tree | 9b630b53e523d5a5ac7a80de2f21386b8e4902b2 /basic | |
parent | 70e8cda17173a2f8d1ae8336be6e1355ef151d0d (diff) |
#96310# New method HasBasicWithModules()
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/basmgr/basmgr.cxx | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index e27facdbfc92..2c1c1bc88203 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: basmgr.cxx,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: ab $ $Date: 2001-12-19 15:53:38 $ + * last change: $Author: ab $ $Date: 2002-01-09 16:43:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -934,6 +934,41 @@ BOOL BasicManager::HasBasicManager( const SotStorage& rStorage ) return rStorage.IsStream( ManagerStreamName ); } +BOOL BasicManager::HasBasicWithModules( const SotStorage& rStorage ) +{ + if( !rStorage.IsStream( ManagerStreamName ) ) + return FALSE; + + StarBASIC* pDummyParentBasic = new StarBASIC(); + BasicManager* pBasMgr = new BasicManager( (SotStorage&)rStorage, pDummyParentBasic ); + BOOL bRet = FALSE; + + USHORT nLibs = pBasMgr->GetLibCount(); + for( USHORT nL = 0; nL < nLibs; nL++ ) + { + BasicLibInfo* pInfo = pBasMgr->pLibs->GetObject( nL ); + StarBASIC* pLib = pInfo->GetLib(); + if( !pLib ) + { + BOOL bLoaded = pBasMgr->ImpLoadLibary( pInfo, NULL, FALSE ); + if( bLoaded ) + pLib = pInfo->GetLib(); + } + if( pLib ) + { + SbxArray* pModules = pLib->GetModules(); + if( pModules->Count() ) + { + bRet = TRUE; + break; + } + } + } + + delete pBasMgr; + return bRet; +} + void BasicManager::ImpMgrNotLoaded( const String& rStorageName ) { // pErrInf wird nur zerstoert, wenn der Fehler von einem ErrorHandler |