From 8241bf7c831b07bc19509387f1514c42bc5624c1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 1 Nov 2010 21:50:46 +0100 Subject: undoapi: - introduced BasicManager::HasMacro/ExecuteMacro - removed SfxQueryMacro, superseded by BasicManager::ExecuteMacro - removed macrconf.hxx - removed SfxObjectShell::CallScript, migrated the only client to BasicManager::HasMacro/SfxObjectShell::CallXScript - removed SfxObjectShell::CallStarBasicScript, migrated the only client to SfxObjectShell::CallXScript --- basic/source/basmgr/basmgr.cxx | 112 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) (limited to 'basic/source/basmgr/basmgr.cxx') diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 84763468e64c..a491b957fef6 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -42,6 +42,8 @@ #include #include #include +#include +#include #include #include @@ -1868,6 +1870,116 @@ bool BasicManager::LegacyPsswdBinaryLimitExceeded( ::com::sun::star::uno::Sequen return false; } + +namespace +{ + SbMethod* lcl_queryMacro( BasicManager* i_manager, String const& i_fullyQualifiedName ) + { + sal_uInt16 nLast = 0; + String sMacro = i_fullyQualifiedName; + String sLibName = sMacro.GetToken( 0, '.', nLast ); + String sModule = sMacro.GetToken( 0, '.', nLast ); + sMacro.Erase( 0, nLast ); + + IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); + const CollatorWrapper* pCollator = aIntlWrapper.getCollator(); + sal_uInt16 nLibCount = i_manager->GetLibCount(); + for ( sal_uInt16 nLib = 0; nLib < nLibCount; ++nLib ) + { + if ( COMPARE_EQUAL == pCollator->compareString( i_manager->GetLibName( nLib ), sLibName ) ) + { + StarBASIC* pLib = i_manager->GetLib( nLib ); + if( !pLib ) + { + i_manager->LoadLib( nLib ); + pLib = i_manager->GetLib( nLib ); + } + + if( pLib ) + { + sal_uInt16 nModCount = pLib->GetModules()->Count(); + for( sal_uInt16 nMod = 0; nMod < nModCount; ++nMod ) + { + SbModule* pMod = (SbModule*)pLib->GetModules()->Get( nMod ); + if ( pMod && COMPARE_EQUAL == pCollator->compareString( pMod->GetName(), sModule ) ) + { + SbMethod* pMethod = (SbMethod*)pMod->Find( sMacro, SbxCLASS_METHOD ); + if( pMethod ) + return pMethod; + } + } + } + } + } + return 0; + } +} + +bool BasicManager::HasMacro( String const& i_fullyQualifiedName ) const +{ + return ( NULL != lcl_queryMacro( const_cast< BasicManager* >( this ), i_fullyQualifiedName ) ); +} + +ErrCode BasicManager::ExecuteMacro( String const& i_fullyQualifiedName, SbxArray* i_arguments, SbxValue* i_retValue ) +{ + SbMethod* pMethod = lcl_queryMacro( this, i_fullyQualifiedName ); + ErrCode nError = 0; + if ( pMethod ) + { + if ( i_arguments ) + pMethod->SetParameters( i_arguments ); + nError = pMethod->Call( i_retValue ); + } + else + nError = ERRCODE_BASIC_PROC_UNDEFINED; + return nError; +} + +ErrCode BasicManager::ExecuteMacro( String const& i_fullyQualifiedName, String const& i_commaSeparatedArgs, SbxValue* i_retValue ) +{ + SbMethod* pMethod = lcl_queryMacro( this, i_fullyQualifiedName ); + if ( !pMethod ) + return ERRCODE_BASIC_PROC_UNDEFINED; + + // arguments must be quoted + String sQuotedArgs; + String sArgs( i_commaSeparatedArgs ); + if ( sArgs.Len()<2 || sArgs.GetBuffer()[1] == '\"') + // no args or already quoted args + sQuotedArgs = sArgs; + else + { + // quote parameters + sArgs.Erase( 0, 1 ); + sArgs.Erase( sArgs.Len()-1, 1 ); + + sQuotedArgs = '('; + + sal_uInt16 nCount = sArgs.GetTokenCount(','); + for ( sal_uInt16 n=0; nGetName(); + sCall += sQuotedArgs; + sCall += ']'; + + SbxVariable* pRet = pMethod->GetParent()->Execute( sCall ); + if ( pRet ) + *i_retValue = *pRet; + return SbxBase::GetError(); +} + //===================================================================== class ModuleInfo_Impl : public ModuleInfoHelper -- cgit From 642cfe8ac206af4fe82bc695d38b5c7f0edf7dc7 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Mon, 10 Jan 2011 14:40:57 +0100 Subject: removetooltypes01: #i112600# adjust basic and scaddins --- basic/source/basmgr/basmgr.cxx | 298 ++++++++++++++++++++--------------------- 1 file changed, 149 insertions(+), 149 deletions(-) (limited to 'basic/source/basmgr/basmgr.cxx') diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 84763468e64c..d1f68fed511b 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -90,15 +90,15 @@ typedef WeakImplHelper1< XStarBasicAccess > StarBasicAccessHelper; #define CURR_VER 2 // Version 1 -// ULONG nEndPos -// USHORT nId -// USHORT nVer -// BOOL bDoLoad +// sal_uIntPtr nEndPos +// sal_uInt16 nId +// sal_uInt16 nVer +// sal_Bool bDoLoad // String LibName // String AbsStorageName // String RelStorageName // Version 2 -// + BOOL bReference +// + sal_Bool bReference static const char* szStdLibName = "Standard"; static const char szBasicStorage[] = "StarBASIC"; @@ -252,7 +252,7 @@ void BasMgrContainerListenerImpl::addLibraryModulesImpl( BasicManager* pMgr, } } - pLib->SetModified( FALSE ); + pLib->SetModified( sal_False ); } @@ -310,7 +310,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementInserted( const ContainerEvent } else pLib->MakeModule32( aName, aMod ); - pLib->SetModified( FALSE ); + pLib->SetModified( sal_False ); } } } @@ -344,7 +344,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementReplaced( const ContainerEvent else pLib->MakeModule32( aName, aMod ); - pLib->SetModified( FALSE ); + pLib->SetModified( sal_False ); } } @@ -364,8 +364,8 @@ void SAL_CALL BasMgrContainerListenerImpl::elementRemoved( const ContainerEvent& StarBASIC* pLib = mpMgr->GetLib( aName ); if( pLib ) { - USHORT nLibId = mpMgr->GetLibId( aName ); - mpMgr->RemoveLib( nLibId, FALSE ); + sal_uInt16 nLibId = mpMgr->GetLibId( aName ); + mpMgr->RemoveLib( nLibId, sal_False ); } } else @@ -375,7 +375,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementRemoved( const ContainerEvent& if( pMod ) { pLib->Remove( pMod ); - pLib->SetModified( FALSE ); + pLib->SetModified( sal_False ); } } } @@ -394,7 +394,7 @@ public: void Reset(); void InsertError( const BasicError& rError ); - BOOL HasErrors() { return (BOOL)aErrorList.Count(); } + sal_Bool HasErrors() { return (sal_Bool)aErrorList.Count(); } BasicError* GetFirstError() { return aErrorList.First(); } BasicError* GetNextError() { return aErrorList.Next(); } }; @@ -428,7 +428,7 @@ BasicError::BasicError() nReason = 0; } -BasicError::BasicError( ULONG nId, USHORT nR, const String& rErrStr ) : +BasicError::BasicError( sal_uIntPtr nId, sal_uInt16 nR, const String& rErrStr ) : aErrStr( rErrStr ) { nErrorId = nId; @@ -452,10 +452,10 @@ private: String aRelStorageName; String aPassword; - BOOL bDoLoad; - BOOL bReference; - BOOL bPasswordVerified; - BOOL bFoundInPath; // Must not relativated again! + sal_Bool bDoLoad; + sal_Bool bReference; + sal_Bool bPasswordVerified; + sal_Bool bFoundInPath; // Must not relativated again! // Lib represents library in new UNO library container Reference< XLibraryContainer > mxScriptCont; @@ -464,10 +464,10 @@ public: BasicLibInfo(); BasicLibInfo( const String& rStorageName ); - BOOL IsReference() const { return bReference; } - BOOL& IsReference() { return bReference; } + sal_Bool IsReference() const { return bReference; } + sal_Bool& IsReference() { return bReference; } - BOOL IsExtern() const { return ! aStorageName.EqualsAscii(szImbedded); } + sal_Bool IsExtern() const { return ! aStorageName.EqualsAscii(szImbedded); } void SetStorageName( const String& rName ) { aStorageName = rName; } const String& GetStorageName() const { return aStorageName; } @@ -490,19 +490,19 @@ public: void SetLibName( const String& rName ) { aLibName = rName; } // Only temporary for Load/Save - BOOL DoLoad() { return bDoLoad; } + sal_Bool DoLoad() { return bDoLoad; } - BOOL HasPassword() const { return aPassword.Len() != 0; } + sal_Bool HasPassword() const { return aPassword.Len() != 0; } const String& GetPassword() const { return aPassword; } void SetPassword( const String& rNewPassword ) { aPassword = rNewPassword; } - BOOL IsPasswordVerified() const { return bPasswordVerified; } - void SetPasswordVerified() { bPasswordVerified = TRUE; } + sal_Bool IsPasswordVerified() const { return bPasswordVerified; } + void SetPasswordVerified() { bPasswordVerified = sal_True; } - BOOL IsFoundInPath() const { return bFoundInPath; } - void SetFoundInPath( BOOL bInPath ) { bFoundInPath = bInPath; } + sal_Bool IsFoundInPath() const { return bFoundInPath; } + void SetFoundInPath( sal_Bool bInPath ) { bFoundInPath = bInPath; } - void Store( SotStorageStream& rSStream, const String& rBasMgrStorageName, BOOL bUseOldReloadInfo ); + void Store( SotStorageStream& rSStream, const String& rBasMgrStorageName, sal_Bool bUseOldReloadInfo ); static BasicLibInfo* Create( SotStorageStream& rSStream ); Reference< XLibraryContainer > GetLibraryContainer( void ) @@ -521,10 +521,10 @@ public: BasicLibInfo::BasicLibInfo() { - bReference = FALSE; - bPasswordVerified = FALSE; - bDoLoad = FALSE; - bFoundInPath = FALSE; + bReference = sal_False; + bPasswordVerified = sal_False; + bDoLoad = sal_False; + bFoundInPath = sal_False; mxScriptCont = NULL; aStorageName = String::CreateFromAscii(szImbedded); aRelStorageName = String::CreateFromAscii(szImbedded); @@ -532,20 +532,20 @@ BasicLibInfo::BasicLibInfo() BasicLibInfo::BasicLibInfo( const String& rStorageName ) { - bReference = TRUE; - bPasswordVerified = FALSE; - bDoLoad = FALSE; + bReference = sal_True; + bPasswordVerified = sal_False; + bDoLoad = sal_False; mxScriptCont = NULL; aStorageName = rStorageName; } -void BasicLibInfo::Store( SotStorageStream& rSStream, const String& rBasMgrStorageName, BOOL bUseOldReloadInfo ) +void BasicLibInfo::Store( SotStorageStream& rSStream, const String& rBasMgrStorageName, sal_Bool bUseOldReloadInfo ) { - ULONG nStartPos = rSStream.Tell(); + sal_uIntPtr nStartPos = rSStream.Tell(); sal_uInt32 nEndPos = 0; - USHORT nId = LIBINFO_ID; - USHORT nVer = CURR_VER; + sal_uInt16 nId = LIBINFO_ID; + sal_uInt16 nVer = CURR_VER; rSStream << nEndPos; rSStream << nId; @@ -559,7 +559,7 @@ void BasicLibInfo::Store( SotStorageStream& rSStream, const String& rBasMgrStora aStorageName = aCurStorageName; // Load again? - BOOL bDoLoad_ = xLib.Is(); + sal_Bool bDoLoad_ = xLib.Is(); if ( bUseOldReloadInfo ) bDoLoad_ = DoLoad(); rSStream << bDoLoad_; @@ -612,8 +612,8 @@ BasicLibInfo* BasicLibInfo::Create( SotStorageStream& rSStream ) BasicLibInfo* pInfo = new BasicLibInfo; sal_uInt32 nEndPos; - USHORT nId; - USHORT nVer; + sal_uInt16 nId; + sal_uInt16 nVer; rSStream >> nEndPos; rSStream >> nId; @@ -623,7 +623,7 @@ BasicLibInfo* BasicLibInfo::Create( SotStorageStream& rSStream ) if( nId == LIBINFO_ID ) { // Reload? - BOOL bDoLoad; + sal_Bool bDoLoad; rSStream >> bDoLoad; pInfo->bDoLoad = bDoLoad; @@ -644,7 +644,7 @@ BasicLibInfo* BasicLibInfo::Create( SotStorageStream& rSStream ) if ( nVer >= 2 ) { - BOOL bReferenz; + sal_Bool bReferenz; rSStream >> bReferenz; pInfo->IsReference() = bReferenz; } @@ -667,7 +667,7 @@ void BasicLibInfo::CalcRelStorageName( const String& rMgrStorageName ) else SetRelStorageName( String() ); } -BasicManager::BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBASIC* pParentFromStdLib, String* pLibPath, BOOL bDocMgr ) : mbDocMgr( bDocMgr ) +BasicManager::BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBASIC* pParentFromStdLib, String* pLibPath, sal_Bool bDocMgr ) : mbDocMgr( bDocMgr ) { DBG_CTOR( BasicManager, 0 ); @@ -704,13 +704,13 @@ BasicManager::BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBA xStdLib->SetName( String::CreateFromAscii(szStdLibName) ); pStdLibInfo->SetLibName( String::CreateFromAscii(szStdLibName) ); xStdLib->SetFlag( SBX_DONTSTORE | SBX_EXTSEARCH ); - xStdLib->SetModified( FALSE ); + xStdLib->SetModified( sal_False ); } else { pStdLib->SetParent( pParentFromStdLib ); // The other get StdLib as parent: - for ( USHORT nBasic = 1; nBasic < GetLibCount(); nBasic++ ) + for ( sal_uInt16 nBasic = 1; nBasic < GetLibCount(); nBasic++ ) { StarBASIC* pBasic = GetLib( nBasic ); if ( pBasic ) @@ -721,7 +721,7 @@ BasicManager::BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBA } } // Modified through insert - pStdLib->SetModified( FALSE ); + pStdLib->SetModified( sal_False ); } // #91626 Save all stream data to save it unmodified if basic isn't modified @@ -732,12 +732,12 @@ BasicManager::BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBA *static_cast(&xManagerStream) >> *mpImpl->mpManagerStream; SotStorageRef xBasicStorage = rStorage.OpenSotStorage - ( String(RTL_CONSTASCII_USTRINGPARAM(szBasicStorage)), eStorageReadMode, FALSE ); + ( String(RTL_CONSTASCII_USTRINGPARAM(szBasicStorage)), eStorageReadMode, sal_False ); if( xBasicStorage.Is() && !xBasicStorage->GetError() ) { - USHORT nLibs = GetLibCount(); + sal_uInt16 nLibs = GetLibCount(); mpImpl->mppLibStreams = new SvMemoryStream*[ nLibs ]; - for( USHORT nL = 0; nL < nLibs; nL++ ) + for( sal_uInt16 nL = 0; nL < nLibs; nL++ ) { BasicLibInfo* pInfo = pLibs->GetObject( nL ); DBG_ASSERT( pInfo, "pInfo?!" ); @@ -756,7 +756,7 @@ BasicManager::BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBA LoadOldBasicManager( rStorage ); } - bBasMgrModified = FALSE; + bBasMgrModified = sal_False; } void copyToLibraryContainer( StarBASIC* pBasic, const LibraryContainerInfo& rInfo ) @@ -775,8 +775,8 @@ void copyToLibraryContainer( StarBASIC* pBasic, const LibraryContainerInfo& rInf if ( !xLib.is() ) return; - USHORT nModCount = pBasic->GetModules()->Count(); - for ( USHORT nMod = 0 ; nMod < nModCount ; nMod++ ) + sal_uInt16 nModCount = pBasic->GetModules()->Count(); + for ( sal_uInt16 nMod = 0 ; nMod < nModCount ; nMod++ ) { SbModule* pModule = (SbModule*)pBasic->GetModules()->Get( nMod ); DBG_ASSERT( pModule, "Modul nicht erhalten!" ); @@ -840,14 +840,14 @@ void BasicManager::SetLibraryContainerInfo( const LibraryContainerInfo& rInfo ) else { // No libs? Maybe an 5.2 document already loaded - USHORT nLibs = GetLibCount(); - for( USHORT nL = 0; nL < nLibs; nL++ ) + sal_uInt16 nLibs = GetLibCount(); + for( sal_uInt16 nL = 0; nL < nLibs; nL++ ) { BasicLibInfo* pBasLibInfo = pLibs->GetObject( nL ); StarBASIC* pLib = pBasLibInfo->GetLib(); if( !pLib ) { - BOOL bLoaded = ImpLoadLibary( pBasLibInfo, NULL, FALSE ); + sal_Bool bLoaded = ImpLoadLibary( pBasLibInfo, NULL, sal_False ); if( bLoaded ) pLib = pBasLibInfo->GetLib(); } @@ -876,7 +876,7 @@ void BasicManager::SetLibraryContainerInfo( const LibraryContainerInfo& rInfo ) SetGlobalUNOConstant( "DialogLibraries", makeAny( mpImpl->maContainerInfo.mxDialogCont ) ); } -BasicManager::BasicManager( StarBASIC* pSLib, String* pLibPath, BOOL bDocMgr ) : mbDocMgr( bDocMgr ) +BasicManager::BasicManager( StarBASIC* pSLib, String* pLibPath, sal_Bool bDocMgr ) : mbDocMgr( bDocMgr ) { DBG_CTOR( BasicManager, 0 ); Init(); @@ -893,8 +893,8 @@ BasicManager::BasicManager( StarBASIC* pSLib, String* pLibPath, BOOL bDocMgr ) : pSLib->SetFlag( SBX_DONTSTORE | SBX_EXTSEARCH ); // Save is only necessary if basic has changed - xStdLib->SetModified( FALSE ); - bBasMgrModified = FALSE; + xStdLib->SetModified( sal_False ); + bBasMgrModified = sal_False; } BasicManager::BasicManager() @@ -919,7 +919,7 @@ void BasicManager::ImpMgrNotLoaded( const String& rStorageName ) xStdLib->SetName( String::CreateFromAscii(szStdLibName) ); pStdLibInfo->SetLibName( String::CreateFromAscii(szStdLibName) ); xStdLib->SetFlag( SBX_DONTSTORE | SBX_EXTSEARCH ); - xStdLib->SetModified( FALSE ); + xStdLib->SetModified( sal_False ); } @@ -934,7 +934,7 @@ void BasicManager::ImpCreateStdLib( StarBASIC* pParentFromStdLib ) } -void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseURL, BOOL bLoadLibs ) +void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseURL, sal_Bool bLoadLibs ) { DBG_CHKTHIS( BasicManager, 0 ); @@ -972,7 +972,7 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseUR sal_uInt32 nEndPos; *xManagerStream >> nEndPos; - USHORT nLibs; + sal_uInt16 nLibs; *xManagerStream >> nLibs; // Plausi! if( nLibs & 0xF000 ) @@ -980,7 +980,7 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseUR DBG_ASSERT( !this, "BasicManager-Stream defect!" ); return; } - for ( USHORT nL = 0; nL < nLibs; nL++ ) + for ( sal_uInt16 nL = 0; nL < nLibs; nL++ ) { BasicLibInfo* pInfo = BasicLibInfo::Create( *xManagerStream ); @@ -990,7 +990,7 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseUR { INetURLObject aObj( aRealStorageName, INET_PROT_FILE ); aObj.removeSegment(); - bool bWasAbsolute = FALSE; + bool bWasAbsolute = sal_False; aObj = aObj.smartRel2Abs( pInfo->GetRelStorageName(), bWasAbsolute ); //*** TODO: Replace if still necessary @@ -1006,7 +1006,7 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseUR if( aPathCFG.SearchFile( aSearchFile, SvtPathOptions::PATH_BASIC ) ) { pInfo->SetStorageName( aSearchFile ); - pInfo->SetFoundInPath( TRUE ); + pInfo->SetFoundInPath( sal_True ); } } } @@ -1071,8 +1071,8 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage ) { String aCurStorageName( aStorName ); INetURLObject aCurStorage( aCurStorageName, INET_PROT_FILE ); - USHORT nLibs = aLibs.GetTokenCount( LIB_SEP ); - for ( USHORT nLib = 0; nLib < nLibs; nLib++ ) + sal_uInt16 nLibs = aLibs.GetTokenCount( LIB_SEP ); + for ( sal_uInt16 nLib = 0; nLib < nLibs; nLib++ ) { String aLibInfo( aLibs.GetToken( nLib, LIB_SEP ) ); // TODO: Remove == 2 @@ -1084,7 +1084,7 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage ) INetURLObject aLibRelStorage( aStorName ); aLibRelStorage.removeSegment(); - bool bWasAbsolute = FALSE; + bool bWasAbsolute = sal_False; aLibRelStorage = aLibRelStorage.smartRel2Abs( aLibRelStorageName, bWasAbsolute); DBG_ASSERT(!bWasAbsolute, "RelStorageName was absolute!" ); @@ -1093,14 +1093,14 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage ) xStorageRef = &rStorage; else { - xStorageRef = new SotStorage( FALSE, aLibAbsStorage.GetMainURL - ( INetURLObject::NO_DECODE ), eStorageReadMode, TRUE ); + xStorageRef = new SotStorage( sal_False, aLibAbsStorage.GetMainURL + ( INetURLObject::NO_DECODE ), eStorageReadMode, sal_True ); if ( xStorageRef->GetError() != ERRCODE_NONE ) - xStorageRef = new SotStorage( FALSE, aLibRelStorage. - GetMainURL( INetURLObject::NO_DECODE ), eStorageReadMode, TRUE ); + xStorageRef = new SotStorage( sal_False, aLibRelStorage. + GetMainURL( INetURLObject::NO_DECODE ), eStorageReadMode, sal_True ); } if ( xStorageRef.Is() ) - AddLib( *xStorageRef, aLibName, FALSE ); + AddLib( *xStorageRef, aLibName, sal_False ); else { // String aErrorText( BasicResId( IDS_SBERR_LIBLOAD ) ); @@ -1143,7 +1143,7 @@ void BasicManager::Init() { DBG_CHKTHIS( BasicManager, 0 ); - bBasMgrModified = FALSE; + bBasMgrModified = sal_False; pErrorMgr = new BasicErrorManager; pLibs = new BasicLibs; mpImpl = new BasicManagerImpl(); @@ -1158,7 +1158,7 @@ BasicLibInfo* BasicManager::CreateLibInfo() return pInf; } -BOOL BasicManager::ImpLoadLibary( BasicLibInfo* pLibInfo, SotStorage* pCurStorage, BOOL bInfosOnly ) const +sal_Bool BasicManager::ImpLoadLibary( BasicLibInfo* pLibInfo, SotStorage* pCurStorage, sal_Bool bInfosOnly ) const { DBG_CHKTHIS( BasicManager, 0 ); @@ -1186,10 +1186,10 @@ BOOL BasicManager::ImpLoadLibary( BasicLibInfo* pLibInfo, SotStorage* pCurStorag } if ( !xStorage.Is() ) - xStorage = new SotStorage( FALSE, aStorageName, eStorageReadMode ); + xStorage = new SotStorage( sal_False, aStorageName, eStorageReadMode ); SotStorageRef xBasicStorage = xStorage->OpenSotStorage - ( String(RTL_CONSTASCII_USTRINGPARAM(szBasicStorage)), eStorageReadMode, FALSE ); + ( String(RTL_CONSTASCII_USTRINGPARAM(szBasicStorage)), eStorageReadMode, sal_False ); if ( !xBasicStorage.Is() || xBasicStorage->GetError() ) { @@ -1207,7 +1207,7 @@ BOOL BasicManager::ImpLoadLibary( BasicLibInfo* pLibInfo, SotStorage* pCurStorag } else { - BOOL bLoaded = FALSE; + sal_Bool bLoaded = sal_False; if ( xBasicStream->Seek( STREAM_SEEK_TO_END ) != 0 ) { if ( !bInfosOnly ) @@ -1220,7 +1220,7 @@ BOOL BasicManager::ImpLoadLibary( BasicLibInfo* pLibInfo, SotStorage* pCurStorag xBasicStream->SetBufferSize( 0 ); StarBASICRef xStdLib = pLibInfo->GetLib(); xStdLib->SetName( pLibInfo->GetLibName() ); - xStdLib->SetModified( FALSE ); + xStdLib->SetModified( sal_False ); xStdLib->SetFlag( SBX_DONTSTORE ); } else @@ -1229,7 +1229,7 @@ BOOL BasicManager::ImpLoadLibary( BasicLibInfo* pLibInfo, SotStorage* pCurStorag xBasicStream->Seek( STREAM_SEEK_TO_BEGIN ); ImplEncryptStream( *xBasicStream ); SbxBase::Skip( *xBasicStream ); - bLoaded = TRUE; + bLoaded = sal_True; } } if ( !bLoaded ) @@ -1256,20 +1256,20 @@ BOOL BasicManager::ImpLoadLibary( BasicLibInfo* pLibInfo, SotStorage* pCurStorag return bLoaded; } } - return FALSE; + return sal_False; } -BOOL BasicManager::ImplEncryptStream( SvStream& rStrm ) const +sal_Bool BasicManager::ImplEncryptStream( SvStream& rStrm ) const { - ULONG nPos = rStrm.Tell(); - UINT32 nCreator; + sal_uIntPtr nPos = rStrm.Tell(); + sal_uInt32 nCreator; rStrm >> nCreator; rStrm.Seek( nPos ); - BOOL bProtected = FALSE; + sal_Bool bProtected = sal_False; if ( nCreator != SBXCR_SBX ) { // Should only be the case for encrypted Streams - bProtected = TRUE; + bProtected = sal_True; rStrm.SetKey( szCryptingKey ); rStrm.RefreshBuffer(); } @@ -1278,11 +1278,11 @@ BOOL BasicManager::ImplEncryptStream( SvStream& rStrm ) const // This code is necessary to load the BASIC of Beta 1 // TODO: Which Beta 1? -BOOL BasicManager::ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) const +sal_Bool BasicManager::ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) const { - BOOL bProtected = ImplEncryptStream( rStrm ); + sal_Bool bProtected = ImplEncryptStream( rStrm ); SbxBaseRef xNew = SbxBase::Load( rStrm ); - BOOL bLoaded = FALSE; + sal_Bool bLoaded = sal_False; if( xNew.Is() ) { if( xNew->IsA( TYPE(StarBASIC) ) ) @@ -1308,8 +1308,8 @@ BOOL BasicManager::ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) con rOldBasic->SetFlag( SBX_EXTSEARCH ); } */ - pNew->SetModified( FALSE ); - bLoaded = TRUE; + pNew->SetModified( sal_False ); + bLoaded = sal_True; } } if ( bProtected ) @@ -1317,14 +1317,14 @@ BOOL BasicManager::ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) con return bLoaded; } -void BasicManager::CheckModules( StarBASIC* pLib, BOOL bReference ) const +void BasicManager::CheckModules( StarBASIC* pLib, sal_Bool bReference ) const { if ( !pLib ) return; - BOOL bModified = pLib->IsModified(); + sal_Bool bModified = pLib->IsModified(); - for ( USHORT nMod = 0; nMod < pLib->GetModules()->Count(); nMod++ ) + for ( sal_uInt16 nMod = 0; nMod < pLib->GetModules()->Count(); nMod++ ) { SbModule* pModule = (SbModule*)pLib->GetModules()->Get( nMod ); DBG_ASSERT( pModule, "Modul nicht erhalten!" ); @@ -1337,11 +1337,11 @@ void BasicManager::CheckModules( StarBASIC* pLib, BOOL bReference ) const if( !bModified && bReference ) { DBG_ERROR( "Per Reference eingebundene Basic-Library ist nicht compiliert!" ); - pLib->SetModified( FALSE ); + pLib->SetModified( sal_False ); } } -StarBASIC* BasicManager::AddLib( SotStorage& rStorage, const String& rLibName, BOOL bReference ) +StarBASIC* BasicManager::AddLib( SotStorage& rStorage, const String& rLibName, sal_Bool bReference ) { DBG_CHKTHIS( BasicManager, 0 ); @@ -1359,12 +1359,12 @@ StarBASIC* BasicManager::AddLib( SotStorage& rStorage, const String& rLibName, B // Use original name otherwise ImpLoadLibary failes... pLibInfo->SetLibName( rLibName ); // Funktioniert so aber nicht, wenn Name doppelt -// USHORT nLibId = GetLibId( rLibName ); - USHORT nLibId = (USHORT) pLibs->GetPos( pLibInfo ); +// sal_uInt16 nLibId = GetLibId( rLibName ); + sal_uInt16 nLibId = (sal_uInt16) pLibs->GetPos( pLibInfo ); // Set StorageName before load because it is compared with pCurStorage pLibInfo->SetStorageName( aStorageName ); - BOOL bLoaded = ImpLoadLibary( pLibInfo, &rStorage ); + sal_Bool bLoaded = ImpLoadLibary( pLibInfo, &rStorage ); if ( bLoaded ) { @@ -1373,21 +1373,21 @@ StarBASIC* BasicManager::AddLib( SotStorage& rStorage, const String& rLibName, B if ( bReference ) { - pLibInfo->GetLib()->SetModified( FALSE ); // Don't save in this case + pLibInfo->GetLib()->SetModified( sal_False ); // Don't save in this case pLibInfo->SetRelStorageName( String() ); // pLibInfo->CalcRelStorageName( GetStorageName() ); - pLibInfo->IsReference() = TRUE; + pLibInfo->IsReference() = sal_True; } else { - pLibInfo->GetLib()->SetModified( TRUE ); // Must be saved after Add! + pLibInfo->GetLib()->SetModified( sal_True ); // Must be saved after Add! pLibInfo->SetStorageName( String::CreateFromAscii(szImbedded) ); // Save in BasicManager-Storage } - bBasMgrModified = TRUE; + bBasMgrModified = sal_True; } else { - RemoveLib( nLibId, FALSE ); + RemoveLib( nLibId, sal_False ); pLibInfo = 0; } @@ -1397,7 +1397,7 @@ StarBASIC* BasicManager::AddLib( SotStorage& rStorage, const String& rLibName, B return 0; } -BOOL BasicManager::IsReference( USHORT nLib ) +sal_Bool BasicManager::IsReference( sal_uInt16 nLib ) { DBG_CHKTHIS( BasicManager, 0 ); @@ -1406,16 +1406,16 @@ BOOL BasicManager::IsReference( USHORT nLib ) if ( pLibInfo ) return pLibInfo->IsReference(); - return FALSE; + return sal_False; } -BOOL BasicManager::RemoveLib( USHORT nLib ) +sal_Bool BasicManager::RemoveLib( sal_uInt16 nLib ) { // Only pyhsical deletion if no reference return RemoveLib( nLib, !IsReference( nLib ) ); } -BOOL BasicManager::RemoveLib( USHORT nLib, BOOL bDelBasicFromStorage ) +sal_Bool BasicManager::RemoveLib( sal_uInt16 nLib, sal_Bool bDelBasicFromStorage ) { DBG_CHKTHIS( BasicManager, 0 ); DBG_ASSERT( nLib, "Standard-Lib cannot be removed!" ); @@ -1428,7 +1428,7 @@ BOOL BasicManager::RemoveLib( USHORT nLib, BOOL bDelBasicFromStorage ) // String aErrorText( BasicResId( IDS_SBERR_REMOVELIB ) ); StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_REMOVELIB, String(), ERRCODE_BUTTON_OK ); pErrorMgr->InsertError( BasicError( *pErrInf, BASERR_REASON_STDLIB, pLibInfo->GetLibName() ) ); - return FALSE; + return sal_False; } // If one of the streams cannot be opened, this is not an error, @@ -1438,14 +1438,14 @@ BOOL BasicManager::RemoveLib( USHORT nLib, BOOL bDelBasicFromStorage ) { SotStorageRef xStorage; if ( !pLibInfo->IsExtern() ) - xStorage = new SotStorage( FALSE, GetStorageName() ); + xStorage = new SotStorage( sal_False, GetStorageName() ); else - xStorage = new SotStorage( FALSE, pLibInfo->GetStorageName() ); + xStorage = new SotStorage( sal_False, pLibInfo->GetStorageName() ); if ( xStorage->IsStorage( String(RTL_CONSTASCII_USTRINGPARAM(szBasicStorage)) ) ) { SotStorageRef xBasicStorage = xStorage->OpenSotStorage - ( String(RTL_CONSTASCII_USTRINGPARAM(szBasicStorage)), STREAM_STD_READWRITE, FALSE ); + ( String(RTL_CONSTASCII_USTRINGPARAM(szBasicStorage)), STREAM_STD_READWRITE, sal_False ); if ( !xBasicStorage.Is() || xBasicStorage->GetError() ) { @@ -1483,20 +1483,20 @@ BOOL BasicManager::RemoveLib( USHORT nLib, BOOL bDelBasicFromStorage ) } } } - bBasMgrModified = TRUE; + bBasMgrModified = sal_True; if ( pLibInfo->GetLib().Is() ) GetStdLib()->Remove( pLibInfo->GetLib() ); delete pLibs->Remove( pLibInfo ); - return TRUE; // Remove was successful, del unimportant + return sal_True; // Remove was successful, del unimportant } -USHORT BasicManager::GetLibCount() const +sal_uInt16 BasicManager::GetLibCount() const { DBG_CHKTHIS( BasicManager, 0 ); - return (USHORT)pLibs->Count(); + return (sal_uInt16)pLibs->Count(); } -StarBASIC* BasicManager::GetLib( USHORT nLib ) const +StarBASIC* BasicManager::GetLib( sal_uInt16 nLib ) const { DBG_CHKTHIS( BasicManager, 0 ); BasicLibInfo* pInf = pLibs->GetObject( nLib ); @@ -1528,7 +1528,7 @@ StarBASIC* BasicManager::GetLib( const String& rName ) const return 0; } -USHORT BasicManager::GetLibId( const String& rName ) const +sal_uInt16 BasicManager::GetLibId( const String& rName ) const { DBG_CHKTHIS( BasicManager, 0 ); @@ -1536,14 +1536,14 @@ USHORT BasicManager::GetLibId( const String& rName ) const while ( pInf ) { if ( pInf->GetLibName().CompareIgnoreCaseToAscii( rName ) == COMPARE_EQUAL ) - return (USHORT)pLibs->GetCurPos(); + return (sal_uInt16)pLibs->GetCurPos(); pInf = pLibs->Next(); } return LIB_NOTFOUND; } -BOOL BasicManager::HasLib( const String& rName ) const +sal_Bool BasicManager::HasLib( const String& rName ) const { DBG_CHKTHIS( BasicManager, 0 ); @@ -1551,14 +1551,14 @@ BOOL BasicManager::HasLib( const String& rName ) const while ( pInf ) { if ( pInf->GetLibName().CompareIgnoreCaseToAscii( rName ) == COMPARE_EQUAL ) - return TRUE; + return sal_True; pInf = pLibs->Next(); } - return FALSE; + return sal_False; } -BOOL BasicManager::SetLibName( USHORT nLib, const String& rName ) +sal_Bool BasicManager::SetLibName( sal_uInt16 nLib, const String& rName ) { DBG_CHKTHIS( BasicManager, 0 ); @@ -1571,15 +1571,15 @@ BOOL BasicManager::SetLibName( USHORT nLib, const String& rName ) { StarBASICRef xStdLib = pLibInfo->GetLib(); xStdLib->SetName( rName ); - xStdLib->SetModified( TRUE ); + xStdLib->SetModified( sal_True ); } - bBasMgrModified = TRUE; - return TRUE; + bBasMgrModified = sal_True; + return sal_True; } - return FALSE; + return sal_False; } -String BasicManager::GetLibName( USHORT nLib ) +String BasicManager::GetLibName( sal_uInt16 nLib ) { DBG_CHKTHIS( BasicManager, 0 ); @@ -1590,11 +1590,11 @@ String BasicManager::GetLibName( USHORT nLib ) return String(); } -BOOL BasicManager::LoadLib( USHORT nLib ) +sal_Bool BasicManager::LoadLib( sal_uInt16 nLib ) { DBG_CHKTHIS( BasicManager, 0 ); - BOOL bDone = FALSE; + sal_Bool bDone = sal_False; BasicLibInfo* pLibInfo = pLibs->GetObject( nLib ); DBG_ASSERT( pLibInfo, "Lib?!" ); if ( pLibInfo ) @@ -1608,7 +1608,7 @@ BOOL BasicManager::LoadLib( USHORT nLib ) } else { - bDone = ImpLoadLibary( pLibInfo, NULL, FALSE ); + bDone = ImpLoadLibary( pLibInfo, NULL, sal_False ); StarBASIC* pLib = GetLib( nLib ); if ( pLib ) { @@ -1654,17 +1654,17 @@ StarBASIC* BasicManager::CreateLib { if( LinkTargetURL.Len() != 0 ) { - SotStorageRef xStorage = new SotStorage( FALSE, LinkTargetURL, STREAM_READ | STREAM_SHARE_DENYWRITE ); + SotStorageRef xStorage = new SotStorage( sal_False, LinkTargetURL, STREAM_READ | STREAM_SHARE_DENYWRITE ); if( !xStorage->GetError() ) { - pLib = AddLib( *xStorage, rLibName, TRUE ); + pLib = AddLib( *xStorage, rLibName, sal_True ); //if( !pLibInfo ) //pLibInfo = FindLibInfo( pLib ); //pLibInfo->SetStorageName( LinkTargetURL ); - //pLibInfo->GetLib()->SetModified( FALSE ); // Dann nicht speichern + //pLibInfo->GetLib()->SetModified( sal_False ); // Dann nicht speichern //pLibInfo->SetRelStorageName( String() ); - //pLibInfo->IsReference() = TRUE; + //pLibInfo->IsReference() = sal_True; } //else //Message? @@ -1720,16 +1720,16 @@ BasicLibInfo* BasicManager::FindLibInfo( StarBASIC* pBasic ) const } -BOOL BasicManager::IsModified() const +sal_Bool BasicManager::IsModified() const { DBG_CHKTHIS( BasicManager, 0 ); if ( bBasMgrModified ) - return TRUE; + return sal_True; return IsBasicModified(); } -BOOL BasicManager::IsBasicModified() const +sal_Bool BasicManager::IsBasicModified() const { DBG_CHKTHIS( BasicManager, 0 ); @@ -1737,17 +1737,17 @@ BOOL BasicManager::IsBasicModified() const while ( pInf ) { if ( pInf->GetLib().Is() && pInf->GetLib()->IsModified() ) - return TRUE; + return sal_True; pInf = pLibs->Next(); } - return FALSE; + return sal_False; } -void BasicManager::SetFlagToAllLibs( short nFlag, BOOL bSet ) const +void BasicManager::SetFlagToAllLibs( short nFlag, sal_Bool bSet ) const { - USHORT nLibs = GetLibCount(); - for ( USHORT nL = 0; nL < nLibs; nL++ ) + sal_uInt16 nLibs = GetLibCount(); + for ( sal_uInt16 nL = 0; nL < nLibs; nL++ ) { BasicLibInfo* pInfo = pLibs->GetObject( nL ); DBG_ASSERT( pInfo, "Info?!" ); @@ -1762,7 +1762,7 @@ void BasicManager::SetFlagToAllLibs( short nFlag, BOOL bSet ) const } } -BOOL BasicManager::HasErrors() +sal_Bool BasicManager::HasErrors() { DBG_CHKTHIS( BasicManager, 0 ); return pErrorMgr->HasErrors(); @@ -2021,10 +2021,10 @@ Sequence< ::rtl::OUString > ModuleContainer_Impl::getElementNames() throw(RuntimeException) { SbxArray* pMods = mpLib ? mpLib->GetModules() : NULL; - USHORT nMods = pMods ? pMods->Count() : 0; + sal_uInt16 nMods = pMods ? pMods->Count() : 0; Sequence< ::rtl::OUString > aRetSeq( nMods ); ::rtl::OUString* pRetSeq = aRetSeq.getArray(); - for( USHORT i = 0 ; i < nMods ; i++ ) + for( sal_uInt16 i = 0 ; i < nMods ; i++ ) { SbxVariable* pMod = pMods->Get( i ); pRetSeq[i] = ::rtl::OUString( pMod->GetName() ); @@ -2351,10 +2351,10 @@ Any LibraryContainer_Impl::getByName( const ::rtl::OUString& aName ) Sequence< ::rtl::OUString > LibraryContainer_Impl::getElementNames() throw(RuntimeException) { - USHORT nLibs = mpMgr->GetLibCount(); + sal_uInt16 nLibs = mpMgr->GetLibCount(); Sequence< ::rtl::OUString > aRetSeq( nLibs ); ::rtl::OUString* pRetSeq = aRetSeq.getArray(); - for( USHORT i = 0 ; i < nLibs ; i++ ) + for( sal_uInt16 i = 0 ; i < nLibs ; i++ ) { pRetSeq[i] = ::rtl::OUString( mpMgr->GetLibName( i ) ); } @@ -2391,7 +2391,7 @@ void LibraryContainer_Impl::removeByName( const ::rtl::OUString& Name ) StarBASIC* pLib = mpMgr->GetLib( Name ); if( !pLib ) throw NoSuchElementException(); - USHORT nLibId = mpMgr->GetLibId( Name ); + sal_uInt16 nLibId = mpMgr->GetLibId( Name ); mpMgr->RemoveLib( nLibId ); } -- cgit