diff options
Diffstat (limited to 'basic')
212 files changed, 7305 insertions, 4535 deletions
diff --git a/basic/inc/basic/basicmanagerrepository.hxx b/basic/inc/basic/basicmanagerrepository.hxx index e486c3880f41..e486c3880f41 100644..100755 --- a/basic/inc/basic/basicmanagerrepository.hxx +++ b/basic/inc/basic/basicmanagerrepository.hxx diff --git a/basic/inc/basic/basicrt.hxx b/basic/inc/basic/basicrt.hxx index 8f55b4f8f247..2d39eb79ca02 100644..100755 --- a/basic/inc/basic/basicrt.hxx +++ b/basic/inc/basic/basicrt.hxx @@ -45,8 +45,8 @@ public: xub_StrLen GetLine(); xub_StrLen GetCol1(); xub_StrLen GetCol2(); - BOOL IsRun(); - BOOL IsValid() { return pRun != NULL; } + sal_Bool IsRun(); + sal_Bool IsValid() { return pRun != NULL; } BasicRuntime GetNextRuntime(); }; @@ -68,12 +68,12 @@ class BasicRuntimeAccess public: static BasicRuntime GetRuntime(); static bool HasRuntime(); - static USHORT GetStackEntryCount(); - static BasicErrorStackEntry GetStackEntry( USHORT nIndex ); - static BOOL HasStack(); + static sal_uInt16 GetStackEntryCount(); + static BasicErrorStackEntry GetStackEntry( sal_uInt16 nIndex ); + static sal_Bool HasStack(); static void DeleteStack(); - static BOOL IsRunInit(); + static sal_Bool IsRunInit(); }; #endif diff --git a/basic/inc/basic/basmgr.hxx b/basic/inc/basic/basmgr.hxx index 360063bbface..51550eab5700 100644..100755 --- a/basic/inc/basic/basmgr.hxx +++ b/basic/inc/basic/basmgr.hxx @@ -69,21 +69,21 @@ class SotStorage; class BasicError { private: - ULONG nErrorId; - USHORT nReason; + sal_uIntPtr nErrorId; + sal_uInt16 nReason; String aErrStr; public: BasicError(); BasicError( const BasicError& rErr ); - BasicError( ULONG nId, USHORT nR, const String& rErrStr ); + BasicError( sal_uIntPtr nId, sal_uInt16 nR, const String& rErrStr ); - ULONG GetErrorId() const { return nErrorId; } - USHORT GetReason() const { return nReason; } + sal_uIntPtr GetErrorId() const { return nErrorId; } + sal_uInt16 GetReason() const { return nReason; } String GetErrorStr() { return aErrStr; } - void SetErrorId( ULONG n ) { nErrorId = n; } - void SetReason( USHORT n ) { nReason = n; } + void SetErrorId( sal_uIntPtr n ) { nErrorId = n; } + void SetReason( sal_uInt16 n ) { nReason = n; } void SetErrorStr( const String& rStr) { aErrStr = rStr; } }; @@ -147,33 +147,33 @@ private: String aName; String maStorageName; - BOOL bBasMgrModified; - BOOL mbDocMgr; + sal_Bool bBasMgrModified; + sal_Bool mbDocMgr; BasicManagerImpl* mpImpl; void Init(); protected: - BOOL ImpLoadLibary( BasicLibInfo* pLibInfo ) const; - BOOL ImpLoadLibary( BasicLibInfo* pLibInfo, SotStorage* pCurStorage, BOOL bInfosOnly = FALSE ) const; + sal_Bool ImpLoadLibary( BasicLibInfo* pLibInfo ) const; + sal_Bool ImpLoadLibary( BasicLibInfo* pLibInfo, SotStorage* pCurStorage, sal_Bool bInfosOnly = sal_False ) const; void ImpCreateStdLib( StarBASIC* pParentFromStdLib ); void ImpMgrNotLoaded( const String& rStorageName ); BasicLibInfo* CreateLibInfo(); - void LoadBasicManager( SotStorage& rStorage, const String& rBaseURL, BOOL bLoadBasics = TRUE ); + void LoadBasicManager( SotStorage& rStorage, const String& rBaseURL, sal_Bool bLoadBasics = sal_True ); void LoadOldBasicManager( SotStorage& rStorage ); - BOOL ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) const; - BOOL ImplEncryptStream( SvStream& rStream ) const; + sal_Bool ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) const; + sal_Bool ImplEncryptStream( SvStream& rStream ) const; BasicLibInfo* FindLibInfo( StarBASIC* pBasic ) const; - void CheckModules( StarBASIC* pBasic, BOOL bReference ) const; - void SetFlagToAllLibs( short nFlag, BOOL bSet ) const; + void CheckModules( StarBASIC* pBasic, sal_Bool bReference ) const; + void SetFlagToAllLibs( short nFlag, sal_Bool bSet ) const; BasicManager(); // This is used only to customize the paths for 'Save as'. ~BasicManager(); public: TYPEINFO(); - BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBASIC* pParentFromStdLib = NULL, String* pLibPath = NULL, BOOL bDocMgr = FALSE ); - BasicManager( StarBASIC* pStdLib, String* pLibPath = NULL, BOOL bDocMgr = FALSE ); + BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBASIC* pParentFromStdLib = NULL, String* pLibPath = NULL, sal_Bool bDocMgr = sal_False ); + BasicManager( StarBASIC* pStdLib, String* pLibPath = NULL, sal_Bool bDocMgr = sal_False ); /** deletes the given BasicManager instance @@ -190,12 +190,12 @@ public: String GetName() const { return aName; } - USHORT GetLibCount() const; - StarBASIC* GetLib( USHORT nLib ) const; + sal_uInt16 GetLibCount() const; + StarBASIC* GetLib( sal_uInt16 nLib ) const; StarBASIC* GetLib( const String& rName ) const; - USHORT GetLibId( const String& rName ) const; + sal_uInt16 GetLibId( const String& rName ) const; - String GetLibName( USHORT nLib ); + String GetLibName( sal_uInt16 nLib ); /** announces the library containers which belong to this BasicManager @@ -209,14 +209,14 @@ public: const ::com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer >& GetScriptLibraryContainer() const; - BOOL LoadLib( USHORT nLib ); - BOOL RemoveLib( USHORT nLib, BOOL bDelBasicFromStorage ); + sal_Bool LoadLib( sal_uInt16 nLib ); + sal_Bool RemoveLib( sal_uInt16 nLib, sal_Bool bDelBasicFromStorage ); // Modify-Flag will be reset only during save. - BOOL IsModified() const; - BOOL IsBasicModified() const; + sal_Bool IsModified() const; + sal_Bool IsBasicModified() const; - BOOL HasErrors(); + sal_Bool HasErrors(); void ClearErrors(); BasicError* GetFirstError(); BasicError* GetNextError(); @@ -238,15 +238,22 @@ public: */ bool LegacyPsswdBinaryLimitExceeded( ::com::sun::star::uno::Sequence< rtl::OUString >& _out_rModuleNames ); bool HasExeCode( const String& ); + /// determines whether the Basic Manager has a given macro, given by fully qualified name + bool HasMacro( String const& i_fullyQualifiedName ) const; + /// executes a given macro + ErrCode ExecuteMacro( String const& i_fullyQualifiedName, SbxArray* i_arguments, SbxValue* i_retValue ); + /// executes a given macro + ErrCode ExecuteMacro( String const& i_fullyQualifiedName, String const& i_commaSeparatedArgs, SbxValue* i_retValue ); + private: - BOOL IsReference( USHORT nLib ); + sal_Bool IsReference( sal_uInt16 nLib ); - BOOL SetLibName( USHORT nLib, const String& rName ); + sal_Bool SetLibName( sal_uInt16 nLib, const String& rName ); StarBASIC* GetStdLib() const; - StarBASIC* AddLib( SotStorage& rStorage, const String& rLibName, BOOL bReference ); - BOOL RemoveLib( USHORT nLib ); - BOOL HasLib( const String& rName ) const; + StarBASIC* AddLib( SotStorage& rStorage, const String& rLibName, sal_Bool bReference ); + sal_Bool RemoveLib( sal_uInt16 nLib ); + sal_Bool HasLib( const String& rName ) const; StarBASIC* CreateLibForLibContainer( const String& rLibName, const com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer >& diff --git a/basic/inc/basic/basrdll.hxx b/basic/inc/basic/basrdll.hxx index 2434dd40ea10..b11607201bb5 100644..100755 --- a/basic/inc/basic/basrdll.hxx +++ b/basic/inc/basic/basrdll.hxx @@ -39,8 +39,8 @@ private: ResMgr* pSttResMgr; ResMgr* pBasResMgr; - BOOL bDebugMode; - BOOL bBreakEnabled; + sal_Bool bDebugMode; + sal_Bool bBreakEnabled; public: BasicDLL(); @@ -51,8 +51,8 @@ public: static void BasicBreak(); - static void EnableBreak( BOOL bEnable ); - static void SetDebugMode( BOOL bDebugMode ); + static void EnableBreak( sal_Bool bEnable ); + static void SetDebugMode( sal_Bool bDebugMode ); }; #define BASIC_DLL() (*(BasicDLL**)GetAppData( SHL_BASIC ) ) diff --git a/basic/inc/basic/dispdefs.hxx b/basic/inc/basic/dispdefs.hxx index 9feb0edbef98..9feb0edbef98 100644..100755 --- a/basic/inc/basic/dispdefs.hxx +++ b/basic/inc/basic/dispdefs.hxx diff --git a/basic/inc/modsizeexceeded.hxx b/basic/inc/basic/modsizeexceeded.hxx index 414b7aff72e0..414b7aff72e0 100644..100755 --- a/basic/inc/modsizeexceeded.hxx +++ b/basic/inc/basic/modsizeexceeded.hxx diff --git a/basic/inc/basic/mybasic.hxx b/basic/inc/basic/mybasic.hxx index 2f87fb69c5a6..3a2ab068d4c4 100644..100755 --- a/basic/inc/basic/mybasic.hxx +++ b/basic/inc/basic/mybasic.hxx @@ -42,10 +42,10 @@ class ErrorEntry; //----------------------------------------------------------------------------- class BasicError { AppBasEd* pWin; - USHORT nLine, nCol1, nCol2; + sal_uInt16 nLine, nCol1, nCol2; String aText; public: - BasicError( AppBasEd*, USHORT, const String&, USHORT, USHORT, USHORT ); + BasicError( AppBasEd*, sal_uInt16, const String&, sal_uInt16, sal_uInt16, sal_uInt16 ); void Show(); }; @@ -53,8 +53,8 @@ public: class MyBasic : public StarBASIC { SbError nError; - virtual BOOL ErrorHdl(); - virtual USHORT BreakHdl(); + virtual sal_Bool ErrorHdl(); + virtual sal_uInt16 BreakHdl(); protected: ::std::vector< BasicError* > aErrors; @@ -73,7 +73,7 @@ public: TYPEINFO(); MyBasic(); virtual ~MyBasic(); - virtual BOOL Compile( SbModule* ); + virtual sal_Bool Compile( SbModule* ); void Reset(); SbError GetErrors() { return nError; } size_t GetCurrentError() { return CurrentError; } @@ -87,10 +87,10 @@ public: virtual void LoadIniFile(); // Determines the extended symbol type for syntax highlighting - virtual SbTextType GetSymbolType( const String &Symbol, BOOL bWasTTControl ); + virtual SbTextType GetSymbolType( const String &Symbol, sal_Bool bWasTTControl ); virtual const String GetSpechialErrorText(); virtual void ReportRuntimeError( AppBasEd *pEditWin ); - virtual void DebugFindNoErrors( BOOL bDebugFindNoErrors ); + virtual void DebugFindNoErrors( sal_Bool bDebugFindNoErrors ); static void SetCompileModule( SbModule *pMod ); static SbModule *GetCompileModule(); diff --git a/basic/inc/basic/process.hxx b/basic/inc/basic/process.hxx index d804ae4c722d..b88391b412ca 100644..100755 --- a/basic/inc/basic/process.hxx +++ b/basic/inc/basic/process.hxx @@ -46,22 +46,22 @@ class Process rtl_uString **m_pEnvList; rtl::OUString m_aProcessName; oslProcess m_pProcess; - BOOL ImplIsRunning(); + sal_Bool ImplIsRunning(); long ImplGetExitCode(); - BOOL bWasGPF; - BOOL bHasBeenStarted; + sal_Bool bWasGPF; + sal_Bool bHasBeenStarted; public: Process(); ~Process(); // Methoden void SetImage( const String &aAppPath, const String &aAppParams, const Environment *pEnv = NULL ); - BOOL Start(); - ULONG GetExitCode(); - BOOL IsRunning(); - BOOL WasGPF(); + sal_Bool Start(); + sal_uIntPtr GetExitCode(); + sal_Bool IsRunning(); + sal_Bool WasGPF(); - BOOL Terminate(); + sal_Bool Terminate(); }; #endif diff --git a/basic/inc/basic/sbdef.hxx b/basic/inc/basic/sbdef.hxx index 1b0b6a3f65b4..1b0b6a3f65b4 100644..100755 --- a/basic/inc/basic/sbdef.hxx +++ b/basic/inc/basic/sbdef.hxx diff --git a/basic/inc/basic/sberrors.hxx b/basic/inc/basic/sberrors.hxx index db072193d852..f2e40ac2e05c 100644..100755 --- a/basic/inc/basic/sberrors.hxx +++ b/basic/inc/basic/sberrors.hxx @@ -32,7 +32,7 @@ #include <basic/sbxdef.hxx> #ifndef __RSC -typedef ULONG SbError; +typedef sal_uIntPtr SbError; #endif // Mapping to SbxError diff --git a/basic/inc/basic/sbmeth.hxx b/basic/inc/basic/sbmeth.hxx index 8b1c9a9ce77f..4c8deafef29c 100644..100755 --- a/basic/inc/basic/sbmeth.hxx +++ b/basic/inc/basic/sbmeth.hxx @@ -49,15 +49,15 @@ class SbMethod : public SbxMethod SbMethodImpl* mpSbMethodImpl; // Impl data SbxVariable* mCaller; // caller SbModule* pMod; - USHORT nDebugFlags; - USHORT nLine1, nLine2; - UINT32 nStart; - BOOL bInvalid; + sal_uInt16 nDebugFlags; + sal_uInt16 nLine1, nLine2; + sal_uInt32 nStart; + sal_Bool bInvalid; SbxArrayRef refStatics; SbMethod( const String&, SbxDataType, SbModule* ); SbMethod( const SbMethod& ); - virtual BOOL LoadData( SvStream&, USHORT ); - virtual BOOL StoreData( SvStream& ) const; + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; virtual ~SbMethod(); public: @@ -68,14 +68,14 @@ public: SbxArray* GetStatics(); void ClearStatics(); SbModule* GetModule() { return pMod; } - UINT32 GetId() const { return nStart; } - USHORT GetDebugFlags() { return nDebugFlags; } - void SetDebugFlags( USHORT n ) { nDebugFlags = n; } - void GetLineRange( USHORT&, USHORT& ); + sal_uInt32 GetId() const { return nStart; } + sal_uInt16 GetDebugFlags() { return nDebugFlags; } + void SetDebugFlags( sal_uInt16 n ) { nDebugFlags = n; } + void GetLineRange( sal_uInt16&, sal_uInt16& ); // Interface to execute a method from the applications virtual ErrCode Call( SbxValue* pRet = NULL, SbxVariable* pCaller = NULL ); - virtual void Broadcast( ULONG nHintId ); + virtual void Broadcast( sal_uIntPtr nHintId ); }; #ifndef __SB_SBMETHODREF_HXX diff --git a/basic/inc/basic/sbmod.hxx b/basic/inc/basic/sbmod.hxx index 94fd9d845e12..cba5714b9c36 100644..100755 --- a/basic/inc/basic/sbmod.hxx +++ b/basic/inc/basic/sbmod.hxx @@ -36,15 +36,18 @@ #include <rtl/ustring.hxx> #include <vector> +#include <deque> + class SbMethod; class SbProperty; class SbiRuntime; -class SbiBreakpoints; +typedef std::deque< sal_uInt16 > SbiBreakpoints; class SbiImage; class SbProcedureProperty; class SbIfaceMapperMethod; class SbClassModuleObject; +class ModuleInitDependencyMap; struct ClassModuleRunInitItem; struct SbClassData; class SbModuleImpl; @@ -63,6 +66,8 @@ class SbModule : public SbxObject SbModule(); SbModule(const SbModule&); + void implClearIfVarDependsOnDeletedBasic( SbxVariable* pVar, StarBASIC* pDeletedBasic ); + protected: com::sun::star::uno::Reference< com::sun::star::script::XInvocation > mxWrapper; ::rtl::OUString aOUSource; @@ -70,36 +75,38 @@ protected: SbiImage* pImage; // the Image SbiBreakpoints* pBreaks; // Breakpoints SbClassData* pClassData; - BOOL mbVBACompat; - INT32 mnType; + sal_Bool mbVBACompat; + sal_Int32 mnType; SbxObjectRef pDocObject; // an impl object ( used by Document Modules ) bool bIsProxyModule; - static void implProcessModuleRunInit( ClassModuleRunInitItem& rItem ); + static void implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassModuleRunInitItem& rItem ); void StartDefinitions(); SbMethod* GetMethod( const String&, SbxDataType ); SbProperty* GetProperty( const String&, SbxDataType ); SbProcedureProperty* GetProcedureProperty( const String&, SbxDataType ); SbIfaceMapperMethod* GetIfaceMapperMethod( const String&, SbMethod* ); - void EndDefinitions( BOOL=FALSE ); - USHORT Run( SbMethod* ); + void EndDefinitions( sal_Bool=sal_False ); + sal_uInt16 Run( SbMethod* ); void RunInit(); void ClearPrivateVars(); - void GlobalRunInit( BOOL bBasicStart ); // for all modules + void ClearVarsDependingOnDeletedBasic( StarBASIC* pDeletedBasic ); + void GlobalRunInit( sal_Bool bBasicStart ); // for all modules void GlobalRunDeInit( void ); - const BYTE* FindNextStmnt( const BYTE*, USHORT&, USHORT& ) const; - const BYTE* FindNextStmnt( const BYTE*, USHORT&, USHORT&, - BOOL bFollowJumps, const SbiImage* pImg=NULL ) const; - virtual BOOL LoadData( SvStream&, USHORT ); - virtual BOOL StoreData( SvStream& ) const; - virtual BOOL LoadCompleted(); + const sal_uInt8* FindNextStmnt( const sal_uInt8*, sal_uInt16&, sal_uInt16& ) const; + const sal_uInt8* FindNextStmnt( const sal_uInt8*, sal_uInt16&, sal_uInt16&, + sal_Bool bFollowJumps, const SbiImage* pImg=NULL ) const; + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; + virtual sal_Bool LoadCompleted(); virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType ); + void handleProcedureProperties( SfxBroadcaster& rBC, const SfxHint& rHint ); virtual ~SbModule(); public: SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICMOD,2); TYPEINFO(); - SbModule( const String&, BOOL bCompat = FALSE ); + SbModule( const String&, sal_Bool bCompat = sal_False ); virtual void SetParent( SbxObject* ); virtual void Clear(); @@ -112,34 +119,34 @@ public: void SetSource32( const ::rtl::OUString& r ); void SetComment( const String& r ); - virtual BOOL Compile(); - BOOL Disassemble( String& rText ); - virtual BOOL IsCompiled() const; + virtual sal_Bool Compile(); + sal_Bool Disassemble( String& rText ); + virtual sal_Bool IsCompiled() const; const SbxObject* FindType( String aTypeName ) const; - virtual BOOL IsBreakable( USHORT nLine ) const; - virtual USHORT GetBPCount() const; - virtual USHORT GetBP( USHORT n ) const; - virtual BOOL IsBP( USHORT nLine ) const; - virtual BOOL SetBP( USHORT nLine ); - virtual BOOL ClearBP( USHORT nLine ); + virtual sal_Bool IsBreakable( sal_uInt16 nLine ) const; + virtual size_t GetBPCount() const; + virtual sal_uInt16 GetBP( size_t n ) const; + virtual sal_Bool IsBP( sal_uInt16 nLine ) const; + virtual sal_Bool SetBP( sal_uInt16 nLine ); + virtual sal_Bool ClearBP( sal_uInt16 nLine ); virtual void ClearAllBP(); // Lines of Subs - virtual SbMethod* GetFunctionForLine( USHORT ); + virtual SbMethod* GetFunctionForLine( sal_uInt16 ); // Store only image, no source (needed for new password protection) - BOOL StoreBinaryData( SvStream& ); - BOOL StoreBinaryData( SvStream&, USHORT nVer ); - BOOL LoadBinaryData( SvStream&, USHORT nVer ); - BOOL LoadBinaryData( SvStream& ); - BOOL ExceedsLegacyModuleSize(); + sal_Bool StoreBinaryData( SvStream& ); + sal_Bool StoreBinaryData( SvStream&, sal_uInt16 nVer ); + sal_Bool LoadBinaryData( SvStream&, sal_uInt16 nVer ); + sal_Bool LoadBinaryData( SvStream& ); + sal_Bool ExceedsLegacyModuleSize(); void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const; bool HasExeCode(); - BOOL IsVBACompat() const; - void SetVBACompat( BOOL bCompat ); - INT32 GetModuleType() { return mnType; } - void SetModuleType( INT32 nType ) { mnType = nType; } + sal_Bool IsVBACompat() const; + void SetVBACompat( sal_Bool bCompat ); + sal_Int32 GetModuleType() { return mnType; } + void SetModuleType( sal_Int32 nType ) { mnType = nType; } bool isProxyModule() { return bIsProxyModule; } void AddVarName( const String& aName ); void RemoveVars(); diff --git a/basic/inc/basic/sbobjmod.hxx b/basic/inc/basic/sbobjmod.hxx index 5db50103ae14..af602191cdd5 100644..100755 --- a/basic/inc/basic/sbobjmod.hxx +++ b/basic/inc/basic/sbobjmod.hxx @@ -47,10 +47,18 @@ class SbObjModule : public SbModule { SbObjModule( const SbObjModule& ); SbObjModule(); + +protected: + virtual ~SbObjModule(); + public: TYPEINFO(); SbObjModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible ); virtual SbxVariable* Find( const XubString& rName, SbxClassType t ); + + virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ); + using SbxValue::GetObject; SbxVariable* GetObject(); void SetUnoObject( const com::sun::star::uno::Any& aObj )throw ( com::sun::star::uno::RuntimeException ) ; @@ -76,7 +84,7 @@ public: SbUserFormModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat ); virtual ~SbUserFormModule(); virtual SbxVariable* Find( const XubString& rName, SbxClassType t ); - void ResetApiObj(); + void ResetApiObj( bool bTriggerTerminateEvent = true ); void Unload(); void Load(); void triggerMethod( const String& ); @@ -88,6 +96,11 @@ public: void triggerLayoutEvent(); void triggerResizeEvent(); + bool getInitState( void ) + { return mbInit; } + void setInitState( bool bInit ) + { mbInit = bInit; } + class SbUserFormModuleInstance* CreateInstance(); }; @@ -99,7 +112,7 @@ public: SbUserFormModuleInstance( SbUserFormModule* pParentModule, const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat ); - virtual BOOL IsClass( const String& ) const; + virtual sal_Bool IsClass( const String& ) const; virtual SbxVariable* Find( const XubString& rName, SbxClassType t ); }; diff --git a/basic/inc/basic/sbprop.hxx b/basic/inc/basic/sbprop.hxx index fc39c2e5f936..730ee6fa0aa7 100644..100755 --- a/basic/inc/basic/sbprop.hxx +++ b/basic/inc/basic/sbprop.hxx @@ -40,7 +40,7 @@ class SbProperty : public SbxProperty friend class SbModule; friend class SbProcedureProperty; SbModule* pMod; - BOOL bInvalid; + sal_Bool bInvalid; SbProperty( const String&, SbxDataType, SbModule* ); virtual ~SbProperty(); public: diff --git a/basic/inc/basic/sbstar.hxx b/basic/inc/basic/sbstar.hxx index f25ddcf02c09..73d80a4345b7 100644..100755 --- a/basic/inc/basic/sbstar.hxx +++ b/basic/inc/basic/sbstar.hxx @@ -37,16 +37,17 @@ #include <basic/sbdef.hxx> #include <basic/sberrors.hxx> #include <com/sun/star/script/ModuleInfo.hpp> +#include <com/sun/star/frame/XModel.hpp> class SbModule; // completed module class SbiInstance; // runtime instance class SbiRuntime; // currently running procedure class SbiImage; // compiled image class BasicLibInfo; // info block for basic manager -class SbiBreakpoints; class SbTextPortions; class SbMethod; class BasicManager; +class DocBasicItem; class StarBASICImpl; @@ -56,6 +57,7 @@ class StarBASIC : public SbxObject friend class SbiExpression; // Access to RTL friend class SbiInstance; friend class SbiRuntime; + friend class DocBasicItem; StarBASICImpl* mpStarBASICImpl; @@ -66,31 +68,33 @@ class StarBASIC : public SbxObject // Handler-Support: Link aErrorHdl; // Error handler Link aBreakHdl; // Breakpoint handler - BOOL bNoRtl; // if TRUE: do not search RTL - BOOL bBreak; // if TRUE: Break, otherwise Step - BOOL bDocBasic; - BOOL bVBAEnabled; + sal_Bool bNoRtl; // if sal_True: do not search RTL + sal_Bool bBreak; // if sal_True: Break, otherwise Step + sal_Bool bDocBasic; + sal_Bool bVBAEnabled; BasicLibInfo* pLibInfo; // Info block for basic manager SbLanguageMode eLanguageMode; // LanguageMode of the basic object - BOOL bQuit; + sal_Bool bQuit; SbxObjectRef pVBAGlobals; SbxObject* getVBAGlobals( ); + void implClearDependingVarsOnDelete( StarBASIC* pDeletedBasic ); + protected: - BOOL CError( SbError, const String&, xub_StrLen, xub_StrLen, xub_StrLen ); + sal_Bool CError( SbError, const String&, xub_StrLen, xub_StrLen, xub_StrLen ); private: - BOOL RTError( SbError, xub_StrLen, xub_StrLen, xub_StrLen ); - BOOL RTError( SbError, const String& rMsg, xub_StrLen, xub_StrLen, xub_StrLen ); - USHORT BreakPoint( xub_StrLen nLine, xub_StrLen nCol1, xub_StrLen nCol2 ); - USHORT StepPoint( xub_StrLen nLine, xub_StrLen nCol1, xub_StrLen nCol2 ); - virtual BOOL LoadData( SvStream&, USHORT ); - virtual BOOL StoreData( SvStream& ) const; + sal_Bool RTError( SbError, xub_StrLen, xub_StrLen, xub_StrLen ); + sal_Bool RTError( SbError, const String& rMsg, xub_StrLen, xub_StrLen, xub_StrLen ); + sal_uInt16 BreakPoint( xub_StrLen nLine, xub_StrLen nCol1, xub_StrLen nCol2 ); + sal_uInt16 StepPoint( xub_StrLen nLine, xub_StrLen nCol1, xub_StrLen nCol2 ); + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; protected: - virtual BOOL ErrorHdl(); - virtual USHORT BreakHdl(); + virtual sal_Bool ErrorHdl(); + virtual sal_uInt16 BreakHdl(); virtual ~StarBASIC(); public: @@ -98,11 +102,11 @@ public: SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASIC,1); TYPEINFO(); - StarBASIC( StarBASIC* pParent = NULL, BOOL bIsDocBasic = FALSE ); + StarBASIC( StarBASIC* pParent = NULL, sal_Bool bIsDocBasic = sal_False ); // #51727 SetModified overridden so that the Modfied-State is // not delivered to Parent. - virtual void SetModified( BOOL ); + virtual void SetModified( sal_Bool ); void* operator new( size_t ); void operator delete( void* ); @@ -119,14 +123,14 @@ public: SbModule* MakeModule( const String& rName, const String& rSrc ); SbModule* MakeModule32( const String& rName, const ::rtl::OUString& rSrc ); SbModule* MakeModule32( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, const ::rtl::OUString& rSrc ); - BOOL Compile( SbModule* ); - BOOL Disassemble( SbModule*, String& rText ); + sal_Bool Compile( SbModule* ); + sal_Bool Disassemble( SbModule*, String& rText ); static void Stop(); static void Error( SbError ); static void Error( SbError, const String& rMsg ); static void FatalError( SbError ); static void FatalError( SbError, const String& rMsg ); - static BOOL IsRunning(); + static sal_Bool IsRunning(); static SbError GetErrBasic(); // #66536 make additional message accessible by RTL function Error static String GetErrorMsg(); @@ -135,7 +139,7 @@ public: void Highlight( const String& rSrc, SbTextPortions& rList ); virtual SbxVariable* Find( const String&, SbxClassType ); - virtual BOOL Call( const String&, SbxArray* = NULL ); + virtual sal_Bool Call( const String&, SbxArray* = NULL ); SbxArray* GetModules() { return pModules; } SbxObject* GetRtl() { return pRtl; } @@ -144,26 +148,26 @@ public: void InitAllModules( StarBASIC* pBasicNotToInit = NULL ); void DeInitAllModules( void ); void ClearAllModuleVars( void ); - void ActivateObject( const String*, BOOL ); - BOOL LoadOldModules( SvStream& ); + void ActivateObject( const String*, sal_Bool ); + sal_Bool LoadOldModules( SvStream& ); // #43011 For TestTool; deletes global vars void ClearGlobalVars( void ); // Calls for error and break handler - static USHORT GetLine(); - static USHORT GetCol1(); - static USHORT GetCol2(); - static void SetErrorData( SbError nCode, USHORT nLine, - USHORT nCol1, USHORT nCol2 ); + static sal_uInt16 GetLine(); + static sal_uInt16 GetCol1(); + static sal_uInt16 GetCol2(); + static void SetErrorData( SbError nCode, sal_uInt16 nLine, + sal_uInt16 nCol1, sal_uInt16 nCol2 ); // Specific to error handler static void MakeErrorText( SbError, const String& aMsg ); static const String& GetErrorText(); static SbError GetErrorCode(); - static BOOL IsCompilerError(); - static USHORT GetVBErrorCode( SbError nError ); - static SbError GetSfxFromVBError( USHORT nError ); + static sal_Bool IsCompilerError(); + static sal_uInt16 GetVBErrorCode( SbError nError ); + static SbError GetSfxFromVBError( sal_uInt16 nError ); static void SetGlobalLanguageMode( SbLanguageMode eLangMode ); static SbLanguageMode GetGlobalLanguageMode(); // Local settings @@ -172,7 +176,7 @@ public: SbLanguageMode GetLanguageMode(); // Specific for break handler - BOOL IsBreak() const { return bBreak; } + sal_Bool IsBreak() const { return bBreak; } static Link GetGlobalErrorHdl(); static void SetGlobalErrorHdl( const Link& rNewHdl ); @@ -188,24 +192,27 @@ public: static SbxBase* FindSBXInCurrentScope( const String& rName ); static SbxVariable* FindVarInCurrentScopy - ( const String& rName, USHORT& rStatus ); - static SbMethod* GetActiveMethod( USHORT nLevel = 0 ); + ( const String& rName, sal_uInt16& rStatus ); + static SbMethod* GetActiveMethod( sal_uInt16 nLevel = 0 ); static SbModule* GetActiveModule(); - void SetVBAEnabled( BOOL bEnabled ); - BOOL isVBAEnabled(); + void SetVBAEnabled( sal_Bool bEnabled ); + sal_Bool isVBAEnabled(); - // #60175 TRUE: SFX-Resource is not displayed on basic errors - static void StaticSuppressSfxResource( BOOL bSuppress ); + // #60175 sal_True: SFX-Resource is not displayed on basic errors + static void StaticSuppressSfxResource( sal_Bool bSuppress ); - // #91147 TRUE: Reschedule is enabled (default>, FALSE: No reschedule - static void StaticEnableReschedule( BOOL bReschedule ); + // #91147 sal_True: Reschedule is enabled (default>, sal_False: No reschedule + static void StaticEnableReschedule( sal_Bool bReschedule ); SbxObjectRef getRTL( void ) { return pRtl; } - BOOL IsDocBasic() { return bDocBasic; } + sal_Bool IsDocBasic() { return bDocBasic; } SbxVariable* VBAFind( const String& rName, SbxClassType t ); bool GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut ); void QuitAndExitApplication(); - BOOL IsQuitApplication() { return bQuit; }; + sal_Bool IsQuitApplication() { return bQuit; }; + + static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > + GetModelFromBasic( SbxObject* pBasic ); }; #ifndef __SB_SBSTARBASICREF_HXX diff --git a/basic/inc/basic/sbstdobj.hxx b/basic/inc/basic/sbstdobj.hxx index a33b1c343bdc..8120e6d25631 100644..100755 --- a/basic/inc/basic/sbstdobj.hxx +++ b/basic/inc/basic/sbstdobj.hxx @@ -58,9 +58,9 @@ protected: virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType ); - void PropType( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); - void PropWidth( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); - void PropHeight( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); + void PropType( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); + void PropWidth( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); + void PropHeight( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); public: TYPEINFO(); @@ -78,23 +78,23 @@ public: class SbStdFont : public SbxObject { protected: - BOOL bBold; - BOOL bItalic; - BOOL bStrikeThrough; - BOOL bUnderline; - USHORT nSize; + sal_Bool bBold; + sal_Bool bItalic; + sal_Bool bStrikeThrough; + sal_Bool bUnderline; + sal_uInt16 nSize; String aName; ~SbStdFont(); virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType ); - void PropBold( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); - void PropItalic( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); - void PropStrikeThrough( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); - void PropUnderline( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); - void PropSize( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); - void PropName( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); + void PropBold( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); + void PropItalic( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); + void PropStrikeThrough( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); + void PropUnderline( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); + void PropSize( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); + void PropName( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); public: TYPEINFO(); @@ -102,16 +102,16 @@ public: SbStdFont(); virtual SbxVariable* Find( const String&, SbxClassType ); - void SetBold( BOOL bB ) { bBold = bB; } - BOOL IsBold() const { return bBold; } - void SetItalic( BOOL bI ) { bItalic = bI; } - BOOL IsItalic() const { return bItalic; } - void SetStrikeThrough( BOOL bS ) { bStrikeThrough = bS; } - BOOL IsStrikeThrough() const { return bStrikeThrough; } - void SetUnderline( BOOL bU ) { bUnderline = bU; } - BOOL IsUnderline() const { return bUnderline; } - void SetSize( USHORT nS ) { nSize = nS; } - USHORT GetSize() const { return nSize; } + void SetBold( sal_Bool bB ) { bBold = bB; } + sal_Bool IsBold() const { return bBold; } + void SetItalic( sal_Bool bI ) { bItalic = bI; } + sal_Bool IsItalic() const { return bItalic; } + void SetStrikeThrough( sal_Bool bS ) { bStrikeThrough = bS; } + sal_Bool IsStrikeThrough() const { return bStrikeThrough; } + void SetUnderline( sal_Bool bU ) { bUnderline = bU; } + sal_Bool IsUnderline() const { return bUnderline; } + void SetSize( sal_uInt16 nS ) { nSize = nS; } + sal_uInt16 GetSize() const { return nSize; } void SetFontName( const String& rName ) { aName = rName; } String GetFontName() const { return aName; } }; @@ -127,12 +127,12 @@ protected: virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType ); - void MethClear( SbxVariable* pVar, SbxArray* pPar_, BOOL bWrite ); - void MethGetData( SbxVariable* pVar, SbxArray* pPar_, BOOL bWrite ); - void MethGetFormat( SbxVariable* pVar, SbxArray* pPar_, BOOL bWrite ); - void MethGetText( SbxVariable* pVar, SbxArray* pPar_, BOOL bWrite ); - void MethSetData( SbxVariable* pVar, SbxArray* pPar_, BOOL bWrite ); - void MethSetText( SbxVariable* pVar, SbxArray* pPar_, BOOL bWrite ); + void MethClear( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite ); + void MethGetData( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite ); + void MethGetFormat( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite ); + void MethGetText( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite ); + void MethSetData( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite ); + void MethSetText( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite ); public: TYPEINFO(); diff --git a/basic/inc/basic/sbuno.hxx b/basic/inc/basic/sbuno.hxx index 0539246e071b..0539246e071b 100644..100755 --- a/basic/inc/basic/sbuno.hxx +++ b/basic/inc/basic/sbuno.hxx diff --git a/basic/inc/basic/sbx.hxx b/basic/inc/basic/sbx.hxx index b3c28ada8989..ec2f9a1b3335 100644..100755 --- a/basic/inc/basic/sbx.hxx +++ b/basic/inc/basic/sbx.hxx @@ -68,9 +68,9 @@ struct SbxParamInfo const String aName; // Name of the parameter SbxBaseRef aTypeRef; // Object, if object type SbxDataType eType; // Data type - UINT16 nFlags; // Flag-Bits - UINT32 nUserData; // IDs etc. - SbxParamInfo( const String& s, SbxDataType t, USHORT n, SbxBase* b = NULL ) + sal_uInt16 nFlags; // Flag-Bits + sal_uInt32 nUserData; // IDs etc. + SbxParamInfo( const String& s, SbxDataType t, sal_uInt16 n, SbxBase* b = NULL ) : aName( s ), aTypeRef( b ), eType( t ), nFlags( n ), nUserData( 0 ) {} ~SbxParamInfo() {} }; @@ -89,27 +89,27 @@ class SbxInfo : public SvRefBase String aComment; String aHelpFile; - UINT32 nHelpId; + sal_uInt32 nHelpId; SbxParams aParams; protected: - BOOL LoadData( SvStream&, USHORT ); - BOOL StoreData( SvStream& ) const; + sal_Bool LoadData( SvStream&, sal_uInt16 ); + sal_Bool StoreData( SvStream& ) const; virtual ~SbxInfo(); public: SbxInfo(); - SbxInfo( const String&, UINT32 ); + SbxInfo( const String&, sal_uInt32 ); - void AddParam( const String&, SbxDataType, USHORT=SBX_READ ); + void AddParam( const String&, SbxDataType, sal_uInt16=SBX_READ ); void AddParam( const SbxParamInfo& ); - const SbxParamInfo* GetParam( USHORT n ) const; // index starts with 1! + const SbxParamInfo* GetParam( sal_uInt16 n ) const; // index starts with 1! const String& GetComment() const { return aComment; } const String& GetHelpFile() const { return aHelpFile; } - UINT32 GetHelpId() const { return nHelpId; } + sal_uInt32 GetHelpId() const { return nHelpId; } void SetComment( const String& r ) { aComment = r; } void SetHelpFile( const String& r ) { aHelpFile = r; } - void SetHelpId( UINT32 nId ) { nHelpId = nId; } + void SetHelpId( sal_uInt32 nId ) { nHelpId = nId; } }; #endif @@ -122,7 +122,7 @@ class SbxHint : public SfxSimpleHint SbxVariable* pVar; public: TYPEINFO(); - SbxHint( ULONG n, SbxVariable* v ) : SfxSimpleHint( n ), pVar( v ) {} + SbxHint( sal_uIntPtr n, SbxVariable* v ) : SfxSimpleHint( n ), pVar( v ) {} SbxVariable* GetVar() const { return pVar; } }; @@ -136,7 +136,7 @@ class SbxAlias : public SbxVariable, public SfxListener { SbxVariableRef xAlias; virtual ~SbxAlias(); - virtual void Broadcast( ULONG ); + virtual void Broadcast( sal_uIntPtr ); virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType ); public: @@ -165,7 +165,7 @@ class SbxArray : public SbxBase friend class SbMethod; friend class SbClassModuleObject; friend SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj ); - void PutDirect( SbxVariable* pVar, UINT32 nIdx ); + void PutDirect( SbxVariable* pVar, sal_uInt32 nIdx ); SbxArrayImpl* mpSbxArrayImpl; // Impl data SbxVarRefs* pData; // The variables @@ -173,8 +173,8 @@ class SbxArray : public SbxBase protected: SbxDataType eType; // Data type of the array virtual ~SbxArray(); - virtual BOOL LoadData( SvStream&, USHORT ); - virtual BOOL StoreData( SvStream& ) const; + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; public: SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_ARRAY,1); @@ -183,28 +183,28 @@ public: SbxArray( const SbxArray& ); SbxArray& operator=( const SbxArray& ); virtual void Clear(); - USHORT Count() const; + sal_uInt16 Count() const; virtual SbxDataType GetType() const; virtual SbxClassType GetClass() const; - SbxVariableRef& GetRef( USHORT ); - SbxVariable* Get( USHORT ); - void Put( SbxVariable*, USHORT ); - void Insert( SbxVariable*, USHORT ); - void Remove( USHORT ); + SbxVariableRef& GetRef( sal_uInt16 ); + SbxVariable* Get( sal_uInt16 ); + void Put( SbxVariable*, sal_uInt16 ); + void Insert( SbxVariable*, sal_uInt16 ); + void Remove( sal_uInt16 ); void Remove( SbxVariable* ); void Merge( SbxArray* ); - const String& GetAlias( USHORT ); - void PutAlias( const String&, USHORT ); - SbxVariable* FindUserData( UINT32 nUserData ); + const String& GetAlias( sal_uInt16 ); + void PutAlias( const String&, sal_uInt16 ); + SbxVariable* FindUserData( sal_uInt32 nUserData ); virtual SbxVariable* Find( const String&, SbxClassType ); // Additional methods for 32-bit indices - UINT32 Count32() const; - SbxVariableRef& GetRef32( UINT32 ); - SbxVariable* Get32( UINT32 ); - void Put32( SbxVariable*, UINT32 ); - void Insert32( SbxVariable*, UINT32 ); - void Remove32( UINT32 ); + sal_uInt32 Count32() const; + SbxVariableRef& GetRef32( sal_uInt32 ); + SbxVariable* Get32( sal_uInt32 ); + void Put32( SbxVariable*, sal_uInt32 ); + void Insert32( SbxVariable*, sal_uInt32 ); + void Remove32( sal_uInt32 ); }; #endif @@ -223,15 +223,15 @@ class SbxDimArray : public SbxArray SbxDim* pFirst, *pLast; // Links to Dimension table short nDim; // Number of dimensions - void AddDimImpl32( INT32, INT32, BOOL bAllowSize0 ); + void AddDimImpl32( sal_Int32, sal_Int32, sal_Bool bAllowSize0 ); bool mbHasFixedSize; protected: - USHORT Offset( const short* ); - UINT32 Offset32( const INT32* ); - USHORT Offset( SbxArray* ); - UINT32 Offset32( SbxArray* ); - virtual BOOL LoadData( SvStream&, USHORT ); - virtual BOOL StoreData( SvStream& ) const; + sal_uInt16 Offset( const short* ); + sal_uInt32 Offset32( const sal_Int32* ); + sal_uInt16 Offset( SbxArray* ); + sal_uInt32 Offset32( SbxArray* ); + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; virtual ~SbxDimArray(); public: SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_DIMARRAY,1); @@ -253,17 +253,17 @@ public: short GetDims() const { return nDim; } void AddDim( short, short ); void unoAddDim( short, short ); - BOOL GetDim( short, short&, short& ) const; + sal_Bool GetDim( short, short&, short& ) const; using SbxArray::GetRef32; - SbxVariableRef& GetRef32( const INT32* ); + SbxVariableRef& GetRef32( const sal_Int32* ); using SbxArray::Get32; - SbxVariable* Get32( const INT32* ); + SbxVariable* Get32( const sal_Int32* ); using SbxArray::Put32; - void Put32( SbxVariable*, const INT32* ); - void AddDim32( INT32, INT32 ); - void unoAddDim32( INT32, INT32 ); - BOOL GetDim32( INT32, INT32&, INT32& ) const; + void Put32( SbxVariable*, const sal_Int32* ); + void AddDim32( sal_Int32, sal_Int32 ); + void unoAddDim32( sal_Int32, sal_Int32 ); + sal_Bool GetDim32( sal_Int32, sal_Int32&, sal_Int32& ) const; bool hasFixedSize() { return mbHasFixedSize; }; void setHasFixedSize( bool bHasFixedSize ) {mbHasFixedSize = bHasFixedSize; }; }; @@ -278,7 +278,7 @@ class SbxCollection : public SbxObject void Initialize(); protected: virtual ~SbxCollection(); - virtual BOOL LoadData( SvStream&, USHORT ); + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType ); // Overridable methods (why not pure virtual?): @@ -292,7 +292,7 @@ public: SbxCollection( const String& rClassname ); SbxCollection( const SbxCollection& ); SbxCollection& operator=( const SbxCollection& ); - virtual SbxVariable* FindUserData( UINT32 nUserData ); + virtual SbxVariable* FindUserData( sal_uInt32 nUserData ); virtual SbxVariable* Find( const String&, SbxClassType ); virtual void Clear(); }; @@ -306,17 +306,17 @@ class SbxStdCollection : public SbxCollection { protected: String aElemClass; - BOOL bAddRemoveOk; + sal_Bool bAddRemoveOk; virtual ~SbxStdCollection(); - virtual BOOL LoadData( SvStream&, USHORT ); - virtual BOOL StoreData( SvStream& ) const; + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; virtual void CollAdd( SbxArray* pPar ); virtual void CollRemove( SbxArray* pPar ); public: SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_FIXCOLLECTION,1); TYPEINFO(); SbxStdCollection - ( const String& rClassname, const String& rElemClass, BOOL=TRUE ); + ( const String& rClassname, const String& rElemClass, sal_Bool=sal_True ); SbxStdCollection( const SbxStdCollection& ); SbxStdCollection& operator=( const SbxStdCollection& ); virtual void Insert( SbxVariable* ); diff --git a/basic/inc/basic/sbxbase.hxx b/basic/inc/basic/sbxbase.hxx index 057b4e0a261b..057b4e0a261b 100644..100755 --- a/basic/inc/basic/sbxbase.hxx +++ b/basic/inc/basic/sbxbase.hxx diff --git a/basic/inc/basic/sbxcore.hxx b/basic/inc/basic/sbxcore.hxx index 786a5213f646..f16bcde9449d 100644..100755 --- a/basic/inc/basic/sbxcore.hxx +++ b/basic/inc/basic/sbxcore.hxx @@ -46,30 +46,30 @@ class UniString; // This version of the Macros does not define Load/StorePrivateData()-methods #define SBX_DECL_PERSIST_NODATA( nCre, nSbxId, nVer ) \ - virtual UINT32 GetCreator() const { return nCre; } \ - virtual UINT16 GetVersion() const { return nVer; } \ - virtual UINT16 GetSbxId() const { return nSbxId; } + virtual sal_uInt32 GetCreator() const { return nCre; } \ + virtual sal_uInt16 GetVersion() const { return nVer; } \ + virtual sal_uInt16 GetSbxId() const { return nSbxId; } #define SBX_DECL_PERSIST_NODATA_() \ - virtual UINT32 GetCreator() const; \ - virtual UINT16 GetVersion() const; \ - virtual UINT16 GetSbxId() const; + virtual sal_uInt32 GetCreator() const; \ + virtual sal_uInt16 GetVersion() const; \ + virtual sal_uInt16 GetSbxId() const; // This version of the macro defines Load/StorePrivateData()-methods #define SBX_DECL_PERSIST( nCre, nSbxId, nVer ) \ - virtual BOOL LoadPrivateData( SvStream&, USHORT ); \ - virtual BOOL StorePrivateData( SvStream& ) const; \ + virtual sal_Bool LoadPrivateData( SvStream&, sal_uInt16 ); \ + virtual sal_Bool StorePrivateData( SvStream& ) const; \ SBX_DECL_PERSIST_NODATA( nCre, nSbxId, nVer ) #define SBX_DECL_PERSIST_() \ - virtual BOOL LoadPrivateData( SvStream&, USHORT ); \ - virtual BOOL StorePrivateData( SvStream& ) const; \ + virtual sal_Bool LoadPrivateData( SvStream&, sal_uInt16 ); \ + virtual sal_Bool StorePrivateData( SvStream& ) const; \ SBX_DECL_PERSIST_NODATA_() #define SBX_IMPL_PERSIST( C, nCre, nSbxId, nVer ) \ - UINT32 C::GetCreator() const { return nCre; } \ - UINT16 C::GetVersion() const { return nVer; } \ - UINT16 C::GetSbxId() const { return nSbxId; } + sal_uInt32 C::GetCreator() const { return nCre; } \ + sal_uInt16 C::GetVersion() const { return nVer; } \ + sal_uInt16 C::GetSbxId() const { return nSbxId; } class SbxBase; class SbxFactory; @@ -83,10 +83,10 @@ class SbxBase : virtual public SvRefBase { SbxBaseImpl* mpSbxBaseImpl; // Impl data - virtual BOOL LoadData( SvStream&, USHORT ); - virtual BOOL StoreData( SvStream& ) const; + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; protected: - USHORT nFlags; // Flag-Bits + sal_uInt16 nFlags; // Flag-Bits SbxBase(); SbxBase( const SbxBase& ); @@ -95,21 +95,21 @@ protected: SBX_DECL_PERSIST(0,0,0); public: TYPEINFO(); - inline void SetFlags( USHORT n ); - inline USHORT GetFlags() const; - inline void SetFlag( USHORT n ); - inline void ResetFlag( USHORT n ); - inline BOOL IsSet( USHORT n ) const; - inline BOOL IsReset( USHORT n ) const; - inline BOOL CanRead() const; - inline BOOL CanWrite() const; - inline BOOL IsModified() const; - inline BOOL IsConst() const; - inline BOOL IsHidden() const; - inline BOOL IsVisible() const; - - virtual BOOL IsFixed() const; - virtual void SetModified( BOOL ); + inline void SetFlags( sal_uInt16 n ); + inline sal_uInt16 GetFlags() const; + inline void SetFlag( sal_uInt16 n ); + inline void ResetFlag( sal_uInt16 n ); + inline sal_Bool IsSet( sal_uInt16 n ) const; + inline sal_Bool IsReset( sal_uInt16 n ) const; + inline sal_Bool CanRead() const; + inline sal_Bool CanWrite() const; + inline sal_Bool IsModified() const; + inline sal_Bool IsConst() const; + inline sal_Bool IsHidden() const; + inline sal_Bool IsVisible() const; + + virtual sal_Bool IsFixed() const; + virtual void SetModified( sal_Bool ); virtual SbxDataType GetType() const; virtual SbxClassType GetClass() const; @@ -118,24 +118,24 @@ public: static SbxBase* Load( SvStream& ); static void Skip( SvStream& ); - BOOL Store( SvStream& ); - virtual BOOL LoadCompleted(); - virtual BOOL StoreCompleted(); + sal_Bool Store( SvStream& ); + virtual sal_Bool LoadCompleted(); + virtual sal_Bool StoreCompleted(); static SbxError GetError(); static void SetError( SbxError ); - static BOOL IsError(); + static sal_Bool IsError(); static void ResetError(); // Set the factory for Load/Store/Create static void AddFactory( SbxFactory* ); static void RemoveFactory( SbxFactory* ); - static SbxBase* Create( UINT16, UINT32=SBXCR_SBX ); + static SbxBase* Create( sal_uInt16, sal_uInt32=SBXCR_SBX ); static SbxObject* CreateObject( const String& ); // Sbx solution as replacement for SfxBroadcaster::Enable() - static void StaticEnableBroadcasting( BOOL bEnable ); - static BOOL StaticIsEnabledBroadcasting( void ); + static void StaticEnableBroadcasting( sal_Bool bEnable ); + static sal_Bool StaticIsEnabledBroadcasting( void ); }; #ifndef SBX_BASE_DECL_DEFINED @@ -143,40 +143,40 @@ public: SV_DECL_REF(SbxBase) #endif -inline void SbxBase::SetFlags( USHORT n ) +inline void SbxBase::SetFlags( sal_uInt16 n ) { DBG_CHKTHIS( SbxBase, 0 ); nFlags = n; } -inline USHORT SbxBase::GetFlags() const +inline sal_uInt16 SbxBase::GetFlags() const { DBG_CHKTHIS( SbxBase, 0 ); return nFlags; } -inline void SbxBase::SetFlag( USHORT n ) +inline void SbxBase::SetFlag( sal_uInt16 n ) { DBG_CHKTHIS( SbxBase, 0 ); nFlags |= n; } -inline void SbxBase::ResetFlag( USHORT n ) +inline void SbxBase::ResetFlag( sal_uInt16 n ) { DBG_CHKTHIS( SbxBase, 0 ); nFlags &= ~n; } -inline BOOL SbxBase::IsSet( USHORT n ) const -{ DBG_CHKTHIS( SbxBase, 0 ); return BOOL( ( nFlags & n ) != 0 ); } +inline sal_Bool SbxBase::IsSet( sal_uInt16 n ) const +{ DBG_CHKTHIS( SbxBase, 0 ); return sal_Bool( ( nFlags & n ) != 0 ); } -inline BOOL SbxBase::IsReset( USHORT n ) const -{ DBG_CHKTHIS( SbxBase, 0 ); return BOOL( ( nFlags & n ) == 0 ); } +inline sal_Bool SbxBase::IsReset( sal_uInt16 n ) const +{ DBG_CHKTHIS( SbxBase, 0 ); return sal_Bool( ( nFlags & n ) == 0 ); } -inline BOOL SbxBase::CanRead() const +inline sal_Bool SbxBase::CanRead() const { DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_READ ); } -inline BOOL SbxBase::CanWrite() const +inline sal_Bool SbxBase::CanWrite() const { DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_WRITE ); } -inline BOOL SbxBase::IsModified() const +inline sal_Bool SbxBase::IsModified() const { DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_MODIFIED ); } -inline BOOL SbxBase::IsConst() const +inline sal_Bool SbxBase::IsConst() const { DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_CONST ); } -inline BOOL SbxBase::IsHidden() const +inline sal_Bool SbxBase::IsHidden() const { DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_HIDDEN ); } -inline BOOL SbxBase::IsVisible() const +inline sal_Bool SbxBase::IsVisible() const { DBG_CHKTHIS( SbxBase, 0 ); return IsReset( SBX_INVISIBLE ); } #endif diff --git a/basic/inc/basic/sbxdef.hxx b/basic/inc/basic/sbxdef.hxx index 0b6ea77c70a2..cc05e3dc1ff3 100644..100755 --- a/basic/inc/basic/sbxdef.hxx +++ b/basic/inc/basic/sbxdef.hxx @@ -56,15 +56,15 @@ enum SbxClassType { // SBX-class-IDs (order is important!) enum SbxDataType { SbxEMPTY = 0, // * Uninitialized SbxNULL = 1, // * Contains no valid data - SbxINTEGER = 2, // * Integer (INT16) - SbxLONG = 3, // * Long integer (INT32) + SbxINTEGER = 2, // * Integer (sal_Int16) + SbxLONG = 3, // * Long integer (sal_Int32) SbxSINGLE = 4, // * Single-precision floating point number (float) SbxDOUBLE = 5, // * Double-precision floating point number (double) - SbxCURRENCY = 6, // Currency (INT64) + SbxCURRENCY = 6, // Currency (sal_Int64) SbxDATE = 7, // * Date (double) SbxSTRING = 8, // * String (StarView) SbxOBJECT = 9, // * SbxBase object pointer - SbxERROR = 10, // * Error (UINT16) + SbxERROR = 10, // * Error (sal_uInt16) SbxBOOL = 11, // * Boolean (0 or -1) SbxVARIANT = 12, // * Display for variant datatype @@ -72,8 +72,8 @@ enum SbxDataType { SbxCHAR = 16, // * signed char SbxBYTE = 17, // * unsigned char - SbxUSHORT = 18, // * unsigned short (UINT16) - SbxULONG = 19, // * unsigned long (UINT32) + SbxUSHORT = 18, // * unsigned short (sal_uInt16) + SbxULONG = 19, // * unsigned long (sal_uInt32) //deprecated: // old 64bit types kept for backward compatibility in file I/O SbxLONG64 = 20, // moved to SbxSALINT64 as 64bit int @@ -111,8 +111,9 @@ enum SbxDataType { SbxUSERn = 2047 // last user defined data type }; -const UINT32 SBX_TYPE_WITH_EVENTS_FLAG = 0x10000; -const UINT32 SBX_FIXED_LEN_STRING_FLAG = 0x10000; // same value as above as no conflict possible +const sal_uInt32 SBX_TYPE_WITH_EVENTS_FLAG = 0x10000; +const sal_uInt32 SBX_TYPE_DIM_AS_NEW_FLAG = 0x20000; +const sal_uInt32 SBX_FIXED_LEN_STRING_FLAG = 0x10000; // same value as above as no conflict possible #endif #ifndef _SBX_OPERATOR @@ -127,8 +128,8 @@ enum SbxOperator { SbxPLUS, // this + var SbxMINUS, // this - var SbxNEG, // -this (var is ignored) - SbxIDIV, // this / var (max INT32!) - + SbxIDIV, // this / var (both operands max. sal_Int32!) + // Boolean operators (max sal_Int32!): // Boolean operators (TODO deprecate this limit: max INT32!) SbxAND, // this & var SbxOR, // this | var @@ -164,7 +165,7 @@ enum SbxNameType { // Type of the questioned name of a variable #endif // from 1996/3/20: New error messages -typedef ULONG SbxError; // Preserve old type +typedef sal_uIntPtr SbxError; // Preserve old type #endif @@ -258,6 +259,8 @@ typedef ULONG SbxError; // Preserve old type #define SBX_REFERENCE 0x4000 // Parameter is Reference (DLL-call) #define SBX_NO_MODIFY 0x8000 // SetModified is suppressed #define SBX_WITH_EVENTS 0x0080 // Same value as unused SBX_HIDDEN +#define SBX_DIM_AS_NEW 0x0800 // Same value as SBX_GBLSEARCH, cannot conflict as one + // is used for objects, the other for variables only // Broadcaster-IDs: #define SBX_HINT_DYING SFX_HINT_DYING @@ -294,10 +297,10 @@ typedef ULONG SbxError; // Preserve old type #define SbxMAXBYTE ( 255) #define SbxMAXINT ( 32767) #define SbxMININT (-32768) -#define SbxMAXUINT ((UINT16) 65535) +#define SbxMAXUINT ((sal_uInt16) 65535) #define SbxMAXLNG ( 2147483647) -#define SbxMINLNG ((INT32)(-2147483647-1)) -#define SbxMAXULNG ((UINT32) 0xffffffff) +#define SbxMINLNG ((sal_Int32)(-2147483647-1)) +#define SbxMAXULNG ((sal_uInt32) 0xffffffff) #define SbxMAXSALUINT64 SAL_MAX_UINT64 #define SbxMAXSALINT64 SAL_MAX_INT64 @@ -323,7 +326,7 @@ typedef ULONG SbxError; // Preserve old type #define SBX_MAXINDEX 0x3FF0 #define SBX_MAXINDEX32 SbxMAXLNG - +// The numeric values of sal_True and FALSE enum SbxBOOL { SbxFALSE = 0, SbxTRUE = -1 }; #endif //ifndef __RSC diff --git a/basic/inc/basic/sbxfac.hxx b/basic/inc/basic/sbxfac.hxx index 986339d48aac..8597458c5ec2 100644..100755 --- a/basic/inc/basic/sbxfac.hxx +++ b/basic/inc/basic/sbxfac.hxx @@ -38,11 +38,11 @@ class UniString; class SbxFactory { - BOOL bHandleLast; // TRUE: Factory is asked at last because of its expensiveness + sal_Bool bHandleLast; // sal_True: Factory is asked at last because of its expensiveness public: - SbxFactory( BOOL bLast=FALSE ) { bHandleLast = bLast; } - BOOL IsHandleLast( void ) { return bHandleLast; } - virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX ); + SbxFactory( sal_Bool bLast=sal_False ) { bHandleLast = bLast; } + sal_Bool IsHandleLast( void ) { return bHandleLast; } + virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX ); virtual SbxObject* CreateObject( const String& ); }; diff --git a/basic/inc/basic/sbxform.hxx b/basic/inc/basic/sbxform.hxx index 0e20dbfd0279..77921a0ce77e 100644..100755 --- a/basic/inc/basic/sbxform.hxx +++ b/basic/inc/basic/sbxform.hxx @@ -112,16 +112,16 @@ class SbxBasicFormater { String BasicFormat( double dNumber, String sFormatStrg ); String BasicFormatNull( String sFormatStrg ); - static BOOL isBasicFormat( String sFormatStrg ); + static sal_Bool isBasicFormat( String sFormatStrg ); private: //*** some helper methods *** //void ShowError( char *sErrMsg ); - inline void ShiftString( String& sStrg, USHORT nStartPos ); + inline void ShiftString( String& sStrg, sal_uInt16 nStartPos ); inline void StrAppendChar( String& sStrg, sal_Unicode ch ); void AppendDigit( String& sStrg, short nDigit ); void LeftShiftDecimalPoint( String& sStrg ); - void StrRoundDigit( String& sStrg, short nPos, BOOL& bOverflow ); + void StrRoundDigit( String& sStrg, short nPos, sal_Bool& bOverflow ); void StrRoundDigit( String& sStrg, short nPos ); void ParseBack( String& sStrg, const String& sFormatStrg, short nFormatPos ); @@ -129,30 +129,30 @@ class SbxBasicFormater { // Methods for string conversion with sprintf(): void InitScan( double _dNum ); void InitExp( double _dNewExp ); - short GetDigitAtPosScan( short nPos, BOOL& bFoundFirstDigit ); + short GetDigitAtPosScan( short nPos, sal_Bool& bFoundFirstDigit ); short GetDigitAtPosExpScan( double dNewExponent, short nPos, - BOOL& bFoundFirstDigit ); - short GetDigitAtPosExpScan( short nPos, BOOL& bFoundFirstDigit ); + sal_Bool& bFoundFirstDigit ); + short GetDigitAtPosExpScan( short nPos, sal_Bool& bFoundFirstDigit ); #else // Methods for direct 'calculation' with log10() and pow(): short GetDigitAtPos( double dNumber, short nPos, double& dNextNumber, - BOOL& bFoundFirstDigit ); + sal_Bool& bFoundFirstDigit ); short RoundDigit( double dNumber ); #endif - String GetPosFormatString( const String& sFormatStrg, BOOL & bFound ); - String GetNegFormatString( const String& sFormatStrg, BOOL & bFound ); - String Get0FormatString( const String& sFormatStrg, BOOL & bFound ); - String GetNullFormatString( const String& sFormatStrg, BOOL & bFound ); + String GetPosFormatString( const String& sFormatStrg, sal_Bool & bFound ); + String GetNegFormatString( const String& sFormatStrg, sal_Bool & bFound ); + String Get0FormatString( const String& sFormatStrg, sal_Bool & bFound ); + String GetNullFormatString( const String& sFormatStrg, sal_Bool & bFound ); short AnalyseFormatString( const String& sFormatStrg, short& nNoOfDigitsLeft, short& nNoOfDigitsRight, short& nNoOfOptionalDigitsLeft, short& nNoOfExponentDigits, short& nNoOfOptionalExponentDigits, - BOOL& bPercent, BOOL& bCurrency, BOOL& bScientific, - BOOL& bGenerateThousandSeparator, + sal_Bool& bPercent, sal_Bool& bCurrency, sal_Bool& bScientific, + sal_Bool& bGenerateThousandSeparator, short& nMultipleThousandSeparators ); void ScanFormatString( double dNumber, const String& sFormatStrg, - String& sReturnStrg, BOOL bCreateSign ); + String& sReturnStrg, sal_Bool bCreateSign ); //*** Data *** sal_Unicode cDecPoint; // sign for the decimal point diff --git a/basic/inc/basic/sbxmeth.hxx b/basic/inc/basic/sbxmeth.hxx index d508d1c3e11e..31b07fdca18d 100644..100755 --- a/basic/inc/basic/sbxmeth.hxx +++ b/basic/inc/basic/sbxmeth.hxx @@ -45,7 +45,7 @@ public: SbxMethod( const SbxMethod& r ) : SvRefBase( r ), SbxVariable( r ) {} SbxMethod& operator=( const SbxMethod& r ) { SbxVariable::operator=( r ); return *this; } - BOOL Run( SbxValues* pValues = NULL ); + sal_Bool Run( SbxValues* pValues = NULL ); virtual SbxClassType GetClass() const; }; diff --git a/basic/inc/basic/sbxmstrm.hxx b/basic/inc/basic/sbxmstrm.hxx index f4c6fd7c5ad5..d3197bff883d 100644..100755 --- a/basic/inc/basic/sbxmstrm.hxx +++ b/basic/inc/basic/sbxmstrm.hxx @@ -38,7 +38,7 @@ SV_DECL_REF(SbxMemoryStream) class SbxMemoryStream : public SbxBase, public SvMemoryStream { public: - SbxMemoryStream(ULONG nInitSize_=512, ULONG nResize_=64) : + SbxMemoryStream(sal_uIntPtr nInitSize_=512, sal_uIntPtr nResize_=64) : SvMemoryStream(nInitSize_,nResize_) {} ~SbxMemoryStream(); diff --git a/basic/inc/basic/sbxobj.hxx b/basic/inc/basic/sbxobj.hxx index 387dc4c7caa5..867cf6e2bd07 100644..100755 --- a/basic/inc/basic/sbxobj.hxx +++ b/basic/inc/basic/sbxobj.hxx @@ -43,9 +43,9 @@ class SbxObject : public SbxVariable, public SfxListener { SbxObjectImpl* mpSbxObjectImpl; // Impl data - SbxArray* FindVar( SbxVariable*, USHORT& ); + SbxArray* FindVar( SbxVariable*, sal_uInt16& ); // AB 23.3.1997, special method for VCPtrRemove (see below) - SbxArray* VCPtrFindVar( SbxVariable*, USHORT& ); + SbxArray* VCPtrFindVar( SbxVariable*, sal_uInt16& ); protected: SbxArrayRef pMethods; // Methods SbxArrayRef pProps; // Properties @@ -53,8 +53,8 @@ protected: SbxProperty* pDfltProp; // Default-Property String aClassName; // Classname String aDfltPropName; - virtual BOOL LoadData( SvStream&, USHORT ); - virtual BOOL StoreData( SvStream& ) const; + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; virtual ~SbxObject(); virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType ); @@ -68,7 +68,7 @@ public: virtual SbxClassType GetClass() const; virtual void Clear(); - virtual BOOL IsClass( const String& ) const; + virtual sal_Bool IsClass( const String& ) const; const String& GetClassName() const { return aClassName; } void SetClassName( const String &rNew ) { aClassName = rNew; } // Default-Property @@ -76,15 +76,15 @@ public: void SetDfltProperty( const String& r ); void SetDfltProperty( SbxProperty* ); // Search for an element - virtual SbxVariable* FindUserData( UINT32 nUserData ); + virtual SbxVariable* FindUserData( sal_uInt32 nUserData ); virtual SbxVariable* Find( const String&, SbxClassType ); SbxVariable* FindQualified( const String&, SbxClassType ); // Quick-Call-Interface for Methods - virtual BOOL Call( const String&, SbxArray* = NULL ); + virtual sal_Bool Call( const String&, SbxArray* = NULL ); // Execution of DDE-Commands SbxVariable* Execute( const String& ); // Manage elements - virtual BOOL GetAll( SbxClassType ) { return TRUE; } + virtual sal_Bool GetAll( SbxClassType ) { return sal_True; } SbxVariable* Make( const String&, SbxClassType, SbxDataType ); virtual SbxObject* MakeObject( const String&, const String& ); virtual void Insert( SbxVariable* ); @@ -97,7 +97,7 @@ public: virtual void Remove( SbxVariable* ); // AB 23.3.1997, deletion per pointer for controls (duplicate names!) void VCPtrRemove( SbxVariable* ); - void SetPos( SbxVariable*, USHORT ); + void SetPos( SbxVariable*, sal_uInt16 ); // Macro-Recording virtual String GenerateSource( const String &rLinePrefix, @@ -109,9 +109,9 @@ public: // Hooks virtual SvDispatch* GetSvDispatch(); // Debugging - void Dump( SvStream&, BOOL bDumpAll=FALSE ); + void Dump( SvStream&, sal_Bool bDumpAll=sal_False ); - static void GarbageCollection( ULONG nObjects = 0 /* ::= all */ ); + static void GarbageCollection( sal_uIntPtr nObjects = 0 /* ::= all */ ); }; #ifndef __SBX_SBXOBJECTREF_HXX diff --git a/basic/inc/basic/sbxprop.hxx b/basic/inc/basic/sbxprop.hxx index 25c875df9222..25c875df9222 100644..100755 --- a/basic/inc/basic/sbxprop.hxx +++ b/basic/inc/basic/sbxprop.hxx diff --git a/basic/inc/basic/sbxvar.hxx b/basic/inc/basic/sbxvar.hxx index 1e7840950fd7..7f0e5d878225 100644..100755 --- a/basic/inc/basic/sbxvar.hxx +++ b/basic/inc/basic/sbxvar.hxx @@ -42,12 +42,12 @@ class SbxDecimal; struct SbxValues { union { - BYTE nByte; - UINT16 nUShort; + sal_uInt8 nByte; + sal_uInt16 nUShort; sal_Unicode nChar; - INT16 nInteger; - UINT32 nULong; - INT32 nLong; + sal_Int16 nInteger; + sal_uInt32 nULong; + sal_Int32 nLong; unsigned int nUInt; int nInt; sal_uInt64 uInt64; @@ -61,12 +61,12 @@ struct SbxValues SbxBase* pObj; - BYTE* pByte; - UINT16* pUShort; + sal_uInt8* pByte; + sal_uInt16* pUShort; sal_Unicode* pChar; - INT16* pInteger; - UINT32* pULong; - INT32* pLong; + sal_Int16* pInteger; + sal_uInt32* pULong; + sal_Int32* pLong; unsigned int* pUInt; int* pInt; sal_uInt64* puInt64; @@ -82,11 +82,11 @@ struct SbxValues SbxValues(): pData( NULL ), eType(SbxEMPTY) {} SbxValues( SbxDataType e ): eType(e) {} SbxValues( char _nChar ): nChar( _nChar ), eType(SbxCHAR) {} - SbxValues( BYTE _nByte ): nByte( _nByte ), eType(SbxBYTE) {} + SbxValues( sal_uInt8 _nByte ): nByte( _nByte ), eType(SbxBYTE) {} SbxValues( short _nInteger ): nInteger( _nInteger ), eType(SbxINTEGER ) {} SbxValues( long _nLong ): nLong( _nLong ), eType(SbxLONG) {} - SbxValues( USHORT _nUShort ): nUShort( _nUShort ), eType(SbxUSHORT) {} - SbxValues( ULONG _nULong ): nULong( _nULong ), eType(SbxULONG) {} + SbxValues( sal_uInt16 _nUShort ): nUShort( _nUShort ), eType(SbxUSHORT) {} + SbxValues( sal_uIntPtr _nULong ): nULong( _nULong ), eType(SbxULONG) {} SbxValues( int _nInt ): nInt( _nInt ), eType(SbxINT) {} SbxValues( unsigned int _nUInt ): nUInt( _nUInt ), eType(SbxUINT) {} SbxValues( float _nSingle ): nSingle( _nSingle ), eType(SbxSINGLE) {} @@ -112,17 +112,17 @@ class SbxValue : public SbxBase SbxValueImpl* mpSbxValueImplImpl; // Impl data // #55226 Transport additional infos - SbxValue* TheRealValue( BOOL bObjInObjError ) const; + SbxValue* TheRealValue( sal_Bool bObjInObjError ) const; SbxValue* TheRealValue() const; protected: SbxValues aData; // Data ::rtl::OUString aPic; // Picture-String String aToolString; // tool string copy - virtual void Broadcast( ULONG ); // Broadcast-Call + virtual void Broadcast( sal_uIntPtr ); // Broadcast-Call virtual ~SbxValue(); - virtual BOOL LoadData( SvStream&, USHORT ); - virtual BOOL StoreData( SvStream& ) const; + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; public: SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_VALUE,1); TYPEINFO(); @@ -131,54 +131,47 @@ public: SbxValue( const SbxValue& ); SbxValue& operator=( const SbxValue& ); virtual void Clear(); - virtual BOOL IsFixed() const; - - BOOL IsInteger() const { return BOOL( GetType() == SbxINTEGER ); } - BOOL IsLong() const { return BOOL( GetType() == SbxLONG ); } - BOOL IsSingle() const { return BOOL( GetType() == SbxSINGLE ); } - BOOL IsDouble() const { return BOOL( GetType() == SbxDOUBLE ); } - BOOL IsString() const { return BOOL( GetType() == SbxSTRING ); } - BOOL IsDate() const { return BOOL( GetType() == SbxDATE ); } - BOOL IsCurrency() const { return BOOL( GetType() == SbxCURRENCY ); } - BOOL IsObject() const { return BOOL( GetType() == SbxOBJECT ); } - BOOL IsDataObject() const { return BOOL( GetType() == SbxDATAOBJECT);} - BOOL IsBool() const { return BOOL( GetType() == SbxBOOL ); } - BOOL IsErr() const { return BOOL( GetType() == SbxERROR ); } - BOOL IsEmpty() const { return BOOL( GetType() == SbxEMPTY ); } - BOOL IsNull() const { return BOOL( GetType() == SbxNULL ); } - BOOL IsChar() const { return BOOL( GetType() == SbxCHAR ); } - BOOL IsByte() const { return BOOL( GetType() == SbxBYTE ); } - BOOL IsUShort() const { return BOOL( GetType() == SbxUSHORT ); } - BOOL IsULong() const { return BOOL( GetType() == SbxULONG ); } - BOOL IsInt() const { return BOOL( GetType() == SbxINT ); } - BOOL IsUInt() const { return BOOL( GetType() == SbxUINT ); } - BOOL IspChar() const { return BOOL( GetType() == SbxLPSTR ); } - BOOL IsNumeric() const; - BOOL IsNumericRTL() const; // #41692 Interface for Basic - BOOL ImpIsNumeric( BOOL bOnlyIntntl ) const; // Implementation + virtual sal_Bool IsFixed() const; + + sal_Bool IsInteger() const { return sal_Bool( GetType() == SbxINTEGER ); } + sal_Bool IsLong() const { return sal_Bool( GetType() == SbxLONG ); } + sal_Bool IsSingle() const { return sal_Bool( GetType() == SbxSINGLE ); } + sal_Bool IsDouble() const { return sal_Bool( GetType() == SbxDOUBLE ); } + sal_Bool IsString() const { return sal_Bool( GetType() == SbxSTRING ); } + sal_Bool IsDate() const { return sal_Bool( GetType() == SbxDATE ); } + sal_Bool IsCurrency()const { return sal_Bool( GetType() == SbxCURRENCY ); } + sal_Bool IsObject() const { return sal_Bool( GetType() == SbxOBJECT ); } + sal_Bool IsDataObject()const{return sal_Bool( GetType() == SbxDATAOBJECT);} + sal_Bool IsBool() const { return sal_Bool( GetType() == SbxBOOL ); } + sal_Bool IsErr() const { return sal_Bool( GetType() == SbxERROR ); } + sal_Bool IsEmpty() const { return sal_Bool( GetType() == SbxEMPTY ); } + sal_Bool IsNull() const { return sal_Bool( GetType() == SbxNULL ); } + sal_Bool IsChar() const { return sal_Bool( GetType() == SbxCHAR ); } + sal_Bool IsByte() const { return sal_Bool( GetType() == SbxBYTE ); } + sal_Bool IsUShort() const { return sal_Bool( GetType() == SbxUSHORT ); } + sal_Bool IsULong() const { return sal_Bool( GetType() == SbxULONG ); } + sal_Bool IsInt() const { return sal_Bool( GetType() == SbxINT ); } + sal_Bool IsUInt() const { return sal_Bool( GetType() == SbxUINT ); } + sal_Bool IspChar() const { return sal_Bool( GetType() == SbxLPSTR ); } + sal_Bool IsNumeric() const; + sal_Bool IsNumericRTL() const; // #41692 Interface for Basic + sal_Bool ImpIsNumeric( sal_Bool bOnlyIntntl ) const; // Implementation virtual SbxClassType GetClass() const; virtual SbxDataType GetType() const; SbxDataType GetFullType() const; - BOOL SetType( SbxDataType ); + sal_Bool SetType( SbxDataType ); - virtual BOOL Get( SbxValues& ) const; - BOOL GetNoBroadcast( SbxValues& ); + virtual sal_Bool Get( SbxValues& ) const; + sal_Bool GetNoBroadcast( SbxValues& ); const SbxValues& GetValues_Impl() const { return aData; } - virtual BOOL Put( const SbxValues& ); + virtual sal_Bool Put( const SbxValues& ); inline SbxValues * data() { return &aData; } - UINT16 GetErr() const; - - BOOL GetBool() const; - BYTE GetByte() const; sal_Unicode GetChar() const; - UINT16 GetUShort() const; - UINT32 GetULong() const; - int GetInt() const; - INT16 GetInteger() const; - INT32 GetLong() const; + sal_Int16 GetInteger() const; + sal_Int32 GetLong() const; sal_Int64 GetInt64() const; sal_uInt64 GetUInt64() const; @@ -189,55 +182,56 @@ public: double GetDouble() const; double GetDate() const; + sal_Bool GetBool() const; + sal_uInt16 GetErr() const; const String& GetString() const; const String& GetCoreString() const; rtl::OUString GetOUString() const; SbxBase* GetObject() const; - BOOL HasObject() const; + sal_Bool HasObject() const; void* GetData() const; - - - BOOL PutEmpty(); - BOOL PutNull(); - BOOL PutErr( USHORT ); - - BOOL PutBool( BOOL ); - BOOL PutByte( BYTE ); - BOOL PutChar( sal_Unicode ); - BOOL PutUShort( UINT16 ); - BOOL PutULong( UINT32 ); - BOOL PutInt( int ); - BOOL PutInteger( INT16 ); - BOOL PutLong( INT32 ); - BOOL PutInt64( sal_Int64 ); - BOOL PutUInt64( sal_uInt64 ); - - BOOL PutSingle( float ); - BOOL PutDouble( double ); - BOOL PutDate( double ); - - // with extended analysis (International, "TRUE"/"FALSE") - BOOL PutStringExt( const ::rtl::OUString& ); - BOOL PutString( const ::rtl::OUString& ); - BOOL PutString( const sal_Unicode* ); // Type = SbxSTRING - BOOL PutpChar( const sal_Unicode* ); // Type = SbxLPSTR + sal_uInt8 GetByte() const; + sal_uInt16 GetUShort() const; + sal_uInt32 GetULong() const; + int GetInt() const; + + sal_Bool PutInteger( sal_Int16 ); + sal_Bool PutLong( sal_Int32 ); + sal_Bool PutSingle( float ); + sal_Bool PutDouble( double ); + sal_Bool PutDate( double ); + sal_Bool PutBool( sal_Bool ); + sal_Bool PutErr( sal_uInt16 ); + sal_Bool PutStringExt( const ::rtl::OUString& ); // with extended analysis (International, "sal_True"/"sal_False") + sal_Bool PutInt64( sal_Int64 ); + sal_Bool PutUInt64( sal_uInt64 ); + sal_Bool PutString( const ::rtl::OUString& ); + sal_Bool PutString( const sal_Unicode* ); // Type = SbxSTRING + sal_Bool PutpChar( const sal_Unicode* ); // Type = SbxLPSTR + sal_Bool PutChar( sal_Unicode ); + sal_Bool PutByte( sal_uInt8 ); + sal_Bool PutUShort( sal_uInt16 ); + sal_Bool PutULong( sal_uInt32 ); + sal_Bool PutInt( int ); + sal_Bool PutEmpty(); + sal_Bool PutNull(); // Special methods - BOOL PutDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ); - BOOL fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ); - BOOL PutDecimal( SbxDecimal* pDecimal ); - BOOL PutCurrency( const sal_Int64& ); + sal_Bool PutDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ); + sal_Bool fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ); + sal_Bool PutDecimal( SbxDecimal* pDecimal ); + sal_Bool PutCurrency( const sal_Int64& ); // Interface for CDbl in Basic - static SbxError ScanNumIntnl( const String& rSrc, double& nVal, BOOL bSingle=FALSE ); + static SbxError ScanNumIntnl( const String& rSrc, double& nVal, sal_Bool bSingle = sal_False ); - BOOL PutObject( SbxBase* ); - BOOL PutData( void* ); + sal_Bool PutObject( SbxBase* ); + sal_Bool PutData( void* ); - virtual BOOL Convert( SbxDataType ); - virtual BOOL Compute( SbxOperator, const SbxValue& ); - virtual BOOL Compare( SbxOperator, const SbxValue& ) const; - BOOL Scan( const String&, USHORT* = NULL ); + virtual sal_Bool Convert( SbxDataType ); + virtual sal_Bool Compute( SbxOperator, const SbxValue& ); + virtual sal_Bool Compare( SbxOperator, const SbxValue& ) const; + sal_Bool Scan( const String&, sal_uInt16* = NULL ); void Format( String&, const String* = NULL ) const; // The following operators are definied for easier handling. @@ -324,6 +318,7 @@ SV_DECL_REF(SbxInfo) class SfxBroadcaster; class SbxVariableImpl; +class StarBASIC; class SbxVariable : public SbxValue { @@ -333,7 +328,7 @@ class SbxVariable : public SbxValue SfxBroadcaster* pCst; // Broadcaster, if needed String maName; // Name, if available SbxArrayRef mpPar; // Parameter-Array, if set - USHORT nHash; // Hash-ID for search + sal_uInt16 nHash; // Hash-ID for search SbxVariableImpl* getImpl( void ); @@ -342,8 +337,8 @@ protected: sal_uIntPtr nUserData; // User data for Call() SbxObject* pParent; // Currently attached object virtual ~SbxVariable(); - virtual BOOL LoadData( SvStream&, USHORT ); - virtual BOOL StoreData( SvStream& ) const; + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; public: SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_VARIABLE,2); TYPEINFO(); @@ -352,13 +347,13 @@ public: SbxVariable( const SbxVariable& ); SbxVariable& operator=( const SbxVariable& ); - void Dump( SvStream&, BOOL bDumpAll=FALSE ); + void Dump( SvStream&, sal_Bool bDumpAll=sal_False ); virtual void SetName( const String& ); virtual const String& GetName( SbxNameType = SbxNAME_NONE ) const; - USHORT GetHashCode() const { return nHash; } + sal_uInt16 GetHashCode() const { return nHash; } - virtual void SetModified( BOOL ); + virtual void SetModified( sal_Bool ); sal_uIntPtr GetUserData() const { return nUserData; } void SetUserData( sal_uIntPtr n ) { nUserData = n; } @@ -375,8 +370,8 @@ public: // Sfx-Broadcasting-Support: // Due to data reduction and better DLL-hierarchie currently via casting SfxBroadcaster& GetBroadcaster(); - BOOL IsBroadcaster() const { return BOOL( pCst != NULL ); } - virtual void Broadcast( ULONG nHintId ); + sal_Bool IsBroadcaster() const { return sal_Bool( pCst != NULL ); } + virtual void Broadcast( sal_uIntPtr nHintId ); inline const SbxObject* GetParent() const { return pParent; } inline SbxObject* GetParent() { return pParent; } @@ -384,9 +379,11 @@ public: const String& GetDeclareClassName( void ); void SetDeclareClassName( const String& ); - void SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener ); + void SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener, + StarBASIC* pParentBasic ); + void ClearComListener( void ); - static USHORT MakeHashCode( const String& rName ); + static sal_uInt16 MakeHashCode( const String& rName ); }; #ifndef SBX_VARIABLE_DECL_DEFINED diff --git a/basic/inc/svtmsg.hrc b/basic/inc/basic/svtmsg.hrc index ff215d3fc9cb..ff215d3fc9cb 100644..100755 --- a/basic/inc/svtmsg.hrc +++ b/basic/inc/basic/svtmsg.hrc diff --git a/basic/inc/testtool.hrc b/basic/inc/basic/testtool.hrc index 075b462944c9..075b462944c9 100644..100755 --- a/basic/inc/testtool.hrc +++ b/basic/inc/basic/testtool.hrc diff --git a/basic/inc/basic/testtool.hxx b/basic/inc/basic/testtool.hxx index 81570d3f60c8..ee0bd25f8ab4 100644..100755 --- a/basic/inc/basic/testtool.hxx +++ b/basic/inc/basic/testtool.hxx @@ -41,7 +41,7 @@ // #94145# Due to a tab in TT_SIGNATURE_FOR_UNICODE_TEXTFILES which is changed to blanks by some editors // this routine became necessary -BOOL IsTTSignatureForUnicodeTextfile( String aLine ); +sal_Bool IsTTSignatureForUnicodeTextfile( String aLine ); #define ADD_ERROR_QUIET(nNr, aStr) \ { \ @@ -101,9 +101,9 @@ public: String aKurzname; String aSlotname; String aLangname; - USHORT nRType; + sal_uInt16 nRType; String aRName; - BOOL bIsReset; + sal_Bool bIsReset; }; // Defines for syntax Highlighting @@ -132,20 +132,20 @@ public: class TTExecutionStatusHint : public SfxSimpleHint { private: - USHORT mnType; + sal_uInt16 mnType; String maExecutionStatus; String maAdditionalExecutionStatus; public: TYPEINFO(); - TTExecutionStatusHint( USHORT nType, sal_Char *pExecutionStatus, const sal_Char *pAdditionalExecutionStatus = "" ) + TTExecutionStatusHint( sal_uInt16 nType, sal_Char *pExecutionStatus, const sal_Char *pAdditionalExecutionStatus = "" ) : SfxSimpleHint(SBX_HINT_EXECUTION_STATUS_INFORMATION) , mnType( nType ) , maExecutionStatus( pExecutionStatus, RTL_TEXTENCODING_ASCII_US ) , maAdditionalExecutionStatus( pAdditionalExecutionStatus, RTL_TEXTENCODING_ASCII_US ) {;} - TTExecutionStatusHint( USHORT nType, const String &aExecutionStatus = String(), const String &aAdditionalExecutionStatus = String() ) + TTExecutionStatusHint( sal_uInt16 nType, const String &aExecutionStatus = String(), const String &aAdditionalExecutionStatus = String() ) : SfxSimpleHint(SBX_HINT_EXECUTION_STATUS_INFORMATION) , mnType( nType ) , maExecutionStatus( aExecutionStatus ) @@ -154,7 +154,7 @@ public: const String& GetExecutionStatus() const { return maExecutionStatus; } const String& GetAdditionalExecutionStatus() const { return maAdditionalExecutionStatus; } - USHORT GetType(){ return mnType; } + sal_uInt16 GetType(){ return mnType; } }; #endif // _BASIC_TESTTOOL_HXX_ diff --git a/basic/inc/basic/ttglobal.hrc b/basic/inc/basic/ttglobal.hrc index 0248a06c7247..0248a06c7247 100644..100755 --- a/basic/inc/basic/ttglobal.hrc +++ b/basic/inc/basic/ttglobal.hrc diff --git a/basic/inc/ttmsg.hrc b/basic/inc/basic/ttmsg.hrc index 26f250bc6a6a..26f250bc6a6a 100644..100755 --- a/basic/inc/ttmsg.hrc +++ b/basic/inc/basic/ttmsg.hrc diff --git a/basic/inc/basic/ttstrhlp.hxx b/basic/inc/basic/ttstrhlp.hxx index be65e0ed3092..adf9068fbdf7 100644..100755 --- a/basic/inc/basic/ttstrhlp.hxx +++ b/basic/inc/basic/ttstrhlp.hxx @@ -32,6 +32,8 @@ #define CByteString( constAsciiStr ) ByteString( RTL_CONSTASCII_STRINGPARAM ( constAsciiStr ) ) #define CUniString( constAsciiStr ) UniString( RTL_CONSTASCII_USTRINGPARAM ( constAsciiStr ) ) +#define Str2Id( Str ) rtl::OUStringToOString( Str, RTL_TEXTENCODING_ASCII_US ) +#define Id2Str( Id ) String( rtl::OStringToOUString( Id, RTL_TEXTENCODING_ASCII_US ) ) #define StartKenn CUniString("%") #define EndKenn CUniString("%") @@ -43,7 +45,7 @@ #define TabKenn ( StartKenn.AppendAscii("Tab") ) #define MakeStringParam(Type,aText) ( Type.AppendAscii("=").Append( aText ).Append( EndKenn ) ) #define MakeStringNumber(Type,nNumber) MakeStringParam (Type, UniString::CreateFromInt32(nNumber)) -#define UIdString(aID) MakeStringParam(UIdKenn,aID.GetText()) +#define UIdString(aID) MakeStringParam(UIdKenn,String(rtl::OStringToOUString( aID, RTL_TEXTENCODING_ASCII_US ))) #define MethodString(nNumber) MakeStringNumber(MethodKenn,nNumber) #define TypeString(nNumber) MakeStringNumber(TypeKenn,nNumber) #define SlotString(nNumber) MakeStringNumber(SlotKenn,nNumber) @@ -56,20 +58,20 @@ #define ResString(nNumber) MakeStringNumber(ResKenn,nNumber) #define ArgString(nNumber, aText) MakeStringParam(ArgKenn(nNumber),aText) -UniString GEN_RES_STR0( ULONG nResId ); -UniString GEN_RES_STR1( ULONG nResId, const String &Text1 ); -UniString GEN_RES_STR2( ULONG nResId, const String &Text1, const String &Text2 ); -UniString GEN_RES_STR3( ULONG nResId, const String &Text1, const String &Text2, const String &Text3 ); +UniString GEN_RES_STR0( sal_uIntPtr nResId ); +UniString GEN_RES_STR1( sal_uIntPtr nResId, const String &Text1 ); +UniString GEN_RES_STR2( sal_uIntPtr nResId, const String &Text1, const String &Text2 ); +UniString GEN_RES_STR3( sal_uIntPtr nResId, const String &Text1, const String &Text2, const String &Text3 ); #define GEN_RES_STR1c( nResId, Text1 ) GEN_RES_STR1( nResId, CUniString(Text1) ) #define GEN_RES_STR2c2( nResId, Text1, Text2 ) GEN_RES_STR2( nResId, Text1, CUniString(Text2) ) #define GEN_RES_STR3c3( nResId, Text1, Text2, Text3 ) GEN_RES_STR3( nResId, Text1, Text2, CUniString(Text3) ) #define IMPL_GEN_RES_STR \ -UniString GEN_RES_STR0( ULONG nResId ) { return ResString( nResId ); } \ -UniString GEN_RES_STR1( ULONG nResId, const UniString &Text1 ) { return GEN_RES_STR0( nResId ).Append( ArgString( 1, Text1 ) ); } \ -UniString GEN_RES_STR2( ULONG nResId, const UniString &Text1, const UniString &Text2 ) { return GEN_RES_STR1( nResId, Text1 ).Append( ArgString( 2, Text2 ) ); } \ -UniString GEN_RES_STR3( ULONG nResId, const UniString &Text1, const UniString &Text2, const UniString &Text3 ) { return GEN_RES_STR2( nResId, Text1, Text2 ).Append( ArgString( 3, Text3 ) );} +UniString GEN_RES_STR0( sal_uIntPtr nResId ) { return ResString( nResId ); } \ +UniString GEN_RES_STR1( sal_uIntPtr nResId, const UniString &Text1 ) { return GEN_RES_STR0( nResId ).Append( ArgString( 1, Text1 ) ); } \ +UniString GEN_RES_STR2( sal_uIntPtr nResId, const UniString &Text1, const UniString &Text2 ) { return GEN_RES_STR1( nResId, Text1 ).Append( ArgString( 2, Text2 ) ); } \ +UniString GEN_RES_STR3( sal_uIntPtr nResId, const UniString &Text1, const UniString &Text2, const UniString &Text3 ) { return GEN_RES_STR2( nResId, Text1, Text2 ).Append( ArgString( 3, Text3 ) );} #endif diff --git a/basic/inc/basic/vbahelper.hxx b/basic/inc/basic/vbahelper.hxx new file mode 100755 index 000000000000..0d99387965fe --- /dev/null +++ b/basic/inc/basic/vbahelper.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef BASIC_VBAHELPR_HXX +#define BASIC_VBAHELPR_HXX + +#include <com/sun/star/frame/XModel.hpp> + +namespace basic { +namespace vba { + +/* This header contains public helper functions for VBA used from this module + and from other VBA implementation modules such as vbahelper. + */ + +// ============================================================================ + +/** Locks or unlocks the controllers of all documents that have the same type + as the specified document. + + First, the global module manager (com.sun.star.frame.ModuleManager) is + asked for the type of the passed model, and all open documents with the + same type will be locked or unlocked. + + @param rxModel + A document model determining the type of the documents to be locked or + unlocked. + + @param bLockControllers + Passing true will lock all controllers, passing false will unlock them. + */ +void lockControllersOfAllDocuments( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel, + sal_Bool bLockControllers ); + +// ============================================================================ + +/** Enables or disables the container windows of all controllers of all + documents that have the same type as the specified document. + + First, the global module manager (com.sun.star.frame.ModuleManager) is + asked for the type of the passed model, and the container windows of all + open documents with the same type will be enabled or disabled. + + @param rxModel + A document model determining the type of the documents to be enabled or + disabled. + + @param bEnableWindows + Passing true will enable all container windows of all controllers, + passing false will disable them. + */ +void enableContainerWindowsOfAllDocuments( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel, + sal_Bool bEnableWindows ); + +// ============================================================================ + +} // namespace vba +} // namespace basic + +#endif diff --git a/basic/inc/basrid.hxx b/basic/inc/basrid.hxx index f79778c61ee0..f79778c61ee0 100644..100755 --- a/basic/inc/basrid.hxx +++ b/basic/inc/basrid.hxx diff --git a/basic/inc/makefile.mk b/basic/inc/makefile.mk index 1b56b6774806..1b56b6774806 100644..100755 --- a/basic/inc/makefile.mk +++ b/basic/inc/makefile.mk diff --git a/basic/inc/pch/precompiled_basic.cxx b/basic/inc/pch/precompiled_basic.cxx index 29280bf5059a..29280bf5059a 100644..100755 --- a/basic/inc/pch/precompiled_basic.cxx +++ b/basic/inc/pch/precompiled_basic.cxx diff --git a/basic/inc/pch/precompiled_basic.hxx b/basic/inc/pch/precompiled_basic.hxx index 6538399a28ea..1b7a57032830 100644..100755 --- a/basic/inc/pch/precompiled_basic.hxx +++ b/basic/inc/pch/precompiled_basic.hxx @@ -273,7 +273,7 @@ #include "vcl/timer.hxx" #include "vcl/toolbox.hxx" #include "vcl/window.hxx" -#include "vcl/wintypes.hxx" +#include "tools/wintypes.hxx" #include "vcl/wrkwin.hxx" #include "xmlscript/xmldlg_imexp.hxx" diff --git a/basic/inc/sb.hrc b/basic/inc/sb.hrc index c371d2abc046..c371d2abc046 100644..100755 --- a/basic/inc/sb.hrc +++ b/basic/inc/sb.hrc diff --git a/basic/inc/sb.hxx b/basic/inc/sb.hxx index b54d77974fef..b54d77974fef 100644..100755 --- a/basic/inc/sb.hxx +++ b/basic/inc/sb.hxx diff --git a/basic/prj/build.lst b/basic/prj/build.lst index c00a3d8412d3..17a34fa5bd9f 100755 --- a/basic/prj/build.lst +++ b/basic/prj/build.lst @@ -1,4 +1,4 @@ -sb basic : l10n offuh oovbaapi svtools xmlscript framework salhelper NULL +sb basic : L10N:l10n offuh oovbaapi svtools xmlscript framework salhelper LIBXSLT:libxslt NULL sb basic usr1 - all sb_mkout NULL sb basic\inc nmake - all sb_inc NULL sb basic\source\app nmake - all sb_app sb_class sb_inc NULL diff --git a/basic/prj/d.lst b/basic/prj/d.lst index d2a083ebcb1e..41d1a59550f0 100644..100755 --- a/basic/prj/d.lst +++ b/basic/prj/d.lst @@ -20,40 +20,10 @@ mkdir: %COMMON_DEST%\res%_EXT% ..\%__SRC%\lib\libsample.a %_DEST%\lib%_EXT%\libsample.a mkdir: %_DEST%\inc%_EXT%\basic -..\inc\testtool.hrc %_DEST%\inc%_EXT%\basic\testtool.hrc -..\inc\ttmsg.hrc %_DEST%\inc%_EXT%\basic\ttmsg.hrc -..\inc\basic\ttglobal.hrc %_DEST%\inc%_EXT%\basic\ttglobal.hrc -..\inc\svtmsg.hrc %_DEST%\inc%_EXT%\basic\svtmsg.hrc +..\inc\basic\*.hxx %_DEST%\inc%_EXT%\basic\*.hxx +..\inc\basic\*.hrc %_DEST%\inc%_EXT%\basic\*.hrc +..\inc\basic\*.h %_DEST%\inc%_EXT%\basic\*.h -..\inc\basic\sbdef.hxx %_DEST%\inc%_EXT%\basic\sbdef.hxx -..\inc\basic\sbmod.hxx %_DEST%\inc%_EXT%\basic\sbmod.hxx -..\inc\basic\sbjsmod.hxx %_DEST%\inc%_EXT%\basic\sbjsmod.hxx -..\inc\basic\sbmeth.hxx %_DEST%\inc%_EXT%\basic\sbmeth.hxx -..\inc\basic\sbprop.hxx %_DEST%\inc%_EXT%\basic\sbprop.hxx -..\inc\basic\sbstar.hxx %_DEST%\inc%_EXT%\basic\sbstar.hxx -..\inc\basic\sbuno.hxx %_DEST%\inc%_EXT%\basic\sbuno.hxx -..\inc\basic\basmgr.hxx %_DEST%\inc%_EXT%\basic\basmgr.hxx -..\inc\basic\sberrors.hxx %_DEST%\inc%_EXT%\basic\sberrors.hxx -..\inc\basic\basrdll.hxx %_DEST%\inc%_EXT%\basic\basrdll.hxx -..\inc\basic\sbstdobj.hxx %_DEST%\inc%_EXT%\basic\sbstdobj.hxx -..\inc\basic\process.hxx %_DEST%\inc%_EXT%\basic\process.hxx -..\inc\basic\mybasic.hxx %_DEST%\inc%_EXT%\basic\mybasic.hxx -..\inc\basic\testtool.hxx %_DEST%\inc%_EXT%\basic\testtool.hxx -..\inc\basic\basicrt.hxx %_DEST%\inc%_EXT%\basic\basicrt.hxx -..\inc\basic\dispdefs.hxx %_DEST%\inc%_EXT%\basic\dispdefs.hxx -..\inc\basic\ttstrhlp.hxx %_DEST%\inc%_EXT%\basic\ttstrhlp.hxx - -..\inc\basic\sbx.hxx %_DEST%\inc%_EXT%\basic\sbx.hxx -..\inc\basic\sbxcore.hxx %_DEST%\inc%_EXT%\basic\sbxcore.hxx -..\inc\basic\sbxdef.hxx %_DEST%\inc%_EXT%\basic\sbxdef.hxx -..\inc\basic\sbxform.hxx %_DEST%\inc%_EXT%\basic\sbxform.hxx -..\inc\basic\sbxmeth.hxx %_DEST%\inc%_EXT%\basic\sbxmeth.hxx -..\inc\basic\sbxobj.hxx %_DEST%\inc%_EXT%\basic\sbxobj.hxx -..\inc\basic\sbxprop.hxx %_DEST%\inc%_EXT%\basic\sbxprop.hxx -..\inc\basic\sbxvar.hxx %_DEST%\inc%_EXT%\basic\sbxvar.hxx -..\inc\basic\sbxbase.hxx %_DEST%\inc%_EXT%\basic\sbxbase.hxx -..\inc\basic\sbxfac.hxx %_DEST%\inc%_EXT%\basic\sbxfac.hxx -..\inc\basic\sbxmstrm.hxx %_DEST%\inc%_EXT%\basic\sbxmstrm.hxx - -..\inc\basic\basicmanagerrepository.hxx %_DEST%\inc%_EXT%\basic\basicmanagerrepository.hxx ..\inc\modsizeexceeded.hxx %_DEST%\inc%_EXT%\basic\modsizeexceeded.hxx +..\%__SRC%\misc\sb.component %_DEST%\xml%_EXT%\sb.component + diff --git a/basic/source/app/app.cxx b/basic/source/app/app.cxx index e82261084a70..7786914f85df 100644..100755 --- a/basic/source/app/app.cxx +++ b/basic/source/app/app.cxx @@ -89,52 +89,52 @@ IMPL_GEN_RES_STR; #ifdef DBG_UTIL // filter Messages generated due to missing configuration Bug:#83887# -void TestToolDebugMessageFilter( const sal_Char *pString, BOOL bIsOsl ) +void TestToolDebugMessageFilter( const sal_Char *pString, sal_Bool bIsOsl ) { - static BOOL static_bInsideFilter = FALSE; + static sal_Bool static_bInsideFilter = sal_False; // Ignore messages during filtering to avoid endless recursions if ( static_bInsideFilter ) return; - static_bInsideFilter = TRUE; + static_bInsideFilter = sal_True; ByteString aMessage( pString ); - BOOL bIgnore = FALSE; + sal_Bool bIgnore = sal_False; if ( bIsOsl ) { // OSL if ( aMessage.Search( CByteString("Cannot open Configuration: Connector: unknown delegatee com.sun.star.connection.Connector.portal") ) != STRING_NOTFOUND ) - bIgnore = TRUE; + bIgnore = sal_True; } else { // DBG #if ! (OSL_DEBUG_LEVEL > 1) if ( aMessage.Search( CByteString("SelectAppIconPixmap") ) != STRING_NOTFOUND ) - bIgnore = TRUE; + bIgnore = sal_True; #endif if ( aMessage.Search( CByteString("PropertySetRegistry::") ) != STRING_NOTFOUND ) - bIgnore = TRUE; + bIgnore = sal_True; if ( aMessage.Search( CByteString("property value missing") ) != STRING_NOTFOUND ) - bIgnore = TRUE; + bIgnore = sal_True; if ( aMessage.Search( CByteString("getDateFormatsImpl") ) != STRING_NOTFOUND && aMessage.Search( CByteString("no date formats") ) != STRING_NOTFOUND ) - bIgnore = TRUE; + bIgnore = sal_True; if ( aMessage.Search( CByteString("ucb::configureUcb(): Bad arguments") ) != STRING_NOTFOUND ) - bIgnore = TRUE; + bIgnore = sal_True; if ( aMessage.Search( CByteString("CreateInstance with arguments exception") ) != STRING_NOTFOUND ) - bIgnore = TRUE; + bIgnore = sal_True; if ( aMessage.Search( CByteString("AcquireTree failed") ) != STRING_NOTFOUND ) - bIgnore = TRUE; + bIgnore = sal_True; } if ( bIgnore ) { - static_bInsideFilter = FALSE; + static_bInsideFilter = sal_False; return; } @@ -156,25 +156,25 @@ void TestToolDebugMessageFilter( const sal_Char *pString, BOOL bIsOsl ) printf("DbgPrintMsgBox failed: %s\n", pString ); } } - static_bInsideFilter = FALSE; + static_bInsideFilter = sal_False; } void SAL_CALL DBG_TestToolDebugMessageFilter( const sal_Char *pString ) { - TestToolDebugMessageFilter( pString, FALSE ); + TestToolDebugMessageFilter( pString, sal_False ); } extern "C" void SAL_CALL osl_TestToolDebugMessageFilter( const sal_Char *pString ) { if ( !getenv( "DISABLE_SAL_DBGBOX" ) ) - TestToolDebugMessageFilter( pString, TRUE ); + TestToolDebugMessageFilter( pString, sal_True ); } #endif // #94145# Due to a tab in TT_SIGNATURE_FOR_UNICODE_TEXTFILES which is changed to blanks by some editors // this routine became necessary -BOOL IsTTSignatureForUnicodeTextfile( String aLine ) +sal_Bool IsTTSignatureForUnicodeTextfile( String aLine ) { aLine.SearchAndReplace( '\t', ' ' ); String ThreeBlanks = CUniString(" "); @@ -272,7 +272,7 @@ int BasicApp::Main( ) if ( aDefIniPath.Exists() ) { aDefIniPath.CopyTo( aIniPath, FSYS_ACTION_COPYFILE ); - FileStat::SetReadOnlyFlag( aIniPath, FALSE ); + FileStat::SetReadOnlyFlag( aIniPath, sal_False ); } } } @@ -355,7 +355,7 @@ void BasicApp::SetFocus() IMPL_LINK( BasicApp, LateInit, void *, pDummy ) { (void) pDummy; /* avoid warning about unused parameter */ - USHORT i; + sal_uInt16 i; for ( i = 0 ; i < Application::GetCommandLineParamCount() ; i++ ) { if ( Application::GetCommandLineParam( i ).Copy(0,4).CompareIgnoreCaseToAscii("-run") == COMPARE_EQUAL @@ -363,7 +363,7 @@ IMPL_LINK( BasicApp, LateInit, void *, pDummy ) || Application::GetCommandLineParam( i ).Copy(0,4).CompareIgnoreCaseToAscii("/run") == COMPARE_EQUAL #endif ) - pFrame->SetAutoRun( TRUE ); + pFrame->SetAutoRun( sal_True ); else if ( Application::GetCommandLineParam( i ).Copy(0,7).CompareIgnoreCaseToAscii("-result") == COMPARE_EQUAL #ifndef UNX || Application::GetCommandLineParam( i ).Copy(0,7).CompareIgnoreCaseToAscii("/result") == COMPARE_EQUAL @@ -374,7 +374,7 @@ IMPL_LINK( BasicApp, LateInit, void *, pDummy ) { if ( ByteString( Application::GetCommandLineParam( i+1 ), osl_getThreadTextEncoding() ).IsNumericAscii() ) { - MsgEdit::SetMaxLogLen( sal::static_int_cast< USHORT >( Application::GetCommandLineParam( i+1 ).ToInt32() ) ); + MsgEdit::SetMaxLogLen( sal::static_int_cast< sal_uInt16 >( Application::GetCommandLineParam( i+1 ).ToInt32() ) ); } i++; } @@ -446,7 +446,7 @@ FloatingExecutionStatus::FloatingExecutionStatus( Window * pParent ) void FloatingExecutionStatus::SetStatus( String aW ) { - Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); + Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); ToTop( TOTOP_NOGRABFOCUS ); aAusblend.Start(); aStatus.SetText( aW ); @@ -454,7 +454,7 @@ void FloatingExecutionStatus::SetStatus( String aW ) void FloatingExecutionStatus::SetAdditionalInfo( String aF ) { - Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); + Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); ToTop( TOTOP_NOGRABFOCUS ); aAusblend.Start(); aAdditionalInfo.SetText( aF ); @@ -473,11 +473,11 @@ TYPEINIT1(TTExecutionStatusHint, SfxSimpleHint); BasicFrame::BasicFrame() : WorkWindow( NULL, WinBits( WB_APP | WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE ) ) -, bIsAutoRun( FALSE ) +, bIsAutoRun( sal_False ) , pDisplayHidDlg( NULL ) , pEditVar ( 0 ) -, bAutoReload( FALSE ) -, bAutoSave( TRUE ) +, bAutoReload( sal_False ) +, bAutoSave( sal_True ) , pBasic( NULL ) , pExecutionStatus( NULL ) , pStatus( NULL ) @@ -487,10 +487,10 @@ BasicFrame::BasicFrame() : WorkWindow( NULL, { Application::SetDefDialogParent( this ); - AlwaysEnableInput( TRUE ); + AlwaysEnableInput( sal_True ); pBasic = TTBasic::CreateMyBasic(); // depending on what was linked to the executable - bInBreak = FALSE; - bDisas = FALSE; + bInBreak = sal_False; + bDisas = sal_False; nFlags = 0; // Icon aAppIcon; @@ -594,11 +594,11 @@ BasicFrame::BasicFrame() : WorkWindow( NULL, } const ByteString ProfilePrefix("_profile_"); -const USHORT ProfilePrefixLen = ProfilePrefix.Len(); +const sal_uInt16 ProfilePrefixLen = ProfilePrefix.Len(); void BasicFrame::LoadIniFile() { - USHORT i; + sal_uInt16 i; Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); for ( i = 0 ; i < aConf.GetGroupCount() ; i++ ) @@ -714,12 +714,12 @@ IMPL_LINK( BasicFrame, CheckAllFiles, Timer*, pTimer ) return 0; } -BOOL BasicFrame::IsAutoRun() +sal_Bool BasicFrame::IsAutoRun() { return bIsAutoRun; } -void BasicFrame::SetAutoRun( BOOL bAuto ) +void BasicFrame::SetAutoRun( sal_Bool bAuto ) { bIsAutoRun = bAuto; } @@ -809,7 +809,7 @@ IMPL_LINK( BasicFrame, CloseButtonClick, void*, EMPTYARG ) break; } } - return Command( RID_FILECLOSE, FALSE ); + return Command( RID_FILECLOSE, sal_False ); } IMPL_LINK( BasicFrame, FloatButtonClick, void*, EMPTYARG ) @@ -848,7 +848,7 @@ void BasicFrame::WinShow_Hide() return; AppWin* p; - BOOL bWasFullscreen = FALSE; + sal_Bool bWasFullscreen = sal_False; for ( size_t i = pList->size(); i > 0; --i ) { p = pList->at( i - 1 ); @@ -859,7 +859,7 @@ void BasicFrame::WinShow_Hide() ) p->Hide( SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); else - p->Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); + p->Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); } bWasFullscreen |= p->GetWinState() == TT_WIN_STATE_MAX; } @@ -869,13 +869,13 @@ void BasicFrame::WinMax_Restore() { // The application buttons AppWin* p; - BOOL bHasFullscreenWin = FALSE; + sal_Bool bHasFullscreenWin = sal_False; for ( size_t i = 0, n = pList->size(); i < n && !bHasFullscreenWin; ++i ) { p = pList->at( i ); bHasFullscreenWin = ( p->GetWinState() == TT_WIN_STATE_MAX ); } - GetMenuBar()->ShowButtons( bHasFullscreenWin, FALSE, FALSE ); + GetMenuBar()->ShowButtons( bHasFullscreenWin, sal_False, sal_False ); WinShow_Hide(); } @@ -901,9 +901,9 @@ void BasicFrame::RemoveWindow( AppWin *pWin ) Menu* pMenu = GetMenuBar(); if( pList->empty() ) { - pMenu->EnableItem( RID_APPEDIT, FALSE ); - pMenu->EnableItem( RID_APPRUN, FALSE ); - pMenu->EnableItem( RID_APPWINDOW, FALSE ); + pMenu->EnableItem( RID_APPEDIT, sal_False ); + pMenu->EnableItem( RID_APPRUN, sal_False ); + pMenu->EnableItem( RID_APPWINDOW, sal_False ); } PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW ); @@ -928,20 +928,20 @@ void BasicFrame::AddWindow( AppWin *pWin ) MenuBar* pMenu = GetMenuBar(); if( !pList->empty() ) { - pMenu->EnableItem( RID_APPEDIT, TRUE ); - pMenu->EnableItem( RID_APPRUN, TRUE ); - pMenu->EnableItem( RID_APPWINDOW, TRUE ); + pMenu->EnableItem( RID_APPEDIT, sal_True ); + pMenu->EnableItem( RID_APPRUN, sal_True ); + pMenu->EnableItem( RID_APPWINDOW, sal_True ); } PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW ); - USHORT nLastID = pWinMenu->GetItemId( pWinMenu->GetItemCount() - 1 ); + sal_uInt16 nLastID = pWinMenu->GetItemId( pWinMenu->GetItemCount() - 1 ); // Separator necessary if ( nLastID < RID_WIN_FILE1 && pWinMenu->GetItemType( pWinMenu->GetItemCount() - 1 ) != MENUITEM_SEPARATOR ) pWinMenu->InsertSeparator(); // Find free ID - USHORT nFreeID = RID_WIN_FILE1; + sal_uInt16 nFreeID = RID_WIN_FILE1; while ( pWinMenu->GetItemPos( nFreeID ) != MENU_ITEM_NOTFOUND && nFreeID < RID_WIN_FILEn ) nFreeID++; @@ -974,7 +974,7 @@ void BasicFrame::FocusWindow( AppWin *pWin ) } } pList->push_back( pWin ); - pWin->Minimize( FALSE ); + pWin->Minimize( sal_False ); aAppFile = pWin->GetText(); UpdateTitle(); @@ -983,14 +983,14 @@ void BasicFrame::FocusWindow( AppWin *pWin ) pStatus->LoadTaskToolBox(); } -BOOL BasicFrame::Close() +sal_Bool BasicFrame::Close() { if( bInBreak || Basic().IsRunning() ) if( RET_NO == QueryBox( this, SttResId( IDS_RUNNING ) ).Execute() ) - return FALSE; + return sal_False; StarBASIC::Stop(); - bInBreak = FALSE; + bInBreak = sal_False; if( CloseAll() ) { aLineNum.Stop(); @@ -1004,33 +1004,33 @@ BOOL BasicFrame::Close() Application::SetDefDialogParent( NULL ); WorkWindow::Close(); - return TRUE; - } else return FALSE; + return sal_True; + } else return sal_False; } -BOOL BasicFrame::CloseAll() +sal_Bool BasicFrame::CloseAll() { while ( !pList->empty() ) if ( !pList->back()->Close() ) - return FALSE; - return TRUE; + return sal_False; + return sal_True; } -BOOL BasicFrame::CompileAll() +sal_Bool BasicFrame::CompileAll() { AppWin* p; for ( size_t i = 0, n = pList->size(); i < n; ++i ) { p = pList->at( i ); - if ( p->ISA(AppBasEd) && !((AppBasEd*)p)->Compile() ) return FALSE; + if ( p->ISA(AppBasEd) && !((AppBasEd*)p)->Compile() ) return sal_False; } - return TRUE; + return sal_True; } // Setup menu #define MENU2FILENAME( Name ) Name.Copy( Name.SearchAscii(" ") +1).EraseAllChars( '~' ) #define LRUNr( nNr ) CByteString("LRU").Append( ByteString::CreateFromInt32( nNr ) ) -String FILENAME2MENU( USHORT nNr, String aName ) +String FILENAME2MENU( sal_uInt16 nNr, String aName ) { String aRet; if ( nNr <= 9 ) @@ -1049,9 +1049,9 @@ void BasicFrame::AddToLRU(String const& aFile) PopupMenu *pPopup = GetMenuBar()->GetPopupMenu(RID_APPFILE); aConfig.SetGroup("LRU"); - USHORT nMaxLRU = (USHORT)aConfig.ReadKey("MaxLRU","4").ToInt32(); + sal_uInt16 nMaxLRU = (sal_uInt16)aConfig.ReadKey("MaxLRU","4").ToInt32(); DirEntry aFileEntry( aFile ); - USHORT i,nLastMove = nMaxLRU; + sal_uInt16 i,nLastMove = nMaxLRU; for ( i = 1 ; i<nMaxLRU && nLastMove == nMaxLRU ; i++ ) { @@ -1083,15 +1083,15 @@ void BasicFrame::LoadLRU() { Config aConfig(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); PopupMenu *pPopup = GetMenuBar()->GetPopupMenu(RID_APPFILE); - BOOL bAddSep = TRUE; + sal_Bool bAddSep = sal_True; aConfig.SetGroup("LRU"); - USHORT nMaxLRU = (USHORT)aConfig.ReadKey("MaxLRU","4").ToInt32(); + sal_uInt16 nMaxLRU = (sal_uInt16)aConfig.ReadKey("MaxLRU","4").ToInt32(); if ( pPopup ) bAddSep = pPopup->GetItemPos( IDM_FILE_LRU1 ) == MENU_ITEM_NOTFOUND; - USHORT i; + sal_uInt16 i; for ( i = 1; i <= nMaxLRU && pPopup != NULL; i++) { String aFile = UniString( aConfig.ReadKey(LRUNr(i)), RTL_TEXTENCODING_UTF8 ); @@ -1101,7 +1101,7 @@ void BasicFrame::LoadLRU() if (bAddSep) { pPopup->InsertSeparator(); - bAddSep = FALSE; + bAddSep = sal_False; } if ( pPopup->GetItemPos( IDM_FILE_LRU1 + i-1 ) == MENU_ITEM_NOTFOUND ) @@ -1120,10 +1120,10 @@ void BasicFrame::LoadLRU() IMPL_LINK( BasicFrame, InitMenu, Menu *, pMenu ) { - BOOL bNormal = BOOL( !bInBreak ); + sal_Bool bNormal = sal_Bool( !bInBreak ); pMenu->EnableItem( RID_RUNCOMPILE, bNormal ); - BOOL bHasEdit = BOOL( pWork != NULL ); + sal_Bool bHasEdit = sal_Bool( pWork != NULL ); pMenu->EnableItem( RID_FILECLOSE, bHasEdit ); pMenu->EnableItem( RID_FILESAVE, bHasEdit ); @@ -1133,16 +1133,16 @@ IMPL_LINK( BasicFrame, InitMenu, Menu *, pMenu ) pMenu->EnableItem( RID_FILELOADLIB, bNormal ); pMenu->EnableItem( RID_FILESAVELIB, bHasEdit ); - BOOL bHasErr = BOOL( bNormal && pBasic->GetErrors() != 0 ); - BOOL bNext = bHasErr & bNormal; - BOOL bPrev = bHasErr & bNormal; + sal_Bool bHasErr = sal_Bool( bNormal && pBasic->GetErrors() != 0 ); + sal_Bool bNext = bHasErr & bNormal; + sal_Bool bPrev = bHasErr & bNormal; if( bHasErr ) { size_t n = pBasic->GetCurrentError(); if( n == 0 ) - bPrev = FALSE; + bPrev = sal_False; if( SbError(n+1) == pBasic->GetErrors() ) - bNext = FALSE; + bNext = sal_False; } pMenu->EnableItem( RID_RUNNEXTERR, bNext ); pMenu->EnableItem( RID_RUNPREVERR, bPrev ); @@ -1150,14 +1150,14 @@ IMPL_LINK( BasicFrame, InitMenu, Menu *, pMenu ) if( pWork ) pWork->InitMenu( pMenu ); - return TRUE; + return sal_True; } IMPL_LINK_INLINE_START( BasicFrame, DeInitMenu, Menu *, pMenu ) { (void) pMenu; /* avoid warning about unused parameter */ - SetAutoRun( FALSE ); + SetAutoRun( sal_False ); String aString; pStatus->Message( aString ); return 0L; @@ -1174,15 +1174,15 @@ IMPL_LINK_INLINE_END( BasicFrame, HighlightMenu, Menu *, pMenu ) IMPL_LINK_INLINE_START( BasicFrame, MenuCommand, Menu *, pMenu ) { - USHORT nId = pMenu->GetCurItemId(); - BOOL bChecked = pMenu->IsItemChecked( nId ); + sal_uInt16 nId = pMenu->GetCurItemId(); + sal_Bool bChecked = pMenu->IsItemChecked( nId ); return Command( nId, bChecked ); } IMPL_LINK_INLINE_END( BasicFrame, MenuCommand, Menu *, pMenu ) IMPL_LINK_INLINE_START( BasicFrame, Accel, Accelerator*, pAcc ) { - SetAutoRun( FALSE ); + SetAutoRun( sal_False ); return Command( pAcc->GetCurItemId() ); } IMPL_LINK_INLINE_END( BasicFrame, Accel, Accelerator*, pAcc ) @@ -1247,14 +1247,14 @@ AppBasEd* BasicFrame::CreateModuleWin( SbModule* pMod ) return p; } -BOOL BasicFrame::LoadFile( String aFilename ) +sal_Bool BasicFrame::LoadFile( String aFilename ) { - BOOL bIsResult = DirEntry( aFilename ).GetExtension().CompareIgnoreCaseToAscii("RES") == COMPARE_EQUAL; - BOOL bIsBasic = DirEntry( aFilename ).GetExtension().CompareIgnoreCaseToAscii("BAS") == COMPARE_EQUAL; + sal_Bool bIsResult = DirEntry( aFilename ).GetExtension().CompareIgnoreCaseToAscii("RES") == COMPARE_EQUAL; + sal_Bool bIsBasic = DirEntry( aFilename ).GetExtension().CompareIgnoreCaseToAscii("BAS") == COMPARE_EQUAL; bIsBasic |= DirEntry( aFilename ).GetExtension().CompareIgnoreCaseToAscii("INC") == COMPARE_EQUAL; AppWin* p; - BOOL bSuccess = TRUE; + sal_Bool bSuccess = sal_True; if ( bIsResult ) { p = new AppError( this, aFilename ); @@ -1281,7 +1281,7 @@ BOOL BasicFrame::LoadFile( String aFilename ) } // Execute command -long BasicFrame::Command( short nID, BOOL bChecked ) +long BasicFrame::Command( short nID, sal_Bool bChecked ) { BasicError* pErr; @@ -1294,7 +1294,7 @@ long BasicFrame::Command( short nID, BOOL bChecked ) case RID_FILEOPEN: { String s; - if( QueryFileName( s, FT_BASIC_SOURCE | FT_RESULT_FILE, FALSE ) ) { + if( QueryFileName( s, FT_BASIC_SOURCE | FT_RESULT_FILE, sal_False ) ) { AddToLRU( s ); LoadFile( s ); } @@ -1333,7 +1333,7 @@ long BasicFrame::Command( short nID, BOOL bChecked ) { SbModule *pModule = ((AppBasEd*)pWork)->GetModule(); #if OSL_DEBUG_LEVEL > 1 - USHORT x; + sal_uInt16 x; x = pWork->GetLineNr(); x = ((AppBasEd*)pWork)->GetModule()->GetBPCount(); if ( !x ) @@ -1341,7 +1341,7 @@ long BasicFrame::Command( short nID, BOOL bChecked ) x = pModule->GetBPCount(); #endif - for ( USHORT nMethod = 0; nMethod < pModule->GetMethods()->Count(); nMethod++ ) + for ( sal_uInt16 nMethod = 0; nMethod < pModule->GetMethods()->Count(); nMethod++ ) { SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Get( nMethod ); DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" ); @@ -1382,7 +1382,7 @@ long BasicFrame::Command( short nID, BOOL bChecked ) if( bInBreak ) // Reset the flag - bInBreak = FALSE; + bInBreak = sal_False; else { if( IsAutoSave() && !SaveAll() ) break; @@ -1391,10 +1391,10 @@ long BasicFrame::Command( short nID, BOOL bChecked ) pStatus->Message( aString ); if( p ) { - BasicDLL::SetDebugMode( TRUE ); + BasicDLL::SetDebugMode( sal_True ); Basic().ClearGlobalVars(); p->Run(); - BasicDLL::SetDebugMode( FALSE ); + BasicDLL::SetDebugMode( sal_False ); // If cancelled during Interactive=FALSE } }} @@ -1409,7 +1409,7 @@ long BasicFrame::Command( short nID, BOOL bChecked ) } break; case RID_RUNDISAS: - bDisas = BOOL( !bChecked ); + bDisas = sal_Bool( !bChecked ); break; case RID_RUNBREAK: if ( Basic().IsRunning() && !bInBreak ) @@ -1419,7 +1419,7 @@ long BasicFrame::Command( short nID, BOOL bChecked ) break; case RID_RUNSTOP: Basic().Stop(); - bInBreak = FALSE; + bInBreak = sal_False; break; case RID_RUNNEXTERR: pErr = pBasic->NextError(); @@ -1560,23 +1560,23 @@ long BasicFrame::Command( short nID, BOOL bChecked ) pWork->Command( CommandEvent( Point(), nID ) ); } } - return TRUE; + return sal_True; } -BOOL BasicFrame::SaveAll() +sal_Bool BasicFrame::SaveAll() { AppWin* p, *q = pWork; for ( size_t i = 0, n = pList->size(); i < n ; i++ ) { p = pList->at( i ); - USHORT nRes = p->QuerySave( QUERY_DISK_CHANGED ); + sal_uInt16 nRes = p->QuerySave( QUERY_DISK_CHANGED ); if( (( nRes == SAVE_RES_ERROR ) && QueryBox(this,SttResId(IDS_ASKSAVEERROR)).Execute() == RET_NO ) || ( nRes == SAVE_RES_CANCEL ) ) - return FALSE; + return sal_False; } if ( q ) q->ToTop(); - return TRUE; + return sal_True; } IMPL_LINK( BasicFrame, ModuleWinExists, String*, pFilename ) @@ -1620,7 +1620,7 @@ AppWin* BasicFrame::FindWin( const String& rName ) return NULL; } -AppWin* BasicFrame::FindWin( USHORT nWinId ) +AppWin* BasicFrame::FindWin( sal_uInt16 nWinId ) { AppWin* p; for ( size_t i = 0, n = pList->size(); i < n ; i++ ) @@ -1649,10 +1649,10 @@ IMPL_LINK( BasicFrame, WriteString, String*, pString ) if ( !pList->empty() ) { pList->back()->pDataEdit->ReplaceSelected( *pString ); - return TRUE; + return sal_True; } else - return FALSE; + return sal_False; } class NewFileDialog : public FileDialog @@ -1675,7 +1675,7 @@ void NewFileDialog::FilterSelect() return; // User decides after he has changed the path String aCurFilter = GetCurFilter(); - USHORT nFilterNr = 0; + sal_uInt16 nFilterNr = 0; while ( nFilterNr < GetFilterCount() && aCurFilter != GetFilterName( nFilterNr ) ) { nFilterNr++; @@ -1692,7 +1692,7 @@ void NewFileDialog::FilterSelect() short NewFileDialog::Execute() { - BOOL bRet = (BOOL)FileDialog::Execute(); + sal_Bool bRet = (sal_Bool)FileDialog::Execute(); if ( bRet ) { Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); @@ -1705,8 +1705,8 @@ short NewFileDialog::Execute() return bRet; } -BOOL BasicFrame::QueryFileName - (String& rName, FileType nFileType, BOOL bSave ) +sal_Bool BasicFrame::QueryFileName + (String& rName, FileType nFileType, sal_Bool bSave ) { NewFileDialog aDlg( this, bSave ? WinBits( WB_SAVEAS ) : WinBits( WB_OPEN ) ); @@ -1752,13 +1752,13 @@ BOOL BasicFrame::QueryFileName if( aDlg.Execute() ) { rName = aDlg.GetPath(); - return TRUE; - } else return FALSE; + return sal_True; + } else return sal_False; } -USHORT BasicFrame::BreakHandler() +sal_uInt16 BasicFrame::BreakHandler() { - bInBreak = TRUE; + bInBreak = sal_True; SetAppMode( String( SttResId ( IDS_APPMODE_BREAK ) ) ); while( bInBreak ) { @@ -1773,7 +1773,7 @@ USHORT BasicFrame::BreakHandler() void BasicFrame::LoadLibrary() { String s; - if( QueryFileName( s, FT_BASIC_LIBRARY, FALSE ) ) + if( QueryFileName( s, FT_BASIC_LIBRARY, sal_False ) ) { CloseAll(); SvFileStream aStrm( s, STREAM_STD_READ ); @@ -1783,7 +1783,7 @@ void BasicFrame::LoadLibrary() pBasic = pNew; // Show all contents if existing SbxArray* pMods = pBasic->GetModules(); - for( USHORT i = 0; i < pMods->Count(); i++ ) + for( sal_uInt16 i = 0; i < pMods->Count(); i++ ) { SbModule* pMod = (SbModule*) pMods->Get( i ); AppWin* p = new AppBasEd( this, pMod ); @@ -1801,7 +1801,7 @@ void BasicFrame::LoadLibrary() void BasicFrame::SaveLibrary() { String s; - if( QueryFileName( s, FT_BASIC_LIBRARY, TRUE ) ) + if( QueryFileName( s, FT_BASIC_LIBRARY, sal_True ) ) { SvFileStream aStrm( s, STREAM_STD_WRITE ); if( !Basic().Store( aStrm ) ) @@ -1815,8 +1815,8 @@ String BasicFrame::GenRealString( const String &aResString ) String aType,aValue,aResult(aResString); String aString; xub_StrLen nInsertPos = 0; - BOOL bFound; - bFound = FALSE; + sal_Bool bFound; + bFound = sal_False; while ( (nStart = aResult.Search(StartKenn,nStartPos)) != STRING_NOTFOUND && (nGleich = aResult.SearchAscii("=",nStart+StartKenn.Len())) != STRING_NOTFOUND && @@ -1836,16 +1836,16 @@ String BasicFrame::GenRealString( const String &aResString ) aString.Erase(); } - aString = String( SttResId( (USHORT)(aValue.ToInt32()) ) ); + aString = String( SttResId( (sal_uInt16)(aValue.ToInt32()) ) ); nInsertPos = nStart; nStartPos = nStart; aResult.Erase( nStart, nEnd-nStart+1 ); - bFound = TRUE; + bFound = sal_True; } else if ( aType.Search(BaseArgKenn) == 0 ) // Starts with BaseArgKenn { // TODO: What the hell is that for?? - USHORT nArgNr = USHORT( aType.Copy( BaseArgKenn.Len() ).ToInt32() ); + sal_uInt16 nArgNr = sal_uInt16( aType.Copy( BaseArgKenn.Len() ).ToInt32() ); DBG_ASSERT( aString.Search( CUniString("($Arg").Append( String::CreateFromInt32(nArgNr) ).AppendAscii(")") ) != STRING_NOTFOUND, "Extra Argument given in String"); aString.SearchAndReplace( CUniString("($Arg").Append( String::CreateFromInt32(nArgNr) ).AppendAscii(")"), aValue ); nStartPos = nStart; diff --git a/basic/source/app/app.hxx b/basic/source/app/app.hxx index 8f3c8e6f9f9b..983e979c5021 100644..100755 --- a/basic/source/app/app.hxx +++ b/basic/source/app/app.hxx @@ -62,7 +62,7 @@ public: void LoadIniFile(); void SetFocus(); - void Wait( BOOL ); + void Wait( sal_Bool ); DECL_LINK( LateInit, void * ); #ifdef DBG_UTIL @@ -71,7 +71,7 @@ public: }; -typedef USHORT FileType; +typedef sal_uInt16 FileType; #define FT_NO_FILE (FileType)0x00 // An error has occurred ... #define FT_BASIC_SOURCE (FileType)0x01 @@ -90,16 +90,16 @@ class BasicFrame : public WorkWindow, public SfxBroadcaster, public SfxListener using SystemWindow::Notify; using Window::Command; - virtual BOOL Close(); - BOOL CloseAll(); // Close all windows - BOOL CompileAll(); // Compile all texts + virtual sal_Bool Close(); + sal_Bool CloseAll(); // Close all windows + sal_Bool CompileAll(); // Compile all texts AutoTimer aLineNum; // Show the line numbers virtual void Resize(); virtual void Move(); virtual void GetFocus(); void LoadLibrary(); void SaveLibrary(); - BOOL bIsAutoRun; + sal_Bool bIsAutoRun; DisplayHidDlg* pDisplayHidDlg; // BreakPoint *pRunToCursorBP; @@ -109,8 +109,8 @@ using Window::Command; Timer aCheckFiles; // Checks the files for changes - BOOL bAutoReload; - BOOL bAutoSave; + sal_Bool bAutoReload; + sal_Bool bAutoSave; DECL_LINK( CheckAllFiles, Timer* ); MyBasicRef pBasic; // BASIC-Engine @@ -126,16 +126,16 @@ using Window::Command; FloatingExecutionStatus *pExecutionStatus; public: - BOOL IsAutoRun(); - void SetAutoRun( BOOL bAuto ); - BOOL bInBreak; // TRUE if in Break-Handler + sal_Bool IsAutoRun(); + void SetAutoRun( sal_Bool bAuto ); + sal_Bool bInBreak; // sal_True if in Break-Handler StatusLine* pStatus; // Status line EditList* pList; // List of edit windows AppWin* pWork; // Current edit window BasicPrinter* pPrn; // Printer - BOOL bDisas; // TRUE: disassemble - USHORT nFlags; // Debugging-Flags - USHORT nMaximizedWindows; // Number of maximized windows + sal_Bool bDisas; // sal_True: disassemble + sal_uInt16 nFlags; // Debugging-Flags + sal_uInt16 nMaximizedWindows; // Number of maximized windows void FocusWindow( AppWin *pWin ); void WinMax_Restore(); void WinShow_Hide(); @@ -157,25 +157,25 @@ public: MsgEdit* GetMsgTree( String aLogFileName ); DECL_LINK( Log, TTLogMsg * ); DECL_LINK( WinInfo, WinInfoRec * ); - BOOL LoadFile( String aFilename ); - long Command( short,BOOL=FALSE ); // Command handler + sal_Bool LoadFile( String aFilename ); + long Command( short,sal_Bool=sal_False ); // Command handler virtual void Command( const CommandEvent& rCEvt ); // Command handler - BOOL SaveAll(); // Save all windows - BOOL QueryFileName( String& rName, FileType nFileType, BOOL bSave ); // Query for filename + sal_Bool SaveAll(); // Save all windows + sal_Bool QueryFileName( String& rName, FileType nFileType, sal_Bool bSave ); // Query for filename DECL_LINK( ModuleWinExists, String* ); DECL_LINK( WriteString, String* ); AppBasEd* CreateModuleWin( SbModule* pMod ); AppBasEd* FindModuleWin( const String& ); AppError* FindErrorWin( const String& ); AppWin* FindWin( const String& ); - AppWin* FindWin( USHORT nWinId ); + AppWin* FindWin( sal_uInt16 nWinId ); AppWin* IsWinValid( AppWin* pMaybeWin ); - USHORT BreakHandler(); // Break-Handler-Callback + sal_uInt16 BreakHandler(); // Break-Handler-Callback void SetEditVar( SbxVariable *pVar ){ pEditVar = pVar;} SbxVariable* GetEditVar(){ return pEditVar;} - BOOL IsAutoReload() { return bAutoReload; } - BOOL IsAutoSave() { return bAutoSave; } + sal_Bool IsAutoReload() { return bAutoReload; } + sal_Bool IsAutoSave() { return bAutoSave; } void LoadIniFile(); virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); diff --git a/basic/source/app/appbased.cxx b/basic/source/app/appbased.cxx index 3a3422e16107..4a3b94d057ec 100644..100755 --- a/basic/source/app/appbased.cxx +++ b/basic/source/app/appbased.cxx @@ -56,10 +56,10 @@ AppBasEd::AppBasEd( BasicFrame* pParent, SbModule* p ) pBreakpoints->Show(); - ((TextEdit*)pDataEdit)->GetTextEditImp().pTextView->SetAutoIndentMode( TRUE ); + ((TextEdit*)pDataEdit)->GetTextEditImp().pTextView->SetAutoIndentMode( sal_True ); ((TextEdit*)pDataEdit)->GetTextEditImp().pTextEngine->SetMaxTextLen( STRING_MAXLEN ); - ((TextEdit*)pDataEdit)->GetTextEditImp().SyntaxHighlight( TRUE ); - ((TextEdit*)pDataEdit)->SaveAsUTF8( TRUE ); + ((TextEdit*)pDataEdit)->GetTextEditImp().SyntaxHighlight( sal_True ); + ((TextEdit*)pDataEdit)->SaveAsUTF8( sal_True ); String aEmpty; @@ -101,7 +101,7 @@ void AppBasEd::Notify( SfxBroadcaster&, const SfxHint& rHint ) const SfxSimpleHint* p = PTR_CAST(SfxSimpleHint,&rHint); if( p ) { - ULONG nHintId = p->GetId(); + sal_uIntPtr nHintId = p->GetId(); if( nHintId == SBX_HINT_LANGUAGE_EXTENSION_LOADED ) { ((TextEdit*)pDataEdit)->GetTextEditImp().InvalidateSyntaxHighlight(); @@ -117,8 +117,8 @@ FileType AppBasEd::GetFileType() IMPL_LINK_INLINE_START( AppBasEd, EditChange, void *, p ) { (void) p; /* avoid warning about unused parameter */ - bCompiled = FALSE; - return TRUE; + bCompiled = sal_False; + return sal_True; } IMPL_LINK_INLINE_END( AppBasEd, EditChange, void *, p ) @@ -126,16 +126,16 @@ IMPL_LINK_INLINE_END( AppBasEd, EditChange, void *, p ) long AppBasEd::InitMenu( Menu* pMenu ) { AppEdit::InitMenu (pMenu ); - BOOL bRunning = pFrame->Basic().IsRunning(); + sal_Bool bRunning = pFrame->Basic().IsRunning(); pMenu->EnableItem( RID_RUNCOMPILE, !bCompiled && !bRunning ); - return TRUE; + return sal_True; } long AppBasEd::DeInitMenu( Menu* pMenu ) { AppEdit::DeInitMenu (pMenu ); pMenu->EnableItem( RID_RUNCOMPILE ); - return TRUE; + return sal_True; } // Menu Handler @@ -177,13 +177,13 @@ void AppBasEd::PostLoad() pMod->SetName( GetText() ); pMod->Clear(); pMod->SetSource( pDataEdit->GetText() ); - bCompiled = FALSE; // because the code might have changed in the meantime + bCompiled = sal_False; // because the code might have changed in the meantime AppEdit::PostLoad(); pBreakpoints->LoadBreakpoints( GetText() ); } -USHORT AppBasEd::ImplSave() +sal_uInt16 AppBasEd::ImplSave() { pBreakpoints->SaveBreakpoints( GetText() ); return AppEdit::ImplSave(); @@ -199,7 +199,7 @@ void AppBasEd::Reload() // Reload source code file after change void AppBasEd::LoadSource() { - BOOL bErr; + sal_Bool bErr; String aName = pMod->GetName(); bErr = !pDataEdit->Load( aName ); @@ -208,7 +208,7 @@ void AppBasEd::LoadSource() ErrorBox( this, SttResId( IDS_READERROR ) ).Execute(); else UpdateFileInfo( HAS_BEEN_LOADED ); - bCompiled = FALSE; // because the code might have changed in the meantime + bCompiled = sal_False; // because the code might have changed in the meantime } // Save as (new name) @@ -219,15 +219,15 @@ void AppBasEd::PostSaveAs() } // Compile -BOOL AppBasEd::Compile() +sal_Bool AppBasEd::Compile() { if( !pDataEdit->HasText() || bCompiled ) - return TRUE; + return sal_True; pMod->SetSource( pDataEdit->GetText() ); - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if( pFrame->Basic().Compile( pMod ) ) { - bRes = TRUE; + bRes = sal_True; if( pFrame->bDisas ) Disassemble(); TextSelection aSel( pDataEdit->GetSelection() ); @@ -257,7 +257,7 @@ void AppBasEd::Run() { pFrame->Basic().Reset(); SbxArray* pAllModules = pFrame->Basic().GetModules(); - for (USHORT i = 0; i < pAllModules->Count(); i++) + for (sal_uInt16 i = 0; i < pAllModules->Count(); i++) { if ( (pAllModules->Get(i)->GetName()).Copy(0,2).CompareToAscii( "--" ) == COMPARE_EQUAL ) { diff --git a/basic/source/app/appbased.hxx b/basic/source/app/appbased.hxx index a7796fb3854b..22e9afa37bc1 100644..100755 --- a/basic/source/app/appbased.hxx +++ b/basic/source/app/appbased.hxx @@ -40,12 +40,12 @@ class AppBasEd : public AppEdit { // Editor-Window: using DockingWindow::Notify; SbModuleRef pMod; // compile module - BOOL bCompiled; // TRUE if compiled + sal_Bool bCompiled; // sal_True if compiled protected: DECL_LINK( EditChange, void * ); #define BREAKPOINTSWIDTH 15 BreakpointWindow *pBreakpoints; - virtual USHORT ImplSave(); // Save file + virtual sal_uInt16 ImplSave(); // Save file public: TYPEINFO(); @@ -61,7 +61,7 @@ public: virtual void PostSaveAs(); // Postprocess of module... void Reload(); void LoadSource(); // Load source for object - BOOL Compile(); // Compile text + sal_Bool Compile(); // Compile text void Run(); // Run image void Disassemble(); // Disassemble image const String& GetModName() const { return pMod->GetName(); } diff --git a/basic/source/app/appedit.cxx b/basic/source/app/appedit.cxx index 7d6ab8669dea..1cf75d13c58a 100644..100755 --- a/basic/source/app/appedit.cxx +++ b/basic/source/app/appedit.cxx @@ -79,8 +79,8 @@ AppEdit::~AppEdit() void AppEdit::LoadIniFile() { TextView *pTextView = ((TextEdit*)pDataEdit)->aEdit.pTextView; - BOOL bWasModified = pTextView->GetTextEngine()->IsModified(); - pTextView->GetTextEngine()->SetModified( FALSE ); + sal_Bool bWasModified = pTextView->GetTextEngine()->IsModified(); + pTextView->GetTextEngine()->SetModified( sal_False ); FontList aFontList( pFrame ); // Just some Window is needed Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); @@ -89,7 +89,7 @@ void AppEdit::LoadIniFile() String aFontStyle = String( aConf.ReadKey( "ScriptFontStyle", "normal" ), RTL_TEXTENCODING_UTF8 ); String aFontSize = String( aConf.ReadKey( "ScriptFontSize", "12" ), RTL_TEXTENCODING_UTF8 ); Font aFont = aFontList.Get( aFontName, aFontStyle ); - ULONG nFontSize = aFontSize.ToInt32(); + sal_uIntPtr nFontSize = aFontSize.ToInt32(); aFont.SetHeight( nFontSize ); #if OSL_DEBUG_LEVEL > 1 @@ -97,7 +97,7 @@ void AppEdit::LoadIniFile() Font aFont2( OutputDevice::GetDefaultFont( DEFAULTFONT_FIXED, Application::GetSettings().GetUILanguage(), 0, pFrame )); } #endif - aFont.SetTransparent( FALSE ); + aFont.SetTransparent( sal_False ); pDataEdit->SetFont( aFont ); if ( ((TextEdit*)pDataEdit)->GetBreakpointWindow() ) @@ -176,7 +176,7 @@ void AppEdit::SetScrollBarRanges() -USHORT AppEdit::GetLineNr() +sal_uInt16 AppEdit::GetLineNr() { return pDataEdit->GetLineNr(); } @@ -193,14 +193,14 @@ long AppEdit::InitMenu( Menu* pMenu ) if( pDataEdit ) { - USHORT UndoCount = ((TextEdit*)pDataEdit)->aEdit.pTextEngine->GetUndoManager().GetUndoActionCount(); - USHORT RedoCount = ((TextEdit*)pDataEdit)->aEdit.pTextEngine->GetUndoManager().GetRedoActionCount(); + size_t UndoCount = ((TextEdit*)pDataEdit)->aEdit.pTextEngine->GetUndoManager().GetUndoActionCount(); + size_t RedoCount = ((TextEdit*)pDataEdit)->aEdit.pTextEngine->GetUndoManager().GetRedoActionCount(); pMenu->EnableItem( RID_EDITUNDO, UndoCount > 0 ); pMenu->EnableItem( RID_EDITREDO, RedoCount > 0 ); } - return TRUE; + return sal_True; } long AppEdit::DeInitMenu( Menu* pMenu ) @@ -210,7 +210,7 @@ long AppEdit::DeInitMenu( Menu* pMenu ) pMenu->EnableItem( RID_EDITUNDO ); pMenu->EnableItem( RID_EDITREDO ); - return TRUE; + return sal_True; } void AppEdit::Resize() @@ -225,7 +225,7 @@ void AppEdit::Resize() if ( pHScroll ) { rHSize = pHScroll->GetSizePixel(); - ULONG nHieght = rHSize.Height(); + sal_uIntPtr nHieght = rHSize.Height(); rNewSize.Height() -= nHieght; rHStart.Y() = rNewSize.Height(); } @@ -233,7 +233,7 @@ void AppEdit::Resize() if ( pVScroll ) { rVSize = pVScroll->GetSizePixel(); - ULONG nWidth = rVSize.Width(); + sal_uIntPtr nWidth = rVSize.Width(); rNewSize.Width() -= nWidth; rVStart.X() = rNewSize.Width(); } @@ -284,7 +284,7 @@ void AppEdit::PostSaveAs() { } -void AppEdit::Highlight( USHORT nLine, USHORT nCol1, USHORT nCol2 ) +void AppEdit::Highlight( sal_uInt16 nLine, sal_uInt16 nCol1, sal_uInt16 nCol2 ) { ((TextEdit*)pDataEdit)->Highlight( nLine, nCol1, nCol2 ); ToTop(); diff --git a/basic/source/app/appedit.hxx b/basic/source/app/appedit.hxx index 2399d42a54ed..67cb4337c6b0 100644..100755 --- a/basic/source/app/appedit.hxx +++ b/basic/source/app/appedit.hxx @@ -43,7 +43,7 @@ public: ScrollBar *pVScroll; ScrollBar *pHScroll; void SetScrollBarRanges(); - ULONG nCurTextWidth; + sal_uIntPtr nCurTextWidth; private: void InitScrollBars(); protected: @@ -52,7 +52,7 @@ public: TYPEINFO(); AppEdit( BasicFrame* ); ~AppEdit(); - USHORT GetLineNr(); // Current line number + sal_uInt16 GetLineNr(); // Current line number FileType GetFileType(); // Returns the file type virtual long InitMenu( Menu* ); // Inits the menu virtual long DeInitMenu( Menu* ); // Reset to enable all Shortcuts @@ -61,8 +61,8 @@ public: void PostLoad(); void PostSaveAs(); void Mark( short, short, short ); // Select text - void Highlight( USHORT nLine, USHORT nCol1, USHORT nCol2 ); - virtual BOOL ReloadAllowed(){ return !StarBASIC::IsRunning(); } + void Highlight( sal_uInt16 nLine, sal_uInt16 nCol1, sal_uInt16 nCol2 ); + virtual sal_Bool ReloadAllowed(){ return !StarBASIC::IsRunning(); } virtual void LoadIniFile(); // (re)load ini file after change }; diff --git a/basic/source/app/apperror.cxx b/basic/source/app/apperror.cxx index cd5bc34b39a8..48781eab1767 100644..100755 --- a/basic/source/app/apperror.cxx +++ b/basic/source/app/apperror.cxx @@ -64,10 +64,10 @@ long AppError::InitMenu( Menu* pMenu ) { AppWin::InitMenu (pMenu ); - pMenu->EnableItem( RID_EDITUNDO, FALSE ); - pMenu->EnableItem( RID_EDITREDO, FALSE ); + pMenu->EnableItem( RID_EDITUNDO, sal_False ); + pMenu->EnableItem( RID_EDITREDO, sal_False ); - return TRUE; + return sal_True; } long AppError::DeInitMenu( Menu* pMenu ) @@ -77,10 +77,10 @@ long AppError::DeInitMenu( Menu* pMenu ) pMenu->EnableItem( RID_EDITUNDO ); pMenu->EnableItem( RID_EDITREDO ); - return TRUE; + return sal_True; } -USHORT AppError::GetLineNr(){ return pDataEdit->GetLineNr(); } +sal_uInt16 AppError::GetLineNr(){ return pDataEdit->GetLineNr(); } FileType AppError::GetFileType() { @@ -102,12 +102,12 @@ void AppError::LoadIniFile() String aFontStyle = String( aConf.ReadKey( "ScriptFontStyle", "normal" ), RTL_TEXTENCODING_UTF8 ); String aFontSize = String( aConf.ReadKey( "ScriptFontSize", "12" ), RTL_TEXTENCODING_UTF8 ); Font aFont = aFontList.Get( aFontName, aFontStyle ); -// ULONG nFontSize = aFontSize.GetValue( FUNIT_POINT ); - ULONG nFontSize = aFontSize.ToInt32(); +// sal_uIntPtr nFontSize = aFontSize.GetValue( FUNIT_POINT ); + sal_uIntPtr nFontSize = aFontSize.ToInt32(); // aFont.SetSize( Size( nFontSize, nFontSize ) ); aFont.SetHeight( nFontSize ); - aFont.SetTransparent( FALSE ); + aFont.SetTransparent( sal_False ); // aFont.SetAlign( ALIGN_BOTTOM ); // aFont.SetHeight( aFont.GetHeight()+2 ); pDataEdit->SetFont( aFont ); diff --git a/basic/source/app/apperror.hxx b/basic/source/app/apperror.hxx index 9dedf5c428aa..c55015a1964d 100644..100755 --- a/basic/source/app/apperror.hxx +++ b/basic/source/app/apperror.hxx @@ -40,10 +40,10 @@ public: // long Command( short nID ); virtual long InitMenu( Menu* ); virtual long DeInitMenu( Menu* ); - USHORT GetLineNr(); + sal_uInt16 GetLineNr(); FileType GetFileType(); MsgEdit* GetMsgTree() { return ((MsgEdit*)pDataEdit); } - virtual BOOL ReloadAllowed(){ return !StarBASIC::IsRunning(); } + virtual sal_Bool ReloadAllowed(){ return !StarBASIC::IsRunning(); } virtual void LoadIniFile(); // (re)load ini file after change DirEntry aBaseDir; }; diff --git a/basic/source/app/appwin.cxx b/basic/source/app/appwin.cxx index e39d6c8e95b3..984637af5178 100644..100755 --- a/basic/source/app/appwin.cxx +++ b/basic/source/app/appwin.cxx @@ -51,10 +51,10 @@ TYPEINIT0(AppWin); AppWin::AppWin( BasicFrame* pParent ) : DockingWindow( pParent, WB_SIZEMOVE | WB_CLOSEABLE | WB_PINABLE ) , nSkipReload(0) -, bHasFile( FALSE ) -, bReloadAborted( FALSE ) +, bHasFile( sal_False ) +, bReloadAborted( sal_False ) , pFrame( pParent ) -, bFind( TRUE ) +, bFind( sal_True ) , pDataEdit(NULL) { // Load the Untitled string if not yet loaded @@ -63,7 +63,7 @@ AppWin::AppWin( BasicFrame* pParent ) nCount++; // Get maximized state from current window - USHORT nInitialWinState; + sal_uInt16 nInitialWinState; if ( pFrame->pWork ) { nInitialWinState = pFrame->pWork->GetWinState(); @@ -97,7 +97,7 @@ void AppWin::SetText( const XubString& rStr ) pFrame->WindowRenamed( this ); } -void AppWin::TitleButtonClick( USHORT nButton ) +void AppWin::TitleButtonClick( sal_uInt16 nButton ) { if ( TITLE_BUTTON_DOCKING == nButton ) if ( TT_WIN_STATE_MAX != nWinState ) @@ -105,7 +105,7 @@ void AppWin::TitleButtonClick( USHORT nButton ) else Restore(); else // if ( TITLE_BUTTON_HIDE == nButton ) - Minimize( TRUE ); + Minimize( sal_True ); } void AppWin::Maximize() @@ -115,7 +115,7 @@ void AppWin::Maximize() nNormalPos = GetPosPixel(); nNormalSize = GetSizePixel(); - SetFloatingMode( FALSE ); + SetFloatingMode( sal_False ); pFrame->nMaximizedWindows++; nWinState = TT_WIN_STATE_MAX; @@ -137,7 +137,7 @@ void AppWin::Maximize() void AppWin::Restore() { - SetFloatingMode( TRUE ); + SetFloatingMode( sal_True ); SetPosSizePixel( nNormalPos, nNormalSize ); if ( TT_WIN_STATE_MAX == nWinState ) @@ -147,7 +147,7 @@ void AppWin::Restore() pFrame->WinMax_Restore(); } -void AppWin::Minimize( BOOL bMinimize ) +void AppWin::Minimize( sal_Bool bMinimize ) { if ( bMinimize ) nWinState |= TT_WIN_STATE_HIDE; @@ -156,7 +156,7 @@ void AppWin::Minimize( BOOL bMinimize ) pFrame->WinMax_Restore(); } -void AppWin::Cascade( USHORT nNr ) +void AppWin::Cascade( sal_uInt16 nNr ) { Restore(); @@ -228,7 +228,7 @@ long AppWin::PreNotify( NotifyEvent& rNEvt ) if ( rNEvt.GetType() == EVENT_GETFOCUS ) if ( pFrame->pList->back() != this ) Activate(); - return FALSE; // Der event soll weiter verarbeitet werden + return sal_False; // Der event soll weiter verarbeitet werden } void AppWin::Activate() @@ -241,14 +241,14 @@ long AppWin::InitMenu( Menu* pMenu ) { ::rtl::OUString aTemp; - BOOL bMarked; + sal_Bool bMarked; if( pDataEdit ) { TextSelection r = pDataEdit->GetSelection(); bMarked = r.HasRange(); } else - bMarked = FALSE; + bMarked = sal_False; pMenu->EnableItem( RID_EDITREPEAT, (aFind.Len() != 0 ) ); pMenu->EnableItem( RID_EDITCUT, bMarked ); pMenu->EnableItem( RID_EDITCOPY, bMarked ); @@ -256,20 +256,20 @@ long AppWin::InitMenu( Menu* pMenu ) pMenu->EnableItem( RID_EDITDEL, bMarked ); // pMenu->EnableItem( RID_HELPTOPIC, bMarked ); - BOOL bHasText; + sal_Bool bHasText; if( pDataEdit ) bHasText = pDataEdit->HasText(); else - bHasText = FALSE; - BOOL bRunning = pFrame->Basic().IsRunning(); - BOOL bCanExecute = BOOL( (!bRunning && bHasText) || pFrame->bInBreak ); + bHasText = sal_False; + sal_Bool bRunning = pFrame->Basic().IsRunning(); + sal_Bool bCanExecute = sal_Bool( (!bRunning && bHasText) || pFrame->bInBreak ); pMenu->EnableItem( RID_RUNSTART, bCanExecute ); pMenu->EnableItem( RID_RUNBREAK, bRunning && !pFrame->bInBreak); pMenu->EnableItem( RID_RUNSTOP, bRunning ); pMenu->EnableItem( RID_RUNTOCURSOR, bCanExecute ); pMenu->EnableItem( RID_RUNSTEPINTO, bCanExecute ); pMenu->EnableItem( RID_RUNSTEPOVER, bCanExecute ); - return TRUE; + return sal_True; } long AppWin::DeInitMenu( Menu* pMenu ) @@ -286,7 +286,7 @@ long AppWin::DeInitMenu( Menu* pMenu ) pMenu->EnableItem( RID_RUNTOCURSOR ); pMenu->EnableItem( RID_RUNSTEPINTO ); pMenu->EnableItem( RID_RUNSTEPOVER ); - return TRUE; + return sal_True; } // Menu Handler @@ -294,7 +294,7 @@ long AppWin::DeInitMenu( Menu* pMenu ) void AppWin::Command( const CommandEvent& rCEvt ) { TextSelection r = pDataEdit->GetSelection(); - BOOL bHasMark = r.HasRange(); + sal_Bool bHasMark = r.HasRange(); switch( rCEvt.GetCommand() ) { case RID_FILESAVE: QuerySave( QUERY_DISK_CHANGED | SAVE_NOT_DIRTY ); break; @@ -336,7 +336,7 @@ void AppWin::Command( const CommandEvent& rCEvt ) pDataEdit->BuildKontextMenu( pKontext ); if ( pKontext ) { - USHORT nRes = pKontext->Execute( this, GetPointerPosPixel() ); + sal_uInt16 nRes = pKontext->Execute( this, GetPointerPosPixel() ); if ( nRes ) pFrame->Command( nRes ); delete pKontext; @@ -347,12 +347,12 @@ void AppWin::Command( const CommandEvent& rCEvt ) } -BOOL AppWin::IsSkipReload() +sal_Bool AppWin::IsSkipReload() { return nSkipReload != 0; } -void AppWin::SkipReload( BOOL bSkip ) +void AppWin::SkipReload( sal_Bool bSkip ) { DBG_ASSERT( bSkip || nSkipReload, "SkipReload aufgehoben ohne es zu aktivieren"); if ( bSkip ) @@ -361,17 +361,17 @@ void AppWin::SkipReload( BOOL bSkip ) nSkipReload--; } -BOOL AppWin::DiskFileChanged( USHORT nWhat ) +sal_Bool AppWin::DiskFileChanged( sal_uInt16 nWhat ) { if ( !bHasFile ) - return FALSE; + return sal_False; switch ( nWhat ) { case SINCE_LAST_LOAD: { if ( bReloadAborted ) - return TRUE; + return sal_True; else return DiskFileChanged( SINCE_LAST_ASK_RELOAD ); } @@ -392,16 +392,16 @@ BOOL AppWin::DiskFileChanged( USHORT nWhat ) default: OSL_FAIL("Not Implemented in AppWin::DiskFileChanged"); } - return TRUE; + return sal_True; } -void AppWin::UpdateFileInfo( USHORT nWhat ) +void AppWin::UpdateFileInfo( sal_uInt16 nWhat ) { switch ( nWhat ) { case HAS_BEEN_LOADED: { - bReloadAborted = FALSE; + bReloadAborted = sal_False; UpdateFileInfo( ASKED_RELOAD ); } @@ -446,7 +446,7 @@ void AppWin::CheckReload() } else { - bReloadAborted = TRUE; + bReloadAborted = sal_True; } } } @@ -457,14 +457,14 @@ void AppWin::Reload() TextSelection aSelMemo = pDataEdit->GetSelection(); Load( GetText() ); pDataEdit->SetSelection( aSelMemo ); - SkipReload( FALSE ); + SkipReload( sal_False ); } // Load file -BOOL AppWin::Load( const String& aName ) +sal_Bool AppWin::Load( const String& aName ) { SkipReload(); - BOOL bErr; + sal_Bool bErr; // if( !QuerySave() ) // return; @@ -493,17 +493,17 @@ BOOL AppWin::Load( const String& aName ) SetText( aModName ); UpdateFileInfo( HAS_BEEN_LOADED ); PostLoad(); - bHasFile = TRUE; + bHasFile = sal_True; } - SkipReload( FALSE ); + SkipReload( sal_False ); return !bErr; } // Save file -USHORT AppWin::ImplSave() +sal_uInt16 AppWin::ImplSave() { SkipReload(); - USHORT nResult = SAVE_RES_NOT_SAVED; + sal_uInt16 nResult = SAVE_RES_NOT_SAVED; String s1 = *pNoName; String s2 = GetText().Copy( 0, s1.Len() ); if( s1 == s2 ) @@ -513,7 +513,7 @@ USHORT AppWin::ImplSave() if ( pDataEdit->Save( aName ) ) { nResult = SAVE_RES_SAVED; - bHasFile = TRUE; + bHasFile = sal_True; } else { @@ -522,38 +522,38 @@ USHORT AppWin::ImplSave() } UpdateFileInfo( HAS_BEEN_LOADED ); } - SkipReload( FALSE ); + SkipReload( sal_False ); return nResult; } // Save to new file name -USHORT AppWin::SaveAs() +sal_uInt16 AppWin::SaveAs() { SkipReload(); String s1 = *pNoName; String s2 = GetText().Copy( 0, s1.Len() ); if( s1 == s2 ) s2.Erase(); else s2 = GetText(); - if( pFrame->QueryFileName( s2, GetFileType(), TRUE ) ) + if( pFrame->QueryFileName( s2, GetFileType(), sal_True ) ) { SetText( s2 ); PostSaveAs(); - SkipReload( FALSE ); + SkipReload( sal_False ); return ImplSave(); } else { - SkipReload( FALSE ); + SkipReload( sal_False ); return SAVE_RES_CANCEL; } } // Should we save the file? -USHORT AppWin::QuerySave( QueryBits nBits ) +sal_uInt16 AppWin::QuerySave( QueryBits nBits ) { - BOOL bQueryDirty = ( nBits & QUERY_DIRTY ) != 0; - BOOL bQueryDiskChanged = ( nBits & QUERY_DISK_CHANGED ) != 0; - BOOL bSaveNotDirty = ( nBits & SAVE_NOT_DIRTY ) != 0; + sal_Bool bQueryDirty = ( nBits & QUERY_DIRTY ) != 0; + sal_Bool bQueryDiskChanged = ( nBits & QUERY_DISK_CHANGED ) != 0; + sal_Bool bSaveNotDirty = ( nBits & SAVE_NOT_DIRTY ) != 0; SkipReload(); short nResult; @@ -562,8 +562,8 @@ USHORT AppWin::QuerySave( QueryBits nBits ) else nResult = RET_NO; - BOOL bAlwaysEnableInput = pFrame->IsAlwaysEnableInput(); - pFrame->AlwaysEnableInput( FALSE ); + sal_Bool bAlwaysEnableInput = pFrame->IsAlwaysEnableInput(); + pFrame->AlwaysEnableInput( sal_False ); if( ( ( IsModified() || bSaveNotDirty ) && bQueryDirty ) || ( DiskFileChanged( SINCE_LAST_LOAD ) && bQueryDiskChanged ) ) { ToTop(); @@ -577,7 +577,7 @@ USHORT AppWin::QuerySave( QueryBits nBits ) } pFrame->AlwaysEnableInput( bAlwaysEnableInput ); - USHORT nReturn; + sal_uInt16 nReturn; switch( nResult ) { case RET_YES: @@ -593,11 +593,11 @@ USHORT AppWin::QuerySave( QueryBits nBits ) OSL_FAIL("switch default where no default should be: Internal error"); nReturn = SAVE_RES_CANCEL; } - SkipReload( FALSE ); + SkipReload( sal_False ); return nReturn; } -BOOL AppWin::Close() +sal_Bool AppWin::Close() { switch ( QuerySave( QUERY_DIRTY ) ) { @@ -606,21 +606,21 @@ BOOL AppWin::Close() { DockingWindow::Close(); delete this; - return TRUE; + return sal_True; } // uncomment to avoid compiler warning // break; case SAVE_RES_ERROR: - return FALSE; + return sal_False; // uncomment to avoid compiler warning // break; case SAVE_RES_CANCEL: - return FALSE; + return sal_False; // uncomment to avoid compiler warning // break; default: OSL_FAIL("Not Implemented in AppWin::Close"); - return FALSE; + return sal_False; } } @@ -630,7 +630,7 @@ void AppWin::Find() SttResId aResId( IDD_FIND_DIALOG ); FindDialog aDlg( this, aResId, aFind ); if( aDlg.Execute() ) { - bFind = TRUE; + bFind = sal_True; Repeat(); } } @@ -642,7 +642,7 @@ void AppWin::Replace() ReplaceDialog* pDlg = new ReplaceDialog (this, aResId, aFind, aReplace ); if( pDlg->Execute() ) { - bFind = FALSE; + bFind = sal_False; Repeat(); } } @@ -650,7 +650,7 @@ void AppWin::Replace() // Repeat search/replace operation void AppWin::Repeat() { - if( (aFind.Len() != 0 ) && ( pDataEdit->Find( aFind ) || (ErrorBox(this,SttResId(IDS_PATTERNNOTFOUND)).Execute() && FALSE) ) && !bFind ) + if( (aFind.Len() != 0 ) && ( pDataEdit->Find( aFind ) || (ErrorBox(this,SttResId(IDS_PATTERNNOTFOUND)).Execute() && sal_False) ) && !bFind ) pDataEdit->ReplaceSelected( aReplace ); } diff --git a/basic/source/app/appwin.hxx b/basic/source/app/appwin.hxx index 2add5e275d4e..e5a79e042d8b 100644..100755 --- a/basic/source/app/appwin.hxx +++ b/basic/source/app/appwin.hxx @@ -36,16 +36,16 @@ #include "dataedit.hxx" #include <vector> +typedef sal_uInt16 QueryBits; -typedef USHORT QueryBits; #define QUERY_NONE ( QueryBits ( 0x00 ) ) #define QUERY_DIRTY ( QueryBits ( 0x01 ) ) #define QUERY_DISK_CHANGED ( QueryBits ( 0x02 ) ) #define QUERY_ALL ( QUERY_DIRTY | QUERY_DISK_CHANGED ) #define SAVE_NOT_DIRTY ( QueryBits ( 0x04 ) ) -#define SAVE_RES_SAVED TRUE -#define SAVE_RES_NOT_SAVED FALSE +#define SAVE_RES_SAVED sal_True +#define SAVE_RES_NOT_SAVED sal_False #define SAVE_RES_ERROR 3 #define SAVE_RES_CANCEL 4 @@ -71,67 +71,67 @@ protected: static short nCount; // number of edit windows static String *pNoName; // "Untitled" FileStat aLastAccess; // Last access time of loaded file - USHORT nSkipReload; // Sometimes there must not be a reload - BOOL bHasFile; // Otherwise reload does not make sense - BOOL bReloadAborted; // Is set if reload was cancelled so that we can ask again wehn closing + sal_uInt16 nSkipReload; // Sometimes there must not be a reload + sal_Bool bHasFile; // Otherwise reload does not make sense + sal_Bool bReloadAborted; // Is set if reload was cancelled so that we can ask again wehn closing short nId; // ID-Nummer( "Unnamed n" ) BasicFrame* pFrame; // Parent-Window String aFind; // Search string String aReplace; // Replace string - BOOL bFind; // TRUE if search not replace + sal_Bool bFind; // sal_True if search not replace void RequestHelp( const HelpEvent& ); // Help handler void GetFocus(); // activate - virtual USHORT ImplSave(); // Save file - USHORT nWinState; // Maximized, Iconized or Normal + virtual sal_uInt16 ImplSave(); // Save file + sal_uInt16 nWinState; // Maximized, Iconized or Normal Point nNormalPos; // Position if normal Size nNormalSize; // Size if Normal virtual long PreNotify( NotifyEvent& rNEvt ); - USHORT nWinId; + sal_uInt16 nWinId; public: TYPEINFO(); AppWin( BasicFrame* ); ~AppWin(); DataEdit* pDataEdit; // Data area - virtual USHORT GetLineNr()=0; // Current line number + virtual sal_uInt16 GetLineNr()=0; // Current line number virtual long InitMenu( Menu* ); // Init of the menu virtual long DeInitMenu( Menu* ); // reset to enable all shortcuts virtual void Command( const CommandEvent& rCEvt ); // Command handler virtual void Resize(); virtual void Help(); - virtual BOOL Load( const String& ); // Load file + virtual sal_Bool Load( const String& ); // Load file virtual void PostLoad(){} // Set source at module - virtual USHORT SaveAs(); // Save file as + virtual sal_uInt16 SaveAs(); // Save file as virtual void PostSaveAs(){} virtual void Find(); // find text virtual void Replace(); // replace text virtual void Repeat(); // repeat find/replace - virtual BOOL Close(); // close window + virtual sal_Bool Close(); // close window virtual void Activate(); // window was activated virtual FileType GetFileType()=0; // returns the filetype - virtual BOOL ReloadAllowed(){ return TRUE; } + virtual sal_Bool ReloadAllowed(){ return sal_True; } virtual void Reload(); // Reload after change on disk virtual void LoadIniFile(){;} // (re)load ini file after change void CheckReload(); // Checks and asks if reload should performed - BOOL DiskFileChanged( USHORT nWhat ); // Checks file for changes - void UpdateFileInfo( USHORT nWhat ); // Remembers last file state - BOOL IsSkipReload(); // Should we test reload? - void SkipReload( BOOL bSkip = TRUE ); - USHORT GetWinState(){ return nWinState; } + sal_Bool DiskFileChanged( sal_uInt16 nWhat ); // Checks file for changes + void UpdateFileInfo( sal_uInt16 nWhat ); // Remembers last file state + sal_Bool IsSkipReload(); // Should we test reload? + void SkipReload( sal_Bool bSkip = sal_True ); + sal_uInt16 GetWinState(){ return nWinState; } void Maximize(); void Restore(); - void Minimize( BOOL bMinimize ); - void Cascade( USHORT nNr ); + void Minimize( sal_Bool bMinimize ); + void Cascade( sal_uInt16 nNr ); - USHORT QuerySave( QueryBits nBits = QUERY_ALL ); - BOOL IsModified() { return pDataEdit->IsModified(); } + sal_uInt16 QuerySave( QueryBits nBits = QUERY_ALL ); + sal_Bool IsModified() { return pDataEdit->IsModified(); } BasicFrame* GetBasicFrame() { return pFrame; } - virtual void TitleButtonClick( USHORT nButton ); + virtual void TitleButtonClick( sal_uInt16 nButton ); virtual void SetText( const XubString& rStr ); - USHORT GetWinId() { return nWinId; } - void SetWinId( USHORT nWId ) { nWinId = nWId; } + sal_uInt16 GetWinId() { return nWinId; } + void SetWinId( sal_uInt16 nWId ) { nWinId = nWId; } }; typedef ::std::vector< AppWin* > EditList; diff --git a/basic/source/app/basic.hrc b/basic/source/app/basic.hrc index e4a69d9d2942..e4a69d9d2942 100644..100755 --- a/basic/source/app/basic.hrc +++ b/basic/source/app/basic.hrc diff --git a/basic/source/app/basic.src b/basic/source/app/basic.src index a879780e90ff..28cffcbae5b7 100644..100755 --- a/basic/source/app/basic.src +++ b/basic/source/app/basic.src @@ -29,6 +29,7 @@ #include "resids.hrc" ModalDialog RID_CALLDLG { + HelpID = "basic:ModalDialog:RID_CALLDLG"; PosSize = MAP_SYSFONT (18,18,142,142); SVLook = TRUE; MOVEABLE = TRUE; @@ -43,11 +44,13 @@ ModalDialog RID_CALLDLG { PosSize = MAP_SYSFONT (10,70,120,8); }; Edit RID_RETVAL { + HelpID = "basic:Edit:RID_CALLDLG:RID_RETVAL"; PosSize = MAP_SYSFONT (10,85,120,12); Border = TRUE; TabStop = TRUE; }; ListBox RID_PARAMS { + HelpID = "basic:ListBox:RID_CALLDLG:RID_PARAMS"; PosSize = MAP_SYSFONT (10,25,120,40); TabStop = TRUE; Border = TRUE; @@ -61,6 +64,7 @@ ModalDialog RID_CALLDLG { }; ModalDialog IDD_ABOUT_DIALOG { + HelpID = "basic:ModalDialog:IDD_ABOUT_DIALOG"; Pos = MAP_APPFONT( 58, 17 ); Size = MAP_APPFONT( 155, 106 ); SVLook = TRUE; @@ -107,6 +111,7 @@ ModalDialog IDD_ABOUT_DIALOG { }; ModalDialog IDD_TT_ABOUT_DIALOG { + HelpID = "basic:ModalDialog:IDD_TT_ABOUT_DIALOG"; Pos = MAP_APPFONT( 58, 17 ); Size = MAP_APPFONT( 120, 81 ); SVLook = TRUE; @@ -138,6 +143,7 @@ ModalDialog IDD_TT_ABOUT_DIALOG { }; ModalDialog IDD_FIND_DIALOG { + HelpID = "basic:ModalDialog:IDD_FIND_DIALOG"; Pos = MAP_APPFONT( 69, 30 ); Size = MAP_APPFONT( 185, 70 ); SVLook = TRUE; @@ -150,6 +156,7 @@ ModalDialog IDD_FIND_DIALOG { TEXT[ en-US ] = "~Text"; }; Edit RID_FIND { + HelpID = "basic:Edit:IDD_FIND_DIALOG:RID_FIND"; BORDER = TRUE; Pos = MAP_APPFONT( 40, 8 ); Size = MAP_APPFONT( 135, 12 ); @@ -172,6 +179,7 @@ ModalDialog IDD_FIND_DIALOG { }; ModalDialog IDD_REPLACE_DIALOG { + HelpID = "basic:ModalDialog:IDD_REPLACE_DIALOG"; Pos = MAP_APPFONT( 69, 30 ); Size = MAP_APPFONT( 185, 88 ); SVLook = TRUE; @@ -188,12 +196,14 @@ ModalDialog IDD_REPLACE_DIALOG { TEXT[ en-US ] = "~Replace by"; }; Edit RID_FIND { + HelpID = "basic:Edit:IDD_REPLACE_DIALOG:RID_FIND"; BORDER = TRUE; Pos = MAP_APPFONT( 65, 8 ); Size = MAP_APPFONT( 110, 12 ); TABSTOP = TRUE; }; Edit RID_REPLACE { + HelpID = "basic:Edit:IDD_REPLACE_DIALOG:RID_REPLACE"; BORDER = TRUE; Pos = MAP_APPFONT( 65, 28 ); Size = MAP_APPFONT( 110, 12 ); @@ -718,6 +728,7 @@ Menu RID_HELP { }; }; ModelessDialog IDD_PRINT_DIALOG { + HelpID = "basic:ModelessDialog:IDD_PRINT_DIALOG"; Pos = MAP_APPFONT( 83, 42 ); Size = MAP_APPFONT( 171, 94 ); MOVEABLE = TRUE; @@ -784,6 +795,7 @@ TabDialog IDD_OPTIONS_DLG TabPage RID_TP_GENERIC { + HelpID = "basic:TabPage:RID_TP_GENERIC"; Hide = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT( 244, 100 ); @@ -793,6 +805,7 @@ TabPage RID_TP_GENERIC { Text[ en-US ] = "Area"; }; ComboBox RID_CB_AREA { + HelpID = "basic:ComboBox:RID_TP_GENERIC:RID_CB_AREA"; HScroll = TRUE; VScroll = TRUE; AutoHScroll = TRUE; @@ -803,12 +816,14 @@ TabPage RID_TP_GENERIC { DropDown = TRUE; }; PushButton RID_PB_NEW_AREA { + HelpID = "basic:PushButton:RID_TP_GENERIC:RID_PB_NEW_AREA"; Pos = MAP_APPFONT( 144, 12 ); Size = MAP_APPFONT( 40, 12 ); TabStop = TRUE; Text[ en-US ] = "New"; }; PushButton RID_PD_DEL_AREA { + HelpID = "basic:PushButton:RID_TP_GENERIC:RID_PD_DEL_AREA"; Pos = MAP_APPFONT( 188, 12 ); Size = MAP_APPFONT( 40, 12 ); TabStop = TRUE; @@ -820,6 +835,7 @@ TabPage RID_TP_GENERIC { Text[ en-US ] = "Setting"; }; ComboBox RID_CB_VALUE { + HelpID = "basic:ComboBox:RID_TP_GENERIC:RID_CB_VALUE"; HScroll = TRUE; VScroll = TRUE; AutoHScroll = TRUE; @@ -829,6 +845,7 @@ TabPage RID_TP_GENERIC { TabStop = TRUE; }; PushButton RID_PB_SELECT_FILE { + HelpID = "basic:PushButton:RID_TP_GENERIC:RID_PB_SELECT_FILE"; Pos = MAP_APPFONT( 188, 48 ); Size = MAP_APPFONT( 40, 12 ); TabStop = TRUE; @@ -837,12 +854,14 @@ TabPage RID_TP_GENERIC { Hide = TRUE; }; PushButton RID_PB_NEW_VALUE { + HelpID = "basic:PushButton:RID_TP_GENERIC:RID_PB_NEW_VALUE"; Pos = MAP_APPFONT( 188, 48 ); Size = MAP_APPFONT( 40, 12 ); TabStop = TRUE; Text[ en-US ] = "New"; }; PushButton RID_PB_DEL_VALUE { + HelpID = "basic:PushButton:RID_TP_GENERIC:RID_PB_DEL_VALUE"; Pos = MAP_APPFONT( 188, 64 ); Size = MAP_APPFONT( 40, 12 ); TabStop = TRUE; @@ -852,6 +871,7 @@ TabPage RID_TP_GENERIC { TabPage RID_TP_PROFILE { + HelpID = "basic:TabPage:RID_TP_PROFILE"; Hide = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT( 244, 100 ); @@ -861,6 +881,7 @@ TabPage RID_TP_PROFILE { Text[ en-US ] = "Profile"; }; ComboBox RID_CB_PROFILE { + HelpID = "basic:ComboBox:RID_TP_PROFILE:RID_CB_PROFILE"; HScroll = TRUE; VScroll = TRUE; AutoHScroll = TRUE; @@ -871,12 +892,14 @@ TabPage RID_TP_PROFILE { DropDown = TRUE; }; PushButton RID_PB_NEW_PROFILE { + HelpID = "basic:PushButton:RID_TP_PROFILE:RID_PB_NEW_PROFILE"; Pos = MAP_APPFONT( 144, 2 ); Size = MAP_APPFONT( 40, 12 ); TabStop = TRUE; Text[ en-US ] = "New"; }; PushButton RID_PD_DEL_PROFILE { + HelpID = "basic:PushButton:RID_TP_PROFILE:RID_PD_DEL_PROFILE"; Pos = MAP_APPFONT( 188, 2 ); Size = MAP_APPFONT( 40, 12 ); TabStop = TRUE; @@ -898,6 +921,7 @@ TabPage RID_TP_PROFILE { Text[ en-US ] = "Base directory"; }; CheckBox HID_CHECK { + HelpID = "basic:CheckBox:RID_TP_PROFILE:HID_CHECK"; Pos = MAP_APPFONT( 7, 58 ); Size = MAP_APPFONT( 86, 12 ); Text[ en-US ] = "Default HID directory"; @@ -905,52 +929,61 @@ TabPage RID_TP_PROFILE { Hide = FALSE; }; Edit LOG_NAME { + HelpID = "basic:Edit:RID_TP_PROFILE:LOG_NAME"; Border = TRUE; Pos = MAP_APPFONT( 97, 26 ); Size = MAP_APPFONT( 116, 12 ); TabStop = TRUE; }; Edit BASIS_NAME { + HelpID = "basic:Edit:RID_TP_PROFILE:BASIS_NAME"; Border = TRUE; Pos = MAP_APPFONT( 97, 42 ); Size = MAP_APPFONT( 116, 12 ); TabStop = TRUE; }; Edit HID_NAME { + HelpID = "basic:Edit:RID_TP_PROFILE:HID_NAME"; Border = TRUE; Pos = MAP_APPFONT( 97, 58 ); Size = MAP_APPFONT( 116, 12 ); TabStop = TRUE; }; PushButton LOG_SET { + HelpID = "basic:PushButton:RID_TP_PROFILE:LOG_SET"; Pos = MAP_APPFONT( 217, 26 ); Size = MAP_APPFONT( 12, 12 ); TabStop = TRUE; Text[ en-US ] = "..."; }; PushButton BASIS_SET { + HelpID = "basic:PushButton:RID_TP_PROFILE:BASIS_SET"; Pos = MAP_APPFONT( 217, 42 ); Size = MAP_APPFONT( 12, 12 ); TabStop = TRUE; Text[ en-US ] = "..."; }; PushButton HID_SET { + HelpID = "basic:PushButton:RID_TP_PROFILE:HID_SET"; Pos = MAP_APPFONT( 217, 58 ); Size = MAP_APPFONT( 12, 12 ); TabStop = TRUE; Text[ en-US ] = "..."; }; CheckBox CB_AUTORELOAD { + HelpID = "basic:CheckBox:RID_TP_PROFILE:CB_AUTORELOAD"; Pos = MAP_APPFONT( 7, 74 ); Size = MAP_APPFONT( 115, 12 ); Text[ en-US ] = "AutoReload"; }; CheckBox CB_AUTOSAVE { + HelpID = "basic:CheckBox:RID_TP_PROFILE:CB_AUTOSAVE"; Pos = MAP_APPFONT( 7, 87 ); Size = MAP_APPFONT( 115, 12 ); Text[ en-US ] = "Save before execute"; }; CheckBox CB_STOPONSYNTAXERRORS { + HelpID = "basic:CheckBox:RID_TP_PROFILE:CB_STOPONSYNTAXERRORS"; Pos = MAP_APPFONT( 132, 74 ); Size = MAP_APPFONT( 115, 12 ); Text[ en-US ] = "Stop on Syntax Errors"; @@ -958,6 +991,7 @@ TabPage RID_TP_PROFILE { }; TabPage RID_TP_CRASH { + HelpID = "basic:TabPage:RID_TP_CRASH"; Hide = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT( 244, 100 ); @@ -967,6 +1001,7 @@ TabPage RID_TP_CRASH { Text[ en-US ] = "Crashreport"; }; CheckBox CB_USEPROXY { + HelpID = "basic:CheckBox:RID_TP_CRASH:CB_USEPROXY"; Pos = MAP_APPFONT( 8, 12 ); Size = MAP_APPFONT( 120, 12 ); Text[ en-US ] = "Use Proxy"; @@ -977,6 +1012,7 @@ TabPage RID_TP_CRASH { Text[ en-US ] = "Host"; }; Edit ED_CRHOST { + HelpID = "basic:Edit:RID_TP_CRASH:ED_CRHOST"; Border = TRUE; Pos = MAP_APPFONT( 43+12, 12+13 ); Size = MAP_APPFONT( 80, 12 ); @@ -988,6 +1024,7 @@ TabPage RID_TP_CRASH { Text[ en-US ] = "Port"; }; NumericField NF_CRPORT { + HelpID = "basic:NumericField:RID_TP_CRASH:NF_CRPORT"; Border = TRUE; Pos = MAP_APPFONT( 43+12, 12+13+16 ); Size = MAP_APPFONT( 40, 12 ); @@ -1001,6 +1038,7 @@ TabPage RID_TP_CRASH { Last = 0xffff; }; CheckBox CB_ALLOWCONTACT { + HelpID = "basic:CheckBox:RID_TP_CRASH:CB_ALLOWCONTACT"; Pos = MAP_APPFONT( 8, 12+13+16+16 ); Size = MAP_APPFONT( 120, 12 ); Text[ en-US ] = "Allow Contact"; @@ -1011,6 +1049,7 @@ TabPage RID_TP_CRASH { Text[ en-US ] = "EMail"; }; Edit ED_EMAIL { + HelpID = "basic:Edit:RID_TP_CRASH:ED_EMAIL"; Border = TRUE; Pos = MAP_APPFONT( 43+12, 12+13+16+16+13 ); Size = MAP_APPFONT( 80, 12 ); @@ -1020,6 +1059,7 @@ TabPage RID_TP_CRASH { TabPage RID_TP_MISC { + HelpID = "basic:TabPage:RID_TP_MISC"; Hide = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT( 244, 100 ); @@ -1034,6 +1074,7 @@ TabPage RID_TP_MISC { Text[ en-US ] = "Host"; }; Edit ED_HOST { + HelpID = "basic:Edit:RID_TP_MISC:ED_HOST"; Border = TRUE; Pos = MAP_APPFONT( 43, 12); Size = MAP_APPFONT( 80, 12 ); @@ -1045,6 +1086,7 @@ TabPage RID_TP_MISC { Text[ en-US ] = "Testtool Port"; }; NumericField NF_TTPORT { + HelpID = "basic:NumericField:RID_TP_MISC:NF_TTPORT"; Border = TRUE; Pos = MAP_APPFONT( 191, 12); Size = MAP_APPFONT( 40, 12 ); @@ -1063,6 +1105,7 @@ TabPage RID_TP_MISC { Text[ en-US ] = "Remote UNO Port"; }; NumericField NF_UNOPORT { + HelpID = "basic:NumericField:RID_TP_MISC:NF_UNOPORT"; Border = TRUE; Pos = MAP_APPFONT( 191, 12+15); Size = MAP_APPFONT( 40, 12 ); @@ -1087,6 +1130,7 @@ TabPage RID_TP_MISC { Text[ en-US ] = "Server Timeout"; }; TimeField SERVER_TIMEOUT { + HelpID = "basic:TimeField:RID_TP_MISC:SERVER_TIMEOUT"; Border = TRUE; Pos = MAP_APPFONT( 83, 50 ); Size = MAP_APPFONT( 40, 12 ); @@ -1102,6 +1146,7 @@ TabPage RID_TP_MISC { Text[ en-US ] = "Max LRU Files"; }; NumericField TF_MAX_LRU { + HelpID = "basic:NumericField:RID_TP_MISC:TF_MAX_LRU"; Border = TRUE; Pos = MAP_APPFONT( 191, 50); Size = MAP_APPFONT( 40, 12 ); @@ -1118,12 +1163,14 @@ TabPage RID_TP_MISC { Text[ en-US ] = "OOo Program Dir"; }; Edit ED_PROGDIR { + HelpID = "basic:Edit:RID_TP_MISC:ED_PROGDIR"; Border = TRUE; Pos = MAP_APPFONT( 83, 50+15 ); Size = MAP_APPFONT( 219-83-4, 12 ); TabStop = TRUE; }; PushButton PB_PROGDIR { + HelpID = "basic:PushButton:RID_TP_MISC:PB_PROGDIR"; Pos = MAP_APPFONT( 219, 50+15 ); Size = MAP_APPFONT( 12, 12 ); TabStop = TRUE; @@ -1133,6 +1180,7 @@ TabPage RID_TP_MISC { TabPage RID_TP_FONT { + HelpID = "basic:TabPage:RID_TP_FONT"; Hide = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT( 244, 100 ); @@ -1142,6 +1190,7 @@ TabPage RID_TP_FONT { Text[ en-US ] = "Type"; }; ComboBox CB_FONTNAME { + HelpID = "basic:ComboBox:RID_TP_FONT:CB_FONTNAME"; Pos = MAP_APPFONT( 4, 12 ); Size = MAP_APPFONT( 123, 12*4 ); Sort = TRUE; @@ -1153,6 +1202,7 @@ TabPage RID_TP_FONT { Text[ en-US ] = "Typeface"; }; ComboBox CB_FONTSTYLE { + HelpID = "basic:ComboBox:RID_TP_FONT:CB_FONTSTYLE"; Pos = MAP_APPFONT( 131, 12 ); Size = MAP_APPFONT( 65, 12*4 ); AutoHScroll = TRUE; @@ -1163,6 +1213,7 @@ TabPage RID_TP_FONT { Text[ en-US ] = "Size"; }; MetricBox MB_FONTSIZE { + HelpID = "basic:MetricBox:RID_TP_FONT:MB_FONTSIZE"; Pos = MAP_APPFONT( 200, 12 ); Size = MAP_APPFONT( 29, 12*4 ); AutoHScroll = TRUE; @@ -1178,6 +1229,7 @@ TabPage RID_TP_FONT { FloatingWindow IDD_DISPLAY_HID { + HelpID = "basic:FloatingWindow:IDD_DISPLAY_HID"; OutputSize = TRUE; SVLook = TRUE; Size = MAP_APPFONT( 261, 160 ); @@ -1204,6 +1256,7 @@ FloatingWindow IDD_DISPLAY_HID { Text[ en-US ] = "Controls"; }; MultiListBox RID_MLB_CONTROLS { + HelpID = "basic:MultiListBox:IDD_DISPLAY_HID:RID_MLB_CONTROLS"; Border = TRUE; AutoHScroll = TRUE; Pos = MAP_APPFONT( 4, 28 ); @@ -1216,6 +1269,7 @@ FloatingWindow IDD_DISPLAY_HID { Text[ en-US ] = "Slots"; }; MultiListBox RID_MLB_SLOTS { + HelpID = "basic:MultiListBox:IDD_DISPLAY_HID:RID_MLB_SLOTS"; Border = TRUE; AutoHScroll = TRUE; Pos = MAP_APPFONT( 4, 132 ); @@ -1223,12 +1277,14 @@ FloatingWindow IDD_DISPLAY_HID { TabStop = TRUE; }; PushButton RID_PB_KOPIEREN { + HelpID = "basic:PushButton:IDD_DISPLAY_HID:RID_PB_KOPIEREN"; Pos = MAP_APPFONT( 216, 28 ); Size = MAP_APPFONT( 40, 12 ); TabStop = TRUE; Text[ en-US ] = "Copy"; }; PushButton RID_PB_BENENNEN { + HelpID = "basic:PushButton:IDD_DISPLAY_HID:RID_PB_BENENNEN"; Pos = MAP_APPFONT( 216, 44 ); Size = MAP_APPFONT( 40, 12 ); TabStop = TRUE; @@ -1236,6 +1292,7 @@ FloatingWindow IDD_DISPLAY_HID { Text[ en-US ] = "Name"; }; PushButton RID_PB_SELECTALL { + HelpID = "basic:PushButton:IDD_DISPLAY_HID:RID_PB_SELECTALL"; Pos = MAP_APPFONT( 216, 44 ); Size = MAP_APPFONT( 40, 12 ); TabStop = TRUE; @@ -1356,6 +1413,7 @@ ImageList RID_IMGLST_LAYOUT }; ModelessDialog IDD_EDIT_VAR { + HelpID = "basic:ModelessDialog:IDD_EDIT_VAR"; Pos = MAP_APPFONT( 0, 0 ); Size = MAP_APPFONT( 171, 87 ); Moveable = TRUE; @@ -1386,6 +1444,7 @@ ModelessDialog IDD_EDIT_VAR { Text[ en-US ] = "Previous contents"; }; RadioButton RID_RB_NEW_BOOL_T { + HelpID = "basic:RadioButton:IDD_EDIT_VAR:RID_RB_NEW_BOOL_T"; Hide = TRUE; Pos = MAP_APPFONT( 53, 37 ); Size = MAP_APPFONT( 40, 12 ); @@ -1393,6 +1452,7 @@ ModelessDialog IDD_EDIT_VAR { Text[ en-US ] = "True"; }; RadioButton RID_RB_NEW_BOOL_F { + HelpID = "basic:RadioButton:IDD_EDIT_VAR:RID_RB_NEW_BOOL_F"; Hide = TRUE; Pos = MAP_APPFONT( 98, 37 ); Size = MAP_APPFONT( 40, 12 ); @@ -1400,6 +1460,7 @@ ModelessDialog IDD_EDIT_VAR { Text[ en-US ] = "False"; }; NumericField RID_NF_NEW_INTEGER { + HelpID = "basic:NumericField:IDD_EDIT_VAR:RID_NF_NEW_INTEGER"; Border = TRUE; Hide = TRUE; Pos = MAP_APPFONT( 53, 37 ); @@ -1414,6 +1475,7 @@ ModelessDialog IDD_EDIT_VAR { SpinSize = 10; }; NumericField RID_NF_NEW_LONG { + HelpID = "basic:NumericField:IDD_EDIT_VAR:RID_NF_NEW_LONG"; Border = TRUE; Hide = TRUE; Pos = MAP_APPFONT( 53, 37 ); @@ -1428,6 +1490,7 @@ ModelessDialog IDD_EDIT_VAR { SpinSize = 10; }; Edit RID_ED_NEW_STRING { + HelpID = "basic:Edit:IDD_EDIT_VAR:RID_ED_NEW_STRING"; Hide = TRUE; Border = TRUE; Pos = MAP_APPFONT( 53, 37 ); @@ -1449,6 +1512,7 @@ ModelessDialog IDD_EDIT_VAR { }; FloatingWindow LOAD_CONF { + HelpID = "basic:FloatingWindow:LOAD_CONF"; SVLook = TRUE; Pos = MAP_APPFONT( 66, 23 ); Size = MAP_APPFONT( 156, 51 ); diff --git a/basic/source/app/basicrt.cxx b/basic/source/app/basicrt.cxx index 1c540e48f825..bd1638587c13 100644..100755 --- a/basic/source/app/basicrt.cxx +++ b/basic/source/app/basicrt.cxx @@ -64,7 +64,7 @@ xub_StrLen BasicRuntime::GetCol2() return pRun->nCol2; } -BOOL BasicRuntime::IsRun() +sal_Bool BasicRuntime::IsRun() { return pRun->IsRun(); } @@ -118,17 +118,17 @@ bool BasicRuntimeAccess::HasRuntime() return pINST && pINST->pRun != NULL; } -USHORT BasicRuntimeAccess::GetStackEntryCount() +sal_uInt16 BasicRuntimeAccess::GetStackEntryCount() { return GetSbData()->pErrStack->Count(); } -BasicErrorStackEntry BasicRuntimeAccess::GetStackEntry( USHORT nIndex ) +BasicErrorStackEntry BasicRuntimeAccess::GetStackEntry( sal_uInt16 nIndex ) { return BasicErrorStackEntry( GetSbData()->pErrStack->GetObject( nIndex ) ); } -BOOL BasicRuntimeAccess::HasStack() +sal_Bool BasicRuntimeAccess::HasStack() { return GetSbData()->pErrStack != NULL; } @@ -139,7 +139,7 @@ void BasicRuntimeAccess::DeleteStack() GetSbData()->pErrStack = NULL; } -BOOL BasicRuntimeAccess::IsRunInit() +sal_Bool BasicRuntimeAccess::IsRunInit() { return GetSbData()->bRunInit; } diff --git a/basic/source/app/basmsg.hrc b/basic/source/app/basmsg.hrc index bfabe2c9759e..bfabe2c9759e 100644..100755 --- a/basic/source/app/basmsg.hrc +++ b/basic/source/app/basmsg.hrc diff --git a/basic/source/app/basmsg.src b/basic/source/app/basmsg.src index e2179afd4c34..e2179afd4c34 100644..100755 --- a/basic/source/app/basmsg.src +++ b/basic/source/app/basmsg.src diff --git a/basic/source/app/brkpnts.cxx b/basic/source/app/brkpnts.cxx index a09480c80dc3..134c5194b7aa 100644..100755 --- a/basic/source/app/brkpnts.cxx +++ b/basic/source/app/brkpnts.cxx @@ -57,7 +57,7 @@ BreakpointWindow::BreakpointWindow( Window *pParent ) , nCurYOffset( 0 ) , nMarkerPos( MARKER_NOMARKER ) , pModule( NULL ) -, bErrorMarker( FALSE ) +, bErrorMarker( sal_False ) { if ( !pImages ) pImages = new ImageList( SttResId( RID_IMGLST_LAYOUT ) ); @@ -81,7 +81,7 @@ void BreakpointWindow::Reset() void BreakpointWindow::SetModule( SbModule *pMod ) { pModule = pMod; - USHORT i; + sal_uInt16 i; for ( i=0 ; i < pModule->GetBPCount() ; i++ ) { InsertBreakpoint( pModule->GetBP( i ) ); @@ -97,13 +97,12 @@ void BreakpointWindow::SetBPsInModule() for ( size_t i = 0, n = BreakpointList.size(); i < n; ++i ) { Breakpoint* pBrk = BreakpointList[ i ]; - pModule->SetBP( (USHORT)pBrk->nLine ); + pModule->SetBP( (sal_uInt16)pBrk->nLine ); #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( !pModule->IsCompiled() || pModule->IsBP( (USHORT)pBrk->nLine ), "Brechpunkt wurde nicht gesetzt" ); + DBG_ASSERT( !pModule->IsCompiled() || pModule->IsBP( (sal_uInt16)pBrk->nLine ), "Brechpunkt wurde nicht gesetzt" ); #endif } - - for ( USHORT nMethod = 0; nMethod < pModule->GetMethods()->Count(); nMethod++ ) + for ( sal_uInt16 nMethod = 0; nMethod < pModule->GetMethods()->Count(); nMethod++ ) { SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Get( nMethod ); DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" ); @@ -146,7 +145,7 @@ void BreakpointWindow::InsertBreakpoint( sal_uInt32 nLine ) #endif if ( StarBASIC::IsRunning() ) { - for ( USHORT nMethod = 0; nMethod < pModule->GetMethods()->Count(); nMethod++ ) + for ( sal_uInt16 nMethod = 0; nMethod < pModule->GetMethods()->Count(); nMethod++ ) { SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Get( nMethod ); DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" ); @@ -226,7 +225,7 @@ void BreakpointWindow::LoadBreakpoints( String aFilename ) for ( i = 0 ; i < aBreakpoints.GetTokenCount( ';' ) ; i++ ) { - InsertBreakpoint( (USHORT)aBreakpoints.GetToken( i, ';' ).ToInt32() ); + InsertBreakpoint( (sal_uInt16)aBreakpoints.GetToken( i, ';' ).ToInt32() ); } } @@ -276,7 +275,7 @@ void BreakpointWindow::Paint( const Rectangle& ) sal_Int32 nY = nLine*nLineHeight - nCurYOffset; DrawImage( Point( 0, nY ) + aBmpOff, aBrk ); } - ShowMarker( TRUE ); + ShowMarker( sal_True ); } @@ -341,7 +340,7 @@ void BreakpointWindow::ShowMarker( bool bShow ) aMarkerOff.X() = ( aOutSz.Width() - aMarkerSz.Width() ) / 2; aMarkerOff.Y() = ( nLineHeight - aMarkerSz.Height() ) / 2; - ULONG nY = nMarkerPos*nLineHeight - nCurYOffset; + sal_uIntPtr nY = nMarkerPos*nLineHeight - nCurYOffset; Point aPos( 0, nY ); aPos += aMarkerOff; if ( bShow ) @@ -359,7 +358,7 @@ void BreakpointWindow::MouseButtonDown( const MouseEvent& rMEvt ) long nLineHeight = GetTextHeight(); long nYPos = aMousePos.Y() + nCurYOffset; long nLine = nYPos / nLineHeight + 1; - ToggleBreakpoint( sal::static_int_cast< USHORT >(nLine) ); + ToggleBreakpoint( sal::static_int_cast< sal_uInt16 >(nLine) ); Invalidate(); } } @@ -375,7 +374,7 @@ void BreakpointWindow::SetMarkerPos( sal_uInt32 nLine, bool bError ) } -void BreakpointWindow::Scroll( long nHorzScroll, long nVertScroll, USHORT nFlags ) +void BreakpointWindow::Scroll( long nHorzScroll, long nVertScroll, sal_uInt16 nFlags ) { (void) nFlags; /* avoid warning about unused parameter */ nCurYOffset -= nVertScroll; diff --git a/basic/source/app/brkpnts.hxx b/basic/source/app/brkpnts.hxx index 55abaf9b9bd9..0ea0fc9b45ad 100644..100755 --- a/basic/source/app/brkpnts.hxx +++ b/basic/source/app/brkpnts.hxx @@ -72,7 +72,7 @@ protected: public: void SetMarkerPos( sal_uInt32 nLine, bool bErrorMarker = false ); - virtual void Scroll( long nHorzScroll, long nVertScroll, USHORT nFlags = 0 ); + virtual void Scroll( long nHorzScroll, long nVertScroll, sal_uInt16 nFlags = 0 ); long& GetCurYOffset() { return nCurYOffset; } }; diff --git a/basic/source/app/dataedit.hxx b/basic/source/app/dataedit.hxx index 7f588b8a2619..60ab6626a85f 100644..100755 --- a/basic/source/app/dataedit.hxx +++ b/basic/source/app/dataedit.hxx @@ -42,9 +42,9 @@ class Font; #define DATA_FUNC_DEF( MemberName, MemberType ) \ public: \ MemberType MemberName; \ - BOOL Find( const String& rStr ); \ - BOOL Load( const String& rStr ); \ - BOOL Save( const String& rStr ); \ + sal_Bool Find( const String& rStr ); \ + sal_Bool Load( const String& rStr ); \ + sal_Bool Save( const String& rStr ); \ \ void GrabFocus(){ MemberName.GrabFocus(); } \ void Show(){ MemberName.Show(); } \ @@ -63,13 +63,13 @@ public: void Redo(); \ String GetText() const; \ void SetText( const String& rStr ); \ - BOOL HasText() const; \ + sal_Bool HasText() const; \ String GetSelected(); \ TextSelection GetSelection() const; \ void SetSelection( const TextSelection& rSelection ); \ - USHORT GetLineNr() const; \ + sal_uInt16 GetLineNr() const; \ void ReplaceSelected( const String& rStr ); \ - BOOL IsModified(); \ + sal_Bool IsModified(); \ void SetModifyHdl( Link l ); @@ -86,19 +86,19 @@ public: virtual void Undo()=0; virtual void Redo()=0; - virtual BOOL Find( const String& )=0; // Find and select text - virtual BOOL Load( const String& )=0; // Load text from file - virtual BOOL Save( const String& )=0; // Save text to file + virtual sal_Bool Find( const String& )=0; // Find and select text + virtual sal_Bool Load( const String& )=0; // Load text from file + virtual sal_Bool Save( const String& )=0; // Save text to file virtual String GetSelected()=0; virtual void GrabFocus()=0; virtual TextSelection GetSelection() const=0; virtual void SetSelection( const TextSelection& rSelection )=0; - virtual USHORT GetLineNr() const=0; + virtual sal_uInt16 GetLineNr() const=0; virtual String GetText() const=0; virtual void SetText( const String& rStr )=0; - virtual BOOL HasText() const=0; // to avoid GetText.Len() + virtual sal_Bool HasText() const=0; // to avoid GetText.Len() virtual void ReplaceSelected( const String& rStr )=0; - virtual BOOL IsModified()=0; + virtual sal_Bool IsModified()=0; virtual void SetModifyHdl( Link )=0; virtual void Show()=0; virtual void SetPosPixel( const Point& rNewPos )=0; diff --git a/basic/source/app/dialogs.cxx b/basic/source/app/dialogs.cxx index 178455cb9e77..dc8a57516b20 100644..100755 --- a/basic/source/app/dialogs.cxx +++ b/basic/source/app/dialogs.cxx @@ -95,9 +95,9 @@ IMPL_LINK_INLINE_START( FindDialog, ButtonClick, Button *, pB ) { if( pB == &aOk ) { *pFind = aFind.GetText(); - EndDialog( TRUE ); - } else EndDialog( FALSE ); - return TRUE; + EndDialog( sal_True ); + } else EndDialog( sal_False ); + return sal_True; } IMPL_LINK_INLINE_END( FindDialog, ButtonClick, Button *, pB ) @@ -125,9 +125,9 @@ IMPL_LINK( ReplaceDialog, ButtonClick, Button *, pB ) if( pB == &aOk ) { *pFind = aFind.GetText(); *pReplace = aReplace.GetText(); - EndDialog( TRUE ); - } else EndDialog( FALSE ); - return TRUE; + EndDialog( sal_True ); + } else EndDialog( sal_False ); + return sal_True; } //////////////////////////////////////////////////////////////////// @@ -150,7 +150,7 @@ void ConfEdit::Init( Config &aConf ) aEdit.SetText( aTemp ); } -ConfEdit::ConfEdit( Window* pParent, USHORT nResText, USHORT nResEdit, USHORT nResButton, const ByteString& aKN, Config &aConf ) +ConfEdit::ConfEdit( Window* pParent, sal_uInt16 nResText, sal_uInt16 nResEdit, sal_uInt16 nResButton, const ByteString& aKN, Config &aConf ) : PushButton( pParent, SttResId(nResButton) ) , aText( pParent, SttResId(nResText) ) , aEdit( pParent, SttResId(nResEdit) ) @@ -159,7 +159,7 @@ ConfEdit::ConfEdit( Window* pParent, USHORT nResText, USHORT nResEdit, USHORT nR Init( aConf ); } -ConfEdit::ConfEdit( Window* pParent, USHORT nResEdit, USHORT nResButton, const ByteString& aKN, Config &aConf ) +ConfEdit::ConfEdit( Window* pParent, sal_uInt16 nResEdit, sal_uInt16 nResButton, const ByteString& aKN, Config &aConf ) : PushButton( pParent, SttResId(nResButton) ) , aText( pParent ) , aEdit( pParent, SttResId(nResEdit) ) @@ -197,7 +197,7 @@ void ConfEdit::Click() } } -OptConfEdit::OptConfEdit( Window* pParent, USHORT nResCheck, USHORT nResEdit, USHORT nResButton, const ByteString& aKN, ConfEdit& rBaseEdit, Config& aConf ) +OptConfEdit::OptConfEdit( Window* pParent, sal_uInt16 nResCheck, sal_uInt16 nResEdit, sal_uInt16 nResButton, const ByteString& aKN, ConfEdit& rBaseEdit, Config& aConf ) : ConfEdit( pParent, nResEdit, nResButton, aKN, aConf ) , aCheck( pParent, SttResId( nResCheck ) ) , rBase( rBaseEdit ) @@ -247,7 +247,7 @@ OptionsDialog::OptionsDialog( Window* pParent, const ResId& aResId ) , aCancel( this ) , aConfig( Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ) ) { - aConfig.EnablePersistence( FALSE ); + aConfig.EnablePersistence( sal_False ); FreeResource(); aTabCtrl.SetActivatePageHdl( LINK( this, OptionsDialog, ActivatePageHdl ) ); aTabCtrl.SetCurPageId( RID_TP_PRO ); @@ -261,25 +261,25 @@ OptionsDialog::OptionsDialog( Window* pParent, const ResId& aResId ) OptionsDialog::~OptionsDialog() { - for ( USHORT i = 0; i < aTabCtrl.GetPageCount(); i++ ) + for ( sal_uInt16 i = 0; i < aTabCtrl.GetPageCount(); i++ ) delete aTabCtrl.GetTabPage( aTabCtrl.GetPageId( i ) ); }; -BOOL OptionsDialog::Close() +sal_Bool OptionsDialog::Close() { if ( TabDialog::Close() ) { delete this; - return TRUE; + return sal_True; } else - return FALSE; + return sal_False; } IMPL_LINK( OptionsDialog, ActivatePageHdl, TabControl *, pTabCtrl ) { - USHORT nId = pTabCtrl->GetCurPageId(); + sal_uInt16 nId = pTabCtrl->GetCurPageId(); // If TabPage was not yet created, do it if ( !pTabCtrl->GetTabPage( nId ) ) { @@ -349,7 +349,7 @@ IMPL_LINK( OptionsDialog, OKClick, Button *, pButton ) } const ByteString ProfilePrefix("_profile_"); -const USHORT ProfilePrefixLen = ProfilePrefix.Len(); +const sal_uInt16 ProfilePrefixLen = ProfilePrefix.Len(); ProfileOptions::ProfileOptions( Window* pParent, Config &rConfig ) : TabPage( pParent, SttResId( RID_TP_PROFILE ) ) @@ -371,7 +371,7 @@ ProfileOptions::ProfileOptions( Window* pParent, Config &rConfig ) { FreeResource(); - aCbProfile.EnableAutocomplete( TRUE ); + aCbProfile.EnableAutocomplete( sal_True ); aCbProfile.SetSelectHdl( LINK( this, ProfileOptions, Select ) ); @@ -386,7 +386,7 @@ ProfileOptions::ProfileOptions( Window* pParent, Config &rConfig ) void ProfileOptions::LoadData() { // collect all profiles (all groups starting with the ProfilePrefix) - for ( USHORT i = 0 ; i < rConf.GetGroupCount() ; i++ ) + for ( sal_uInt16 i = 0 ; i < rConf.GetGroupCount() ; i++ ) { ByteString aProfile = rConf.GetGroupName( i ); if ( aProfile.Match( ProfilePrefix ) ) @@ -507,7 +507,7 @@ CrashreportOptions::CrashreportOptions( Window* pParent, Config &aConfig ) { FreeResource(); - aNFCRPort.SetUseThousandSep( FALSE ); + aNFCRPort.SetUseThousandSep( sal_False ); ByteString aTemp; @@ -517,7 +517,7 @@ CrashreportOptions::CrashreportOptions( Window* pParent, Config &aConfig ) if ( aTemp.EqualsIgnoreCaseAscii( "true" ) || aTemp.Equals( "1" ) ) aCBUseProxy.Check(); else - aCBUseProxy.Check( FALSE ); + aCBUseProxy.Check( sal_False ); aCBUseProxy.SetToggleHdl( LINK( this, CrashreportOptions, CheckProxy ) ); LINK( this, CrashreportOptions, CheckProxy ).Call( NULL ); // call once to initialize @@ -532,7 +532,7 @@ CrashreportOptions::CrashreportOptions( Window* pParent, Config &aConfig ) if ( aTemp.EqualsIgnoreCaseAscii( "true" ) || aTemp.Equals( "1" ) ) aCBAllowContact.Check(); else - aCBAllowContact.Check( FALSE ); + aCBAllowContact.Check( sal_False ); aCBAllowContact.SetToggleHdl( LINK( this, CrashreportOptions, CheckResponse ) ); LINK( this, CrashreportOptions, CheckResponse ).Call( NULL ); // call once to initialize @@ -598,9 +598,9 @@ MiscOptions::MiscOptions( Window* pParent, Config &aConfig ) { FreeResource(); - aNFTTPort.SetUseThousandSep( FALSE ); - aNFUNOPort.SetUseThousandSep( FALSE ); - aTFMaxLRU.SetUseThousandSep( FALSE ); + aNFTTPort.SetUseThousandSep( sal_False ); + aNFUNOPort.SetUseThousandSep( sal_False ); + aTFMaxLRU.SetUseThousandSep( sal_False ); ByteString aTemp; @@ -648,8 +648,8 @@ void MiscOptions::Save( Config &aConfig ) aConfig.SetGroup("LRU"); ByteString aTemp = aConfig.ReadKey( "MaxLRU", "4" ); - USHORT nOldMaxLRU = (USHORT)aTemp.ToInt32(); - USHORT n; + sal_uInt16 nOldMaxLRU = (sal_uInt16)aTemp.ToInt32(); + sal_uInt16 n; for ( n = nOldMaxLRU ; n > aTFMaxLRU.GetValue() ; n-- ) aConfig.DeleteKey( ByteString("LRU").Append( ByteString::CreateFromInt32( n ) ) ); aConfig.WriteKey( "MaxLRU", ByteString::CreateFromInt64( aTFMaxLRU.GetValue() ) ); @@ -722,8 +722,8 @@ IMPL_LINK( FontOptions, FontSizeChanged, void*, EMPTYARG ) void FontOptions::UpdatePreview() { Font aFont = aFontList.Get( aFontName.GetText(), aFontStyle.GetText() ); -// ULONG nFontSize = aFontSize.GetValue( FUNIT_POINT ); - ULONG nFontSize = static_cast<ULONG>((aFontSize.GetValue() + 5) / 10); +// sal_uIntPtr nFontSize = aFontSize.GetValue( FUNIT_POINT ); + sal_uIntPtr nFontSize = static_cast<sal_uIntPtr>((aFontSize.GetValue() + 5) / 10); aFont.SetHeight( nFontSize ); aFTPreview.SetFont( aFont ); aFTPreview.SetText( aFontName.GetText() ); @@ -757,13 +757,13 @@ GenericOptions::GenericOptions( Window* pParent, Config &aConfig ) , aPbDelValue( this, SttResId( RID_PB_DEL_VALUE ) ) , nMoveButtons( 0 ) -, bShowSelectPath( FALSE ) +, bShowSelectPath( sal_False ) { FreeResource(); LoadData(); - aCbArea.EnableAutocomplete( TRUE ); - aCbValue.EnableAutocomplete( TRUE ); + aCbArea.EnableAutocomplete( sal_True ); + aCbValue.EnableAutocomplete( sal_True ); aCbArea.SetSelectHdl( LINK( this, GenericOptions, LoadGroup ) ); @@ -789,7 +789,7 @@ GenericOptions::~GenericOptions() StringList* GenericOptions::GetAllGroups() { StringList* pGroups = new StringList(); - for ( USHORT i = 0 ; i < aConf.GetGroupCount() ; i++ ) + for ( sal_uInt16 i = 0 ; i < aConf.GetGroupCount() ; i++ ) { String *pGroup = new String( aConf.GetGroupName( i ), RTL_TEXTENCODING_UTF8 ); pGroups->push_back( pGroup ); @@ -826,16 +826,16 @@ void GenericOptions::ShowSelectPath( const String &rType ) { // Show Path button nMoveButtons += nDelta; aMoveTimer.Start(); - bShowSelectPath = TRUE; - aPbSelectPath.Show( TRUE ); - aPbSelectPath.Enable( TRUE ); + bShowSelectPath = sal_True; + aPbSelectPath.Show( sal_True ); + aPbSelectPath.Enable( sal_True ); } else if ( !rType.EqualsIgnoreCaseAscii( "PATH" ) && bShowSelectPath ) { // Hide Path button nMoveButtons -= nDelta; aMoveTimer.Start(); - bShowSelectPath = FALSE; - aPbSelectPath.Enable( FALSE ); + bShowSelectPath = sal_False; + aPbSelectPath.Enable( sal_False ); } } @@ -888,7 +888,7 @@ IMPL_LINK( GenericOptions, LoadGroup, ComboBox*, EMPTYARG ) aConf.SetGroup( aLastGroupName ); aConf.WriteKey( C_KEY_AKTUELL, ByteString( aCurrentValue, RTL_TEXTENCODING_UTF8 ) ); - USHORT i; + sal_uInt16 i; for ( i=0 ; i < aCbValue.GetEntryCount() ; i++ ) { if ( i > 0 ) @@ -1006,16 +1006,16 @@ class TextAndWin : public DockingWindow Window* pFtOriginalParent; Window* pWinOriginalParent; long nSpace; // default space - BOOL bAlignTop; + sal_Bool bAlignTop; public: - TextAndWin( Window *pParent, FixedText *pFtP, Window *pWinP, long nSpaceP, BOOL bAlignTopP ); + TextAndWin( Window *pParent, FixedText *pFtP, Window *pWinP, long nSpaceP, sal_Bool bAlignTopP ); ~TextAndWin(); virtual void Resize(); }; -TextAndWin::TextAndWin( Window *pParent, FixedText *pFtP, Window *pWinP, long nSpaceP, BOOL bAlignTopP ) +TextAndWin::TextAndWin( Window *pParent, FixedText *pFtP, Window *pWinP, long nSpaceP, sal_Bool bAlignTopP ) : DockingWindow( pParent ) , pFt( pFtP ) , pWin( pWinP ) @@ -1097,8 +1097,8 @@ DisplayHidDlg::DisplayHidDlg( Window * pParent ) #endif pSplit = new SplitWindow( this ); - pControls = new TextAndWin( pSplit, &aFtControls, &aMlbControls, aMlbControls.GetPosPixel().X(), TRUE ); - pSlots = new TextAndWin( pSplit, &aFtSlots, &aMlbSlots, aMlbControls.GetPosPixel().X(), FALSE ); + pControls = new TextAndWin( pSplit, &aFtControls, &aMlbControls, aMlbControls.GetPosPixel().X(), sal_True ); + pSlots = new TextAndWin( pSplit, &aFtSlots, &aMlbSlots, aMlbControls.GetPosPixel().X(), sal_False ); pSplit->SetPosPixel( aFtControls.GetPosPixel() ); pSplit->InsertItem( 1, pControls, 70, SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE ); @@ -1124,7 +1124,7 @@ DisplayHidDlg::~DisplayHidDlg() IMPL_LINK( DisplayHidDlg, CopyToClipboard, void*, EMPTYARG ) { String aSammel; - USHORT i; + sal_uInt16 i; for ( i=0 ; i < aMlbControls.GetSelectEntryCount() ; i++ ) { @@ -1146,7 +1146,7 @@ IMPL_LINK( DisplayHidDlg, SelectAll, PushButton*, pButton ) { if ( pButton->GetState() != STATE_CHECK ) { - USHORT i; + sal_uInt16 i; for ( i=0 ; i < aMlbControls.GetEntryCount() ; i++ ) aMlbControls.SelectEntryPos( i ); for ( i=0 ; i < aMlbSlots.GetEntryCount() ; i++ ) @@ -1249,7 +1249,7 @@ void DisplayHidDlg::Resize() } else { -// SetUpdateMode( FALSE ); +// SetUpdateMode( sal_False ); // Minimum size Size aSize( GetOutputSizePixel() ); @@ -1305,7 +1305,7 @@ void DisplayHidDlg::Resize() aPos.Move( pSplit->GetSizePixel().Width(), pSplit->GetSizePixel().Height() ); aOKClose.SetPosPixel( aPos ); -// SetUpdateMode( TRUE ); +// SetUpdateMode( sal_True ); // Invalidate(); } FloatingWindow::Resize(); @@ -1385,7 +1385,7 @@ VarEditDialog::VarEditDialog( Window * pParent, SbxVariable *pPVar ) IMPL_LINK( VarEditDialog, OKClick, Button *, pButton ) { (void) pButton; /* avoid warning about unused parameter */ - BOOL bWasError = SbxBase::IsError(); // Probably an error is thrown + sal_Bool bWasError = SbxBase::IsError(); // Probably an error is thrown SbxDataType eType = pVar->GetType(); @@ -1428,7 +1428,7 @@ SvNumberformat:: String aContent( aEditRID_ED_NEW_STRING.GetText() ); - BOOL bError = FALSE; + sal_Bool bError = sal_False; switch ( eType ) { case SbxBOOL: @@ -1441,10 +1441,10 @@ SvNumberformat:: // pVar->PutDate( aContent ); // break; case SbxINTEGER: - pVar->PutInteger( (INT16)aNumericFieldRID_NF_NEW_INTEGER.GetValue() ); + pVar->PutInteger( (sal_Int16)aNumericFieldRID_NF_NEW_INTEGER.GetValue() ); break; case SbxLONG: - pVar->PutLong( static_cast<INT32>(aNumericFieldRID_NF_NEW_LONG.GetValue()) ); + pVar->PutLong( static_cast<sal_Int32>(aNumericFieldRID_NF_NEW_LONG.GetValue()) ); break; case SbxDOUBLE: case SbxSINGLE: @@ -1465,7 +1465,7 @@ SvNumberformat:: // pVar->PutStringExt( aEditRID_ED_NEW_STRING.GetText() ); if ( !bWasError && SbxBase::IsError() ) { - bError = TRUE; + bError = sal_True; SbxBase::ResetError(); } diff --git a/basic/source/app/dialogs.hxx b/basic/source/app/dialogs.hxx index 677bef1962be..108aaa5de062 100644..100755 --- a/basic/source/app/dialogs.hxx +++ b/basic/source/app/dialogs.hxx @@ -93,8 +93,8 @@ protected: void Init( Config &aConf ); public: - ConfEdit( Window* pParent, USHORT nResText, USHORT nResEdit, USHORT nResButton, const ByteString& aKN, Config &aConf ); - ConfEdit( Window* pParent, USHORT nResEdit, USHORT nResButton, const ByteString& aKN, Config &aConf ); + ConfEdit( Window* pParent, sal_uInt16 nResText, sal_uInt16 nResEdit, sal_uInt16 nResButton, const ByteString& aKN, Config &aConf ); + ConfEdit( Window* pParent, sal_uInt16 nResEdit, sal_uInt16 nResButton, const ByteString& aKN, Config &aConf ); void Save( Config &aConf ); void Reload( Config &aConf ); void Click(); @@ -110,7 +110,7 @@ protected: ConfEdit& rBase; DECL_LINK( ToggleHdl, CheckBox* ); public: - OptConfEdit( Window* pParent, USHORT nResCheck, USHORT nResEdit, USHORT nResButton, const ByteString& aKN, ConfEdit& rBaseEdit, Config& aConf ); + OptConfEdit( Window* pParent, sal_uInt16 nResCheck, sal_uInt16 nResEdit, sal_uInt16 nResButton, const ByteString& aKN, ConfEdit& rBaseEdit, Config& aConf ); void Reload( Config &aConf ); DECL_LINK( BaseModifyHdl, Edit* ); }; @@ -130,7 +130,7 @@ private: public: OptionsDialog( Window* pParent, const ResId& ); ~OptionsDialog(); - virtual BOOL Close(); + virtual sal_Bool Close(); DECL_LINK( ActivatePageHdl, TabControl * ); @@ -261,7 +261,7 @@ class GenericOptions : public TabPage PushButton aPbDelValue; int nMoveButtons; - BOOL bShowSelectPath; + sal_Bool bShowSelectPath; AutoTimer aMoveTimer; DECL_LINK( MoveButtons, AutoTimer* ); @@ -309,7 +309,7 @@ protected: DockingWindow* pSlots; SplitWindow *pSplit; - ULONG nDisplayMode; + sal_uIntPtr nDisplayMode; DECL_LINK( Select, void* ); DECL_LINK( SelectAll, PushButton* ); diff --git a/basic/source/app/makefile.mk b/basic/source/app/makefile.mk index e62b11c0beb4..e62b11c0beb4 100644..100755 --- a/basic/source/app/makefile.mk +++ b/basic/source/app/makefile.mk diff --git a/basic/source/app/msgedit.cxx b/basic/source/app/msgedit.cxx index 34b59d50ed9b..1ebc24d560a0 100644..100755 --- a/basic/source/app/msgedit.cxx +++ b/basic/source/app/msgedit.cxx @@ -52,10 +52,10 @@ Version 3 Changed Charset from CHARSET_IBMPC to RTL_TEXTENCODING_UTF8 #include "basmsg.hrc" #include "basrid.hxx" -USHORT MsgEdit::nMaxLogLen = 0; -BOOL MsgEdit::bLimitLogLen = FALSE; -BOOL MsgEdit::bPrintLogToStdout = FALSE; -BOOL MsgEdit::bPrintLogToStdoutSet = FALSE; +sal_uInt16 MsgEdit::nMaxLogLen = 0; +sal_Bool MsgEdit::bLimitLogLen = sal_False; +sal_Bool MsgEdit::bPrintLogToStdout = sal_False; +sal_Bool MsgEdit::bPrintLogToStdoutSet = sal_False; #define WARNING_PREFIX String( SttResId( S_WARNING_PREFIX ) ) #define VERSION_STRING CUniString("File Format Version: ") @@ -69,8 +69,8 @@ MsgEdit::MsgEdit( AppError* pParent, BasicFrame *pBF, const WinBits& aBits ) , pCurrentTestCase(NULL) , pCurrentAssertion( NULL ) , pCurrentError(NULL) -, bModified(FALSE) -, bFileLoading(FALSE) +, bModified(sal_False) +, bFileLoading(sal_False) , nVersion(0) , pAppError( pParent ) , aEditTree( pParent, pBF, aBits | WB_HASBUTTONS | WB_HASLINES | WB_HASBUTTONSATROOT ) @@ -83,15 +83,15 @@ MsgEdit::MsgEdit( AppError* pParent, BasicFrame *pBF, const WinBits& aBits ) if ( !bPrintLogToStdoutSet ) { - bPrintLogToStdoutSet = TRUE; - for ( USHORT i = 0 ; i < Application::GetCommandLineParamCount() ; i++ ) + bPrintLogToStdoutSet = sal_True; + for ( sal_uInt16 i = 0 ; i < Application::GetCommandLineParamCount() ; i++ ) { if ( Application::GetCommandLineParam( i ).Copy(0,9).CompareIgnoreCaseToAscii("-printlog") == COMPARE_EQUAL #ifndef UNX || Application::GetCommandLineParam( i ).Copy(0,9).CompareIgnoreCaseToAscii("/printlog") == COMPARE_EQUAL #endif ) - bPrintLogToStdout = TRUE; + bPrintLogToStdout = sal_True; } } } @@ -172,11 +172,11 @@ void MsgEdit::AddAnyMsg( TTLogMsg *LogMsg ) if ( !bFileLoading ) { // Comes from Testtool and must be written immediately - BOOL bFileWasChanged = pAppError->DiskFileChanged( SINCE_LAST_LOAD ); + sal_Bool bFileWasChanged = pAppError->DiskFileChanged( SINCE_LAST_LOAD ); DBG_ASSERT( aLogFileName == LogMsg->aLogFileName, "Logging to different logfile as before" ); DirEntry aEntry( LogMsg->aLogFileName ); - BOOL bNewFile = !aEntry.Exists(); + sal_Bool bNewFile = !aEntry.Exists(); SvFileStream aStrm( LogMsg->aLogFileName, STREAM_STD_WRITE ); if ( bNewFile ) { @@ -224,7 +224,7 @@ void MsgEdit::AddRun( String aMsg, TTDebugData aDebugData ) { if ( !bFileLoading && bLimitLogLen ) { - USHORT nSkip = nMaxLogLen; + sal_uInt16 nSkip = nMaxLogLen; SvLBoxEntry *pRun = aEditTree.First(); while ( nSkip-- && pRun ) pRun = aEditTree.NextSibling( pRun ); @@ -235,7 +235,7 @@ void MsgEdit::AddRun( String aMsg, TTDebugData aDebugData ) aEditTree.GetModel()->Remove( aEditTree.NextSibling( pRun ) ); aEditTree.GetModel()->Remove( pRun ); - bModified = TRUE; + bModified = sal_True; lModify.Call( NULL ); Save( aLogFileName ); pAppError->UpdateFileInfo( HAS_BEEN_LOADED ); @@ -244,9 +244,9 @@ void MsgEdit::AddRun( String aMsg, TTDebugData aDebugData ) COPY_TTDEBUGDATA( LOG_RUN ); if ( !bFileLoading || ( bFileLoading && nVersion >= 2 ) ) - pCurrentRun = aEditTree.InsertEntry( aMsg, NULL, FALSE, 0, pTTDebugData ); + pCurrentRun = aEditTree.InsertEntry( aMsg, NULL, sal_False, 0, pTTDebugData ); else // First file format - pCurrentRun = aEditTree.InsertEntry( aMsg, NULL, FALSE, LIST_APPEND, pTTDebugData ); // and therefor at the end + pCurrentRun = aEditTree.InsertEntry( aMsg, NULL, sal_False, LIST_APPEND, pTTDebugData ); // and therefor at the end aEditTree.ShowEntry( pCurrentRun ); pCurrentTestCase = NULL; @@ -265,7 +265,7 @@ void MsgEdit::AddTestCase( String aMsg, TTDebugData aDebugData ) else { COPY_TTDEBUGDATA( LOG_TEST_CASE ); - pCurrentTestCase = aEditTree.InsertEntry( aMsg, pCurrentRun, FALSE, LIST_APPEND, pTTDebugData ); + pCurrentTestCase = aEditTree.InsertEntry( aMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); aEditTree.ShowEntry( pCurrentTestCase ); } } @@ -287,7 +287,7 @@ void MsgEdit::AddError( String aMsg, TTDebugData aDebugData ) if ( pCurrentTestCase ) { COPY_TTDEBUGDATA( LOG_ERROR ); - pCurrentError = aEditTree.InsertEntry( aMsg, pCurrentTestCase, FALSE, LIST_APPEND, pTTDebugData ); + pCurrentError = aEditTree.InsertEntry( aMsg, pCurrentTestCase, sal_False, LIST_APPEND, pTTDebugData ); aEditTree.ShowEntry( pCurrentError ); } } @@ -298,7 +298,7 @@ void MsgEdit::AddCallStack( String aMsg, TTDebugData aDebugData ) if ( pCurrentError ) { COPY_TTDEBUGDATA( LOG_CALL_STACK ); - aEditTree.InsertEntry( aMsg, pCurrentError, FALSE, LIST_APPEND, pTTDebugData ); + aEditTree.InsertEntry( aMsg, pCurrentError, sal_False, LIST_APPEND, pTTDebugData ); } } @@ -307,16 +307,16 @@ void MsgEdit::AddMessage( String aMsg, TTDebugData aDebugData ) SvLBoxEntry *pThisEntry = NULL; COPY_TTDEBUGDATA( LOG_MESSAGE ); if ( pCurrentTestCase ) - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentTestCase, FALSE, LIST_APPEND, pTTDebugData ); + pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentTestCase, sal_False, LIST_APPEND, pTTDebugData ); else if ( pCurrentRun ) { - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, FALSE, LIST_APPEND, pTTDebugData ); + pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); aEditTree.ShowEntry( pThisEntry ); } else { AddRun( aMsg, aDebugData ); - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, FALSE, LIST_APPEND, pTTDebugData ); + pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); aEditTree.ShowEntry( pThisEntry ); } } @@ -329,16 +329,16 @@ void MsgEdit::AddWarning( String aMsg, TTDebugData aDebugData ) COPY_TTDEBUGDATA( LOG_WARNING ); if ( pCurrentTestCase ) - pThisEntry = aEditTree.InsertEntry( aCompleteMsg, pCurrentTestCase, FALSE, LIST_APPEND, pTTDebugData ); + pThisEntry = aEditTree.InsertEntry( aCompleteMsg, pCurrentTestCase, sal_False, LIST_APPEND, pTTDebugData ); else if ( pCurrentRun ) { - pThisEntry = aEditTree.InsertEntry( aCompleteMsg, pCurrentRun, FALSE, LIST_APPEND, pTTDebugData ); + pThisEntry = aEditTree.InsertEntry( aCompleteMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); aEditTree.ShowEntry( pThisEntry ); } else { AddRun( aMsg, aDebugData ); - pThisEntry = aEditTree.InsertEntry( aCompleteMsg, pCurrentRun, FALSE, LIST_APPEND, pTTDebugData ); + pThisEntry = aEditTree.InsertEntry( aCompleteMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); aEditTree.ShowEntry( pThisEntry ); } @@ -357,16 +357,16 @@ void MsgEdit::AddAssertion( String aMsg, TTDebugData aDebugData ) SvLBoxEntry *pThisEntry = NULL; COPY_TTDEBUGDATA( LOG_ASSERTION ); if ( pCurrentTestCase ) - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentTestCase, FALSE, LIST_APPEND, pTTDebugData ); + pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentTestCase, sal_False, LIST_APPEND, pTTDebugData ); else if ( pCurrentRun ) { - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, FALSE, LIST_APPEND, pTTDebugData ); + pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); aEditTree.ShowEntry( pThisEntry ); } else { AddRun( aMsg, aDebugData ); - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, FALSE, LIST_APPEND, pTTDebugData ); + pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); aEditTree.ShowEntry( pThisEntry ); } @@ -381,18 +381,18 @@ void MsgEdit::AddAssertionStack( String aMsg, TTDebugData aDebugData ) SvLBoxEntry *pThisEntry = NULL; COPY_TTDEBUGDATA( LOG_ASSERTION_STACK ); if ( pCurrentAssertion ) - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentAssertion, FALSE, LIST_APPEND, pTTDebugData ); + pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentAssertion, sal_False, LIST_APPEND, pTTDebugData ); else if ( pCurrentTestCase ) - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentTestCase, FALSE, LIST_APPEND, pTTDebugData ); + pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentTestCase, sal_False, LIST_APPEND, pTTDebugData ); else if ( pCurrentRun ) { - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, FALSE, LIST_APPEND, pTTDebugData ); + pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); aEditTree.ShowEntry( pThisEntry ); } else { AddRun( aMsg, aDebugData ); - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, FALSE, LIST_APPEND, pTTDebugData ); + pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); aEditTree.ShowEntry( pThisEntry ); } @@ -405,16 +405,16 @@ void MsgEdit::AddQAError( String aMsg, TTDebugData aDebugData ) SvLBoxEntry *pThisEntry = NULL; COPY_TTDEBUGDATA( LOG_QA_ERROR ); if ( pCurrentTestCase ) - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentTestCase, FALSE, LIST_APPEND, pTTDebugData ); + pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentTestCase, sal_False, LIST_APPEND, pTTDebugData ); else if ( pCurrentRun ) { - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, FALSE, LIST_APPEND, pTTDebugData ); + pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); aEditTree.ShowEntry( pThisEntry ); } else { AddRun( aMsg, aDebugData ); - pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, FALSE, LIST_APPEND, pTTDebugData ); + pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun, sal_False, LIST_APPEND, pTTDebugData ); aEditTree.ShowEntry( pThisEntry ); } @@ -423,8 +423,8 @@ void MsgEdit::AddQAError( String aMsg, TTDebugData aDebugData ) } /* - SvLBoxEntry* GetEntry( SvLBoxEntry* pParent, ULONG nPos ) const { return SvLBox::GetEntry(pParent,nPos); } - SvLBoxEntry* GetEntry( ULONG nRootPos ) const { return SvLBox::GetEntry(nRootPos);} + SvLBoxEntry* GetEntry( SvLBoxEntry* pParent, sal_uIntPtr nPos ) const { return SvLBox::GetEntry(pParent,nPos); } + SvLBoxEntry* GetEntry( sal_uIntPtr nRootPos ) const { return SvLBox::GetEntry(nRootPos);} @@ -437,16 +437,16 @@ void MsgEdit::AddQAError( String aMsg, TTDebugData aDebugData ) SvLBoxEntry* PrevSelected( SvLBoxEntry* pEntry ) const { return (SvLBoxEntry*)(SvListView::PrevSelected(pEntry)); } SvLBoxEntry* LastSelected() const { return (SvLBoxEntry*)(SvListView::LastSelected()); } - SvLBoxEntry* GetEntry( SvLBoxEntry* pParent, ULONG nPos ) const { return (SvLBoxEntry*)(pModel->GetEntry(pParent,nPos)); } - SvLBoxEntry* GetEntry( ULONG nRootPos ) const { return (SvLBoxEntry*)(pModel->GetEntry(nRootPos)); } + SvLBoxEntry* GetEntry( SvLBoxEntry* pParent, sal_uIntPtr nPos ) const { return (SvLBoxEntry*)(pModel->GetEntry(pParent,nPos)); } + SvLBoxEntry* GetEntry( sal_uIntPtr nRootPos ) const { return (SvLBoxEntry*)(pModel->GetEntry(nRootPos)); } SvLBoxEntry* GetParent( SvLBoxEntry* pEntry ) const { return (SvLBoxEntry*)(pModel->GetParent(pEntry)); } SvLBoxEntry* GetRootLevelParent(SvLBoxEntry* pEntry ) const { return (SvLBoxEntry*)(pModel->GetRootLevelParent( pEntry ));} - BOOL IsInChildList( SvListEntry* pParent, SvListEntry* pChild) const; - SvListEntry* GetEntry( SvListEntry* pParent, ULONG nPos ) const; - SvListEntry* GetEntry( ULONG nRootPos ) const; - SvListEntry* GetEntryAtAbsPos( ULONG nAbsPos ) const; + sal_Bool IsInChildList( SvListEntry* pParent, SvListEntry* pChild) const; + SvListEntry* GetEntry( SvListEntry* pParent, sal_uIntPtr nPos ) const; + SvListEntry* GetEntry( sal_uIntPtr nRootPos ) const; + SvListEntry* GetEntryAtAbsPos( sal_uIntPtr nAbsPos ) const; SvListEntry* GetParent( SvListEntry* pEntry ) const; SvListEntry* GetRootLevelParent( SvListEntry* pEntry ) const; */ @@ -460,11 +460,11 @@ void MsgEdit::Delete() CHECK( pCurrentTestCase ); CHECK( pCurrentAssertion ); CHECK( pCurrentError ); - bModified = TRUE; + bModified = sal_True; lModify.Call( NULL ); } -void MsgEdit::Cut(){ Copy(); Delete(); bModified = TRUE; lModify.Call( NULL ); } +void MsgEdit::Cut(){ Copy(); Delete(); bModified = sal_True; lModify.Call( NULL ); } void MsgEdit::Copy(){ ::svt::OStringTransfer::CopyString( GetSelected(), &aEditTree ); } /**/void MsgEdit::Paste(){ Sound::Beep(); } void MsgEdit::Undo(){ Sound::Beep(); } @@ -545,7 +545,7 @@ TextSelection MsgEdit::GetSelection() const { if ( aEditTree.FirstSelected() ) { - ULONG nStart=0,nEnd=0; + sal_uIntPtr nStart=0,nEnd=0; nStart = aEditTree.GetModel()->GetAbsPos(aEditTree.FirstSelected() ); if ( aEditTree.LastSelected() ) nEnd = aEditTree.GetModel()->GetAbsPos(aEditTree.LastSelected() ); @@ -557,25 +557,25 @@ TextSelection MsgEdit::GetSelection() const void MsgEdit::SetSelection( const TextSelection& rSelection ) { - ULONG nStart,nEnd; + sal_uIntPtr nStart,nEnd; while ( aEditTree.GetSelectionCount() ) - aEditTree.Select( aEditTree.FirstSelected(), FALSE ); + aEditTree.Select( aEditTree.FirstSelected(), sal_False ); if ( rSelection.HasRange() ) { nStart = rSelection.GetStart().GetPara(); nEnd = rSelection.GetEnd().GetPara(); - for ( ULONG i = nStart ; i <= nEnd ; i++ ) - aEditTree.Select( aEditTree.GetModel()->GetEntryAtAbsPos( i ), TRUE ); + for ( sal_uIntPtr i = nStart ; i <= nEnd ; i++ ) + aEditTree.Select( aEditTree.GetModel()->GetEntryAtAbsPos( i ), sal_True ); } } -USHORT MsgEdit::GetLineNr() const +sal_uInt16 MsgEdit::GetLineNr() const { if ( aEditTree.GetCurEntry() ) - return (USHORT)aEditTree.GetModel()->GetAbsPos(aEditTree.GetCurEntry() ) + 1; + return (sal_uInt16)aEditTree.GetModel()->GetAbsPos(aEditTree.GetCurEntry() ) + 1; else return 0; } @@ -587,7 +587,7 @@ void MsgEdit::ReplaceSelected( const String& rStr ) OSL_FAIL("Not Implemented"); } -BOOL MsgEdit::IsModified(){ return bModified; } +sal_Bool MsgEdit::IsModified(){ return bModified; } void MsgEdit::SetModifyHdl( Link l ){ lModify = l; } String MsgEdit::GetText() const @@ -611,16 +611,16 @@ void MsgEdit::SetText( const String& rStr ) OSL_FAIL("Not Implemented"); } -BOOL MsgEdit::HasText() const +sal_Bool MsgEdit::HasText() const { return aEditTree.First() != NULL; } // Search from the beginning or mark start + 1 -BOOL MsgEdit::Find( const String& s ) +sal_Bool MsgEdit::Find( const String& s ) { TextSelection r = GetSelection(); - USHORT bgn = (USHORT) r.GetStart().GetPara() + 1; + sal_uInt16 bgn = (sal_uInt16) r.GetStart().GetPara() + 1; if ( r.GetStart().GetPara() == 0 ) bgn = 0; // Search from the beginning @@ -630,11 +630,11 @@ BOOL MsgEdit::Find( const String& s ) if( aEditTree.GetEntryText( pEntry ).Search( s, 0 ) != STRING_NOTFOUND ) { aEditTree.SetCurEntry( pEntry ); - return TRUE; + return sal_True; } pEntry = aEditTree.Next( pEntry ); } - return FALSE; + return sal_False; } /****************************************************************** @@ -647,17 +647,17 @@ BOOL MsgEdit::Find( const String& s ) ******************************************************************/ -BOOL MsgEdit::Load( const String& aName ) +sal_Bool MsgEdit::Load( const String& aName ) { aLogFileName = aName; - BOOL bOk = TRUE, bFirstLine = TRUE; - BOOL bLoadError = FALSE; + sal_Bool bOk = sal_True, bFirstLine = sal_True; + sal_Bool bLoadError = sal_False; SvFileStream aStrm( aName, STREAM_STD_READ ); if( aStrm.IsOpen() ) { aEditTree.Clear(); String aLine; - bFileLoading = TRUE; // To avoid logging to disk + bFileLoading = sal_True; // To avoid logging to disk TTLogMsg *pLogMsg = new TTLogMsg; while( !aStrm.IsEof() && bOk ) { @@ -667,7 +667,7 @@ BOOL MsgEdit::Load( const String& aName ) aStrm.ReadByteStringLine( aLine, RTL_TEXTENCODING_IBM_850 ); if( aStrm.GetError() != SVSTREAM_OK ) - bOk = FALSE; + bOk = sal_False; #define TOKEN( n ) aLine.GetToken( n ) @@ -677,9 +677,9 @@ BOOL MsgEdit::Load( const String& aName ) TTDebugData aDebugData; aDebugData.aLogType = TTLogType( TOKEN(0).ToInt32() ); aDebugData.aFilename = TOKEN(1); - aDebugData.nLine = USHORT( TOKEN(2).ToInt32() ); - aDebugData.nCol1 = USHORT( TOKEN(3).ToInt32() ); - aDebugData.nCol2 = USHORT( TOKEN(4).ToInt32() ); + aDebugData.nLine = sal_uInt16( TOKEN(2).ToInt32() ); + aDebugData.nCol1 = sal_uInt16( TOKEN(3).ToInt32() ); + aDebugData.nCol2 = sal_uInt16( TOKEN(4).ToInt32() ); aDebugData.aMsg = aLine.GetQuotedToken( 5, CUniString("\"\"") ); // Remove leading and trailing quotes @@ -692,13 +692,13 @@ BOOL MsgEdit::Load( const String& aName ) AddAnyMsg( pLogMsg ); } else if ( bFirstLine && (aLine.Search( VERSION_STRING ) == 0) ) - nVersion = USHORT( aLine.Copy( VERSION_STRING.Len() ).ToInt32() ); + nVersion = sal_uInt16( aLine.Copy( VERSION_STRING.Len() ).ToInt32() ); else if ( aLine.Len() ) - bLoadError = TRUE; + bLoadError = sal_True; - bFirstLine = FALSE; + bFirstLine = sal_False; } - bFileLoading = FALSE; + bFileLoading = sal_False; delete pLogMsg; aStrm.Close(); if ( nVersion < 2 && !bLoadError ) @@ -706,16 +706,16 @@ BOOL MsgEdit::Load( const String& aName ) } else - bOk = FALSE; + bOk = sal_False; return bOk; } -BOOL MsgEdit::Save( const String& aName ) +sal_Bool MsgEdit::Save( const String& aName ) { - BOOL bOk = TRUE; - BOOL bIsText = DirEntry( aName ).GetExtension().CompareIgnoreCaseToAscii("TXT") == COMPARE_EQUAL; + sal_Bool bOk = sal_True; + sal_Bool bIsText = DirEntry( aName ).GetExtension().CompareIgnoreCaseToAscii("TXT") == COMPARE_EQUAL; if ( bIsText && !QueryBox( NULL, SttResId( IDS_LOSS_OF_INFORMATION ) ).Execute() ) - return FALSE; + return sal_False; SvFileStream aStrm( aName, STREAM_STD_WRITE | STREAM_TRUNC ); if( aStrm.IsOpen() ) { @@ -753,16 +753,16 @@ BOOL MsgEdit::Save( const String& aName ) } } if( aStrm.GetError() != SVSTREAM_OK ) - bOk = FALSE; + bOk = sal_False; else { - bModified = FALSE; + bModified = sal_False; lModify.Call( NULL ); } } else - bOk = FALSE; + bOk = sal_False; return bOk; } @@ -774,7 +774,7 @@ TTTreeListBox::TTTreeListBox( AppError* pParent, BasicFrame* pBF, WinBits nWinSt //, nDeselectParent(0) {} -BOOL TTTreeListBox::JumpToSourcecode( SvLBoxEntry *pThisEntry ) +sal_Bool TTTreeListBox::JumpToSourcecode( SvLBoxEntry *pThisEntry ) { if ( pThisEntry && pThisEntry->GetUserData() && ((TTDebugData*)pThisEntry->GetUserData())->aFilename.Len() > 0 ) { @@ -810,20 +810,20 @@ BOOL TTTreeListBox::JumpToSourcecode( SvLBoxEntry *pThisEntry ) if ( pBasicFrame->pWork && pBasicFrame->pWork->ISA(AppEdit) ) ((AppEdit*)pBasicFrame->pWork)->Highlight( aData->nLine, aData->nCol1, aData->nCol2 ); - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } -BOOL TTTreeListBox::DoubleClickHdl() +sal_Bool TTTreeListBox::DoubleClickHdl() { return JumpToSourcecode( GetHdlEntry() ); } -/*ULONG TTTreeListBox::SelectChildren( SvLBoxEntry* pParent, BOOL bSelect ) +/*sal_uIntPtr TTTreeListBox::SelectChildren( SvLBoxEntry* pParent, sal_Bool bSelect ) { SvLBoxEntry *pEntry = FirstChild( pParent ); - ULONG nRet = 0; + sal_uIntPtr nRet = 0; while ( pEntry ) { nRet++; @@ -838,8 +838,8 @@ void TTTreeListBox::SelectHdl() { SvLBoxEntry* pHdlEntry = GetHdlEntry(); - SelectChildren( pHdlEntry, TRUE ); - Select( pHdlEntry, TRUE ); + SelectChildren( pHdlEntry, sal_True ); + Select( pHdlEntry, sal_True ); // InitMenu(pApp->GetAppMenu()->GetPopupMenu( RID_APPEDIT )); // so that delete works correct } @@ -849,13 +849,13 @@ void TTTreeListBox::DeselectHdl() if ( GetParent( pHdlEntry ) ) { nDeselectParent++; - Select( GetParent( pHdlEntry ), FALSE ); + Select( GetParent( pHdlEntry ), sal_False ); nDeselectParent--; } if ( !nDeselectParent ) { - SelectChildren( pHdlEntry, FALSE ); - Select( pHdlEntry, FALSE ); + SelectChildren( pHdlEntry, sal_False ); + Select( pHdlEntry, sal_False ); } Invalidate(); } */ @@ -926,15 +926,15 @@ class TTLBoxString : public SvLBoxString { public: - TTLBoxString( SvLBoxEntry* pEntry, USHORT nFlags, + TTLBoxString( SvLBoxEntry* pEntry, sal_uInt16 nFlags, const String& rStr ) : SvLBoxString(pEntry,nFlags,rStr) {} - virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags, + virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry); }; -void TTLBoxString::Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags, +void TTLBoxString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry ) { TTFeatures aFeatures = ((TTTreeListBox*)&rDev)->GetFeatures( pEntry ); @@ -958,7 +958,7 @@ void TTLBoxString::Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags, else { aFont.SetFillColor( aCol ); - aFont.SetTransparent( FALSE ); + aFont.SetTransparent( sal_False ); Color aCol2( COL_BLACK ); aFont.SetColor( aCol2 ); } @@ -984,7 +984,7 @@ void TTTreeListBox::InitEntry(SvLBoxEntry* pEntry, const String& rStr ,const Image& rImg1, const Image& rImg2, SvLBoxButtonKind eButtonKind ) { - USHORT nColToHilite = 1; //0==Bitmap;1=="Column1";2=="Column2" + sal_uInt16 nColToHilite = 1; //0==Bitmap;1=="Column1";2=="Column2" SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind ); SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nColToHilite ); TTLBoxString* pStr = new TTLBoxString( pEntry, 0, pCol->GetText() ); diff --git a/basic/source/app/msgedit.hxx b/basic/source/app/msgedit.hxx index 02355eb21a15..442ff3034c19 100644..100755 --- a/basic/source/app/msgedit.hxx +++ b/basic/source/app/msgedit.hxx @@ -38,7 +38,7 @@ class AppError; #define SelectChildren SelectChilds -typedef USHORT TTFeatures; // Bitfield for features of the entries +typedef sal_uInt16 TTFeatures; // Bitfield for features of the entries #define HasNothing TTFeatures(0x00) #define HasError TTFeatures(0x01) #define HasWarning TTFeatures(0x02) @@ -50,13 +50,13 @@ class TTTreeListBox : public SvTreeListBox { protected: // virtual void Command( const CommandEvent& rCEvt ); -// USHORT nDeselectParent; +// sal_uInt16 nDeselectParent; BasicFrame *pBasicFrame; void InitEntry( SvLBoxEntry*, const String&, const Image&, const Image&, SvLBoxButtonKind eButtonKind ); AppError *pAppError; - BOOL JumpToSourcecode( SvLBoxEntry *pThisEntry ); + sal_Bool JumpToSourcecode( SvLBoxEntry *pThisEntry ); public: TTTreeListBox( AppError* pParent, BasicFrame* pBF, WinBits nWinStyle=0 ); @@ -64,11 +64,11 @@ public: // virtual void SelectHdl(); // virtual void DeselectHdl(); - virtual BOOL DoubleClickHdl(); + virtual sal_Bool DoubleClickHdl(); virtual void KeyInput( const KeyEvent& rKEvt ); -// ULONG SelectChildren( SvLBoxEntry* pParent, BOOL bSelect ); +// sal_uIntPtr SelectChildren( SvLBoxEntry* pParent, sal_Bool bSelect ); TTFeatures GetFeatures( SvLBoxEntry* ); }; @@ -80,20 +80,20 @@ class MsgEdit : public DataEdit SvLBoxEntry *pCurrentTestCase; SvLBoxEntry *pCurrentAssertion; SvLBoxEntry *pCurrentError; - BOOL bModified; + sal_Bool bModified; Link lModify; - BOOL bFileLoading; // TRUE while loading a file + sal_Bool bFileLoading; // sal_True while loading a file String Impl_MakeText( SvLBoxEntry *pEntry ) const; String Impl_MakeSaveText( SvLBoxEntry *pEntry ) const; String Impl_MakeSaveText( TTDebugData aData ) const; - USHORT nVersion; // Stores file version + sal_uInt16 nVersion; // Stores file version AppError* pAppError; String aLogFileName; - static USHORT nMaxLogLen; - static BOOL bLimitLogLen; - static BOOL bPrintLogToStdout; - static BOOL bPrintLogToStdoutSet; // has it been initialized yet + static sal_uInt16 nMaxLogLen; + static sal_Bool bLimitLogLen; + static sal_Bool bPrintLogToStdout; + static sal_Bool bPrintLogToStdoutSet; // has it been initialized yet public: MsgEdit( AppError*, BasicFrame *pBF, const WinBits& ); ~MsgEdit(); @@ -108,7 +108,7 @@ public: void AddAssertionStack( String aMsg, TTDebugData aDebugData ); void AddQAError( String aMsg, TTDebugData aDebugData ); - static void SetMaxLogLen( USHORT nLen ) { nMaxLogLen = nLen; bLimitLogLen = TRUE; } + static void SetMaxLogLen( sal_uInt16 nLen ) { nMaxLogLen = nLen; bLimitLogLen = sal_True; } DATA_FUNC_DEF( aEditTree, TTTreeListBox ) }; diff --git a/basic/source/app/mybasic.cxx b/basic/source/app/mybasic.cxx index 5c165f441058..9e2a32fe751f 100644..100755 --- a/basic/source/app/mybasic.cxx +++ b/basic/source/app/mybasic.cxx @@ -60,7 +60,7 @@ TYPEINIT1(MyBasic,StarBASIC) class MyFactory : public SbxFactory { public: - virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX ); + virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX ); }; static SampleObjectFac aFac1; @@ -68,7 +68,7 @@ static MyFactory aFac2; static ProcessFactory aProcessFac; static short nInst = 0; -SbxBase* MyFactory::Create( UINT16 nSbxId, UINT32 nCr ) +SbxBase* MyFactory::Create( sal_uInt16 nSbxId, sal_uInt32 nCr ) { if( nCr == SBXCR_TEST && nSbxId == SBXID_MYBASIC ) return new MyBasic; @@ -152,7 +152,7 @@ void MyBasic::LoadIniFile() { } -SbTextType MyBasic::GetSymbolType( const String &rSymbol, BOOL bWasTTControl ) +SbTextType MyBasic::GetSymbolType( const String &rSymbol, sal_Bool bWasTTControl ) { (void) rSymbol; /* avoid warning about unused parameter */ (void) bWasTTControl; /* avoid warning about unused parameter */ @@ -179,7 +179,7 @@ void MyBasic::Reset() CurrentError = 0; } -BOOL MyBasic::Compile( SbModule* p ) +sal_Bool MyBasic::Compile( SbModule* p ) { Reset(); return StarBASIC::Compile( p ); @@ -215,7 +215,7 @@ BasicError* MyBasic::FirstError() return NULL; } -BOOL MyBasic::ErrorHdl() +sal_Bool MyBasic::ErrorHdl() { AppBasEd* pWin = aBasicApp.pFrame->FindModuleWin( GetActiveModule()->GetName() ); if( !pWin ) @@ -233,12 +233,12 @@ BOOL MyBasic::ErrorHdl() ); nError++; CurrentError = aErrors.size() - 1; - return BOOL( nError < 20 ); // Cancel after 20 errors + return sal_Bool( nError < 20 ); // Cancel after 20 errors } else { ReportRuntimeError( pWin ); - return FALSE; + return sal_False; } } @@ -255,7 +255,7 @@ void MyBasic::ReportRuntimeError( AppBasEd *pEditWin ) GetCol1(), GetCol2() ).Show(); } -void MyBasic::DebugFindNoErrors( BOOL bDebugFindNoErrors ) +void MyBasic::DebugFindNoErrors( sal_Bool bDebugFindNoErrors ) { (void) bDebugFindNoErrors; /* avoid warning about unused parameter */ } @@ -265,7 +265,7 @@ const String MyBasic::GetSpechialErrorText() return GetErrorText(); } -USHORT MyBasic::BreakHdl() +sal_uInt16 MyBasic::BreakHdl() { SbModule* pMod = GetActiveModule(); if( pMod ) @@ -299,7 +299,7 @@ USHORT MyBasic::BreakHdl() ***************************************************************************/ BasicError::BasicError - ( AppBasEd* w, USHORT nE, const String& r, USHORT nL, USHORT nC1, USHORT nC2 ) + ( AppBasEd* w, sal_uInt16 nE, const String& r, sal_uInt16 nL, sal_uInt16 nC1, sal_uInt16 nC2 ) : aText( SttResId( IDS_ERROR1 ) ) { pWin = w; diff --git a/basic/source/app/printer.cxx b/basic/source/app/printer.cxx index 84cddf422759..675aeed2c7e0 100644..100755 --- a/basic/source/app/printer.cxx +++ b/basic/source/app/printer.cxx @@ -88,7 +88,7 @@ void BasicPrinter::Print( const String& rFile, const String& rText, BasicFrame * // Disable PRINT-Menu MenuBar* pBar = pFrame->GetMenuBar(); Menu* pFileMenu = pBar->GetPopupMenu( RID_APPFILE ); - pFileMenu->EnableItem( RID_FILEPRINT, FALSE ); + pFileMenu->EnableItem( RID_FILEPRINT, sal_False ); mpListener.reset( new vcl::OldStylePrintAdaptor( mpPrinter ) ); mpListener->StartPage(); @@ -107,7 +107,7 @@ void BasicPrinter::Print( const String& rFile, const String& rText, BasicFrame * Printer::PrintJob( mpListener, mpPrinter->GetJobSetup() ); nPage = 1; - pFileMenu->EnableItem( RID_FILEPRINT, TRUE ); + pFileMenu->EnableItem( RID_FILEPRINT, sal_True ); } diff --git a/basic/source/app/printer.hxx b/basic/source/app/printer.hxx index b884a642e76f..b884a642e76f 100644..100755 --- a/basic/source/app/printer.hxx +++ b/basic/source/app/printer.hxx diff --git a/basic/source/app/process.cxx b/basic/source/app/process.cxx index 91e28de22a6a..02d27e3a7ba6 100644..100755 --- a/basic/source/app/process.cxx +++ b/basic/source/app/process.cxx @@ -49,9 +49,9 @@ Process::Process() , m_nEnvCount( 0 ) , m_pEnvList( NULL ) , m_aProcessName() +, bWasGPF( sal_False ) +, bHasBeenStarted( sal_False ) , m_pProcess( NULL ) -, bWasGPF( FALSE ) -, bHasBeenStarted( FALSE ) { } @@ -77,7 +77,7 @@ Process::~Process() } -BOOL Process::ImplIsRunning() +sal_Bool Process::ImplIsRunning() { if ( m_pProcess && bHasBeenStarted ) { @@ -85,12 +85,12 @@ BOOL Process::ImplIsRunning() aProcessInfo.Size = sizeof(oslProcessInfo); osl_getProcessInfo(m_pProcess, osl_Process_EXITCODE, &aProcessInfo ); if ( !(aProcessInfo.Fields & osl_Process_EXITCODE) ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } else - return FALSE; + return sal_False; } long Process::ImplGetExitCode() @@ -166,17 +166,17 @@ void Process::SetImage( const String &aAppPath, const String &aAppParams, const ::rtl::OUString aNormalizedAppPath; osl::FileBase::getFileURLFromSystemPath( ::rtl::OUString(aAppPath), aNormalizedAppPath ); m_aProcessName = aNormalizedAppPath;; - bHasBeenStarted = FALSE; + bHasBeenStarted = sal_False; } } -BOOL Process::Start() +sal_Bool Process::Start() { // Start program - BOOL bSuccess=FALSE; + sal_Bool bSuccess=sal_False; if ( m_aProcessName.getLength() && !ImplIsRunning() ) { - bWasGPF = FALSE; + bWasGPF = sal_False; #ifdef WNT sal_uInt32 nErrorMode = SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_NOALIGNMENTFAULTEXCEPT | SEM_NOGPFAULTERRORBOX); try @@ -199,7 +199,7 @@ BOOL Process::Start() } catch( ... ) { - bWasGPF = TRUE; + bWasGPF = sal_True; // TODO: Output debug message !! } nErrorMode = SetErrorMode(nErrorMode); @@ -211,17 +211,17 @@ BOOL Process::Start() return bSuccess; } -ULONG Process::GetExitCode() +sal_uIntPtr Process::GetExitCode() { // ExitCode of program after execution return ImplGetExitCode(); } -BOOL Process::IsRunning() +sal_Bool Process::IsRunning() { return ImplIsRunning(); } -BOOL Process::WasGPF() +sal_Bool Process::WasGPF() { // Did the process fail? #ifdef WNT return ImplGetExitCode() == 3221225477; @@ -230,11 +230,11 @@ BOOL Process::WasGPF() #endif } -BOOL Process::Terminate() +sal_Bool Process::Terminate() { if ( ImplIsRunning() ) return osl_terminateProcess(m_pProcess) == osl_Process_E_None; - return TRUE; + return sal_True; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/processw.cxx b/basic/source/app/processw.cxx index accd727df62f..4bf428b6a0ac 100644..100755 --- a/basic/source/app/processw.cxx +++ b/basic/source/app/processw.cxx @@ -44,10 +44,10 @@ // none // 2) Methods: // SetImage( Filename ) -// BOOL Start -// USHORT GetExitCode -// BOOL IsRunning -// BOOL WasGPF +// sal_Bool Start +// sal_uInt16 GetExitCode +// sal_Bool IsRunning +// sal_Bool WasGPF // This implementation is a sample for a table driven version that @@ -63,7 +63,7 @@ #define _BWRITE 0x0200 // can be used as Lvaluen #define _LVALUE _BWRITE #define _READWRITE 0x0300 // can read and written -#define _OPT 0x0400 // TRUE: optional parameter +#define _OPT 0x0400 // sal_True: optional parameter #define _METHOD 0x1000 // Mask-Bit for a method #define _PROPERTY 0x2000 // Mask-Bit for a property #define _COLL 0x4000 // Mask-Bit for a collection @@ -124,12 +124,12 @@ SbxVariable* ProcessWrapper::Find( const String& rName, SbxClassType t ) // otherwise search Methods* p = pMethods; short nIndex = 0; - BOOL bFound = FALSE; + sal_Bool bFound = sal_False; while( p->nArgs != -1 ) { if( rName.EqualsIgnoreCaseAscii( p->pName ) ) { - bFound = TRUE; break; + bFound = sal_True; break; } nIndex += ( p->nArgs & _ARGSMASK ) + 1; p = pMethods + nIndex; @@ -164,22 +164,22 @@ void ProcessWrapper::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCT, { SbxVariable* pVar = pHint->GetVar(); SbxArray* pNotifyPar = pVar->GetParameters(); - USHORT nIndex = (USHORT) pVar->GetUserData(); + sal_uInt16 nIndex = (sal_uInt16) pVar->GetUserData(); // No index: put through if( nIndex ) { - ULONG t = pHint->GetId(); + sal_uIntPtr t = pHint->GetId(); if( t == SBX_HINT_INFOWANTED ) pVar->SetInfo( GetInfo( (short) pVar->GetUserData() ) ); else { - BOOL bWrite = FALSE; + sal_Bool bWrite = sal_False; if( t == SBX_HINT_DATACHANGED ) - bWrite = TRUE; + bWrite = sal_True; if( t == SBX_HINT_DATAWANTED || bWrite ) { // Parameter-Test for methods: - USHORT nPar = pMethods[ --nIndex ].nArgs & 0x00FF; + sal_uInt16 nPar = pMethods[ --nIndex ].nArgs & 0x00FF; // Element 0 is the return value if( ( !pNotifyPar && nPar ) || ( pNotifyPar && pNotifyPar->Count() < nPar+1 ) ) @@ -207,7 +207,7 @@ SbxInfo* ProcessWrapper::GetInfo( short nIdx ) { p++; String aMethodName( p->pName, RTL_TEXTENCODING_ASCII_US ); - USHORT nInfoFlags = ( p->nArgs >> 8 ) & 0x03; + sal_uInt16 nInfoFlags = ( p->nArgs >> 8 ) & 0x03; if( p->nArgs & _OPT ) nInfoFlags |= SBX_OPTIONAL; pResultInfo->AddParam( aMethodName, p->eType, nInfoFlags ); @@ -221,10 +221,10 @@ SbxInfo* ProcessWrapper::GetInfo( short nIdx ) //////////////////////////////////////////////////////////////////////////// -// Properties and methods save the return value in argv[0] (Get, bPut = FALSE) -// and store the value from argv[0] (Put, bPut = TRUE) +// Properties and methods save the return value in argv[0] (Get, bPut = sal_False) +// and store the value from argv[0] (Put, bPut = sal_True) -void ProcessWrapper::PSetImage( SbxVariable* pVar, SbxArray* pMethodePar, BOOL bWriteIt ) +void ProcessWrapper::PSetImage( SbxVariable* pVar, SbxArray* pMethodePar, sal_Bool bWriteIt ) { // Imagefile of the executable (void) pVar; /* avoid warning about unused parameter */ (void) bWriteIt; /* avoid warning about unused parameter */ @@ -234,28 +234,28 @@ void ProcessWrapper::PSetImage( SbxVariable* pVar, SbxArray* pMethodePar, BOOL b pProcess->SetImage(pMethodePar->Get( 1 )->GetString(), String() ); } -void ProcessWrapper::PStart( SbxVariable* pVar, SbxArray* pMethodePar, BOOL bWriteIt ) +void ProcessWrapper::PStart( SbxVariable* pVar, SbxArray* pMethodePar, sal_Bool bWriteIt ) { // Program is started (void) pMethodePar; /* avoid warning about unused parameter */ (void) bWriteIt; /* avoid warning about unused parameter */ pVar->PutBool( pProcess->Start() ); } -void ProcessWrapper::PGetExitCode( SbxVariable* pVar, SbxArray* pMethodePar, BOOL bWriteIt ) +void ProcessWrapper::PGetExitCode( SbxVariable* pVar, SbxArray* pMethodePar, sal_Bool bWriteIt ) { // ExitCode of the program after it was finished (void) pMethodePar; /* avoid warning about unused parameter */ (void) bWriteIt; /* avoid warning about unused parameter */ pVar->PutULong( pProcess->GetExitCode() ); } -void ProcessWrapper::PIsRunning( SbxVariable* pVar, SbxArray* pMethodePar, BOOL bWriteIt ) +void ProcessWrapper::PIsRunning( SbxVariable* pVar, SbxArray* pMethodePar, sal_Bool bWriteIt ) { // Program is still running (void) pMethodePar; /* avoid warning about unused parameter */ (void) bWriteIt; /* avoid warning about unused parameter */ pVar->PutBool( pProcess->IsRunning() ); } -void ProcessWrapper::PWasGPF( SbxVariable* pVar, SbxArray* pMethodePar, BOOL bWriteIt ) +void ProcessWrapper::PWasGPF( SbxVariable* pVar, SbxArray* pMethodePar, sal_Bool bWriteIt ) { // Program faulted with GPF etc. (void) pMethodePar; /* avoid warning about unused parameter */ (void) bWriteIt; /* avoid warning about unused parameter */ diff --git a/basic/source/app/processw.hxx b/basic/source/app/processw.hxx index 32e486b0ffd8..f5d60b8d783c 100644..100755 --- a/basic/source/app/processw.hxx +++ b/basic/source/app/processw.hxx @@ -43,7 +43,7 @@ using SbxVariable::GetInfo; public: #endif typedef void( ProcessWrapper::*pMeth ) - ( SbxVariable* pThis, SbxArray* pArgs, BOOL bWrite ); + ( SbxVariable* pThis, SbxArray* pArgs, sal_Bool bWrite ); #if defined ( ICC ) private: #endif @@ -57,11 +57,11 @@ private: static Methods aProcessMethods[]; // Method table Methods *pMethods; // Current method table - void PSetImage( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); - void PStart( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); - void PGetExitCode( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); - void PIsRunning( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); - void PWasGPF( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); + void PSetImage( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); + void PStart( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); + void PGetExitCode( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); + void PIsRunning( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); + void PWasGPF( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); // Internal members and methods Process *pProcess; diff --git a/basic/source/app/resids.hrc b/basic/source/app/resids.hrc index 5d3fbb098dde..5d3fbb098dde 100644..100755 --- a/basic/source/app/resids.hrc +++ b/basic/source/app/resids.hrc diff --git a/basic/source/app/status.cxx b/basic/source/app/status.cxx index 14b0fcde5e38..f545538a84bd 100644..100755 --- a/basic/source/app/status.cxx +++ b/basic/source/app/status.cxx @@ -73,7 +73,7 @@ void StatusLine::SetProfileName( const String& s ) IMPL_LINK( StatusLine, ActivateTask, TaskToolBox*, pTTB ) { - USHORT nFirstWinPos=0; + sal_uInt16 nFirstWinPos=0; MenuBar* pMenu = pFrame->GetMenuBar(); PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW ); @@ -82,14 +82,14 @@ IMPL_LINK( StatusLine, ActivateTask, TaskToolBox*, pTTB ) nFirstWinPos += pTTB->GetItemPos( pTTB->GetCurItemId() ) / 2; - USHORT x; + sal_uInt16 x; x = pTTB->GetItemPos( pTTB->GetCurItemId() ); x = pWinMenu->GetItemId( nFirstWinPos ); x = pWinMenu->GetItemCount(); AppWin* pWin = pFrame->FindWin( pWinMenu->GetItemText( pWinMenu->GetItemId( nFirstWinPos ) ).EraseAllChars( L'~' ) ); if ( pWin ) { - pWin->Minimize( FALSE ); + pWin->Minimize( sal_False ); pWin->ToTop(); } return 0; @@ -97,7 +97,7 @@ IMPL_LINK( StatusLine, ActivateTask, TaskToolBox*, pTTB ) void StatusLine::LoadTaskToolBox() { - USHORT nFirstWinPos=0; + sal_uInt16 nFirstWinPos=0; MenuBar* pMenu = pFrame->GetMenuBar(); PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW ); diff --git a/basic/source/app/status.hxx b/basic/source/app/status.hxx index 7c3b04bed8cc..7c3b04bed8cc 100644..100755 --- a/basic/source/app/status.hxx +++ b/basic/source/app/status.hxx diff --git a/basic/source/app/svtmsg.src b/basic/source/app/svtmsg.src index b7ce968b4438..365f5f3d4ee6 100644..100755 --- a/basic/source/app/svtmsg.src +++ b/basic/source/app/svtmsg.src @@ -24,7 +24,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include "svtmsg.hrc" +#include "basic/svtmsg.hrc" // Here are included the messages of the folder /basic/source/app diff --git a/basic/source/app/testbasi.cxx b/basic/source/app/testbasi.cxx index 05818806c8a8..05818806c8a8 100644..100755 --- a/basic/source/app/testbasi.cxx +++ b/basic/source/app/testbasi.cxx diff --git a/basic/source/app/testtool.idl b/basic/source/app/testtool.idl index acda657881c7..acda657881c7 100644..100755 --- a/basic/source/app/testtool.idl +++ b/basic/source/app/testtool.idl diff --git a/basic/source/app/testtool.src b/basic/source/app/testtool.src index 245cff6c7917..090cb735c139 100644..100755 --- a/basic/source/app/testtool.src +++ b/basic/source/app/testtool.src @@ -24,7 +24,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include "testtool.hrc" +#include "basic/testtool.hrc" /////////////////////////////// diff --git a/basic/source/app/textedit.cxx b/basic/source/app/textedit.cxx index 2891cf5e7a16..4ffbef7121f8 100644..100755 --- a/basic/source/app/textedit.cxx +++ b/basic/source/app/textedit.cxx @@ -44,19 +44,19 @@ TextEditImp::TextEditImp( AppEdit* pParent, const WinBits& aBits ) : Window( pParent, aBits ) , pAppEdit( pParent ) -, bHighlightning( FALSE ) -, bDoSyntaxHighlight( FALSE ) -, bDelayHighlight( TRUE ) +, bHighlightning( sal_False ) +, bDoSyntaxHighlight( sal_False ) +, bDelayHighlight( sal_True ) , nTipId( 0 ) -, bViewMoved( FALSE ) +, bViewMoved( sal_False ) { pTextEngine = new TextEngine(); pTextEngine->SetMaxTextLen( STRING_MAXLEN ); - pTextEngine->EnableUndo( TRUE ); + pTextEngine->EnableUndo( sal_True ); pTextView = new TextView( pTextEngine, this ); pTextEngine->InsertView( pTextView ); - pTextEngine->SetModified( FALSE ); + pTextEngine->SetModified( sal_False ); aSyntaxIdleTimer.SetTimeout( 200 ); aSyntaxIdleTimer.SetTimeoutHdl( LINK( this, TextEditImp, SyntaxTimerHdl ) ); @@ -79,10 +79,10 @@ TextEditImp::~TextEditImp() delete pTextEngine; } -BOOL TextEditImp::ViewMoved() +sal_Bool TextEditImp::ViewMoved() { - BOOL bOld = bViewMoved; - bViewMoved = FALSE; + sal_Bool bOld = bViewMoved; + bViewMoved = sal_False; return bOld; } @@ -98,7 +98,7 @@ void TextEditImp::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) pAppEdit->pVScroll->SetThumbPos( pTextView->GetStartDocPos().Y() ); if ( ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow() ) ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow()->Scroll( 0, ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow()->GetCurYOffset() - pTextView->GetStartDocPos().Y() ); - bViewMoved = TRUE; + bViewMoved = sal_True; } else if( rTextHint.GetId() == TEXT_HINT_TEXTHEIGHTCHANGED ) { @@ -114,8 +114,8 @@ void TextEditImp::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } else if( rTextHint.GetId() == TEXT_HINT_TEXTFORMATTED ) { - ULONG nWidth = pTextEngine->CalcTextWidth(); - if ( (ULONG)nWidth != pAppEdit->nCurTextWidth ) + sal_uIntPtr nWidth = pTextEngine->CalcTextWidth(); + if ( (sal_uIntPtr)nWidth != pAppEdit->nCurTextWidth ) { pAppEdit->nCurTextWidth = nWidth; if ( pAppEdit->pHScroll ) @@ -128,12 +128,12 @@ void TextEditImp::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) else if( rTextHint.GetId() == TEXT_HINT_PARAINSERTED ) { if ( ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow() ) - ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow()->AdjustBreakpoints( rTextHint.GetValue()+1, TRUE ); + ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow()->AdjustBreakpoints( rTextHint.GetValue()+1, sal_True ); } else if( rTextHint.GetId() == TEXT_HINT_PARAREMOVED ) { if ( ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow() ) - ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow()->AdjustBreakpoints( rTextHint.GetValue()+1, FALSE ); + ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow()->AdjustBreakpoints( rTextHint.GetValue()+1, sal_False ); // Itchy adaption for two signs at line ends instead of one (hard coded default) pTextEngine->SetMaxTextLen( STRING_MAXLEN - pTextEngine->GetParagraphCount() ); @@ -188,12 +188,12 @@ int TextAttribSpechial::operator==( const TextAttrib& rAttr ) const ( maFontWeight == ((const TextAttribSpechial&)rAttr).maFontWeight ) ); } -void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff ) +void TextEditImp::ImpDoHighlight( const String& rSource, sal_uIntPtr nLineOff ) { SbTextPortions aPortionList; pAppEdit->GetBasicFrame()->Basic().Highlight( rSource, aPortionList ); - USHORT nCount = aPortionList.Count(); + sal_uInt16 nCount = aPortionList.Count(); if ( !nCount ) return; @@ -210,8 +210,8 @@ void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff ) } // here is the postprocessing for types for the TestTool - USHORT i; - BOOL bWasTTControl = FALSE; + sal_uInt16 i; + sal_Bool bWasTTControl = sal_False; for ( i = 0; i < aPortionList.Count(); i++ ) { SbTextPortion& r = aPortionList[i]; @@ -228,20 +228,20 @@ void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff ) r.eType = pAppEdit->GetBasicFrame()->Basic().GetSymbolType( aSymbol, bWasTTControl ); if ( r.eType == TT_CONTROL ) - bWasTTControl = TRUE; + bWasTTControl = sal_True; else - bWasTTControl = FALSE; + bWasTTControl = sal_False; } break; case SB_PUNCTUATION: { String aPunctuation = rSource.Copy( r.nStart, r.nEnd - r.nStart +1 ); if ( aPunctuation.CompareToAscii( "." ) != COMPARE_EQUAL ) - bWasTTControl = FALSE; + bWasTTControl = sal_False; } break; default: - bWasTTControl = FALSE; + bWasTTControl = sal_False; } } @@ -271,7 +271,7 @@ void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff ) r.nEnd = rSource.Len()-1; } - BOOL bWasModified = pTextEngine->IsModified(); + sal_Bool bWasModified = pTextEngine->IsModified(); for ( i = 0; i < aPortionList.Count(); i++ ) { SbTextPortion& r = aPortionList[i]; @@ -280,7 +280,7 @@ void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff ) SbTextType eCol = r.eType; Color aColor; - ULONG nLine = nLineOff+r.nLine-1; // -1, because BASIC starts with 1 + sal_uIntPtr nLine = nLineOff+r.nLine-1; // -1, because BASIC starts with 1 switch ( +eCol ) { case SB_KEYWORD: @@ -333,7 +333,7 @@ void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff ) pTextEngine->SetModified( bWasModified ); } -void TextEditImp::DoSyntaxHighlight( ULONG nPara ) +void TextEditImp::DoSyntaxHighlight( sal_uIntPtr nPara ) { // Due to delayed syntax highlight it can happen that the // paragraph does no longer exist @@ -355,7 +355,7 @@ void TextEditImp::DoDelayedSyntaxHighlight( xub_StrLen nPara ) { if ( bDelayHighlight ) { - aSyntaxLineTable.Insert( nPara, (void*)(ULONG)1 ); + aSyntaxLineTable.Insert( nPara, (void*)(sal_uIntPtr)1 ); aSyntaxIdleTimer.Start(); } else @@ -366,32 +366,32 @@ void TextEditImp::DoDelayedSyntaxHighlight( xub_StrLen nPara ) IMPL_LINK( TextEditImp, SyntaxTimerHdl, Timer *, EMPTYARG ) { DBG_ASSERT( pTextView, "Not yet a View but Syntax-Highlight ?!" ); - pTextEngine->SetUpdateMode( FALSE ); + pTextEngine->SetUpdateMode( sal_False ); - bHighlightning = TRUE; - USHORT nLine; + bHighlightning = sal_True; + sal_uInt16 nLine; while ( aSyntaxLineTable.First() && !Application::AnyInput( INPUT_MOUSEANDKEYBOARD ) ) { - nLine = (USHORT)aSyntaxLineTable.GetCurKey(); + nLine = (sal_uInt16)aSyntaxLineTable.GetCurKey(); DoSyntaxHighlight( nLine ); aSyntaxLineTable.Remove( nLine ); } - BOOL bWasModified = pTextEngine->IsModified(); + sal_Bool bWasModified = pTextEngine->IsModified(); if ( aSyntaxLineTable.Count() > 3 ) // Without VDev { - pTextEngine->SetUpdateMode( TRUE ); - pTextView->ShowCursor( TRUE, TRUE ); + pTextEngine->SetUpdateMode( sal_True ); + pTextView->ShowCursor( sal_True, sal_True ); } else - pTextEngine->SetUpdateMode( TRUE ); // ! With VDev + pTextEngine->SetUpdateMode( sal_True ); // ! With VDev - // SetUpdateMode( TRUE ) soll kein Modify setzen + // SetUpdateMode( sal_True ) soll kein Modify setzen pTextEngine->SetModified( bWasModified ); // SyntaxTimerHdl wird gerufen, wenn Text-Aenderung // => gute Gelegenheit, Textbreite zu ermitteln! - bHighlightning = FALSE; + bHighlightning = sal_False; if ( aSyntaxLineTable.First() ) aImplSyntaxIdleTimer.Start(); @@ -405,7 +405,7 @@ void TextEditImp::InvalidateSyntaxHighlight() DoDelayedSyntaxHighlight( i ); } -void TextEditImp::SyntaxHighlight( BOOL bNew ) +void TextEditImp::SyntaxHighlight( sal_Bool bNew ) { if ( ( bNew && bDoSyntaxHighlight ) || ( !bNew && !bDoSyntaxHighlight ) ) return; @@ -422,12 +422,12 @@ void TextEditImp::SyntaxHighlight( BOOL bNew ) else { aSyntaxIdleTimer.Stop(); - pTextEngine->SetUpdateMode( FALSE ); - for ( ULONG i = 0; i < pTextEngine->GetParagraphCount(); i++ ) + pTextEngine->SetUpdateMode( sal_False ); + for ( sal_uIntPtr i = 0; i < pTextEngine->GetParagraphCount(); i++ ) pTextEngine->RemoveAttribs( i ); - pTextEngine->SetUpdateMode( TRUE ); - pTextView->ShowCursor(TRUE, TRUE ); + pTextEngine->SetUpdateMode( sal_True ); + pTextView->ShowCursor(sal_True, sal_True ); } } @@ -437,15 +437,15 @@ void TextEditImp::SetFont( const Font& rNewFont ) pTextEngine->SetFont(rNewFont); } -BOOL TextEditImp::IsModified() +sal_Bool TextEditImp::IsModified() { return pTextEngine->IsModified(); } void TextEditImp::KeyInput( const KeyEvent& rKeyEvent ) { - BOOL bWasModified = pTextView->GetTextEngine()->IsModified(); - pTextView->GetTextEngine()->SetModified( FALSE ); + sal_Bool bWasModified = pTextView->GetTextEngine()->IsModified(); + pTextView->GetTextEngine()->SetModified( sal_False ); if ( !pTextView->KeyInput( rKeyEvent ) ) Window::KeyInput( rKeyEvent ); @@ -526,10 +526,10 @@ SbxBase* TextEditImp::GetSbxAtMousePos( String &aWord ) if ( aSuffixes.Search( aWord.GetChar(nLastChar) ) != STRING_NOTFOUND ) aWord.Erase( nLastChar, 1 ); // because perhaps TestTools throws an error - BOOL bWasError = SbxBase::IsError(); - pAppEdit->GetBasicFrame()->Basic().DebugFindNoErrors( TRUE ); + sal_Bool bWasError = SbxBase::IsError(); + pAppEdit->GetBasicFrame()->Basic().DebugFindNoErrors( sal_True ); SbxBase* pSBX = StarBASIC::FindSBXInCurrentScope( aWord ); - pAppEdit->GetBasicFrame()->Basic().DebugFindNoErrors( FALSE ); + pAppEdit->GetBasicFrame()->Basic().DebugFindNoErrors( sal_False ); DBG_ASSERT( !( !bWasError && SbxBase::IsError()), "Error generated while retrieving Variable data for viewing" ); if ( !bWasError && SbxBase::IsError() ) SbxBase::ResetError(); @@ -655,8 +655,8 @@ DBG_NAME(TextEdit) TextEdit::TextEdit( AppEdit* pParent, const WinBits& aBits ) : pBreakpointWindow( NULL ) -, bFileWasUTF8( FALSE ) -, bSaveAsUTF8( FALSE ) +, bFileWasUTF8( sal_False ) +, bSaveAsUTF8( sal_False ) , aEdit( pParent, aBits | WB_NOHIDESELECTION ) { DBG_CTOR(TextEdit,0); @@ -665,7 +665,7 @@ DBG_CTOR(TextEdit,0); TextEdit::~TextEdit() {DBG_DTOR(TextEdit,0);} -void TextEdit::Highlight( ULONG nLine, xub_StrLen nCol1, xub_StrLen nCol2 ) +void TextEdit::Highlight( sal_uIntPtr nLine, xub_StrLen nCol1, xub_StrLen nCol2 ) { if ( nLine ) // Should not occure but at 'Sub expected' in first line nLine--; @@ -691,7 +691,7 @@ void TextEdit::Highlight( ULONG nLine, xub_StrLen nCol1, xub_StrLen nCol2 ) // Because nCol2 *may* point after the current statement // (because the next one starts there) there are space // that must be removed - BOOL bColon = FALSE; + sal_Bool bColon = sal_False; while ( s.GetChar( nCol2 ) == ' ' && nCol2 > nCol1 && !bColon ) { @@ -699,7 +699,7 @@ void TextEdit::Highlight( ULONG nLine, xub_StrLen nCol1, xub_StrLen nCol2 ) if ( s.GetChar( nCol2 ) == ':' ) { nCol2--; - bColon = TRUE; + bColon = sal_True; } } @@ -724,31 +724,31 @@ String TextEdit::GetSelected(){ return aEdit.pTextView->GetSelected(); } TextSelection TextEdit::GetSelection() const{ return aEdit.pTextView->GetSelection(); } void TextEdit::SetSelection( const TextSelection& rSelection ){ aEdit.pTextView->SetSelection( rSelection ); } -USHORT TextEdit::GetLineNr() const +sal_uInt16 TextEdit::GetLineNr() const { - return sal::static_int_cast< USHORT >( + return sal::static_int_cast< sal_uInt16 >( aEdit.pTextView->GetSelection().GetEnd().GetPara()+1); } void TextEdit::ReplaceSelected( const String& rStr ){ aEdit.pTextView->InsertText(rStr); } -BOOL TextEdit::IsModified(){ return aEdit.IsModified(); } +sal_Bool TextEdit::IsModified(){ return aEdit.IsModified(); } String TextEdit::GetText() const { return aEdit.pTextEngine->GetText( GetSystemLineEnd() ); } -void TextEdit::SetText( const String& rStr ){ aEdit.pTextEngine->SetText(rStr); aEdit.pTextEngine->SetModified( FALSE ); } +void TextEdit::SetText( const String& rStr ){ aEdit.pTextEngine->SetText(rStr); aEdit.pTextEngine->SetModified( sal_False ); } void TextEdit::SetModifyHdl( Link l ){ aEdit.SetModifyHdl(l); } -BOOL TextEdit::HasText() const { return aEdit.pTextEngine->GetTextLen() > 0; } +sal_Bool TextEdit::HasText() const { return aEdit.pTextEngine->GetTextLen() > 0; } // Search from the beginning or at mark + 1 -BOOL TextEdit::Find( const String& s ) +sal_Bool TextEdit::Find( const String& s ) { DBG_CHKTHIS(TextEdit,0); TextSelection aSelection = aEdit.pTextView->GetSelection(); - ULONG nPara = aSelection.GetStart().GetPara(); + sal_uIntPtr nPara = aSelection.GetStart().GetPara(); xub_StrLen nIndex = aSelection.GetStart().GetIndex(); if ( aSelection.HasRange() ) @@ -762,23 +762,23 @@ BOOL TextEdit::Find( const String& s ) if( nIndex != STRING_NOTFOUND ) { aEdit.pTextView->SetSelection( TextSelection( TextPaM( nPara, nIndex ), TextPaM( nPara, nIndex + s.Len() ) ) ); - return TRUE; + return sal_True; } nIndex = 0; nPara++; } - return FALSE; + return sal_False; } -BOOL TextEdit::Load( const String& aName ) +sal_Bool TextEdit::Load( const String& aName ) { DBG_CHKTHIS(TextEdit,0); - BOOL bOk = TRUE; + sal_Bool bOk = sal_True; SvFileStream aStrm( aName, STREAM_STD_READ ); if( aStrm.IsOpen() ) { String aText, aLine, aLineBreak; - BOOL bIsFirstLine = TRUE; + sal_Bool bIsFirstLine = sal_True; aLineBreak += '\n'; aLineBreak.ConvertLineEnd(); rtl_TextEncoding aFileEncoding = RTL_TEXTENCODING_IBM_850; @@ -788,29 +788,29 @@ DBG_CHKTHIS(TextEdit,0); if ( bIsFirstLine && IsTTSignatureForUnicodeTextfile( aLine ) ) { aFileEncoding = RTL_TEXTENCODING_UTF8; - bFileWasUTF8 = TRUE; + bFileWasUTF8 = sal_True; } else { if ( !bIsFirstLine ) aText += aLineBreak; aText += aLine; - bIsFirstLine = FALSE; + bIsFirstLine = sal_False; } if( aStrm.GetError() != SVSTREAM_OK ) - bOk = FALSE; + bOk = sal_False; } SetText( aText ); } else - bOk = FALSE; + bOk = sal_False; return bOk; } -BOOL TextEdit::Save( const String& aName ) +sal_Bool TextEdit::Save( const String& aName ) { DBG_CHKTHIS(TextEdit,0); - BOOL bOk = TRUE; + sal_Bool bOk = sal_True; SvFileStream aStrm( aName, STREAM_STD_WRITE | STREAM_TRUNC ); rtl_TextEncoding aFileEncoding = RTL_TEXTENCODING_IBM_850; if( aStrm.IsOpen() ) @@ -825,10 +825,10 @@ DBG_CHKTHIS(TextEdit,0); aSave.ConvertLineEnd(LINEEND_LF); aStrm << ByteString( aSave, aFileEncoding ).GetBuffer(); if( aStrm.GetError() != SVSTREAM_OK ) - bOk = FALSE; + bOk = sal_False; else - aEdit.pTextEngine->SetModified(FALSE); - } else bOk = FALSE; + aEdit.pTextEngine->SetModified(sal_False); + } else bOk = sal_False; return bOk; } diff --git a/basic/source/app/textedit.hxx b/basic/source/app/textedit.hxx index 094896fa87f4..21044c75e4bf 100644..100755 --- a/basic/source/app/textedit.hxx +++ b/basic/source/app/textedit.hxx @@ -49,7 +49,7 @@ class TextEditImp : public Window, public SfxListener using Window::Notify; protected: - void DoSyntaxHighlight( ULONG nPara ); + void DoSyntaxHighlight( sal_uIntPtr nPara ); private: @@ -63,10 +63,10 @@ private: void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - void ImpDoHighlight( const String& rSource, ULONG nLineOff ); - BOOL bHighlightning; - BOOL bDoSyntaxHighlight; - BOOL bDelayHighlight; + void ImpDoHighlight( const String& rSource, sal_uIntPtr nLineOff ); + sal_Bool bHighlightning; + sal_Bool bDoSyntaxHighlight; + sal_Bool bDelayHighlight; SbxBase* GetSbxAtMousePos( String &aWord ); @@ -75,12 +75,12 @@ private: DECL_LINK( ShowVarContents, void* ); Point aTipPos; String aTipWord; - ULONG nTipId; + sal_uIntPtr nTipId; Timer HideTipTimer; Timer ShowTipTimer; - BOOL bViewMoved; + sal_Bool bViewMoved; public: TextEditImp( AppEdit *pParent, const WinBits& aBits ); @@ -90,7 +90,7 @@ public: TextView *pTextView; void SetFont( const Font& rNewFont ); - BOOL IsModified(); + sal_Bool IsModified(); void SetModifyHdl( Link l ){ ModifyHdl = l; } void KeyInput( const KeyEvent& rKeyEvent ); @@ -99,14 +99,14 @@ public: void MouseButtonDown( const MouseEvent& rMouseEvent ); // void MouseMove( const MouseEvent& rMouseEvent ); void Command( const CommandEvent& rCEvt ); - //BOOL Drop( const DropEvent& rEvt ); - //BOOL QueryDrop( DropEvent& rEvt ); + //sal_Bool Drop( const DropEvent& rEvt ); + //sal_Bool QueryDrop( DropEvent& rEvt ); - BOOL ViewMoved(); + sal_Bool ViewMoved(); void DoDelayedSyntaxHighlight( xub_StrLen nPara ); void InvalidateSyntaxHighlight(); - void SyntaxHighlight( BOOL bNew ); + void SyntaxHighlight( sal_Bool bNew ); void BuildKontextMenu( PopupMenu *&pMenu ); }; @@ -116,13 +116,13 @@ DBG_NAMEEX(TextEdit) class TextEdit : public DataEdit { BreakpointWindow *pBreakpointWindow; - BOOL bFileWasUTF8; - BOOL bSaveAsUTF8; + sal_Bool bFileWasUTF8; + sal_Bool bSaveAsUTF8; public: TextEdit( AppEdit*, const WinBits& ); ~TextEdit(); - void Highlight( ULONG nLine, xub_StrLen nCol1, xub_StrLen nCol2 ); + void Highlight( sal_uIntPtr nLine, xub_StrLen nCol1, xub_StrLen nCol2 ); TextEditImp& GetTextEditImp() { return aEdit; } void SetBreakpointWindow( BreakpointWindow *pBPWindow ){ pBreakpointWindow = pBPWindow; } @@ -132,7 +132,7 @@ public: virtual void BuildKontextMenu( PopupMenu *&pMenu ); - void SaveAsUTF8( BOOL bUTF8 ) { bSaveAsUTF8 = bUTF8; } + void SaveAsUTF8( sal_Bool bUTF8 ) { bSaveAsUTF8 = bUTF8; } }; #endif diff --git a/basic/source/app/ttbasic.cxx b/basic/source/app/ttbasic.cxx index cfc12a85dcc4..cfc12a85dcc4 100644..100755 --- a/basic/source/app/ttbasic.cxx +++ b/basic/source/app/ttbasic.cxx diff --git a/basic/source/app/ttbasic.hxx b/basic/source/app/ttbasic.hxx index 8810da66b5e9..8810da66b5e9 100644..100755 --- a/basic/source/app/ttbasic.hxx +++ b/basic/source/app/ttbasic.hxx diff --git a/basic/source/app/ttmsg.src b/basic/source/app/ttmsg.src index e0f43e89b851..c2c017b167ca 100644..100755 --- a/basic/source/app/ttmsg.src +++ b/basic/source/app/ttmsg.src @@ -24,7 +24,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include "ttmsg.hrc" +#include "basic/ttmsg.hrc" // Here are included the messages of the folder /basic/source/testtool diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index 2057a065e96c..f94155d67808 100644..100755 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -138,9 +138,17 @@ namespace basic impl_getLocationForModel( const Reference< XModel >& _rxDocumentModel ); /** creates a new BasicManager instance for the given model + + @param _out_rpBasicManager + reference to the pointer variable that will hold the new + BasicManager. + + @param _rxDocumentModel + the model whose BasicManager will be created. Must not be <NULL/>. */ - BasicManagerPointer - impl_createManagerForModel( const Reference< XModel >& _rxDocumentModel ); + void impl_createManagerForModel( + BasicManagerPointer& _out_rpBasicManager, + const Reference< XModel >& _rxDocumentModel ); /** creates the application-wide BasicManager */ @@ -243,9 +251,17 @@ namespace basic { ::osl::MutexGuard aGuard( m_aMutex ); + /* #163556# (DR) - This function may be called recursively while + constructing the Basic manager and loading the Basic storage. By + passing the map entry received from impl_getLocationForModel() to + the function impl_createManagerForModel(), the new Basic manager + will be put immediately into the map of existing Basic managers, + thus a recursive call of this function will find and return it + without creating another instance. + */ BasicManagerPointer& pBasicManager = impl_getLocationForModel( _rxDocumentModel ); if ( pBasicManager == NULL ) - pBasicManager = impl_createManagerForModel( _rxDocumentModel ); + impl_createManagerForModel( pBasicManager, _rxDocumentModel ); return pBasicManager; } @@ -407,21 +423,21 @@ namespace basic } //-------------------------------------------------------------------- - BasicManagerPointer ImplRepository::impl_createManagerForModel( const Reference< XModel >& _rxDocumentModel ) + void ImplRepository::impl_createManagerForModel( BasicManagerPointer& _out_rpBasicManager, const Reference< XModel >& _rxDocumentModel ) { StarBASIC* pAppBasic = impl_getDefaultAppBasicLibrary(); - BasicManager* pBasicManager( NULL ); + _out_rpBasicManager = 0; Reference< XStorage > xStorage; if ( !impl_getDocumentStorage_nothrow( _rxDocumentModel, xStorage ) ) // the document is not able to provide the storage it is based on. - return pBasicManager; + return; Reference< XPersistentLibraryContainer > xBasicLibs; Reference< XPersistentLibraryContainer > xDialogLibs; if ( !impl_getDocumentLibraryContainers_nothrow( _rxDocumentModel, xBasicLibs, xDialogLibs ) ) // the document does not have BasicLibraries and DialogLibraries - return pBasicManager; + return; if ( xStorage.is() ) { @@ -432,24 +448,24 @@ namespace basic // Storage and BaseURL are only needed by binary documents! SotStorageRef xDummyStor = new SotStorage( ::rtl::OUString() ); - pBasicManager = new BasicManager( *xDummyStor, String() /* TODO/LATER: xStorage */, + _out_rpBasicManager = new BasicManager( *xDummyStor, String() /* TODO/LATER: xStorage */, pAppBasic, - &aAppBasicDir, TRUE ); - if ( pBasicManager->HasErrors() ) + &aAppBasicDir, sal_True ); + if ( _out_rpBasicManager->HasErrors() ) { // handle errors - BasicError* pErr = pBasicManager->GetFirstError(); + BasicError* pErr = _out_rpBasicManager->GetFirstError(); while ( pErr ) { // show message to user if ( ERRCODE_BUTTON_CANCEL == ErrorHandler::HandleError( pErr->GetErrorId() ) ) { // user wants to break loading of BASIC-manager - BasicManagerCleaner::deleteBasicManager( pBasicManager ); + BasicManagerCleaner::deleteBasicManager( _out_rpBasicManager ); xStorage.clear(); break; } - pErr = pBasicManager->GetNextError(); + pErr = _out_rpBasicManager->GetNextError(); } } } @@ -460,14 +476,14 @@ namespace basic // create new BASIC-manager StarBASIC* pBasic = new StarBASIC( pAppBasic ); pBasic->SetFlag( SBX_EXTSEARCH ); - pBasicManager = new BasicManager( pBasic, NULL, TRUE ); + _out_rpBasicManager = new BasicManager( pBasic, NULL, sal_True ); } // knit the containers with the BasicManager LibraryContainerInfo aInfo( xBasicLibs, xDialogLibs, dynamic_cast< OldBasicPassword* >( xBasicLibs.get() ) ); OSL_ENSURE( aInfo.mpOldBasicPassword, "ImplRepository::impl_createManagerForModel: wrong BasicLibraries implementation!" ); - pBasicManager->SetLibraryContainerInfo( aInfo ); - //pBasicCont->setBasicManager( pBasicManager ); + _out_rpBasicManager->SetLibraryContainerInfo( aInfo ); + //pBasicCont->setBasicManager( _out_rpBasicManager ); // that's not needed anymore today. The containers will retrieve their associated // BasicManager from the BasicManagerRepository, when needed. @@ -475,13 +491,13 @@ namespace basic impl_initDocLibraryContainers_nothrow( xBasicLibs, xDialogLibs ); // so that also dialogs etc. could be 'qualified' addressed - pBasicManager->GetLib(0)->SetParent( pAppBasic ); + _out_rpBasicManager->GetLib(0)->SetParent( pAppBasic ); // global properties in the document's Basic - pBasicManager->SetGlobalUNOConstant( "ThisComponent", makeAny( _rxDocumentModel ) ); + _out_rpBasicManager->SetGlobalUNOConstant( "ThisComponent", makeAny( _rxDocumentModel ) ); // notify - impl_notifyCreationListeners( _rxDocumentModel, *pBasicManager ); + impl_notifyCreationListeners( _rxDocumentModel, *_out_rpBasicManager ); // register as listener for this model being disposed/closed Reference< XComponent > xDocumentComponent( _rxDocumentModel, UNO_QUERY ); @@ -489,9 +505,14 @@ namespace basic startComponentListening( xDocumentComponent ); // register as listener for the BasicManager being destroyed - StartListening( *pBasicManager ); + StartListening( *_out_rpBasicManager ); + + // #i104876: Library container must not be modified just after + // creation. This happens as side effect when creating default + // "Standard" libraries and needs to be corrected here + xBasicLibs->setModified( sal_False ); + xDialogLibs->setModified( sal_False ); - return pBasicManager; } //-------------------------------------------------------------------- diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index dde988b50d38..a2aa4b53207c 100644..100755 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -43,6 +43,8 @@ #include <tools/diagnose_ex.h> #include <basic/sbmod.hxx> #include <basic/sbobjmod.hxx> +#include <unotools/intlwrapper.hxx> +#include <comphelper/processfactory.hxx> #include <basic/sbuno.hxx> #include <basic/basmgr.hxx> @@ -94,15 +96,15 @@ typedef vector< BasicError* > BasErrorLst; #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"; @@ -254,7 +256,7 @@ void BasMgrContainerListenerImpl::addLibraryModulesImpl( BasicManager* pMgr, } } - pLib->SetModified( FALSE ); + pLib->SetModified( sal_False ); } @@ -312,7 +314,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementInserted( const ContainerEvent } else pLib->MakeModule32( aName, aMod ); - pLib->SetModified( FALSE ); + pLib->SetModified( sal_False ); } } } @@ -346,7 +348,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementReplaced( const ContainerEvent else pLib->MakeModule32( aName, aMod ); - pLib->SetModified( FALSE ); + pLib->SetModified( sal_False ); } } @@ -366,8 +368,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 @@ -377,7 +379,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementRemoved( const ContainerEvent& if( pMod ) { pLib->Remove( pMod ); - pLib->SetModified( FALSE ); + pLib->SetModified( sal_False ); } } } @@ -452,7 +454,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; @@ -478,10 +480,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; @@ -490,10 +492,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; } @@ -516,19 +518,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 ) @@ -644,10 +646,10 @@ BasicLibInfo* BasicLibs::Remove( BasicLibInfo* LibInfo ) 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); @@ -655,20 +657,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; @@ -682,7 +684,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_; @@ -735,8 +737,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; @@ -746,7 +748,7 @@ BasicLibInfo* BasicLibInfo::Create( SotStorageStream& rSStream ) if( nId == LIBINFO_ID ) { // Reload? - BOOL bDoLoad; + sal_Bool bDoLoad; rSStream >> bDoLoad; pInfo->bDoLoad = bDoLoad; @@ -767,7 +769,7 @@ BasicLibInfo* BasicLibInfo::Create( SotStorageStream& rSStream ) if ( nVer >= 2 ) { - BOOL bReferenz; + sal_Bool bReferenz; rSStream >> bReferenz; pInfo->IsReference() = bReferenz; } @@ -790,7 +792,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 ); @@ -827,13 +829,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 ) @@ -844,7 +846,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 @@ -855,12 +857,12 @@ BasicManager::BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBA *static_cast<SvStream*>(&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?!" ); @@ -879,7 +881,7 @@ BasicManager::BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBA LoadOldBasicManager( rStorage ); } - bBasMgrModified = FALSE; + bBasMgrModified = sal_False; } void copyToLibraryContainer( StarBASIC* pBasic, const LibraryContainerInfo& rInfo ) @@ -898,8 +900,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!" ); @@ -963,14 +965,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(); } @@ -999,7 +1001,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(); @@ -1016,8 +1018,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() @@ -1042,7 +1044,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 ); } @@ -1057,7 +1059,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 ); @@ -1095,7 +1097,7 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseUR sal_uInt32 nEndPos; *xManagerStream >> nEndPos; - USHORT nLibs; + sal_uInt16 nLibs; *xManagerStream >> nLibs; // Plausibility! if( nLibs & 0xF000 ) @@ -1103,7 +1105,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 ); @@ -1113,7 +1115,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 @@ -1129,7 +1131,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 ); } } } @@ -1192,8 +1194,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 @@ -1205,7 +1207,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!" ); @@ -1214,14 +1216,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 { StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, aStorName, ERRCODE_BUTTON_OK ); @@ -1258,8 +1260,8 @@ bool BasicManager::HasExeCode( const String& sLib ) if ( pLib ) { SbxArray* pMods = pLib->GetModules(); - USHORT nMods = pMods ? pMods->Count() : 0; - for( USHORT i = 0; i < nMods; i++ ) + sal_uInt16 nMods = pMods ? pMods->Count() : 0; + for( sal_uInt16 i = 0; i < nMods; i++ ) { SbModule* p = (SbModule*) pMods->Get( i ); if ( p ) @@ -1274,7 +1276,7 @@ void BasicManager::Init() { DBG_CHKTHIS( BasicManager, 0 ); - bBasMgrModified = FALSE; + bBasMgrModified = sal_False; pErrorMgr = new BasicErrorManager; pLibs = new BasicLibs; mpImpl = new BasicManagerImpl(); @@ -1289,7 +1291,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 ); @@ -1317,10 +1319,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() ) { @@ -1338,7 +1340,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 ) @@ -1351,7 +1353,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 @@ -1360,7 +1362,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 ) @@ -1387,20 +1389,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(); } @@ -1409,11 +1411,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) ) ) @@ -1432,8 +1434,8 @@ BOOL BasicManager::ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) con // Fill new libray container (5.2 -> 6.0) copyToLibraryContainer( pNew, mpImpl->maContainerInfo ); - pNew->SetModified( FALSE ); - bLoaded = TRUE; + pNew->SetModified( sal_False ); + bLoaded = sal_True; } } if ( bProtected ) @@ -1441,14 +1443,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!" ); @@ -1461,11 +1463,11 @@ void BasicManager::CheckModules( StarBASIC* pLib, BOOL bReference ) const if( !bModified && bReference ) { OSL_FAIL( "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 ); @@ -1483,11 +1485,11 @@ 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 = (USHORT) pLibs->GetPos( pLibInfo ); + 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 ) { @@ -1496,20 +1498,20 @@ 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->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; } @@ -1519,7 +1521,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 ); @@ -1528,16 +1530,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!" ); @@ -1550,7 +1552,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, @@ -1560,14 +1562,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() ) { @@ -1604,20 +1606,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 ); @@ -1649,7 +1651,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 ); @@ -1657,14 +1659,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 ); @@ -1672,14 +1674,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 ); @@ -1692,15 +1694,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 ); @@ -1711,11 +1713,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 ) @@ -1729,7 +1731,7 @@ BOOL BasicManager::LoadLib( USHORT nLib ) } else { - bDone = ImpLoadLibary( pLibInfo, NULL, FALSE ); + bDone = ImpLoadLibary( pLibInfo, NULL, sal_False ); StarBASIC* pLib = GetLib( nLib ); if ( pLib ) { @@ -1772,10 +1774,10 @@ 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 ); } DBG_ASSERT( pLib, "XML Import: Linked basic library could not be loaded"); @@ -1829,16 +1831,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 ); @@ -1846,17 +1848,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?!" ); @@ -1871,7 +1873,7 @@ void BasicManager::SetFlagToAllLibs( short nFlag, BOOL bSet ) const } } -BOOL BasicManager::HasErrors() +sal_Bool BasicManager::HasErrors() { DBG_CHKTHIS( BasicManager, 0 ); return pErrorMgr->HasErrors(); @@ -1977,6 +1979,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; n<nCount; ++n ) + { + sQuotedArgs += '\"'; + sQuotedArgs += sArgs.GetToken( n, ',' ); + sQuotedArgs += '\"'; + if ( n<nCount-1 ) + sQuotedArgs += ','; + } + + sQuotedArgs += ')'; + } + + // add quoted arguments and do the call + String sCall( '[' ); + sCall += pMethod->GetName(); + sCall += sQuotedArgs; + sCall += ']'; + + SbxVariable* pRet = pMethod->GetParent()->Execute( sCall ); + if ( pRet ) + *i_retValue = *pRet; + return SbxBase::GetError(); +} + //===================================================================== class ModuleInfo_Impl : public ModuleInfoHelper @@ -2130,10 +2242,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() ); @@ -2460,10 +2572,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 ) ); } @@ -2500,7 +2612,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 ); } diff --git a/basic/source/basmgr/makefile.mk b/basic/source/basmgr/makefile.mk index e08e9cc753bd..615a8e8465ef 100644..100755 --- a/basic/source/basmgr/makefile.mk +++ b/basic/source/basmgr/makefile.mk @@ -39,7 +39,8 @@ ENABLE_EXCEPTIONS=TRUE SLOFILES= \ $(SLO)$/basmgr.obj \ - $(SLO)$/basicmanagerrepository.obj + $(SLO)$/basicmanagerrepository.obj\ + $(SLO)$/vbahelper.obj # --- Targets ------------------------------------------------------------- diff --git a/basic/source/basmgr/vbahelper.cxx b/basic/source/basmgr/vbahelper.cxx new file mode 100755 index 000000000000..a09446f2e40b --- /dev/null +++ b/basic/source/basmgr/vbahelper.cxx @@ -0,0 +1,212 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_basic.hxx" + +#include "basic/vbahelper.hxx" +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/XModel2.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <comphelper/processfactory.hxx> + +namespace basic { +namespace vba { + +using namespace ::com::sun::star; + +// ============================================================================ + +namespace { + +/** Creates the global module manager needed to identify the type of documents. + */ +uno::Reference< frame::XModuleManager > lclCreateModuleManager() +{ + uno::Reference< frame::XModuleManager > xModuleManager; + try + { + uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW ); + xModuleManager.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ) ) ), uno::UNO_QUERY ); + } + catch( uno::Exception& ) + { + } + OSL_ENSURE( xModuleManager.is(), "::basic::vba::lclCreateModuleManager - cannot create module manager" ); + return xModuleManager; +} + +// ---------------------------------------------------------------------------- + +/** Returns the document service name of the specified document. + */ +::rtl::OUString lclIdentifyDocument( const uno::Reference< frame::XModuleManager >& rxModuleManager, const uno::Reference< frame::XModel >& rxModel ) +{ + ::rtl::OUString aServiceName; + if( rxModuleManager.is() ) + { + try + { + aServiceName = rxModuleManager->identify( rxModel ); + } + catch( uno::Exception& ) + { + } + OSL_ENSURE( aServiceName.getLength() > 0, "::basic::vba::lclIdentifyDocument - cannot identify document" ); + } + return aServiceName; +} + +// ---------------------------------------------------------------------------- + +/** Returns an enumeration of all open documents. + */ +uno::Reference< container::XEnumeration > lclCreateDocumentEnumeration() +{ + uno::Reference< container::XEnumeration > xEnumeration; + try + { + uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW ); + uno::Reference< frame::XDesktop > xDesktop( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ), uno::UNO_QUERY_THROW ); + uno::Reference< container::XEnumerationAccess > xComponentsEA( xDesktop->getComponents(), uno::UNO_SET_THROW ); + xEnumeration = xComponentsEA->createEnumeration(); + + } + catch( uno::Exception& ) + { + } + OSL_ENSURE( xEnumeration.is(), "::basic::vba::lclCreateDocumentEnumeration - cannot create enumeration of all documents" ); + return xEnumeration; +} + +// ---------------------------------------------------------------------------- + +/** Locks or unlocks the controllers of the specified document model. + */ +void lclLockControllers( const uno::Reference< frame::XModel >& rxModel, sal_Bool bLockControllers ) +{ + if( rxModel.is() ) try + { + if( bLockControllers ) + rxModel->lockControllers(); + else + rxModel->unlockControllers(); + } + catch( uno::Exception& ) + { + } +} + +// ---------------------------------------------------------------------------- + +/** Enables or disables the container windows of all controllers of the + specified document model. + */ +void lclEnableContainerWindows( const uno::Reference< frame::XModel >& rxModel, sal_Bool bEnableWindows ) +{ + try + { + uno::Reference< frame::XModel2 > xModel2( rxModel, uno::UNO_QUERY_THROW ); + uno::Reference< container::XEnumeration > xControllersEnum( xModel2->getControllers(), uno::UNO_SET_THROW ); + // iterate over all controllers + while( xControllersEnum->hasMoreElements() ) + { + try + { + uno::Reference< frame::XController > xController( xControllersEnum->nextElement(), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XFrame > xFrame( xController->getFrame(), uno::UNO_SET_THROW ); + uno::Reference< awt::XWindow > xWindow( xFrame->getContainerWindow(), uno::UNO_SET_THROW ); + xWindow->setEnable( bEnableWindows ); + } + catch( uno::Exception& ) + { + } + } + } + catch( uno::Exception& ) + { + } +} + +// ---------------------------------------------------------------------------- + +typedef void (*ModifyDocumentFunc)( const uno::Reference< frame::XModel >&, sal_Bool ); + +/** Implementation iterating over all documents that have the same type as the + specified model, and calling the passed functor. + */ +void lclIterateDocuments( ModifyDocumentFunc pModifyDocumentFunc, const uno::Reference< frame::XModel >& rxModel, sal_Bool bModificator ) +{ + uno::Reference< frame::XModuleManager > xModuleManager = lclCreateModuleManager(); + uno::Reference< container::XEnumeration > xDocumentsEnum = lclCreateDocumentEnumeration(); + ::rtl::OUString aIdentifier = lclIdentifyDocument( xModuleManager, rxModel ); + if( xModuleManager.is() && xDocumentsEnum.is() && (aIdentifier.getLength() > 0) ) + { + // iterate over all open documents + while( xDocumentsEnum->hasMoreElements() ) + { + try + { + uno::Reference< frame::XModel > xCurrModel( xDocumentsEnum->nextElement(), uno::UNO_QUERY_THROW ); + ::rtl::OUString aCurrIdentifier = lclIdentifyDocument( xModuleManager, xCurrModel ); + if( aCurrIdentifier == aIdentifier ) + pModifyDocumentFunc( xCurrModel, bModificator ); + } + catch( uno::Exception& ) + { + } + } + } + else + { + // no module manager, no documents enumeration, no identifier -> at least process the passed document + pModifyDocumentFunc( rxModel, bModificator ); + } +} + +} // namespace + +// ============================================================================ + +void lockControllersOfAllDocuments( const uno::Reference< frame::XModel >& rxModel, sal_Bool bLockControllers ) +{ + lclIterateDocuments( &lclLockControllers, rxModel, bLockControllers ); +} + +// ============================================================================ + +void enableContainerWindowsOfAllDocuments( const uno::Reference< frame::XModel >& rxModel, sal_Bool bEnableWindows ) +{ + lclIterateDocuments( &lclEnableContainerWindows, rxModel, bEnableWindows ); +} + +// ============================================================================ + +} // namespace vba +} // namespace basic diff --git a/basic/source/classes/disas.cxx b/basic/source/classes/disas.cxx index 24cc000edfe7..a06c0d05ed18 100644..100755 --- a/basic/source/classes/disas.cxx +++ b/basic/source/classes/disas.cxx @@ -236,7 +236,7 @@ static const char* _crlf() } // This method exists because we want to load the file as own segment -BOOL SbModule::Disassemble( String& rText ) +sal_Bool SbModule::Disassemble( String& rText ) { rText.Erase(); if( pImage ) @@ -244,7 +244,7 @@ BOOL SbModule::Disassemble( String& rText ) SbiDisas aDisas( this, pImage ); aDisas.Disas( rText ); } - return BOOL( rText.Len() != 0 ); + return sal_Bool( rText.Len() != 0 ); } SbiDisas::SbiDisas( SbModule* p, const SbiImage* q ) : rImg( *q ), pMod( p ) @@ -278,23 +278,23 @@ SbiDisas::SbiDisas( SbModule* p, const SbiImage* q ) : rImg( *q ), pMod( p ) } nOff = 0; // Add the publics - for( USHORT i = 0; i < pMod->GetMethods()->Count(); i++ ) + for( sal_uInt16 i = 0; i < pMod->GetMethods()->Count(); i++ ) { SbMethod* pMeth = PTR_CAST(SbMethod,pMod->GetMethods()->Get( i )); if( pMeth ) { - USHORT nPos = (USHORT) (pMeth->GetId()); + sal_uInt16 nPos = (sal_uInt16) (pMeth->GetId()); cLabels[ nPos >> 3 ] |= ( 1 << ( nPos & 7 ) ); } } } // Read current opcode -BOOL SbiDisas::Fetch() +sal_Bool SbiDisas::Fetch() { nPC = nOff; if( nOff >= rImg.GetCodeSize() ) - return FALSE; + return sal_False; const unsigned char* p = (const unsigned char*)( rImg.GetCode() + nOff ); eOp = (SbiOpcode) ( *p++ & 0xFF ); if( eOp <= SbOP0_END ) @@ -302,29 +302,29 @@ BOOL SbiDisas::Fetch() nOp1 = nOp2 = 0; nParts = 1; nOff++; - return TRUE; + return sal_True; } else if( eOp <= SbOP1_END ) { nOff += 5; if( nOff > rImg.GetCodeSize() ) - return FALSE; + return sal_False; nOp1 = *p++; nOp1 |= *p++ << 8; nOp1 |= *p++ << 16; nOp1 |= *p++ << 24; nParts = 2; - return TRUE; + return sal_True; } else if( eOp <= SbOP2_END ) { nOff += 9; if( nOff > rImg.GetCodeSize() ) - return FALSE; + return sal_False; nOp1 = *p++; nOp1 |= *p++ << 8; nOp1 |= *p++ << 16; nOp1 |= *p++ << 24; nOp2 = *p++; nOp2 |= *p++ << 8; nOp2 |= *p++ << 16; nOp2 |= *p++ << 24; nParts = 3; - return TRUE; + return sal_True; } else - return FALSE; + return sal_False; } void SbiDisas::Disas( SvStream& r ) @@ -351,7 +351,7 @@ void SbiDisas::Disas( String& r ) aText.ConvertLineEnd(); } -BOOL SbiDisas::DisasLine( String& rText ) +sal_Bool SbiDisas::DisasLine( String& rText ) { char cBuf[ 100 ]; const char* pMask[] = { @@ -361,7 +361,7 @@ BOOL SbiDisas::DisasLine( String& rText ) "%08" SAL_PRIXUINT32 " %02X %08X %08X " }; rText.Erase(); if( !Fetch() ) - return FALSE; + return sal_False; // New line? if( eOp == _STMNT && nOp1 != nLine ) @@ -369,8 +369,8 @@ BOOL SbiDisas::DisasLine( String& rText ) // Find line String aSource = rImg.aOUSource; nLine = nOp1; - USHORT n = 0; - USHORT l = (USHORT)nLine; + sal_uInt16 n = 0; + sal_uInt16 l = (sal_uInt16)nLine; while( --l ) { n = aSource.SearchAscii( "\n", n ); if( n == STRING_NOTFOUND ) break; @@ -379,16 +379,16 @@ BOOL SbiDisas::DisasLine( String& rText ) // Show position if( n != STRING_NOTFOUND ) { - USHORT n2 = aSource.SearchAscii( "\n", n ); + sal_uInt16 n2 = aSource.SearchAscii( "\n", n ); if( n2 == STRING_NOTFOUND ) n2 = aSource.Len() - n; String s( aSource.Copy( n, n2 - n + 1 ) ); - BOOL bDone; + sal_Bool bDone; do { - bDone = TRUE; + bDone = sal_True; n = s.Search( '\r' ); - if( n != STRING_NOTFOUND ) bDone = FALSE, s.Erase( n, 1 ); + if( n != STRING_NOTFOUND ) bDone = sal_False, s.Erase( n, 1 ); n = s.Search( '\n' ); - if( n != STRING_NOTFOUND ) bDone = FALSE, s.Erase( n, 1 ); + if( n != STRING_NOTFOUND ) bDone = sal_False, s.Erase( n, 1 ); } while( !bDone ); // snprintf( cBuf, sizeof(cBuf), pMask[ 0 ], nPC ); // rText += cBuf; @@ -404,7 +404,7 @@ BOOL SbiDisas::DisasLine( String& rText ) { // Public? ByteString aByteMethName; - for( USHORT i = 0; i < pMod->GetMethods()->Count(); i++ ) + for( sal_uInt16 i = 0; i < pMod->GetMethods()->Count(); i++ ) { SbMethod* pMeth = PTR_CAST(SbMethod,pMod->GetMethods()->Get( i )); if( pMeth ) @@ -434,7 +434,7 @@ BOOL SbiDisas::DisasLine( String& rText ) rText += ':'; rText.AppendAscii( _crlf() ); } - snprintf( cBuf, sizeof(cBuf), pMask[ nParts ], nPC, (USHORT) eOp, nOp1, nOp2 ); + snprintf( cBuf, sizeof(cBuf), pMask[ nParts ], nPC, (sal_uInt16) eOp, nOp1, nOp2 ); String aPCodeStr; aPCodeStr.AppendAscii( cBuf ); @@ -454,13 +454,13 @@ BOOL SbiDisas::DisasLine( String& rText ) rText += aPCodeStr; - return TRUE; + return sal_True; } // Read from StringPool void SbiDisas::StrOp( String& rText ) { - String aStr = rImg.GetString( (USHORT)nOp1 ); + String aStr = rImg.GetString( (sal_uInt16)nOp1 ); ByteString aByteString( aStr, RTL_TEXTENCODING_ASCII_US ); const char* p = aByteString.GetBuffer(); if( p ) @@ -472,7 +472,7 @@ void SbiDisas::StrOp( String& rText ) else { rText.AppendAscii( "?String? " ); - rText += (USHORT)nOp1; + rText += (sal_uInt16)nOp1; } } @@ -526,7 +526,7 @@ void SbiDisas::ResumeOp( String& rText ) } // print Prompt -// FALSE/TRUE +// sal_False/TRUE void SbiDisas::PromptOp( String& rText ) { if( nOp1 ) @@ -558,16 +558,16 @@ void SbiDisas::CharOp( String& rText ) rText += '\''; else rText.AppendAscii( "char " ), - rText += (USHORT)nOp1; + rText += (sal_uInt16)nOp1; } // Print var: String-ID and type void SbiDisas::VarOp( String& rText ) { - rText += rImg.GetString( (USHORT)(nOp1 & 0x7FFF) ); + rText += rImg.GetString( (sal_uInt16)(nOp1 & 0x7FFF) ); rText.AppendAscii( "\t; " ); // The type - UINT32 n = nOp1; + sal_uInt32 n = nOp1; nOp1 = nOp2; TypeOp( rText ); if( n & 0x8000 ) @@ -577,7 +577,7 @@ void SbiDisas::VarOp( String& rText ) // Define variable: String-ID and type void SbiDisas::VarDefOp( String& rText ) { - rText += rImg.GetString( (USHORT)(nOp1 & 0x7FFF) ); + rText += rImg.GetString( (sal_uInt16)(nOp1 & 0x7FFF) ); rText.AppendAscii( "\t; " ); // The Typ nOp1 = nOp2; @@ -590,7 +590,7 @@ void SbiDisas::OffOp( String& rText ) rText += String::CreateFromInt32( nOp1 & 0x7FFF ); rText.AppendAscii( "\t; " ); // The type - UINT32 n = nOp1; + sal_uInt32 n = nOp1; nOp1 = nOp2; TypeOp( rText ); if( n & 0x8000 ) @@ -618,11 +618,11 @@ void SbiDisas::TypeOp( String& rText ) else { rText.AppendAscii( "type " ); - rText += (USHORT)nOp1; + rText += (sal_uInt16)nOp1; } } -// TRUE-Label, condition Opcode +// sal_True-Label, condition Opcode void SbiDisas::CaseOp( String& rText ) { LblOp( rText ); @@ -635,8 +635,8 @@ void SbiDisas::StmntOp( String& rText ) { rText += String::CreateFromInt32( nOp1 ); rText += ','; - UINT32 nCol = nOp2 & 0xFF; - UINT32 nFor = nOp2 / 0x100; + sal_uInt32 nCol = nOp2 & 0xFF; + sal_uInt32 nFor = nOp2 / 0x100; rText += String::CreateFromInt32( nCol ); rText.AppendAscii( " (For-Level: " ); rText += String::CreateFromInt32( nFor ); diff --git a/basic/source/classes/errobject.cxx b/basic/source/classes/errobject.cxx index 44f55aa65f7a..44f55aa65f7a 100644..100755 --- a/basic/source/classes/errobject.cxx +++ b/basic/source/classes/errobject.cxx diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx index 37b8037bf9e3..bb26b99129dd 100644..100755 --- a/basic/source/classes/eventatt.cxx +++ b/basic/source/classes/eventatt.cxx @@ -88,54 +88,6 @@ using namespace ::cppu; using namespace ::osl; - -Reference< frame::XModel > getModelFromBasic( SbxObject* pBasic ) -{ - OSL_PRECOND( pBasic != NULL, "getModelFromBasic: illegal call!" ); - if ( !pBasic ) - return NULL; - - // look for the ThisComponent variable, first in the parent (which - // might be the document's Basic), then in the parent's parent (which might be - // the application Basic) - const ::rtl::OUString sThisComponent( RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" ) ); - SbxVariable* pThisComponent = NULL; - - SbxObject* pLookup = pBasic->GetParent(); - while ( pLookup && !pThisComponent ) - { - pThisComponent = pLookup->Find( sThisComponent, SbxCLASS_OBJECT ); - pLookup = pLookup->GetParent(); - } - if ( !pThisComponent ) - { - OSL_TRACE("Failed to get ThisComponent"); - // the application Basic, at the latest, should have this variable - return NULL; - } - - Any aThisComponent( sbxToUnoValue( pThisComponent ) ); - Reference< frame::XModel > xModel( aThisComponent, UNO_QUERY ); - if ( !xModel.is() ) - { - // it's no XModel. Okay, ThisComponent nowadays is allowed to be a controller. - Reference< frame::XController > xController( aThisComponent, UNO_QUERY ); - if ( xController.is() ) - xModel = xController->getModel(); - } - - if ( !xModel.is() ) - return NULL; - -#if OSL_DEBUG_LEVEL > 0 - OSL_TRACE("Have model ThisComponent points to url %s", - ::rtl::OUStringToOString( xModel->getURL(), - RTL_TEXTENCODING_ASCII_US ).pData->buffer ); -#endif - - return xModel; -} - void SFURL_firing_impl( const ScriptEvent& aScriptEvent, Any* pRet, const Reference< frame::XModel >& xModel ) { OSL_TRACE("SFURL_firing_impl() processing script url %s", @@ -346,7 +298,7 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any if( aName == aLibName ) { // Search only in the lib, not automatically in application basic - USHORT nFlags = pBasic->GetFlags(); + sal_uInt16 nFlags = pBasic->GetFlags(); pBasic->ResetFlag( SBX_GBLSEARCH ); pMethVar = pBasic->Find( aMacro, SbxCLASS_DONTCARE ); pBasic->SetFlags( nFlags ); @@ -376,7 +328,7 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any { SbxVariableRef xVar = new SbxVariable( SbxVARIANT ); unoToSbxValue( (SbxVariable*)xVar, pArgs[i] ); - xArray->Put( xVar, sal::static_int_cast< USHORT >(i+1) ); + xArray->Put( xVar, sal::static_int_cast< sal_uInt16 >(i+1) ); } } @@ -486,7 +438,7 @@ Any implFindDialogLibForDialogBasic( const Any& aAnyISP, SbxObject* pBasic, Star return aDlgLibAny; } -void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ) { (void)pBasic; (void)bWrite; @@ -565,7 +517,7 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) bool bDocDialog = false; StarBASIC* pFoundBasic = NULL; OSL_TRACE("About to try get a hold of ThisComponent"); - Reference< frame::XModel > xModel = getModelFromBasic( pINST->GetBasic() ) ; + Reference< frame::XModel > xModel = StarBASIC::GetModelFromBasic( pINST->GetBasic() ) ; aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pINST->GetBasic(), pFoundBasic ); // If we found the dialog then it belongs to the Search basic if ( !pFoundBasic ) diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx index 716cbe0497d7..d9e7bc521af1 100644..100755 --- a/basic/source/classes/image.cxx +++ b/basic/source/classes/image.cxx @@ -48,8 +48,8 @@ SbiImage::SbiImage() nLegacyCodeSize = nDimBase = 0; bInit = - bError = FALSE; - bFirstInit = TRUE; + bError = sal_False; + bFirstInit = sal_True; eCharSet = gsl_getSystemTextEncoding(); } @@ -74,7 +74,7 @@ void SbiImage::Clear() nCodeSize = 0; eCharSet = gsl_getSystemTextEncoding(); nDimBase = 0; - bError = FALSE; + bError = sal_False; } /************************************************************************** @@ -83,25 +83,25 @@ void SbiImage::Clear() * **************************************************************************/ -BOOL SbiGood( SvStream& r ) +sal_Bool SbiGood( SvStream& r ) { - return BOOL( !r.IsEof() && r.GetError() == SVSTREAM_OK ); + return sal_Bool( !r.IsEof() && r.GetError() == SVSTREAM_OK ); } // Open Record -ULONG SbiOpenRecord( SvStream& r, UINT16 nSignature, UINT16 nElem ) +sal_uIntPtr SbiOpenRecord( SvStream& r, sal_uInt16 nSignature, sal_uInt16 nElem ) { - ULONG nPos = r.Tell(); - r << nSignature << (INT32) 0 << nElem; + sal_uIntPtr nPos = r.Tell(); + r << nSignature << (sal_Int32) 0 << nElem; return nPos; } // Close Record -void SbiCloseRecord( SvStream& r, ULONG nOff ) +void SbiCloseRecord( SvStream& r, sal_uIntPtr nOff ) { - ULONG nPos = r.Tell(); + sal_uIntPtr nPos = r.Tell(); r.Seek( nOff + 2 ); - r << (INT32) ( nPos - nOff - 8 ); + r << (sal_Int32) ( nPos - nOff - 8 ); r.Seek( nPos ); } @@ -113,40 +113,40 @@ void SbiCloseRecord( SvStream& r, ULONG nOff ) // If the version number does not find, binary parts are omitted, but not // source, comments and name -BOOL SbiImage::Load( SvStream& r ) +sal_Bool SbiImage::Load( SvStream& r ) { - UINT32 nVersion = 0; // Versionsnumber + sal_uInt32 nVersion = 0; // Versionsnumber return Load( r, nVersion ); } -BOOL SbiImage::Load( SvStream& r, UINT32& nVersion ) +sal_Bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion ) { - UINT16 nSign, nCount; - UINT32 nLen, nOff; + sal_uInt16 nSign, nCount; + sal_uInt32 nLen, nOff; Clear(); // Read Master-Record r >> nSign >> nLen >> nCount; - ULONG nLast = r.Tell() + nLen; - UINT32 nCharSet; // System charset - UINT32 lDimBase; - UINT16 nReserved1; - UINT32 nReserved2; - UINT32 nReserved3; - BOOL bBadVer = FALSE; + sal_uIntPtr nLast = r.Tell() + nLen; + sal_uInt32 nCharSet; // System charset + sal_uInt32 lDimBase; + sal_uInt16 nReserved1; + sal_uInt32 nReserved2; + sal_uInt32 nReserved3; + sal_Bool bBadVer = sal_False; if( nSign == B_MODULE ) { r >> nVersion >> nCharSet >> lDimBase >> nFlags >> nReserved1 >> nReserved2 >> nReserved3; eCharSet = (CharSet) nCharSet; eCharSet = GetSOLoadTextEncoding( eCharSet ); - bBadVer = BOOL( nVersion > B_CURVERSION ); - nDimBase = (USHORT) lDimBase; + bBadVer = sal_Bool( nVersion > B_CURVERSION ); + nDimBase = (sal_uInt16) lDimBase; } bool bLegacy = ( nVersion < B_EXT_IMG_VERSION ); - ULONG nNext; + sal_uIntPtr nNext; while( ( nNext = r.Tell() ) < nLast ) { @@ -174,7 +174,7 @@ BOOL SbiImage::Load( SvStream& r, UINT32& nVersion ) #ifdef EXTENDED_BINARY_MODULES case B_EXTSOURCE: { - for( UINT16 j = 0 ; j < nCount ; j++ ) + for( sal_uInt16 j = 0 ; j < nCount ; j++ ) { String aTmp; r.ReadByteString( aTmp, eCharSet ); @@ -191,10 +191,10 @@ BOOL SbiImage::Load( SvStream& r, UINT32& nVersion ) if ( bLegacy ) { ReleaseLegacyBuffer(); // release any previously held buffer - nLegacyCodeSize = (UINT16) nCodeSize; + nLegacyCodeSize = (sal_uInt16) nCodeSize; pLegacyPCode = pCode; - PCodeBuffConvertor< UINT16, UINT32 > aLegacyToNew( (BYTE*)pLegacyPCode, nLegacyCodeSize ); + PCodeBuffConvertor< sal_uInt16, sal_uInt32 > aLegacyToNew( (sal_uInt8*)pLegacyPCode, nLegacyCodeSize ); aLegacyToNew.convert(); pCode = (char*)aLegacyToNew.GetBuffer(); nCodeSize = aLegacyToNew.GetSize(); @@ -220,20 +220,20 @@ BOOL SbiImage::Load( SvStream& r, UINT32& nVersion ) for( i = 0; i < nStrings && SbiGood( r ); i++ ) { r >> nOff; - pStringOff[ i ] = (USHORT) nOff; + pStringOff[ i ] = (sal_uInt16) nOff; } r >> nLen; if( SbiGood( r ) ) { delete [] pStrings; pStrings = new sal_Unicode[ nLen ]; - nStringSize = (USHORT) nLen; + nStringSize = (sal_uInt16) nLen; char* pByteStrings = new char[ nLen ]; r.Read( pByteStrings, nStringSize ); for( short j = 0; j < nStrings; j++ ) { - USHORT nOff2 = (USHORT) pStringOff[ j ]; + sal_uInt16 nOff2 = (sal_uInt16) pStringOff[ j ]; String aStr( pByteStrings + nOff2, eCharSet ); memcpy( pStrings + nOff2, aStr.GetBuffer(), (aStr.Len() + 1) * sizeof( sal_Unicode ) ); } @@ -253,11 +253,11 @@ done: //if( eCharSet != ::GetSystemCharSet() ) //ConvertStrings(); if( !SbiGood( r ) ) - bError = TRUE; - return BOOL( !bError ); + bError = sal_True; + return sal_Bool( !bError ); } -BOOL SbiImage::Save( SvStream& r, UINT32 nVer ) +sal_Bool SbiImage::Save( SvStream& r, sal_uInt32 nVer ) { bool bLegacy = ( nVer < B_EXT_IMG_VERSION ); @@ -268,23 +268,23 @@ BOOL SbiImage::Save( SvStream& r, UINT32 nVer ) SbiImage aEmptyImg; aEmptyImg.aName = aName; aEmptyImg.Save( r, B_LEGACYVERSION ); - return TRUE; + return sal_True; } // First of all the header - ULONG nStart = SbiOpenRecord( r, B_MODULE, 1 ); - ULONG nPos; + sal_uIntPtr nStart = SbiOpenRecord( r, B_MODULE, 1 ); + sal_uIntPtr nPos; eCharSet = GetSOStoreTextEncoding( eCharSet ); if ( bLegacy ) - r << (INT32) B_LEGACYVERSION; + r << (sal_Int32) B_LEGACYVERSION; else - r << (INT32) B_CURVERSION; - r << (INT32) eCharSet - << (INT32) nDimBase - << (INT16) nFlags - << (INT16) 0 - << (INT32) 0 - << (INT32) 0; + r << (sal_Int32) B_CURVERSION; + r << (sal_Int32) eCharSet + << (sal_Int32) nDimBase + << (sal_Int16) nFlags + << (sal_Int16) 0 + << (sal_Int32) 0 + << (sal_Int32) 0; // Name? if( aName.Len() && SbiGood( r ) ) @@ -321,9 +321,9 @@ BOOL SbiImage::Save( SvStream& r, UINT32 nVer ) if( nLen > STRING_MAXLEN ) { sal_Int32 nRemainingLen = nLen - nMaxUnitSize; - UINT16 nUnitCount = UINT16( (nRemainingLen + nMaxUnitSize - 1) / nMaxUnitSize ); + sal_uInt16 nUnitCount = sal_uInt16( (nRemainingLen + nMaxUnitSize - 1) / nMaxUnitSize ); nPos = SbiOpenRecord( r, B_EXTSOURCE, nUnitCount ); - for( UINT16 i = 0 ; i < nUnitCount ; i++ ) + for( sal_uInt16 i = 0 ; i < nUnitCount ; i++ ) { sal_Int32 nCopyLen = (nRemainingLen > nMaxUnitSize) ? nMaxUnitSize : nRemainingLen; @@ -342,7 +342,7 @@ BOOL SbiImage::Save( SvStream& r, UINT32 nVer ) if ( bLegacy ) { ReleaseLegacyBuffer(); // release any previously held buffer - PCodeBuffConvertor< UINT32, UINT16 > aNewToLegacy( (BYTE*)pCode, nCodeSize ); + PCodeBuffConvertor< sal_uInt32, sal_uInt16 > aNewToLegacy( (sal_uInt8*)pCode, nCodeSize ); aNewToLegacy.convert(); pLegacyPCode = (char*)aNewToLegacy.GetBuffer(); nLegacyCodeSize = aNewToLegacy.GetSize(); @@ -357,21 +357,21 @@ BOOL SbiImage::Save( SvStream& r, UINT32 nVer ) { nPos = SbiOpenRecord( r, B_STRINGPOOL, nStrings ); // For every String: - // UINT32 Offset of the Strings in the Stringblock + // sal_uInt32 Offset of the Strings in the Stringblock short i; for( i = 0; i < nStrings && SbiGood( r ); i++ ) - r << (UINT32) pStringOff[ i ]; + r << (sal_uInt32) pStringOff[ i ]; // Then the String-Block char* pByteStrings = new char[ nStringSize ]; for( i = 0; i < nStrings; i++ ) { - USHORT nOff = (USHORT) pStringOff[ i ]; + sal_uInt16 nOff = (sal_uInt16) pStringOff[ i ]; ByteString aStr( pStrings + nOff, eCharSet ); memcpy( pByteStrings + nOff, aStr.GetBuffer(), (aStr.Len() + 1) * sizeof( char ) ); } - r << (UINT32) nStringSize; + r << (sal_uInt32) nStringSize; r.Write( pByteStrings, nStringSize ); delete[] pByteStrings; @@ -380,8 +380,8 @@ BOOL SbiImage::Save( SvStream& r, UINT32 nVer ) // Set overall length SbiCloseRecord( r, nStart ); if( !SbiGood( r ) ) - bError = TRUE; - return BOOL( !bError ); + bError = sal_True; + return sal_Bool( !bError ); } /************************************************************************** @@ -397,15 +397,15 @@ void SbiImage::MakeStrings( short nSize ) nStringOff = 0; nStringSize = 1024; pStrings = new sal_Unicode[ nStringSize ]; - pStringOff = new UINT32[ nSize ]; + pStringOff = new sal_uInt32[ nSize ]; if( pStrings && pStringOff ) { nStrings = nSize; - memset( pStringOff, 0, nSize * sizeof( UINT32 ) ); + memset( pStringOff, 0, nSize * sizeof( sal_uInt32 ) ); memset( pStrings, 0, nStringSize * sizeof( sal_Unicode ) ); } else - bError = TRUE; + bError = sal_True; } // Add a string to StringPool. The String buffer is dynamically @@ -413,16 +413,16 @@ void SbiImage::MakeStrings( short nSize ) void SbiImage::AddString( const String& r ) { if( nStringIdx >= nStrings ) - bError = TRUE; + bError = sal_True; if( !bError ) { xub_StrLen len = r.Len() + 1; - UINT32 needed = nStringOff + len; + sal_uInt32 needed = nStringOff + len; if( needed > 0xFFFFFF00L ) - bError = TRUE; // out of mem! + bError = sal_True; // out of mem! else if( needed > nStringSize ) { - UINT32 nNewLen = needed + 1024; + sal_uInt32 nNewLen = needed + 1024; nNewLen &= 0xFFFFFC00; // trim to 1K border if( nNewLen > 0xFFFFFF00L ) nNewLen = 0xFFFFFF00L; @@ -432,10 +432,10 @@ void SbiImage::AddString( const String& r ) memcpy( p, pStrings, nStringSize * sizeof( sal_Unicode ) ); delete[] pStrings; pStrings = p; - nStringSize = sal::static_int_cast< UINT32 >(nNewLen); + nStringSize = sal::static_int_cast< sal_uInt16 >(nNewLen); } else - bError = TRUE; + bError = sal_True; } if( !bError ) { @@ -454,7 +454,7 @@ void SbiImage::AddString( const String& r ) // The block was fetched by the compiler from class SbBuffer and // is already created with new. Additionally it contains all Integers // in Big Endian format, so can be directly read/written. -void SbiImage::AddCode( char* p, UINT32 s ) +void SbiImage::AddCode( char* p, sal_uInt32 s ) { pCode = p; nCodeSize = s; @@ -488,14 +488,14 @@ String SbiImage::GetString( short nId ) const { if( nId && nId <= nStrings ) { - UINT32 nOff = pStringOff[ nId - 1 ]; + sal_uInt32 nOff = pStringOff[ nId - 1 ]; sal_Unicode* pStr = pStrings + nOff; // #i42467: Special treatment for vbNullChar if( *pStr == 0 ) { - UINT32 nNextOff = (nId < nStrings) ? pStringOff[ nId ] : nStringOff; - UINT32 nLen = nNextOff - nOff - 1; + sal_uInt32 nNextOff = (nId < nStrings) ? pStringOff[ nId ] : nStringOff; + sal_uInt32 nLen = nNextOff - nOff - 1; if( nLen == 1 ) { // Force length 1 and make char 0 afterwards @@ -518,14 +518,14 @@ const SbxObject* SbiImage::FindType (String aTypeName) const return rTypes.Is() ? (SbxObject*)rTypes->Find(aTypeName,SbxCLASS_OBJECT) : NULL; } -UINT16 SbiImage::CalcLegacyOffset( INT32 nOffset ) +sal_uInt16 SbiImage::CalcLegacyOffset( sal_Int32 nOffset ) { - return SbiCodeGen::calcLegacyOffSet( (BYTE*)pCode, nOffset ) ; + return SbiCodeGen::calcLegacyOffSet( (sal_uInt8*)pCode, nOffset ) ; } -UINT32 SbiImage::CalcNewOffset( INT16 nOffset ) +sal_uInt32 SbiImage::CalcNewOffset( sal_Int16 nOffset ) { - return SbiCodeGen::calcNewOffSet( (BYTE*)pLegacyPCode, nOffset ) ; + return SbiCodeGen::calcNewOffSet( (sal_uInt8*)pLegacyPCode, nOffset ) ; } void SbiImage::ReleaseLegacyBuffer() @@ -535,11 +535,11 @@ void SbiImage::ReleaseLegacyBuffer() nLegacyCodeSize = 0; } -BOOL SbiImage::ExceedsLegacyLimits() +sal_Bool SbiImage::ExceedsLegacyLimits() { if ( ( nStringSize > 0xFF00L ) || ( CalcLegacyOffset( nCodeSize ) > 0xFF00L ) ) - return TRUE; - return FALSE; + return sal_True; + return sal_False; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/classes/makefile.mk b/basic/source/classes/makefile.mk index e00ed4674cc1..e00ed4674cc1 100644..100755 --- a/basic/source/classes/makefile.mk +++ b/basic/source/classes/makefile.mk diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx index 2c01c49f814c..2f20c0e016fe 100644..100755 --- a/basic/source/classes/propacc.cxx +++ b/basic/source/classes/propacc.cxx @@ -94,7 +94,7 @@ SbPropertyValues::~SbPropertyValues() { _xInfo = Reference< XPropertySetInfo >(); - for ( USHORT n = 0; n < _aPropVals.Count(); ++n ) + for ( sal_uInt16 n = 0; n < _aPropVals.Count(); ++n ) delete _aPropVals.GetObject( n ); } @@ -113,7 +113,7 @@ Reference< XPropertySetInfo > SbPropertyValues::getPropertySetInfo(void) throw( //------------------------------------------------------------------------- -INT32 SbPropertyValues::GetIndex_Impl( const ::rtl::OUString &rPropName ) const +sal_Int32 SbPropertyValues::GetIndex_Impl( const ::rtl::OUString &rPropName ) const { PropertyValue **ppPV; ppPV = (PropertyValue **) @@ -134,9 +134,9 @@ void SbPropertyValues::setPropertyValue( ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { - INT32 nIndex = GetIndex_Impl( aPropertyName ); + sal_Int32 nIndex = GetIndex_Impl( aPropertyName ); PropertyValue *pPropVal = _aPropVals.GetObject( - sal::static_int_cast< USHORT >(nIndex)); + sal::static_int_cast< sal_uInt16 >(nIndex)); pPropVal->Value = aValue; } @@ -148,10 +148,10 @@ Any SbPropertyValues::getPropertyValue( ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { - INT32 nIndex = GetIndex_Impl( aPropertyName ); + sal_Int32 nIndex = GetIndex_Impl( aPropertyName ); if ( nIndex != USHRT_MAX ) return _aPropVals.GetObject( - sal::static_int_cast< USHORT >(nIndex))->Value; + sal::static_int_cast< sal_uInt16 >(nIndex))->Value; return Any(); } @@ -200,7 +200,7 @@ void SbPropertyValues::removeVetoableChangeListener( Sequence< PropertyValue > SbPropertyValues::getPropertyValues(void) throw (::com::sun::star::uno::RuntimeException) { Sequence<PropertyValue> aRet( _aPropVals.Count()); - for ( USHORT n = 0; n < _aPropVals.Count(); ++n ) + for ( sal_uInt16 n = 0; n < _aPropVals.Count(); ++n ) aRet.getArray()[n] = *_aPropVals.GetObject(n); return aRet; } @@ -232,14 +232,14 @@ PropertySetInfoImpl::PropertySetInfoImpl() { } -INT32 PropertySetInfoImpl::GetIndex_Impl( const ::rtl::OUString &rPropName ) const +sal_Int32 PropertySetInfoImpl::GetIndex_Impl( const ::rtl::OUString &rPropName ) const { Property *pP; pP = (Property*) bsearch( &rPropName, _aProps.getConstArray(), _aProps.getLength(), sizeof( Property ), SbCompare_UString_Property_Impl ); - return pP ? sal::static_int_cast<INT32>( (pP-_aProps.getConstArray()) / sizeof(pP) ) : -1; + return pP ? sal::static_int_cast<sal_Int32>( (pP-_aProps.getConstArray()) / sizeof(pP) ) : -1; } Sequence< Property > PropertySetInfoImpl::getProperties(void) throw() @@ -273,7 +273,7 @@ SbPropertySetInfo::SbPropertySetInfo() SbPropertySetInfo::SbPropertySetInfo( const SbPropertyValueArr_Impl &rPropVals ) { aImpl._aProps.realloc( rPropVals.Count() ); - for ( USHORT n = 0; n < rPropVals.Count(); ++n ) + for ( sal_uInt16 n = 0; n < rPropVals.Count(); ++n ) { Property &rProp = aImpl._aProps.getArray()[n]; const PropertyValue &rPropVal = *rPropVals.GetObject(n); @@ -303,7 +303,7 @@ Property SbPropertySetInfo::getPropertyByName(const ::rtl::OUString& Name) return aImpl.getPropertyByName( Name ); } -BOOL SbPropertySetInfo::hasPropertyByName(const ::rtl::OUString& Name) +sal_Bool SbPropertySetInfo::hasPropertyByName(const ::rtl::OUString& Name) throw( RuntimeException ) { return aImpl.hasPropertyByName( Name ); @@ -324,7 +324,7 @@ SbPropertyContainer::~SbPropertyContainer() //---------------------------------------------------------------------------- void SbPropertyContainer::addProperty(const ::rtl::OUString& Name, - INT16 Attributes, + sal_Int16 Attributes, const Any& DefaultValue) throw( PropertyExistException, IllegalTypeException, IllegalArgumentException, RuntimeException ) @@ -354,7 +354,7 @@ Property SbPropertyContainer::getPropertyByName(const ::rtl::OUString& Name) return aImpl.getPropertyByName( Name ); } -BOOL SbPropertyContainer::hasPropertyByName(const ::rtl::OUString& Name) +sal_Bool SbPropertyContainer::hasPropertyByName(const ::rtl::OUString& Name) throw( RuntimeException ) { return aImpl.hasPropertyByName( Name ); @@ -376,7 +376,7 @@ void SbPropertyContainer::setPropertyValues(const Sequence< PropertyValue >& Pro //---------------------------------------------------------------------------- -void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ) { (void)pBasic; (void)bWrite; diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 83c9cc15265a..bb65b0c8b82b 100644..100755 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -53,7 +53,10 @@ #include "sb.hrc" #include <basrid.hxx> #include <osl/mutex.hxx> +#include <cppuhelper/implbase1.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/util/XCloseBroadcaster.hpp> +#include <com/sun/star/util/XCloseListener.hpp> #include "errobject.hxx" #include <boost/unordered_map.hpp> @@ -67,11 +70,151 @@ TYPEINIT1(StarBASIC,SbxObject) #define RTLNAME "@SBRTL" // i#i68894# +using namespace ::com::sun::star; using com::sun::star::uno::Reference; using com::sun::star::uno::Any; using com::sun::star::uno::UNO_QUERY; using com::sun::star::lang::XMultiServiceFactory; +// ============================================================================ + +class DocBasicItem : public ::cppu::WeakImplHelper1< util::XCloseListener > +{ +public: + explicit DocBasicItem( StarBASIC& rDocBasic ); + virtual ~DocBasicItem(); + + inline const SbxObjectRef& getClassModules() const { return mxClassModules; } + inline bool isDocClosed() const { return mbDocClosed; } + + void clearDependingVarsOnDelete( StarBASIC& rDeletedBasic ); + + void startListening(); + void stopListening(); + + virtual void SAL_CALL queryClosing( const lang::EventObject& rSource, sal_Bool bGetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException); + virtual void SAL_CALL notifyClosing( const lang::EventObject& rSource ) throw (uno::RuntimeException); + virtual void SAL_CALL disposing( const lang::EventObject& rSource ) throw (uno::RuntimeException); + +private: + StarBASIC& mrDocBasic; + SbxObjectRef mxClassModules; + bool mbDocClosed; + bool mbDisposed; +}; + +// ---------------------------------------------------------------------------- + +DocBasicItem::DocBasicItem( StarBASIC& rDocBasic ) : + mrDocBasic( rDocBasic ), + mxClassModules( new SbxObject( String() ) ), + mbDocClosed( false ), + mbDisposed( false ) +{ +} + +DocBasicItem::~DocBasicItem() +{ + stopListening(); +} + +void DocBasicItem::clearDependingVarsOnDelete( StarBASIC& rDeletedBasic ) +{ + mrDocBasic.implClearDependingVarsOnDelete( &rDeletedBasic ); +} + +void DocBasicItem::startListening() +{ + Any aThisComp; + mrDocBasic.GetUNOConstant( "ThisComponent", aThisComp ); + Reference< util::XCloseBroadcaster > xCloseBC( aThisComp, UNO_QUERY ); + if( xCloseBC.is() ) + try { xCloseBC->addCloseListener( this ); } catch( uno::Exception& ) {} +} + +void DocBasicItem::stopListening() +{ + if( mbDisposed ) return; + mbDisposed = true; + Any aThisComp; + mrDocBasic.GetUNOConstant( "ThisComponent", aThisComp ); + Reference< util::XCloseBroadcaster > xCloseBC( aThisComp, UNO_QUERY ); + if( xCloseBC.is() ) + try { xCloseBC->removeCloseListener( this ); } catch( uno::Exception& ) {} +} + +void SAL_CALL DocBasicItem::queryClosing( const lang::EventObject& /*rSource*/, sal_Bool /*bGetsOwnership*/ ) throw (util::CloseVetoException, uno::RuntimeException) +{ +} + +void SAL_CALL DocBasicItem::notifyClosing( const lang::EventObject& /*rEvent*/ ) throw (uno::RuntimeException) +{ + stopListening(); + mbDocClosed = true; +} + +void SAL_CALL DocBasicItem::disposing( const lang::EventObject& /*rEvent*/ ) throw (uno::RuntimeException) +{ + stopListening(); +} + +// ---------------------------------------------------------------------------- + +namespace { + +typedef ::rtl::Reference< DocBasicItem > DocBasicItemRef; +typedef boost::unordered_map< const StarBASIC *, DocBasicItemRef > DocBasicItemMap; + // ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInitDependencyMap; + +static DocBasicItemMap GaDocBasicItems; + +const DocBasicItem* lclFindDocBasicItem( const StarBASIC* pDocBasic ) +{ + DocBasicItemMap::iterator it = GaDocBasicItems.find( pDocBasic ); + return (it != GaDocBasicItems.end()) ? it->second.get() : 0; +} + +void lclInsertDocBasicItem( StarBASIC& rDocBasic ) +{ + DocBasicItemRef& rxDocBasicItem = GaDocBasicItems[ &rDocBasic ]; + rxDocBasicItem.set( new DocBasicItem( rDocBasic ) ); + rxDocBasicItem->startListening(); +} + +void lclRemoveDocBasicItem( StarBASIC& rDocBasic ) +{ + DocBasicItemMap::iterator it = GaDocBasicItems.find( &rDocBasic ); + if( it != GaDocBasicItems.end() ) + { + it->second->stopListening(); + GaDocBasicItems.erase( it ); + } + DocBasicItemMap::iterator it_end = GaDocBasicItems.end(); + for( it = GaDocBasicItems.begin(); it != it_end; ++it ) + it->second->clearDependingVarsOnDelete( rDocBasic ); +} + +StarBASIC* lclGetDocBasicForModule( SbModule* pModule ) +{ + StarBASIC* pRetBasic = NULL; + SbxObject* pCurParent = pModule; + while( pCurParent->GetParent() != NULL ) + { + pCurParent = pCurParent->GetParent(); + StarBASIC* pDocBasic = PTR_CAST( StarBASIC, pCurParent ); + if( pDocBasic != NULL && pDocBasic->IsDocBasic() ) + { + pRetBasic = pDocBasic; + break; + } + } + return pRetBasic; +} + +} // namespace + +// ============================================================================ + SbxObject* StarBASIC::getVBAGlobals( ) { if ( !pVBAGlobals ) @@ -113,7 +256,7 @@ SbxVariable* StarBASIC::VBAFind( const String& rName, SbxClassType t ) // Create array for conversion SFX <-> VB error code struct SFX_VB_ErrorItem { - USHORT nErrorVB; + sal_uInt16 nErrorVB; SbError nErrorSFX; }; @@ -249,7 +392,7 @@ const SFX_VB_ErrorItem SFX_VB_ErrorTab[] = // the Modul-relationshop. But it works only when a modul is loaded. // Can cause troubles with separately loaded properties! -SbxBase* SbiFactory::Create( UINT16 nSbxId, UINT32 nCreator ) +SbxBase* SbiFactory::Create( sal_uInt16 nSbxId, sal_uInt32 nCreator ) { if( nCreator == SBXCR_SBX ) { @@ -298,11 +441,11 @@ SbxObject* SbiFactory::CreateObject( const String& rClass ) class SbOLEFactory : public SbxFactory { public: - virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX ); + virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX ); virtual SbxObject* CreateObject( const String& ); }; -SbxBase* SbOLEFactory::Create( UINT16, UINT32 ) +SbxBase* SbOLEFactory::Create( sal_uInt16, sal_uInt32 ) { // Not supported return NULL; @@ -323,11 +466,11 @@ SbxObject* SbOLEFactory::CreateObject( const String& rClassName ) class SbFormFactory : public SbxFactory { public: - virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX ); + virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX ); virtual SbxObject* CreateObject( const String& ); }; -SbxBase* SbFormFactory::Create( UINT16, UINT32 ) +SbxBase* SbFormFactory::Create( sal_uInt16, sal_uInt32 ) { // Not supported return NULL; @@ -341,7 +484,18 @@ SbxObject* SbFormFactory::CreateObject( const String& rClassName ) { if( SbUserFormModule* pFormModule = PTR_CAST( SbUserFormModule, pVar->GetObject() ) ) { - pFormModule->Load(); + bool bInitState = pFormModule->getInitState(); + if( bInitState ) + { + // Not the first instantiate, reset + bool bTriggerTerminateEvent = false; + pFormModule->ResetApiObj( bTriggerTerminateEvent ); + pFormModule->setInitState( false ); + } + else + { + pFormModule->Load(); + } return pFormModule->CreateInstance(); } } @@ -360,8 +514,8 @@ SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj ) // Copy the properties, not only the reference to them SbxArray* pProps = pRet->GetProperties(); - UINT32 nCount = pProps->Count32(); - for( UINT32 i = 0 ; i < nCount ; i++ ) + sal_uInt32 nCount = pProps->Count32(); + for( sal_uInt32 i = 0 ; i < nCount ; i++ ) { SbxVariable* pVar = pProps->Get32( i ); SbxProperty* pProp = PTR_CAST( SbxProperty, pVar ); @@ -378,18 +532,18 @@ SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj ) pDest->setHasFixedSize( pSource->hasFixedSize() ); if ( pSource->GetDims() && pSource->hasFixedSize() ) { - INT32 lb = 0; - INT32 ub = 0; - for ( INT32 j = 1 ; j <= pSource->GetDims(); ++j ) + sal_Int32 lb = 0; + sal_Int32 ub = 0; + for ( sal_Int32 j = 1 ; j <= pSource->GetDims(); ++j ) { - pSource->GetDim32( (INT32)j, lb, ub ); + pSource->GetDim32( (sal_Int32)j, lb, ub ); pDest->AddDim32( lb, ub ); } } else pDest->unoAddDim( 0, -1 ); // variant array - USHORT nSavFlags = pVar->GetFlags(); + sal_uInt16 nSavFlags = pVar->GetFlags(); pNewProp->ResetFlag( SBX_FIXED ); // need to reset the FIXED flag // when calling PutObject ( because the type will not match Object ) @@ -415,11 +569,11 @@ SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj ) class SbTypeFactory : public SbxFactory { public: - virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX ); + virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX ); virtual SbxObject* CreateObject( const String& ); }; -SbxBase* SbTypeFactory::Create( UINT16, UINT32 ) +SbxBase* SbTypeFactory::Create( sal_uInt16, sal_uInt32 ) { // Not supported return NULL; @@ -444,6 +598,7 @@ SbxObject* createUserTypeImpl( const String& rClassName ) return pRetObj; } + TYPEINIT1(SbClassModuleObject,SbModule) SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule ) @@ -463,8 +618,8 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule ) // Copy the methods from original class module SbxArray* pClassMethods = pClassModule->GetMethods(); - UINT32 nMethodCount = pClassMethods->Count32(); - UINT32 i; + sal_uInt32 nMethodCount = pClassMethods->Count32(); + sal_uInt32 i; for( i = 0 ; i < nMethodCount ; i++ ) { SbxVariable* pVar = pClassMethods->Get32( i ); @@ -476,7 +631,7 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule ) SbMethod* pMethod = PTR_CAST(SbMethod, pVar ); if( pMethod ) { - USHORT nFlags_ = pMethod->GetFlags(); + sal_uInt16 nFlags_ = pMethod->GetFlags(); pMethod->SetFlag( SBX_NO_BROADCAST ); SbMethod* pNewMethod = new SbMethod( *pMethod ); pNewMethod->ResetFlag( SBX_NO_BROADCAST ); @@ -484,7 +639,7 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule ) pNewMethod->pMod = this; pNewMethod->SetParent( this ); pMethods->PutDirect( pNewMethod, i ); - StartListening( pNewMethod->GetBroadcaster(), TRUE ); + StartListening( pNewMethod->GetBroadcaster(), sal_True ); } } } @@ -522,14 +677,14 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule ) // Copy the properties from original class module SbxArray* pClassProps = pClassModule->GetProperties(); - UINT32 nPropertyCount = pClassProps->Count32(); + sal_uInt32 nPropertyCount = pClassProps->Count32(); for( i = 0 ; i < nPropertyCount ; i++ ) { SbxVariable* pVar = pClassProps->Get32( i ); SbProcedureProperty* pProcedureProp = PTR_CAST( SbProcedureProperty, pVar ); if( pProcedureProp ) { - USHORT nFlags_ = pProcedureProp->GetFlags(); + sal_uInt16 nFlags_ = pProcedureProp->GetFlags(); pProcedureProp->SetFlag( SBX_NO_BROADCAST ); SbProcedureProperty* pNewProp = new SbProcedureProperty ( pProcedureProp->GetName(), pProcedureProp->GetType() ); @@ -538,14 +693,14 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule ) pNewProp->ResetFlag( SBX_NO_BROADCAST ); // except the Broadcast if it was set pProcedureProp->SetFlags( nFlags_ ); pProps->PutDirect( pNewProp, i ); - StartListening( pNewProp->GetBroadcaster(), TRUE ); + StartListening( pNewProp->GetBroadcaster(), sal_True ); } else { SbxProperty* pProp = PTR_CAST( SbxProperty, pVar ); if( pProp ) { - USHORT nFlags_ = pProp->GetFlags(); + sal_uInt16 nFlags_ = pProp->GetFlags(); pProp->SetFlag( SBX_NO_BROADCAST ); SbxProperty* pNewProp = new SbxProperty( *pProp ); @@ -559,7 +714,6 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule ) if( pObj != NULL ) { String aObjClass = pObj->GetClassName(); - (void)aObjClass; SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pObjBase); if( pClassModuleObj != NULL ) @@ -594,8 +748,12 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule ) SbClassModuleObject::~SbClassModuleObject() { + // do not trigger termination event when document is already closed if( StarBASIC::IsRunning() ) - triggerTerminateEvent(); + if( StarBASIC* pDocBasic = lclGetDocBasicForModule( this ) ) + if( const DocBasicItem* pDocBasicItem = lclFindDocBasicItem( pDocBasic ) ) + if( !pDocBasicItem->isDocClosed() ) + triggerTerminateEvent(); // Must be deleted by base class dtor because this data // is not owned by the SbClassModuleObject object @@ -606,7 +764,7 @@ SbClassModuleObject::~SbClassModuleObject() void SbClassModuleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType ) { - SbModule::SFX_NOTIFY( rBC, rBCType, rHint, rHintType ); + handleProcedureProperties( rBC, rHint ); } SbxVariable* SbClassModuleObject::Find( const XubString& rName, SbxClassType t ) @@ -683,8 +841,14 @@ SbClassFactory::~SbClassFactory() void SbClassFactory::AddClassModule( SbModule* pClassModule ) { + SbxObjectRef xToUseClassModules = xClassModules; + + if( StarBASIC* pDocBasic = lclGetDocBasicForModule( pClassModule ) ) + if( const DocBasicItem* pDocBasicItem = lclFindDocBasicItem( pDocBasic ) ) + xToUseClassModules = pDocBasicItem->getClassModules(); + SbxObject* pParent = pClassModule->GetParent(); - xClassModules->Insert( pClassModule ); + xToUseClassModules->Insert( pClassModule ); pClassModule->SetParent( pParent ); } @@ -693,7 +857,7 @@ void SbClassFactory::RemoveClassModule( SbModule* pClassModule ) xClassModules->Remove( pClassModule ); } -SbxBase* SbClassFactory::Create( UINT16, UINT32 ) +SbxBase* SbClassFactory::Create( sal_uInt16, sal_uInt32 ) { // Not supported return NULL; @@ -701,12 +865,19 @@ SbxBase* SbClassFactory::Create( UINT16, UINT32 ) SbxObject* SbClassFactory::CreateObject( const String& rClassName ) { - SbxVariable* pVar = xClassModules->Find( rClassName, SbxCLASS_DONTCARE ); + SbxObjectRef xToUseClassModules = xClassModules; + + if( SbModule* pMod = pMOD ) + if( StarBASIC* pDocBasic = lclGetDocBasicForModule( pMod ) ) + if( const DocBasicItem* pDocBasicItem = lclFindDocBasicItem( pDocBasic ) ) + xToUseClassModules = pDocBasicItem->getClassModules(); + + SbxVariable* pVar = xToUseClassModules->Find( rClassName, SbxCLASS_OBJECT ); SbxObject* pRet = NULL; if( pVar ) { - SbModule* pMod = (SbModule*)pVar; - pRet = new SbClassModuleObject( pMod ); + SbModule* pVarMod = (SbModule*)pVar; + pRet = new SbClassModuleObject( pVarMod ); } return pRet; } @@ -718,21 +889,19 @@ SbModule* SbClassFactory::FindClass( const String& rClassName ) return pMod; } -StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic ) +StarBASIC::StarBASIC( StarBASIC* p, sal_Bool bIsDocBasic ) : SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASIC") ) ), bDocBasic( bIsDocBasic ) { SetParent( p ); pLibInfo = NULL; - bNoRtl = bBreak = FALSE; - bVBAEnabled = FALSE; + bNoRtl = bBreak = sal_False; + bVBAEnabled = sal_False; pModules = new SbxArray; if( !GetSbData()->nInst++ ) { pSBFAC = new SbiFactory; AddFactory( pSBFAC ); - pUNOFAC = new SbUnoFactory; - AddFactory( pUNOFAC ); pTYPEFAC = new SbTypeFactory; AddFactory( pTYPEFAC ); pCLASSFAC = new SbClassFactory; @@ -741,23 +910,31 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic ) AddFactory( pOLEFAC ); pFORMFAC = new SbFormFactory; AddFactory( pFORMFAC ); + pUNOFAC = new SbUnoFactory; + AddFactory( pUNOFAC ); } pRtl = new SbiStdObject( String( RTL_CONSTASCII_USTRINGPARAM(RTLNAME) ), this ); // Search via StarBasic is always global SetFlag( SBX_GBLSEARCH ); pVBAGlobals = NULL; - bQuit = FALSE; + bQuit = sal_False; + + if( bDocBasic ) + lclInsertDocBasicItem( *this ); } // #51727 Override SetModified so that the modified state // is not given to the parent -void StarBASIC::SetModified( BOOL b ) +void StarBASIC::SetModified( sal_Bool b ) { SbxBase::SetModified( b ); } StarBASIC::~StarBASIC() { + // Needs to be first action as it can trigger events + disposeComVariablesForBasic( this ); + if( !--GetSbData()->nInst ) { RemoveFactory( pSBFAC ); @@ -786,18 +963,30 @@ StarBASIC::~StarBASIC() } #endif } + else if( bDocBasic ) + { + SbxError eOld = SbxBase::GetError(); + + lclRemoveDocBasicItem( *this ); + + SbxBase::ResetError(); + if( eOld != SbxERR_OK ) + SbxBase::SetError( eOld ); + } // #100326 Set Parent NULL in registered listeners if( xUnoListeners.Is() ) { - USHORT uCount = xUnoListeners->Count(); - for( USHORT i = 0 ; i < uCount ; i++ ) + sal_uInt16 uCount = xUnoListeners->Count(); + for( sal_uInt16 i = 0 ; i < uCount ; i++ ) { SbxVariable* pListenerObj = xUnoListeners->Get( i ); pListenerObj->SetParent( NULL ); } xUnoListeners = NULL; } + + clearUnoMethodsForBasic( this ); } // Override new() operator, so that everyone can create a new instance @@ -805,7 +994,7 @@ void* StarBASIC::operator new( size_t n ) { if( n < sizeof( StarBASIC ) ) { -// DBG_ASSERT( FALSE, "Warnung: inkompatibler BASIC-Stand!" ); +// DBG_ASSERT( sal_False, "Warnung: inkompatibler BASIC-Stand!" ); n = sizeof( StarBASIC ); } return ::operator new( n ); @@ -816,6 +1005,27 @@ void StarBASIC::operator delete( void* p ) ::operator delete( p ); } +void StarBASIC::implClearDependingVarsOnDelete( StarBASIC* pDeletedBasic ) +{ + if( this != pDeletedBasic ) + { + for( sal_uInt16 i = 0; i < pModules->Count(); i++ ) + { + SbModule* p = (SbModule*)pModules->Get( i ); + p->ClearVarsDependingOnDeletedBasic( pDeletedBasic ); + } + } + + for( sal_uInt16 nObj = 0; nObj < pObjs->Count(); nObj++ ) + { + SbxVariable* pVar = pObjs->Get( nObj ); + StarBASIC* pBasic = PTR_CAST(StarBASIC,pVar); + if( pBasic && pBasic != pDeletedBasic ) + pBasic->implClearDependingVarsOnDelete( pDeletedBasic ); + } +} + + /************************************************************************** * * Creation/Managment of modules @@ -860,7 +1070,7 @@ SbModule* StarBASIC::MakeModule32( const String& rName, const ModuleInfo& mInfo, p->SetSource32( rSrc ); p->SetParent( this ); pModules->Insert( p, pModules->Count() ); - SetModified( TRUE ); + SetModified( sal_True ); return p; } @@ -870,14 +1080,14 @@ void StarBASIC::Insert( SbxVariable* pVar ) { pModules->Insert( pVar, pModules->Count() ); pVar->SetParent( this ); - StartListening( pVar->GetBroadcaster(), TRUE ); + StartListening( pVar->GetBroadcaster(), sal_True ); } else { - BOOL bWasModified = IsModified(); + sal_Bool bWasModified = IsModified(); SbxObject::Insert( pVar ); if( !bWasModified && pVar->IsSet( SBX_DONTSTORE ) ) - SetModified( FALSE ); + SetModified( sal_False ); } } @@ -895,17 +1105,17 @@ void StarBASIC::Remove( SbxVariable* pVar ) SbxObject::Remove( pVar ); } -BOOL StarBASIC::Compile( SbModule* pMod ) +sal_Bool StarBASIC::Compile( SbModule* pMod ) { - return pMod ? pMod->Compile() : FALSE; + return pMod ? pMod->Compile() : sal_False; } -BOOL StarBASIC::Disassemble( SbModule* pMod, String& rText ) +sal_Bool StarBASIC::Disassemble( SbModule* pMod, String& rText ) { rText.Erase(); if( pMod ) pMod->Disassemble( rText ); - return BOOL( rText.Len() != 0 ); + return sal_Bool( rText.Len() != 0 ); } void StarBASIC::Clear() @@ -916,7 +1126,7 @@ void StarBASIC::Clear() SbModule* StarBASIC::FindModule( const String& rName ) { - for( USHORT i = 0; i < pModules->Count(); i++ ) + for( sal_uInt16 i = 0; i < pModules->Count(); i++ ) { SbModule* p = (SbModule*) pModules->Get( i ); if( p->GetName().EqualsIgnoreCaseAscii( rName ) ) @@ -945,15 +1155,15 @@ struct ClassModuleRunInitItem {} }; -typedef boost::unordered_map< ::rtl::OUString, ClassModuleRunInitItem, - ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInitDependencyMap; - -static ModuleInitDependencyMap* GpMIDMap = NULL; +// Derive from unordered_map type instead of typedef +// to allow forward declaration in sbmod.hxx +class ModuleInitDependencyMap : public + boost::unordered_map< ::rtl::OUString, ClassModuleRunInitItem, + ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > +{}; -void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem ) +void SbModule::implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassModuleRunInitItem& rItem ) { - ModuleInitDependencyMap& rMIDMap = *GpMIDMap; - rItem.m_bProcessing = true; //bool bAnyDependencies = true; @@ -968,8 +1178,8 @@ void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem ) String& rStr = *it; // Is required type a class module? - ModuleInitDependencyMap::iterator itFind = rMIDMap.find( rStr ); - if( itFind != rMIDMap.end() ) + ModuleInitDependencyMap::iterator itFind = rMap.find( rStr ); + if( itFind != rMap.end() ) { ClassModuleRunInitItem& rParentItem = itFind->second; if( rParentItem.m_bProcessing ) @@ -980,7 +1190,7 @@ void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem ) } if( !rParentItem.m_bRunInitDone ) - implProcessModuleRunInit( rParentItem ); + implProcessModuleRunInit( rMap, rParentItem ); } } } @@ -994,8 +1204,10 @@ void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem ) // Run Init-Code of all modules (including inserted libraries) void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit ) { + SolarMutexGuard guard; + // Init own modules - for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ ) + for ( sal_uInt16 nMod = 0; nMod < pModules->Count(); nMod++ ) { SbModule* pModule = (SbModule*)pModules->Get( nMod ); if( !pModule->IsCompiled() ) @@ -1008,8 +1220,7 @@ void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit ) // Consider required types to init in right order. Class modules // that are required by other modules have to be initialized first. ModuleInitDependencyMap aMIDMap; - GpMIDMap = &aMIDMap; - for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ ) + for ( sal_uInt16 nMod = 0; nMod < pModules->Count(); nMod++ ) { SbModule* pModule = (SbModule*)pModules->Get( nMod ); String aModuleName = pModule->GetName(); @@ -1021,12 +1232,11 @@ void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit ) for( it = aMIDMap.begin() ; it != aMIDMap.end(); ++it ) { ClassModuleRunInitItem& rItem = it->second; - SbModule::implProcessModuleRunInit( rItem ); + SbModule::implProcessModuleRunInit( aMIDMap, rItem ); } - GpMIDMap = NULL; // Call RunInit on standard modules - for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ ) + for ( sal_uInt16 nMod = 0; nMod < pModules->Count(); nMod++ ) { SbModule* pModule = (SbModule*)pModules->Get( nMod ); if( !pModule->isProxyModule() ) @@ -1035,7 +1245,7 @@ void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit ) // Check all objects if they are BASIC, // if yes initialize - for ( USHORT nObj = 0; nObj < pObjs->Count(); nObj++ ) + for ( sal_uInt16 nObj = 0; nObj < pObjs->Count(); nObj++ ) { SbxVariable* pVar = pObjs->Get( nObj ); StarBASIC* pBasic = PTR_CAST(StarBASIC,pVar); @@ -1049,14 +1259,14 @@ void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit ) void StarBASIC::DeInitAllModules( void ) { // Deinit own modules - for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ ) + for ( sal_uInt16 nMod = 0; nMod < pModules->Count(); nMod++ ) { SbModule* pModule = (SbModule*)pModules->Get( nMod ); - if( pModule->pImage ) + if( pModule->pImage && !pModule->isProxyModule() && !pModule->ISA(SbObjModule) ) pModule->pImage->bInit = false; } - for ( USHORT nObj = 0; nObj < pObjs->Count(); nObj++ ) + for ( sal_uInt16 nObj = 0; nObj < pObjs->Count(); nObj++ ) { SbxVariable* pVar = pObjs->Get( nObj ); StarBASIC* pBasic = PTR_CAST(StarBASIC,pVar); @@ -1069,13 +1279,13 @@ void StarBASIC::DeInitAllModules( void ) void StarBASIC::ClearGlobalVars( void ) { SbxArrayRef xProps( GetProperties() ); - USHORT nPropCount = xProps->Count(); - for ( USHORT nProp = 0 ; nProp < nPropCount ; ++nProp ) + sal_uInt16 nPropCount = xProps->Count(); + for ( sal_uInt16 nProp = 0 ; nProp < nPropCount ; ++nProp ) { SbxBase* pVar = xProps->Get( nProp ); pVar->Clear(); } - SetModified( TRUE ); + SetModified( sal_True ); } // This implementation at first searches within the runtime library, @@ -1106,7 +1316,7 @@ SbxVariable* StarBASIC::Find( const String& rName, SbxClassType t ) } // Search module if( !pRes ) - for( USHORT i = 0; i < pModules->Count(); i++ ) + for( sal_uInt16 i = 0; i < pModules->Count(); i++ ) { SbModule* p = (SbModule*) pModules->Get( i ); if( p->IsVisible() ) @@ -1123,12 +1333,12 @@ SbxVariable* StarBASIC::Find( const String& rName, SbxClassType t ) } // Only variables qualified by the Module Name e.g. Sheet1.foo // should work for Documant && Class type Modules - INT32 nType = p->GetModuleType(); + sal_Int32 nType = p->GetModuleType(); if ( nType == ModuleType::DOCUMENT || nType == ModuleType::FORM ) continue; // otherwise check if the element is available // unset GBLSEARCH-Flag (due to Rekursion) - USHORT nGblFlag = p->GetFlags() & SBX_GBLSEARCH; + sal_uInt16 nGblFlag = p->GetFlags() & SBX_GBLSEARCH; p->ResetFlag( SBX_GBLSEARCH ); pRes = p->Find( rName, t ); p->SetFlag( nGblFlag ); @@ -1144,9 +1354,9 @@ SbxVariable* StarBASIC::Find( const String& rName, SbxClassType t ) return pRes; } -BOOL StarBASIC::Call( const String& rName, SbxArray* pParam ) +sal_Bool StarBASIC::Call( const String& rName, SbxArray* pParam ) { - BOOL bRes = SbxObject::Call( rName, pParam ); + sal_Bool bRes = SbxObject::Call( rName, pParam ); if( !bRes ) { SbxError eErr = SbxBase::GetError(); @@ -1169,7 +1379,7 @@ SbxBase* StarBASIC::FindSBXInCurrentScope( const String& rName ) // Preserve old interface SbxVariable* StarBASIC::FindVarInCurrentScopy -( const String& rName, USHORT& rStatus ) +( const String& rName, sal_uInt16& rStatus ) { rStatus = 1; // Presumption: nothing found SbxVariable* pVar = NULL; @@ -1187,7 +1397,7 @@ SbxVariable* StarBASIC::FindVarInCurrentScopy void StarBASIC::QuitAndExitApplication() { Stop(); - bQuit = TRUE; + bQuit = sal_True; } void StarBASIC::Stop() @@ -1200,9 +1410,9 @@ void StarBASIC::Stop() } } -BOOL StarBASIC::IsRunning() +sal_Bool StarBASIC::IsRunning() { - return BOOL( pINST != NULL ); + return sal_Bool( pINST != NULL ); } /************************************************************************** @@ -1213,7 +1423,7 @@ BOOL StarBASIC::IsRunning() // Activation of an object. There is no need to access active objects // with name via BASIC. If NULL is given, everything is activated. -void StarBASIC::ActivateObject( const String* pName, BOOL bActivate ) +void StarBASIC::ActivateObject( const String* pName, sal_Bool bActivate ) { if( pName ) { @@ -1228,7 +1438,7 @@ void StarBASIC::ActivateObject( const String* pName, BOOL bActivate ) } else { - for( USHORT i = 0; i < GetObjects()->Count(); i++ ) + for( sal_uInt16 i = 0; i < GetObjects()->Count(); i++ ) { SbxObject* p = (SbxObject*) GetObjects()->Get( i ); if( bActivate ) @@ -1245,7 +1455,7 @@ void StarBASIC::ActivateObject( const String* pName, BOOL bActivate ) * **************************************************************************/ -SbMethod* StarBASIC::GetActiveMethod( USHORT nLevel ) +SbMethod* StarBASIC::GetActiveMethod( sal_uInt16 nLevel ) { if( pINST ) return pINST->GetCaller( nLevel ); @@ -1261,41 +1471,41 @@ SbModule* StarBASIC::GetActiveModule() return pCMOD; } -USHORT StarBASIC::BreakPoint( USHORT l, USHORT c1, USHORT c2 ) +sal_uInt16 StarBASIC::BreakPoint( sal_uInt16 l, sal_uInt16 c1, sal_uInt16 c2 ) { SetErrorData( 0, l, c1, c2 ); - bBreak = TRUE; + bBreak = sal_True; if( GetSbData()->aBreakHdl.IsSet() ) - return (USHORT) GetSbData()->aBreakHdl.Call( this ); + return (sal_uInt16) GetSbData()->aBreakHdl.Call( this ); else return BreakHdl(); } -USHORT StarBASIC::StepPoint( USHORT l, USHORT c1, USHORT c2 ) +sal_uInt16 StarBASIC::StepPoint( sal_uInt16 l, sal_uInt16 c1, sal_uInt16 c2 ) { SetErrorData( 0, l, c1, c2 ); - bBreak = FALSE; + bBreak = sal_False; if( GetSbData()->aBreakHdl.IsSet() ) - return (USHORT) GetSbData()->aBreakHdl.Call( this ); + return (sal_uInt16) GetSbData()->aBreakHdl.Call( this ); else return BreakHdl(); } -USHORT StarBASIC::BreakHdl() +sal_uInt16 StarBASIC::BreakHdl() { - return (USHORT) ( aBreakHdl.IsSet() + return (sal_uInt16) ( aBreakHdl.IsSet() ? aBreakHdl.Call( this ) : SbDEBUG_CONTINUE ); } // Calls for error handler and break handler -USHORT StarBASIC::GetLine() { return GetSbData()->nLine; } -USHORT StarBASIC::GetCol1() { return GetSbData()->nCol1; } -USHORT StarBASIC::GetCol2() { return GetSbData()->nCol2; } +sal_uInt16 StarBASIC::GetLine() { return GetSbData()->nLine; } +sal_uInt16 StarBASIC::GetCol1() { return GetSbData()->nCol1; } +sal_uInt16 StarBASIC::GetCol2() { return GetSbData()->nCol2; } // Specific to error handler SbError StarBASIC::GetErrorCode() { return GetSbData()->nCode; } const String& StarBASIC::GetErrorText() { return GetSbData()->aErrMsg; } -BOOL StarBASIC::IsCompilerError() { return GetSbData()->bCompiler; } +sal_Bool StarBASIC::IsCompilerError() { return GetSbData()->bCompiler; } void StarBASIC::SetGlobalLanguageMode( SbLanguageMode eLanguageMode ) { GetSbData()->eLanguageMode = eLanguageMode; @@ -1322,9 +1532,9 @@ SbLanguageMode StarBASIC::GetLanguageMode() // binaere search by VB-Error -> SFX-Error. // Map back new error codes to old, Sbx-compatible -USHORT StarBASIC::GetVBErrorCode( SbError nError ) +sal_uInt16 StarBASIC::GetVBErrorCode( SbError nError ) { - USHORT nRet = 0; + sal_uInt16 nRet = 0; if( SbiRuntime::isVBAEnabled() ) { @@ -1349,7 +1559,7 @@ USHORT StarBASIC::GetVBErrorCode( SbError nError ) // search loop const SFX_VB_ErrorItem* pErrItem; - USHORT nIndex = 0; + sal_uInt16 nIndex = 0; do { pErrItem = SFX_VB_ErrorTab + nIndex; @@ -1364,7 +1574,7 @@ USHORT StarBASIC::GetVBErrorCode( SbError nError ) return nRet; } -SbError StarBASIC::GetSfxFromVBError( USHORT nError ) +SbError StarBASIC::GetSfxFromVBError( sal_uInt16 nError ) { SbError nRet = 0L; @@ -1396,7 +1606,7 @@ SbError StarBASIC::GetSfxFromVBError( USHORT nError ) } } const SFX_VB_ErrorItem* pErrItem; - USHORT nIndex = 0; + sal_uInt16 nIndex = 0; do { pErrItem = SFX_VB_ErrorTab + nIndex; @@ -1416,7 +1626,7 @@ SbError StarBASIC::GetSfxFromVBError( USHORT nError ) // set Error- / Break-data void StarBASIC::SetErrorData -( SbError nCode, USHORT nLine, USHORT nCol1, USHORT nCol2 ) +( SbError nCode, sal_uInt16 nLine, sal_uInt16 nCol1, sal_uInt16 nCol2 ) { SbiGlobals& aGlobals = *GetSbData(); aGlobals.nCode = nCode; @@ -1432,26 +1642,26 @@ struct BasicStringList_Impl : private Resource { ResId aResId; - BasicStringList_Impl( ResId& rErrIdP, USHORT nId) + BasicStringList_Impl( ResId& rErrIdP, sal_uInt16 nId) : Resource( rErrIdP ),aResId(nId, *rErrIdP.GetResMgr() ){} ~BasicStringList_Impl() { FreeResource(); } String GetString(){ return String( aResId ); } - BOOL IsErrorTextAvailable( void ) + sal_Bool IsErrorTextAvailable( void ) { return IsAvailableRes(aResId.SetRT(RSC_STRING)); } }; //---------------------------------------------------------------- // Flag, that prevent the activation of the SFX-Resources at a Basic error -static BOOL bStaticSuppressSfxResource = FALSE; +static sal_Bool bStaticSuppressSfxResource = sal_False; -void StarBASIC::StaticSuppressSfxResource( BOOL bSuppress ) +void StarBASIC::StaticSuppressSfxResource( sal_Bool bSuppress ) { bStaticSuppressSfxResource = bSuppress; } // Hack for #83750, use bStaticSuppressSfxResource as setup flag -BOOL runsInSetup( void ) +sal_Bool runsInSetup( void ) { return bStaticSuppressSfxResource; } @@ -1467,11 +1677,11 @@ void StarBASIC::MakeErrorText( SbError nId, const String& aMsg ) return; } - USHORT nOldID = GetVBErrorCode( nId ); + sal_uInt16 nOldID = GetVBErrorCode( nId ); // intantiate the help class BasResId aId( RID_BASIC_START ); - BasicStringList_Impl aMyStringList( aId, USHORT(nId & ERRCODE_RES_MASK) ); + BasicStringList_Impl aMyStringList( aId, sal_uInt16(nId & ERRCODE_RES_MASK) ); if( aMyStringList.IsErrorTextAvailable() ) { @@ -1479,7 +1689,7 @@ void StarBASIC::MakeErrorText( SbError nId, const String& aMsg ) String aMsg1 = aMyStringList.GetString(); // replace argument placeholder with %s String aSrgStr( RTL_CONSTASCII_USTRINGPARAM("$(ARG1)") ); - USHORT nResult = aMsg1.Search( aSrgStr ); + sal_uInt16 nResult = aMsg1.Search( aSrgStr ); if( nResult != STRING_NOTFOUND ) { @@ -1500,8 +1710,8 @@ void StarBASIC::MakeErrorText( SbError nId, const String& aMsg ) } -BOOL StarBASIC::CError - ( SbError code, const String& rMsg, USHORT l, USHORT c1, USHORT c2 ) +sal_Bool StarBASIC::CError + ( SbError code, const String& rMsg, sal_uInt16 l, sal_uInt16 c1, sal_uInt16 c2 ) { SolarMutexGuard aSolarGuard; @@ -1511,39 +1721,39 @@ BOOL StarBASIC::CError // #109018 Check if running Basic is affected StarBASIC* pStartedBasic = pINST->GetBasic(); if( pStartedBasic != this ) - return FALSE; + return sal_False; Stop(); } // set flag, so that GlobalRunInit notice the error - GetSbData()->bGlobalInitErr = TRUE; + GetSbData()->bGlobalInitErr = sal_True; // tinker the error message MakeErrorText( code, rMsg ); // Implementation of the code for the string transport to SFX-Error if( rMsg.Len() ) - code = (ULONG)*new StringErrorInfo( code, String(rMsg) ); + code = (sal_uIntPtr)*new StringErrorInfo( code, String(rMsg) ); SetErrorData( code, l, c1, c2 ); - GetSbData()->bCompiler = TRUE; - BOOL bRet; + GetSbData()->bCompiler = sal_True; + sal_Bool bRet; if( GetSbData()->aErrHdl.IsSet() ) - bRet = (BOOL) GetSbData()->aErrHdl.Call( this ); + bRet = (sal_Bool) GetSbData()->aErrHdl.Call( this ); else bRet = ErrorHdl(); - GetSbData()->bCompiler = FALSE; // only true for error handler + GetSbData()->bCompiler = sal_False; // only true for error handler return bRet; } -BOOL StarBASIC::RTError - ( SbError code, USHORT l, USHORT c1, USHORT c2 ) +sal_Bool StarBASIC::RTError + ( SbError code, sal_uInt16 l, sal_uInt16 c1, sal_uInt16 c2 ) { return RTError( code, String(), l, c1, c2 ); } -BOOL StarBASIC::RTError( SbError code, const String& rMsg, USHORT l, USHORT c1, USHORT c2 ) +sal_Bool StarBASIC::RTError( SbError code, const String& rMsg, sal_uInt16 l, sal_uInt16 c1, sal_uInt16 c2 ) { SolarMutexGuard aSolarGuard; @@ -1565,15 +1775,15 @@ BOOL StarBASIC::RTError( SbError code, const String& rMsg, USHORT l, USHORT c1, aTmp += String::CreateFromInt32( SbxErrObject::getUnoErrObject()->getNumber() ); aTmp += String( RTL_CONSTASCII_USTRINGPARAM("\'\n") ); aTmp += GetSbData()->aErrMsg.Len() ? GetSbData()->aErrMsg : rMsg; - code = (ULONG)*new StringErrorInfo( code, aTmp ); + code = (sal_uIntPtr)*new StringErrorInfo( code, aTmp ); } else - code = (ULONG)*new StringErrorInfo( code, String(rMsg) ); + code = (sal_uIntPtr)*new StringErrorInfo( code, String(rMsg) ); } SetErrorData( code, l, c1, c2 ); if( GetSbData()->aErrHdl.IsSet() ) - return (BOOL) GetSbData()->aErrHdl.Call( this ); + return (sal_Bool) GetSbData()->aErrHdl.Call( this ); else return ErrorHdl(); } @@ -1618,7 +1828,7 @@ String StarBASIC::GetErrorMsg() return String(); } -USHORT StarBASIC::GetErl() +sal_uInt16 StarBASIC::GetErl() { if( pINST ) return pINST->GetErl(); @@ -1626,10 +1836,10 @@ USHORT StarBASIC::GetErl() return 0; } -BOOL StarBASIC::ErrorHdl() +sal_Bool StarBASIC::ErrorHdl() { - return (BOOL) ( aErrorHdl.IsSet() - ? aErrorHdl.Call( this ) : FALSE ); + return (sal_Bool) ( aErrorHdl.IsSet() + ? aErrorHdl.Call( this ) : sal_False ); } Link StarBASIC::GetGlobalErrorHdl() @@ -1667,16 +1877,16 @@ SbxArrayRef StarBASIC::getUnoListeners( void ) * **************************************************************************/ -BOOL StarBASIC::LoadData( SvStream& r, USHORT nVer ) +sal_Bool StarBASIC::LoadData( SvStream& r, sal_uInt16 nVer ) { if( !SbxObject::LoadData( r, nVer ) ) - return FALSE; + return sal_False; // #95459 Delete dialogs, otherwise endless recursion // in SbxVarable::GetType() if dialogs are accessed - USHORT nObjCount = pObjs->Count(); + sal_uInt16 nObjCount = pObjs->Count(); SbxVariable** ppDeleteTab = new SbxVariable*[ nObjCount ]; - USHORT nObj; + sal_uInt16 nObj; for( nObj = 0 ; nObj < nObjCount ; nObj++ ) { @@ -1692,14 +1902,14 @@ BOOL StarBASIC::LoadData( SvStream& r, USHORT nVer ) } delete[] ppDeleteTab; - UINT16 nMod; + sal_uInt16 nMod; pModules->Clear(); r >> nMod; - for( USHORT i = 0; i < nMod; i++ ) + for( sal_uInt16 i = 0; i < nMod; i++ ) { SbModule* pMod = (SbModule*) SbxBase::Load( r ); if( !pMod ) - return FALSE; + return sal_False; else if( pMod->ISA(SbJScriptModule) ) { // assign Ref, so that pMod will be deleted @@ -1722,26 +1932,26 @@ BOOL StarBASIC::LoadData( SvStream& r, USHORT nVer ) // Search via StarBASIC is at all times global DBG_ASSERT( IsSet( SBX_GBLSEARCH ), "Basic ohne GBLSEARCH geladen" ); SetFlag( SBX_GBLSEARCH ); - return TRUE; + return sal_True; } -BOOL StarBASIC::StoreData( SvStream& r ) const +sal_Bool StarBASIC::StoreData( SvStream& r ) const { if( !SbxObject::StoreData( r ) ) - return FALSE; - r << (UINT16) pModules->Count(); - for( USHORT i = 0; i < pModules->Count(); i++ ) + return sal_False; + r << (sal_uInt16) pModules->Count(); + for( sal_uInt16 i = 0; i < pModules->Count(); i++ ) { SbModule* p = (SbModule*) pModules->Get( i ); if( !p->Store( r ) ) - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } -BOOL StarBASIC::LoadOldModules( SvStream& ) +sal_Bool StarBASIC::LoadOldModules( SvStream& ) { - return FALSE; + return sal_False; } bool StarBASIC::GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut ) @@ -1757,6 +1967,54 @@ bool StarBASIC::GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::u return bRes; } +Reference< frame::XModel > StarBASIC::GetModelFromBasic( SbxObject* pBasic ) +{ + OSL_PRECOND( pBasic != NULL, "getModelFromBasic: illegal call!" ); + if ( !pBasic ) + return NULL; + + // look for the ThisComponent variable, first in the parent (which + // might be the document's Basic), then in the parent's parent (which might be + // the application Basic) + const ::rtl::OUString sThisComponent( RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" ) ); + SbxVariable* pThisComponent = NULL; + + SbxObject* pLookup = pBasic->GetParent(); + while ( pLookup && !pThisComponent ) + { + pThisComponent = pLookup->Find( sThisComponent, SbxCLASS_OBJECT ); + pLookup = pLookup->GetParent(); + } + if ( !pThisComponent ) + { + OSL_TRACE("Failed to get ThisComponent"); + // the application Basic, at the latest, should have this variable + return NULL; + } + + Any aThisComponentAny( sbxToUnoValue( pThisComponent ) ); + Reference< frame::XModel > xModel( aThisComponentAny, UNO_QUERY ); + if ( !xModel.is() ) + { + // it's no XModel. Okay, ThisComponent nowadays is allowed to be a controller. + Reference< frame::XController > xController( aThisComponentAny, UNO_QUERY ); + if ( xController.is() ) + xModel = xController->getModel(); + } + + if ( !xModel.is() ) + return NULL; + +#if OSL_DEBUG_LEVEL > 0 + OSL_TRACE("Have model ThisComponent points to url %s", + ::rtl::OUStringToOString( xModel->getURL(), + RTL_TEXTENCODING_ASCII_US ).pData->buffer ); +#endif + + return xModel; +} + + //======================================================================== // #118116 Implementation Collection object @@ -1766,7 +2024,7 @@ static const char pCountStr[] = "Count"; static const char pAddStr[] = "Add"; static const char pItemStr[] = "Item"; static const char pRemoveStr[] = "Remove"; -static USHORT nCountHash = 0, nAddHash, nItemHash, nRemoveHash; +static sal_uInt16 nCountHash = 0, nAddHash, nItemHash, nRemoveHash; SbxInfoRef BasicCollection::xAddInfo = NULL; SbxInfoRef BasicCollection::xItemInfo = NULL; @@ -1837,10 +2095,10 @@ void BasicCollection::SFX_NOTIFY( SfxBroadcaster& rCst, const TypeId& rId1, const SbxHint* p = PTR_CAST(SbxHint,&rHint); if( p ) { - ULONG nId = p->GetId(); - BOOL bRead = BOOL( nId == SBX_HINT_DATAWANTED ); - BOOL bWrite = BOOL( nId == SBX_HINT_DATACHANGED ); - BOOL bRequestInfo = BOOL( nId == SBX_HINT_INFOWANTED ); + sal_uIntPtr nId = p->GetId(); + sal_Bool bRead = sal_Bool( nId == SBX_HINT_DATAWANTED ); + sal_Bool bWrite = sal_Bool( nId == SBX_HINT_DATACHANGED ); + sal_Bool bRequestInfo = sal_Bool( nId == SBX_HINT_INFOWANTED ); SbxVariable* pVar = p->GetVar(); SbxArray* pArg = pVar->GetParameters(); XubString aVarName( pVar->GetName() ); @@ -1875,9 +2133,9 @@ void BasicCollection::SFX_NOTIFY( SfxBroadcaster& rCst, const TypeId& rId1, SbxObject::SFX_NOTIFY( rCst, rId1, rHint, rId2 ); } -INT32 BasicCollection::implGetIndex( SbxVariable* pIndexVar ) +sal_Int32 BasicCollection::implGetIndex( SbxVariable* pIndexVar ) { - INT32 nIndex = -1; + sal_Int32 nIndex = -1; if( pIndexVar->GetType() == SbxSTRING ) nIndex = implGetIndexForName( pIndexVar->GetString() ); else @@ -1885,12 +2143,12 @@ INT32 BasicCollection::implGetIndex( SbxVariable* pIndexVar ) return nIndex; } -INT32 BasicCollection::implGetIndexForName( const String& rName ) +sal_Int32 BasicCollection::implGetIndexForName( const String& rName ) { - INT32 nIndex = -1; - INT32 nCount = xItemArray->Count32(); - INT32 nNameHash = MakeHashCode( rName ); - for( INT32 i = 0 ; i < nCount ; i++ ) + sal_Int32 nIndex = -1; + sal_Int32 nCount = xItemArray->Count32(); + sal_Int32 nNameHash = MakeHashCode( rName ); + for( sal_Int32 i = 0 ; i < nCount ; i++ ) { SbxVariable* pVar = xItemArray->Get32( i ); if( pVar->GetHashCode() == nNameHash && @@ -1905,7 +2163,7 @@ INT32 BasicCollection::implGetIndexForName( const String& rName ) void BasicCollection::CollAdd( SbxArray* pPar_ ) { - USHORT nCount = pPar_->Count(); + sal_uInt16 nCount = pPar_->Count(); if( nCount < 2 || nCount > 5 ) { SetError( SbxERR_WRONG_ARGS ); @@ -1931,7 +2189,7 @@ void BasicCollection::CollAdd( SbxArray* pPar_ ) return; } SbxVariable* pAfter = pPar_->Get(4); - INT32 nAfterIndex = implGetIndex( pAfter ); + sal_Int32 nAfterIndex = implGetIndex( pAfter ); if( nAfterIndex == -1 ) { SetError( SbERR_BAD_ARGUMENT ); @@ -1941,7 +2199,7 @@ void BasicCollection::CollAdd( SbxArray* pPar_ ) } else // if( nCount == 4 ) { - INT32 nBeforeIndex = implGetIndex( pBefore ); + sal_Int32 nBeforeIndex = implGetIndex( pBefore ); if( nBeforeIndex == -1 ) { SetError( SbERR_BAD_ARGUMENT ); @@ -1990,8 +2248,8 @@ void BasicCollection::CollItem( SbxArray* pPar_ ) } SbxVariable* pRes = NULL; SbxVariable* p = pPar_->Get( 1 ); - INT32 nIndex = implGetIndex( p ); - if( nIndex >= 0 && nIndex < (INT32)xItemArray->Count32() ) + sal_Int32 nIndex = implGetIndex( p ); + if( nIndex >= 0 && nIndex < (sal_Int32)xItemArray->Count32() ) pRes = xItemArray->Get32( nIndex ); if( !pRes ) SetError( SbERR_BAD_ARGUMENT ); @@ -2008,8 +2266,8 @@ void BasicCollection::CollRemove( SbxArray* pPar_ ) } SbxVariable* p = pPar_->Get( 1 ); - INT32 nIndex = implGetIndex( p ); - if( nIndex >= 0 && nIndex < (INT32)xItemArray->Count32() ) + sal_Int32 nIndex = implGetIndex( p ); + if( nIndex >= 0 && nIndex < (sal_Int32)xItemArray->Count32() ) xItemArray->Remove32( nIndex ); else SetError( SbERR_BAD_ARGUMENT ); diff --git a/basic/source/classes/sb.src b/basic/source/classes/sb.src index df916c64b031..df916c64b031 100644..100755 --- a/basic/source/classes/sb.src +++ b/basic/source/classes/sb.src diff --git a/basic/source/classes/sbintern.cxx b/basic/source/classes/sbintern.cxx index 0732b0c0e1d4..2f0a9fe93fee 100644..100755 --- a/basic/source/classes/sbintern.cxx +++ b/basic/source/classes/sbintern.cxx @@ -62,13 +62,13 @@ SbiGlobals::SbiGlobals() nCode = 0; nLine = 0; nCol1 = nCol2 = 0; - bCompiler = FALSE; - bGlobalInitErr = FALSE; - bRunInit = FALSE; + bCompiler = sal_False; + bGlobalInitErr = sal_False; + bRunInit = sal_False; eLanguageMode = SB_LANG_BASIC; pErrStack = NULL; pTransliterationWrapper = NULL; - bBlockCompilerError = FALSE; + bBlockCompilerError = sal_False; pAppBasMgr = NULL; pMSOMacroRuntimLib = NULL; } diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 9dffcf21361e..28765880c6e4 100644..100755 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -34,15 +34,18 @@ #include <svl/hint.hxx> #include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase2.hxx> #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/typeprovider.hxx> -#include <cppuhelper/extract.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/extract.hxx> #include <comphelper/processfactory.hxx> #include <rtl/ustrbuf.hxx> #include <rtl/strbuf.hxx> #include <com/sun/star/script/ArrayWrapper.hpp> +#include <com/sun/star/script/NativeObjectWrapper.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/uno/DeploymentException.hpp> @@ -60,6 +63,7 @@ #include <com/sun/star/script/XTypeConverter.hpp> #include <com/sun/star/script/XDefaultProperty.hpp> #include <com/sun/star/script/XDefaultMethod.hpp> +#include <com/sun/star/script/XDirectInvocation.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/reflection/XIdlArray.hpp> @@ -454,7 +458,7 @@ String implGetWrappedMsg( const WrappedTargetException& e ) void implHandleBasicErrorException( BasicErrorException& e ) { - SbError nError = StarBASIC::GetSfxFromVBError( (USHORT)e.ErrorCode ); + SbError nError = StarBASIC::GetSfxFromVBError( (sal_uInt16)e.ErrorCode ); StarBASIC::Error( nError, e.ErrorMessageArgument ); } @@ -480,7 +484,7 @@ void implHandleWrappedTargetException( const Any& _rWrappedTargetException ) { if ( aBasicError.ErrorCode != 0 ) { - nError = StarBASIC::GetSfxFromVBError( (USHORT) aBasicError.ErrorCode ); + nError = StarBASIC::GetSfxFromVBError( (sal_uInt16) aBasicError.ErrorCode ); if ( nError == 0 ) { nError = (SbError) aBasicError.ErrorCode; @@ -507,7 +511,7 @@ void implHandleWrappedTargetException( const Any& _rWrappedTargetException ) // special handling for BasicErrorException errors if ( aWrapped.TargetException >>= aBasicError ) { - nError = StarBASIC::GetSfxFromVBError( (USHORT)aBasicError.ErrorCode ); + nError = StarBASIC::GetSfxFromVBError( (sal_uInt16)aBasicError.ErrorCode ); aMessageBuf.append( aBasicError.ErrorMessageArgument ); aExamine.clear(); break; @@ -552,6 +556,43 @@ static void implHandleAnyException( const Any& _rCaughtException ) } } +// NativeObjectWrapper handling +struct ObjectItem +{ + SbxObjectRef m_xNativeObj; + + ObjectItem( void ) + {} + ObjectItem( SbxObject* pNativeObj ) + : m_xNativeObj( pNativeObj ) + {} +}; +static std::vector< ObjectItem > GaNativeObjectWrapperVector; + +void clearNativeObjectWrapperVector( void ) +{ + GaNativeObjectWrapperVector.clear(); +} + +sal_uInt32 lcl_registerNativeObjectWrapper( SbxObject* pNativeObj ) +{ + sal_uInt32 nIndex = GaNativeObjectWrapperVector.size(); + GaNativeObjectWrapperVector.push_back( ObjectItem( pNativeObj ) ); + return nIndex; +} + +SbxObject* lcl_getNativeObject( sal_uInt32 nIndex ) +{ + SbxObjectRef xRetObj; + if( nIndex < GaNativeObjectWrapperVector.size() ) + { + ObjectItem& rItem = GaNativeObjectWrapperVector[ nIndex ]; + xRetObj = rItem.m_xNativeObj; + } + return xRetObj; +} + + // convert from Uno to Sbx SbxDataType unoToSbxType( TypeClass eType ) { @@ -634,7 +675,7 @@ static void implSequenceToMultiDimArray( SbxDimArray*& pArray, Sequence< sal_Int sal_Int32 nLen = xIdlArray->getLen( aValue ); for ( sal_Int32 index = 0; index < nLen; ++index ) { - Any aElementAny = xIdlArray->get( aValue, (UINT32)index ); + Any aElementAny = xIdlArray->get( aValue, (sal_uInt32)index ); // This detects the dimension were currently processing if ( dimCopy == dimension ) { @@ -736,6 +777,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue ) if( eTypeClass == TypeClass_STRUCT ) { ArrayWrapper aWrap; + NativeObjectWrapper aNativeObjectWrapper; if ( (aValue >>= aWrap) ) { SbxDimArray* pArray = NULL; @@ -746,7 +788,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue ) if ( pArray ) { SbxDimArrayRef xArray = pArray; - USHORT nFlags = pVar->GetFlags(); + sal_uInt16 nFlags = pVar->GetFlags(); pVar->ResetFlag( SBX_FIXED ); pVar->PutObject( (SbxDimArray*)xArray ); pVar->SetFlags( nFlags ); @@ -755,6 +797,18 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue ) pVar->PutEmpty(); break; } + else if ( (aValue >>= aNativeObjectWrapper) ) + { + sal_uInt32 nIndex = 0; + if( (aNativeObjectWrapper.ObjectId >>= nIndex) ) + { + SbxObject* pObj = lcl_getNativeObject( nIndex ); + pVar->PutObject( pObj ); + } + else + pVar->PutEmpty(); + break; + } else { SbiInstance* pInst = pINST; @@ -856,7 +910,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue ) for( i = 0 ; i < nLen ; i++ ) { // convert elements - Any aElementAny = xIdlArray->get( aValue, (UINT32)i ); + Any aElementAny = xIdlArray->get( aValue, (sal_uInt32)i ); SbxVariableRef xVar = new SbxVariable( eSbxElementType ); unoToSbxValue( (SbxVariable*)xVar, aElementAny ); @@ -870,7 +924,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue ) } // return the Array - USHORT nFlags = pVar->GetFlags(); + sal_uInt16 nFlags = pVar->GetFlags(); pVar->ResetFlag( SBX_FIXED ); pVar->PutObject( (SbxDimArray*)xArray ); pVar->SetFlags( nFlags ); @@ -1008,9 +1062,9 @@ Type getUnoTypeForSbxValue( SbxValue* pVal ) // this one - otherwise the whole will be considered as Any-Sequence sal_Bool bNeedsInit = sal_True; - INT32 nSize = nUpper - nLower + 1; - INT32 nIdx = nLower; - for( INT32 i = 0 ; i < nSize ; i++,nIdx++ ) + sal_Int32 nSize = nUpper - nLower + 1; + sal_Int32 nIdx = nLower; + for( sal_Int32 i = 0 ; i < nSize ; i++,nIdx++ ) { SbxVariableRef xVar = pArray->Get32( &nIdx ); Type aType = getUnoTypeForSbxValue( (SbxVariable*)xVar ); @@ -1046,10 +1100,10 @@ Type getUnoTypeForSbxValue( SbxValue* pVal ) if( eElementTypeClass == TypeClass_VOID || eElementTypeClass == TypeClass_ANY ) { // For this check the array's dim structure does not matter - UINT32 nFlatArraySize = pArray->Count32(); + sal_uInt32 nFlatArraySize = pArray->Count32(); sal_Bool bNeedsInit = sal_True; - for( UINT32 i = 0 ; i < nFlatArraySize ; i++ ) + for( sal_uInt32 i = 0 ; i < nFlatArraySize ; i++ ) { SbxVariableRef xVar = pArray->SbxArray::Get32( i ); Type aType = getUnoTypeForSbxValue( (SbxVariable*)xVar ); @@ -1123,6 +1177,20 @@ Any sbxToUnoValueImpl( SbxVariable* pVar, bool bBlockConversionToSmallestType = if( pClassModule->createCOMWrapperForIface( aRetAny, pClassModuleObj ) ) return aRetAny; } + if( !xObj->ISA(SbUnoObject) ) + { + // Create NativeObjectWrapper to identify object in case of callbacks + SbxObject* pObj = PTR_CAST(SbxObject,pVar->GetObject()); + if( pObj != NULL ) + { + NativeObjectWrapper aNativeObjectWrapper; + sal_uInt32 nIndex = lcl_registerNativeObjectWrapper( pObj ); + aNativeObjectWrapper.ObjectId <<= nIndex; + Any aRetAny; + aRetAny <<= aNativeObjectWrapper; + return aRetAny; + } + } } } @@ -1259,6 +1327,29 @@ Any sbxToUnoValue( SbxVariable* pVar ) return sbxToUnoValueImpl( pVar ); } +// Funktion, um einen globalen Bezeichner im +// UnoScope zu suchen und fuer Sbx zu wrappen +static bool implGetTypeByName( const String& rName, Type& rRetType ) +{ + bool bSuccess = false; + + Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl(); + if( xTypeAccess->hasByHierarchicalName( rName ) ) + { + Any aRet = xTypeAccess->getByHierarchicalName( rName ); + Reference< XTypeDescription > xTypeDesc; + aRet >>= xTypeDesc; + + if( xTypeDesc.is() ) + { + rRetType = Type( xTypeDesc->getTypeClass(), xTypeDesc->getName() ); + bSuccess = true; + } + } + return bSuccess; +} + + // converting of Sbx to Uno with known target class Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty ) { @@ -1344,6 +1435,39 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty } break; + case TypeClass_TYPE: + { + if( eBaseType == SbxOBJECT ) + { + // XIdlClass? + Reference< XIdlClass > xIdlClass; + + SbxBaseRef pObj = (SbxBase*)pVar->GetObject(); + if( pObj && pObj->ISA(SbUnoObject) ) + { + Any aUnoAny = ((SbUnoObject*)(SbxBase*)pObj)->getUnoAny(); + aUnoAny >>= xIdlClass; + } + + if( xIdlClass.is() ) + { + ::rtl::OUString aClassName = xIdlClass->getName(); + Type aType( xIdlClass->getTypeClass(), aClassName.getStr() ); + aRetVal <<= aType; + } + } + else if( eBaseType == SbxSTRING ) + { + // String representing type? + String aTypeName = pVar->GetString(); + Type aType; + bool bSuccess = implGetTypeByName( aTypeName, aType ); + if( bSuccess ) + aRetVal <<= aType; + } + } + break; + /* we leave out the following types case TypeClass_SERVICE: break; case TypeClass_CLASS: break; @@ -1532,7 +1656,7 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty return aRetVal; } -void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, bool bOLEAutomation, UINT32 nParamCount ) +void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, bool bOLEAutomation, sal_uInt32 nParamCount ) { AutomationNamedArgsSbxArray* pArgNamesArray = NULL; if( bOLEAutomation ) @@ -1541,7 +1665,7 @@ void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, bool bOL args.realloc( nParamCount ); Any* pAnyArgs = args.getArray(); bool bBlockConversionToSmallestType = pINST->IsCompatibility(); - UINT32 i = 0; + sal_uInt32 i = 0; if( pArgNamesArray ) { Sequence< ::rtl::OUString >& rNameSeq = pArgNamesArray->getNames(); @@ -1549,7 +1673,7 @@ void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, bool bOL Any aValAny; for( i = 0 ; i < nParamCount ; i++ ) { - USHORT iSbx = (USHORT)(i+1); + sal_uInt16 iSbx = (sal_uInt16)(i+1); aValAny = sbxToUnoValueImpl( pParams->Get( iSbx ), bBlockConversionToSmallestType ); @@ -1572,7 +1696,7 @@ void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, bool bOL { for( i = 0 ; i < nParamCount ; i++ ) { - pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (USHORT)(i+1) ), + pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (sal_uInt16)(i+1) ), bBlockConversionToSmallestType ); } } @@ -1584,9 +1708,9 @@ enum INVOKETYPE SetProp, Func }; -Any invokeAutomationMethod( const String& Name, Sequence< Any >& args, SbxArray* pParams, UINT32 nParamCount, Reference< XInvocation >& rxInvocation, INVOKETYPE invokeType = Func ) +Any invokeAutomationMethod( const String& Name, Sequence< Any >& args, SbxArray* pParams, sal_uInt32 nParamCount, Reference< XInvocation >& rxInvocation, INVOKETYPE invokeType = Func ) { - Sequence< INT16 > OutParamIndex; + Sequence< sal_Int16 > OutParamIndex; Sequence< Any > OutParam; Any aRetAny; @@ -1611,30 +1735,30 @@ Any invokeAutomationMethod( const String& Name, Sequence< Any >& args, SbxArray* break; // should introduce an error here } - const INT16* pIndices = OutParamIndex.getConstArray(); - UINT32 nLen = OutParamIndex.getLength(); + const sal_Int16* pIndices = OutParamIndex.getConstArray(); + sal_uInt32 nLen = OutParamIndex.getLength(); if( nLen ) { const Any* pNewValues = OutParam.getConstArray(); - for( UINT32 j = 0 ; j < nLen ; j++ ) + for( sal_uInt32 j = 0 ; j < nLen ; j++ ) { - INT16 iTarget = pIndices[ j ]; - if( iTarget >= (INT16)nParamCount ) + sal_Int16 iTarget = pIndices[ j ]; + if( iTarget >= (sal_Int16)nParamCount ) break; - unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pNewValues[ j ] ); + unoToSbxValue( (SbxVariable*)pParams->Get( (sal_uInt16)(j+1) ), pNewValues[ j ] ); } } return aRetAny; } // Debugging help method to readout the imlemented interfaces of an object -String Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Reference< XIdlClass >& xClass, USHORT nRekLevel ) +String Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Reference< XIdlClass >& xClass, sal_uInt16 nRekLevel ) { Type aIfaceType = ::getCppuType( (const Reference< XInterface > *)0 ); static Reference< XIdlClass > xIfaceClass = TypeToIdlClass( aIfaceType ); String aRetStr; - for( USHORT i = 0 ; i < nRekLevel ; i++ ) + for( sal_uInt16 i = 0 ; i < nRekLevel ; i++ ) aRetStr.AppendAscii( " " ); aRetStr += String( xClass->getName() ); ::rtl::OUString aClassName = xClass->getName(); @@ -1653,8 +1777,8 @@ String Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Reference< // get the super interfaces Sequence< Reference< XIdlClass > > aSuperClassSeq = xClass->getSuperclasses(); const Reference< XIdlClass >* pClasses = aSuperClassSeq.getConstArray(); - UINT32 nSuperIfaceCount = aSuperClassSeq.getLength(); - for( UINT32 j = 0 ; j < nSuperIfaceCount ; j++ ) + sal_uInt32 nSuperIfaceCount = aSuperClassSeq.getLength(); + for( sal_uInt32 j = 0 ; j < nSuperIfaceCount ; j++ ) { const Reference< XIdlClass >& rxIfaceClass = pClasses[j]; if( !rxIfaceClass->equals( xIfaceClass ) ) @@ -1735,8 +1859,8 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj, { Sequence< Type > aTypeSeq = xTypeProvider->getTypes(); const Type* pTypeArray = aTypeSeq.getConstArray(); - UINT32 nIfaceCount = aTypeSeq.getLength(); - for( UINT32 j = 0 ; j < nIfaceCount ; j++ ) + sal_uInt32 nIfaceCount = aTypeSeq.getLength(); + for( sal_uInt32 j = 0 ; j < nIfaceCount ; j++ ) { const Type& rType = pTypeArray[j]; @@ -1814,8 +1938,8 @@ String Impl_GetSupportedInterfaces( SbUnoObject* pUnoObj ) // get the interfaces of the implementation Sequence< Type > aTypeSeq = xTypeProvider->getTypes(); const Type* pTypeArray = aTypeSeq.getConstArray(); - UINT32 nIfaceCount = aTypeSeq.getLength(); - for( UINT32 j = 0 ; j < nIfaceCount ; j++ ) + sal_uInt32 nIfaceCount = aTypeSeq.getLength(); + for( sal_uInt32 j = 0 ; j < nIfaceCount ; j++ ) { const Type& rType = pTypeArray[j]; @@ -1913,13 +2037,13 @@ String Impl_DumpProperties( SbUnoObject* pUnoObj ) } Sequence<Property> props = xAccess->getProperties( PropertyConcept::ALL - PropertyConcept::DANGEROUS ); - UINT32 nUnoPropCount = props.getLength(); + sal_uInt32 nUnoPropCount = props.getLength(); const Property* pUnoProps = props.getConstArray(); SbxArray* pProps = pUnoObj->GetProperties(); - USHORT nPropCount = pProps->Count(); - USHORT nPropsPerLine = 1 + nPropCount / 30; - for( USHORT i = 0; i < nPropCount; i++ ) + sal_uInt16 nPropCount = pProps->Count(); + sal_uInt16 nPropsPerLine = 1 + nPropCount / 30; + for( sal_uInt16 i = 0; i < nPropCount; i++ ) { SbxVariable* pVar = pProps->Get( i ); if( pVar ) @@ -1932,7 +2056,7 @@ String Impl_DumpProperties( SbUnoObject* pUnoObj ) // Is it in Uno a sequence? SbxDataType eType = pVar->GetFullType(); - BOOL bMaybeVoid = FALSE; + sal_Bool bMaybeVoid = sal_False; if( i < nUnoPropCount ) { const Property& rProp = pUnoProps[ i ]; @@ -1942,7 +2066,7 @@ String Impl_DumpProperties( SbUnoObject* pUnoObj ) if( rProp.Attributes & PropertyAttribute::MAYBEVOID ) { eType = unoToSbxType( rProp.Type.getTypeClass() ); - bMaybeVoid = TRUE; + bMaybeVoid = sal_True; } if( eType == SbxOBJECT ) { @@ -1993,14 +2117,14 @@ String Impl_DumpMethods( SbUnoObject* pUnoObj ) const Reference< XIdlMethod >* pUnoMethods = methods.getConstArray(); SbxArray* pMethods = pUnoObj->GetMethods(); - USHORT nMethodCount = pMethods->Count(); + sal_uInt16 nMethodCount = pMethods->Count(); if( !nMethodCount ) { aRet.AppendAscii( "\nNo methods found\n" ); return aRet; } - USHORT nPropsPerLine = 1 + nMethodCount / 30; - for( USHORT i = 0; i < nMethodCount; i++ ) + sal_uInt16 nPropsPerLine = 1 + nMethodCount / 30; + for( sal_uInt16 i = 0; i < nMethodCount; i++ ) { SbxVariable* pVar = pMethods->Get( i ); if( pVar ) @@ -2028,12 +2152,12 @@ String Impl_DumpMethods( SbUnoObject* pUnoObj ) // the get-method mustn't have a parameter Sequence< Reference< XIdlClass > > aParamsSeq = rxMethod->getParameterTypes(); - UINT32 nParamCount = aParamsSeq.getLength(); + sal_uInt32 nParamCount = aParamsSeq.getLength(); const Reference< XIdlClass >* pParams = aParamsSeq.getConstArray(); if( nParamCount > 0 ) { - for( USHORT j = 0; j < nParamCount; j++ ) + for( sal_uInt16 j = 0; j < nParamCount; j++ ) { String aTypeStr = Dbg_SbxDataType2String( unoToSbxType( pParams[ j ] ) ); aPropStr += aTypeStr; @@ -2080,7 +2204,7 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, if( pHint->GetId() == SBX_HINT_DATAWANTED ) { // Test-Properties - INT32 nId = pProp->nId; + sal_Int32 nId = pProp->nId; if( nId < 0 ) { // Id == -1: Display implemented interfaces according the ClassProvider @@ -2131,7 +2255,7 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, { try { - UINT32 nParamCount = pParams ? ((UINT32)pParams->Count() - 1) : 0; + sal_uInt32 nParamCount = pParams ? ((sal_uInt32)pParams->Count() - 1) : 0; sal_Bool bCanBeConsideredAMethod = mxInvocation->hasMethod( pProp->GetName() ); Any aRetAny; if ( bCanBeConsideredAMethod && nParamCount ) @@ -2204,18 +2328,18 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, if( pHint->GetId() == SBX_HINT_DATAWANTED ) { // number of Parameter -1 because of Param0 == this - UINT32 nParamCount = pParams ? ((UINT32)pParams->Count() - 1) : 0; + sal_uInt32 nParamCount = pParams ? ((sal_uInt32)pParams->Count() - 1) : 0; Sequence<Any> args; - BOOL bOutParams = FALSE; - UINT32 i; + sal_Bool bOutParams = sal_False; + sal_uInt32 i; if( !bInvocation && mxUnoAccess.is() ) { // get info const Sequence<ParamInfo>& rInfoSeq = pMeth->getParamInfos(); const ParamInfo* pParamInfos = rInfoSeq.getConstArray(); - UINT32 nUnoParamCount = rInfoSeq.getLength(); - UINT32 nAllocParamCount = nParamCount; + sal_uInt32 nUnoParamCount = rInfoSeq.getLength(); + sal_uInt32 nAllocParamCount = nParamCount; // ignore surplus parameter; alternative: throw an error if( nParamCount > nUnoParamCount ) @@ -2258,14 +2382,14 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, com::sun::star::uno::Type aType( rxClass->getTypeClass(), rxClass->getName() ); // ATTENTION: Don't forget for Sbx-Parameter the offset! - pAnyArgs[i] = sbxToUnoValue( pParams->Get( (USHORT)(i+1) ), aType ); + pAnyArgs[i] = sbxToUnoValue( pParams->Get( (sal_uInt16)(i+1) ), aType ); // If it is not certain check whether the out-parameter are available. if( !bOutParams ) { ParamMode aParamMode = rInfo.aMode; if( aParamMode != ParamMode_IN ) - bOutParams = TRUE; + bOutParams = sal_True; } } } @@ -2277,7 +2401,7 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, } // call the method - GetSbData()->bBlockCompilerError = TRUE; // #106433 Block compiler errors for API calls + GetSbData()->bBlockCompilerError = sal_True; // #106433 Block compiler errors for API calls try { if( !bInvocation && mxUnoAccess.is() ) @@ -2296,13 +2420,13 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, const Sequence<ParamInfo>& rInfoSeq = pMeth->getParamInfos(); const ParamInfo* pParamInfos = rInfoSeq.getConstArray(); - UINT32 j; + sal_uInt32 j; for( j = 0 ; j < nParamCount ; j++ ) { const ParamInfo& rInfo = pParamInfos[j]; ParamMode aParamMode = rInfo.aMode; if( aParamMode != ParamMode_IN ) - unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pAnyArgs[ j ] ); + unoToSbxValue( (SbxVariable*)pParams->Get( (sal_uInt16)(j+1) ), pAnyArgs[ j ] ); } } } @@ -2310,7 +2434,7 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, { Any aRetAny = invokeAutomationMethod( pMeth->GetName(), args, pParams, nParamCount, mxInvocation ); unoToSbxValue( pVar, aRetAny ); - } + } // remove parameter here, because this was not done anymore in unoToSbxValue() // for arrays @@ -2321,7 +2445,7 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, { implHandleAnyException( ::cppu::getCaughtException() ); } - GetSbData()->bBlockCompilerError = FALSE; // #106433 Unblock compiler errors + GetSbData()->bBlockCompilerError = sal_False; // #106433 Unblock compiler errors } } else @@ -2337,8 +2461,8 @@ Reference< XInvocation > createDynamicInvocationFor( const Any& aAny ); SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ ) : SbxObject( aName_ ) - , bNeedIntrospection( TRUE ) - , bIgnoreNativeCOMObjectMembers( FALSE ) + , bNeedIntrospection( sal_True ) + , bNativeCOMObject( sal_False ) { static Reference< XIntrospection > xIntrospection; @@ -2381,7 +2505,7 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ ) // The remainder refers only to the introspection if( !xTypeProvider.is() ) { - bNeedIntrospection = FALSE; + bNeedIntrospection = sal_False; return; } @@ -2389,34 +2513,34 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ ) // hiding of equally named COM symbols, e.g. XInvocation::getValue Reference< oleautomation::XAutomationObject > xAutomationObject( aUnoObj_, UNO_QUERY ); if( xAutomationObject.is() ) - bIgnoreNativeCOMObjectMembers = TRUE; + bNativeCOMObject = sal_True; } maTmpUnoObj = aUnoObj_; //*** Define the name *** - BOOL bFatalError = TRUE; + sal_Bool bFatalError = sal_True; // Is it an interface or a struct? - BOOL bSetClassName = FALSE; + sal_Bool bSetClassName = sal_False; String aClassName_; if( eType == TypeClass_STRUCT || eType == TypeClass_EXCEPTION ) { // Struct is Ok - bFatalError = FALSE; + bFatalError = sal_False; // insert the real name of the class if( aName_.Len() == 0 ) { aClassName_ = String( aUnoObj_.getValueType().getTypeName() ); - bSetClassName = TRUE; + bSetClassName = sal_True; } } else if( eType == TypeClass_INTERFACE ) { // Interface works always through the type in the Any - bFatalError = FALSE; + bFatalError = sal_False; // Ask for the XIdlClassProvider-Interface Reference< XIdlClassProvider > xClassProvider( x, UNO_QUERY ); @@ -2426,14 +2550,14 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ ) if( aName_.Len() == 0 ) { Sequence< Reference< XIdlClass > > szClasses = xClassProvider->getIdlClasses(); - UINT32 nLen = szClasses.getLength(); + sal_uInt32 nLen = szClasses.getLength(); if( nLen ) { const Reference< XIdlClass > xImplClass = szClasses.getConstArray()[ 0 ]; if( xImplClass.is() ) { aClassName_ = String( xImplClass->getName() ); - bSetClassName = TRUE; + bSetClassName = sal_True; } } } @@ -2464,7 +2588,7 @@ void SbUnoObject::doIntrospection( void ) if( !bNeedIntrospection ) return; - bNeedIntrospection = FALSE; + bNeedIntrospection = sal_False; if( !xIntrospection.is() ) { @@ -2513,6 +2637,47 @@ void SbUnoObject::doIntrospection( void ) // Start of a list of all SbUnoMethod-Instances static SbUnoMethod* pFirst = NULL; +void clearUnoMethodsForBasic( StarBASIC* pBasic ) +{ + SbUnoMethod* pMeth = pFirst; + while( pMeth ) + { + SbxObject* pObject = dynamic_cast< SbxObject* >( pMeth->GetParent() ); + if ( pObject ) + { + StarBASIC* pModBasic = dynamic_cast< StarBASIC* >( pObject->GetParent() ); + if ( pModBasic == pBasic ) + { + // for now the solution is to remove the method from the list and to clear it, + // but in case the element should be correctly transfered to another StarBASIC, + // we should either set module parent to NULL without clearing it, or even + // set the new StarBASIC as the parent of the module + // pObject->SetParent( NULL ); + + if( pMeth == pFirst ) + pFirst = pMeth->pNext; + else if( pMeth->pPrev ) + pMeth->pPrev->pNext = pMeth->pNext; + if( pMeth->pNext ) + pMeth->pNext->pPrev = pMeth->pPrev; + + pMeth->pPrev = NULL; + pMeth->pNext = NULL; + + pMeth->SbxValue::Clear(); + pObject->SbxValue::Clear(); + + // start from the beginning after object clearing, the cycle will end since the method is removed each time + pMeth = pFirst; + } + else + pMeth = pMeth->pNext; + } + else + pMeth = pMeth->pNext; + } +} + void clearUnoMethods( void ) { SbUnoMethod* pMeth = pFirst; @@ -2529,10 +2694,12 @@ SbUnoMethod::SbUnoMethod const String& aName_, SbxDataType eSbxType, Reference< XIdlMethod > xUnoMethod_, - bool bInvocation + bool bInvocation, + bool bDirect ) : SbxMethod( aName_, eSbxType ) , mbInvocation( bInvocation ) + , mbDirectInvocation( bDirect ) { m_xUnoMethod = xUnoMethod_; pParamInfoSeq = NULL; @@ -2568,16 +2735,16 @@ SbxInfo* SbUnoMethod::GetInfo() const Sequence<ParamInfo>& rInfoSeq = getParamInfos(); const ParamInfo* pParamInfos = rInfoSeq.getConstArray(); - UINT32 nParamCount = rInfoSeq.getLength(); + sal_uInt32 nParamCount = rInfoSeq.getLength(); - for( UINT32 i = 0 ; i < nParamCount ; i++ ) + for( sal_uInt32 i = 0 ; i < nParamCount ; i++ ) { const ParamInfo& rInfo = pParamInfos[i]; ::rtl::OUString aParamName = rInfo.aName; // const Reference< XIdlClass >& rxClass = rInfo.aType; SbxDataType t = SbxVARIANT; - USHORT nFlags_ = SBX_READ; + sal_uInt16 nFlags_ = SBX_READ; pInfo->AddParam( aParamName, t, nFlags_ ); } } @@ -2600,7 +2767,7 @@ SbUnoProperty::SbUnoProperty const String& aName_, SbxDataType eSbxType, const Property& aUnoProp_, - INT32 nId_, + sal_Int32 nId_, bool bInvocation ) : SbxProperty( aName_, eSbxType ) @@ -2633,7 +2800,7 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t ) if( !pRes ) { ::rtl::OUString aUName( rName ); - if( mxUnoAccess.is() && !bIgnoreNativeCOMObjectMembers ) + if( mxUnoAccess.is() && !bNativeCOMObject ) { if( mxExactName.is() ) { @@ -2734,6 +2901,17 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t ) QuickInsert( (SbxVariable*)xMethRef ); pRes = xMethRef; } + else + { + Reference< XDirectInvocation > xDirectInvoke( mxInvocation, UNO_QUERY ); + if ( xDirectInvoke.is() && xDirectInvoke->hasMember( aUName ) ) + { + SbxVariableRef xMethRef = new SbUnoMethod( aUName, SbxVARIANT, xDummyMethod, true, true ); + QuickInsert( (SbxVariable*)xMethRef ); + pRes = xMethRef; + } + + } } catch( RuntimeException& e ) { @@ -2793,11 +2971,11 @@ void SbUnoObject::implCreateAll( void ) // get instrospection Reference< XIntrospectionAccess > xAccess = mxUnoAccess; - if( !xAccess.is() || bIgnoreNativeCOMObjectMembers ) + if( !xAccess.is() || bNativeCOMObject ) { if( mxInvocation.is() ) xAccess = mxInvocation->getIntrospection(); - else if( bIgnoreNativeCOMObjectMembers ) + else if( bNativeCOMObject ) return; } if( !xAccess.is() ) @@ -2805,10 +2983,10 @@ void SbUnoObject::implCreateAll( void ) // Establish properties Sequence<Property> props = xAccess->getProperties( PropertyConcept::ALL - PropertyConcept::DANGEROUS ); - UINT32 nPropCount = props.getLength(); + sal_uInt32 nPropCount = props.getLength(); const Property* pProps_ = props.getConstArray(); - UINT32 i; + sal_uInt32 i; for( i = 0 ; i < nPropCount ; i++ ) { const Property& rProp = pProps_[ i ]; @@ -2831,7 +3009,7 @@ void SbUnoObject::implCreateAll( void ) // Create methods Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods ( MethodConcept::ALL - MethodConcept::DANGEROUS ); - UINT32 nMethCount = aMethodSeq.getLength(); + sal_uInt32 nMethCount = aMethodSeq.getLength(); const Reference< XIdlMethod >* pMethods_ = aMethodSeq.getConstArray(); for( i = 0 ; i < nMethCount ; i++ ) { @@ -2891,7 +3069,7 @@ SbUnoObject* Impl_CreateUnoStruct( const String& aClassName ) // Factory-Class to create Uno-Structs per DIM AS NEW -SbxBase* SbUnoFactory::Create( UINT16, UINT32 ) +SbxBase* SbUnoFactory::Create( sal_uInt16, sal_uInt32 ) { // Via SbxId nothing works in Uno return NULL; @@ -2924,7 +3102,7 @@ void createAllObjectProperties( SbxObject* pObj ) } -void RTL_Impl_CreateUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +void RTL_Impl_CreateUnoStruct( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ) { (void)pBasic; (void)bWrite; @@ -2949,7 +3127,7 @@ void RTL_Impl_CreateUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) refVar->PutObject( (SbUnoObject*)xUnoObj ); } -void RTL_Impl_CreateUnoService( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +void RTL_Impl_CreateUnoService( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ) { (void)pBasic; (void)bWrite; @@ -3003,7 +3181,7 @@ void RTL_Impl_CreateUnoService( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) } } -void RTL_Impl_CreateUnoServiceWithArguments( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +void RTL_Impl_CreateUnoServiceWithArguments( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ) { (void)pBasic; (void)bWrite; @@ -3061,7 +3239,7 @@ void RTL_Impl_CreateUnoServiceWithArguments( StarBASIC* pBasic, SbxArray& rPar, } } -void RTL_Impl_GetProcessServiceManager( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +void RTL_Impl_GetProcessServiceManager( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ) { (void)pBasic; (void)bWrite; @@ -3085,13 +3263,13 @@ void RTL_Impl_GetProcessServiceManager( StarBASIC* pBasic, SbxArray& rPar, BOOL } } -void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ) { (void)pBasic; (void)bWrite; // We need 2 parameter minimum - USHORT nParCount = rPar.Count(); + sal_uInt16 nParCount = rPar.Count(); if( nParCount < 3 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -3100,7 +3278,7 @@ void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) // variable for the return value SbxVariableRef refVar = rPar.Get(0); - refVar->PutBool( FALSE ); + refVar->PutBool( sal_False ); // get the Uno-Object SbxBaseRef pObj = (SbxBase*)rPar.Get( 1 )->GetObject(); @@ -3119,7 +3297,7 @@ void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) if( !xCoreReflection.is() ) return; - for( USHORT i = 2 ; i < nParCount ; i++ ) + for( sal_uInt16 i = 2 ; i < nParCount ; i++ ) { // get the name of the interface of the struct String aIfaceName = rPar.Get( i )->GetString(); @@ -3137,10 +3315,10 @@ void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) } // Every thing works; then return TRUE - refVar->PutBool( TRUE ); + refVar->PutBool( sal_True ); } -void RTL_Impl_IsUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +void RTL_Impl_IsUnoStruct( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ) { (void)pBasic; (void)bWrite; @@ -3154,7 +3332,7 @@ void RTL_Impl_IsUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) // variable for the return value SbxVariableRef refVar = rPar.Get(0); - refVar->PutBool( FALSE ); + refVar->PutBool( sal_False ); // get the Uno-Object SbxVariableRef xParam = rPar.Get( 1 ); @@ -3166,11 +3344,11 @@ void RTL_Impl_IsUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) Any aAny = ((SbUnoObject*)(SbxBase*)pObj)->getUnoAny(); TypeClass eType = aAny.getValueType().getTypeClass(); if( eType == TypeClass_STRUCT ) - refVar->PutBool( TRUE ); + refVar->PutBool( sal_True ); } -void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ) { (void)pBasic; (void)bWrite; @@ -3183,7 +3361,7 @@ void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) // variable for the return value SbxVariableRef refVar = rPar.Get(0); - refVar->PutBool( FALSE ); + refVar->PutBool( sal_False ); // get the Uno-Objects SbxVariableRef xParam1 = rPar.Get( 1 ); @@ -3215,7 +3393,7 @@ void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) //XInterfaceRef x2 = *(XInterfaceRef*)aAny2.get(); if( x1 == x2 ) - refVar->PutBool( TRUE ); + refVar->PutBool( sal_True ); } typedef boost::unordered_map< ::rtl::OUString, std::vector< ::rtl::OUString >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleHash; @@ -3488,7 +3666,7 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t ) // Take us out as listener at once, // the values are all constant if( pRes->IsBroadcaster() ) - EndListening( pRes->GetBroadcaster(), TRUE ); + EndListening( pRes->GetBroadcaster(), sal_True ); } } return pRes; @@ -3572,14 +3750,14 @@ void SbUnoService::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, if( pUnoCtor && pHint->GetId() == SBX_HINT_DATAWANTED ) { // Parameter count -1 because of Param0 == this - UINT32 nParamCount = pParams ? ((UINT32)pParams->Count() - 1) : 0; + sal_uInt32 nParamCount = pParams ? ((sal_uInt32)pParams->Count() - 1) : 0; Sequence<Any> args; - BOOL bOutParams = FALSE; + sal_Bool bOutParams = sal_False; Reference< XServiceConstructorDescription > xCtor = pUnoCtor->getServiceCtorDesc(); Sequence< Reference< XParameter > > aParameterSeq = xCtor->getParameters(); const Reference< XParameter >* pParameterSeq = aParameterSeq.getConstArray(); - UINT32 nUnoParamCount = aParameterSeq.getLength(); + sal_uInt32 nUnoParamCount = aParameterSeq.getLength(); // Default: Ignore not needed parameters bool bParameterError = false; @@ -3597,8 +3775,8 @@ void SbUnoService::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, } // Too many parameters with context as first parameter? - USHORT nSbxParameterOffset = 1; - USHORT nParameterOffsetByContext = 0; + sal_uInt16 nSbxParameterOffset = 1; + sal_uInt16 nParameterOffsetByContext = 0; Reference < XComponentContext > xFirstParamContext; if( nParamCount > nUnoParamCount ) { @@ -3609,8 +3787,8 @@ void SbUnoService::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, nParameterOffsetByContext = 1; } - UINT32 nEffectiveParamCount = nParamCount - nParameterOffsetByContext; - UINT32 nAllocParamCount = nEffectiveParamCount; + sal_uInt32 nEffectiveParamCount = nParamCount - nParameterOffsetByContext; + sal_uInt32 nAllocParamCount = nEffectiveParamCount; if( nEffectiveParamCount > nUnoParamCount ) { if( !bRestParameterMode ) @@ -3637,9 +3815,9 @@ void SbUnoService::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, { args.realloc( nAllocParamCount ); Any* pAnyArgs = args.getArray(); - for( UINT32 i = 0 ; i < nEffectiveParamCount ; i++ ) + for( sal_uInt32 i = 0 ; i < nEffectiveParamCount ; i++ ) { - USHORT iSbx = (USHORT)(i + nSbxParameterOffset + nParameterOffsetByContext); + sal_uInt16 iSbx = (sal_uInt16)(i + nSbxParameterOffset + nParameterOffsetByContext); // bRestParameterMode allows nEffectiveParamCount > nUnoParamCount Reference< XParameter > xParam; @@ -3661,7 +3839,7 @@ void SbUnoService::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, if( !bOutParams ) { if( xParam->isOut() ) - bOutParams = TRUE; + bOutParams = sal_True; } } else @@ -3706,14 +3884,14 @@ void SbUnoService::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, { const Any* pAnyArgs = args.getConstArray(); - for( UINT32 j = 0 ; j < nUnoParamCount ; j++ ) + for( sal_uInt32 j = 0 ; j < nUnoParamCount ; j++ ) { Reference< XParameter > xParam = pParameterSeq[j]; if( !xParam.is() ) continue; if( xParam->isOut() ) - unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pAnyArgs[ j ] ); + unoToSbxValue( (SbxVariable*)pParams->Get( (sal_uInt16)(j+1) ), pAnyArgs[ j ] ); } } } @@ -3798,8 +3976,8 @@ void SbUnoSingleton::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, { SbxVariable* pVar = pHint->GetVar(); SbxArray* pParams = pVar->GetParameters(); - UINT32 nParamCount = pParams ? ((UINT32)pParams->Count() - 1) : 0; - UINT32 nAllowedParamCount = 1; + sal_uInt32 nParamCount = pParams ? ((sal_uInt32)pParams->Count() - 1) : 0; + sal_uInt32 nAllowedParamCount = 1; Reference < XComponentContext > xContextToUse; if( nParamCount > 0 ) @@ -3858,7 +4036,7 @@ public: ~BasicAllListener_Impl(); // Methods of XInterface - //virtual BOOL queryInterface( Uik aUik, Reference< XInterface > & rOut ); + //virtual sal_Bool queryInterface( Uik aUik, Reference< XInterface > & rOut ); // Methods of XAllListener virtual void SAL_CALL firing(const AllEventObject& Event) throw ( RuntimeException ); @@ -3904,13 +4082,13 @@ void BasicAllListener_Impl::firing_impl( const AllEventObject& Event, Any* pRet // Create in a Basic Array SbxArrayRef xSbxArray = new SbxArray( SbxVARIANT ); const Any * pArgs = Event.Arguments.getConstArray(); - INT32 nCount = Event.Arguments.getLength(); - for( INT32 i = 0; i < nCount; i++ ) + sal_Int32 nCount = Event.Arguments.getLength(); + for( sal_Int32 i = 0; i < nCount; i++ ) { // Convert elements SbxVariableRef xVar = new SbxVariable( SbxVARIANT ); unoToSbxValue( (SbxVariable*)xVar, pArgs[i] ); - xSbxArray->Put( xVar, sal::static_int_cast< USHORT >(i+1) ); + xSbxArray->Put( xVar, sal::static_int_cast< sal_uInt16 >(i+1) ); } pLib->Call( aMethodName, xSbxArray ); @@ -3922,7 +4100,7 @@ void BasicAllListener_Impl::firing_impl( const AllEventObject& Event, Any* pRet if( pVar ) { // #95792 Avoid a second call - USHORT nFlags = pVar->GetFlags(); + sal_uInt16 nFlags = pVar->GetFlags(); pVar->SetFlag( SBX_NO_BROADCAST ); *pRet = sbxToUnoValueImpl( pVar ); pVar->SetFlags( nFlags ); @@ -4117,7 +4295,7 @@ sal_Bool SAL_CALL InvocationToAllListenerMapper::hasProperty(const ::rtl::OUStri // Uno-Service erzeugen // 1. Parameter == Prefix-Name of the macro // 2. Parameter == fully qualified name of the listener -void SbRtl_CreateUnoListener( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +void SbRtl_CreateUnoListener( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ) //RTLFUNC(CreateUnoListener) { (void)bWrite; @@ -4181,7 +4359,7 @@ void SbRtl_CreateUnoListener( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) //======================================================================== // Represents the DefaultContext property of the ProcessServiceManager // in the Basic runtime system. -void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ) { (void)pBasic; (void)bWrite; @@ -4209,11 +4387,13 @@ void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite //======================================================================== // Creates a Basic wrapper object for a strongly typed Uno value // 1. parameter: Uno type as full qualified type name, e.g. "byte[]" -void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ) { (void)pBasic; (void)bWrite; + static String aTypeTypeString( RTL_CONSTASCII_USTRINGPARAM("type") ); + // 2 parameters needed if ( rPar.Count() != 3 ) { @@ -4225,6 +4405,41 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) String aTypeName = rPar.Get(1)->GetString(); SbxVariable* pVal = rPar.Get(2); + if( aTypeName == aTypeTypeString ) + { + SbxDataType eBaseType = pVal->SbxValue::GetType(); + String aValTypeName; + if( eBaseType == SbxSTRING ) + { + aValTypeName = pVal->GetString(); + } + else if( eBaseType == SbxOBJECT ) + { + // XIdlClass? + Reference< XIdlClass > xIdlClass; + + SbxBaseRef pObj = (SbxBase*)pVal->GetObject(); + if( pObj && pObj->ISA(SbUnoObject) ) + { + Any aUnoAny = ((SbUnoObject*)(SbxBase*)pObj)->getUnoAny(); + aUnoAny >>= xIdlClass; + } + + if( xIdlClass.is() ) + aValTypeName = xIdlClass->getName(); + } + Type aType; + bool bSuccess = implGetTypeByName( aValTypeName, aType ); + if( bSuccess ) + { + Any aTypeAny( aType ); + SbxVariableRef refVar = rPar.Get(0); + SbxObjectRef xUnoAnyObject = new SbUnoAnyObject( aTypeAny ); + refVar->PutObject( xUnoAnyObject ); + } + return; + } + // Check the type Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl(); Any aRet; @@ -4280,14 +4495,26 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) //========================================================================== -typedef WeakImplHelper1< XInvocation > ModuleInvocationProxyHelper; +namespace { +class OMutexBasis +{ +protected: + // this mutex is necessary for OInterfaceContainerHelper + ::osl::Mutex m_aMutex; +}; +} // namespace + +typedef WeakImplHelper2< XInvocation, XComponent > ModuleInvocationProxyHelper; -class ModuleInvocationProxy : public ModuleInvocationProxyHelper +class ModuleInvocationProxy : public OMutexBasis, + public ModuleInvocationProxyHelper { ::rtl::OUString m_aPrefix; SbxObjectRef m_xScopeObj; bool m_bProxyIsClassModuleObject; + ::cppu::OInterfaceContainerHelper m_aListeners; + public: ModuleInvocationProxy( const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj ); ~ModuleInvocationProxy() @@ -4307,11 +4534,17 @@ public: Sequence< sal_Int16 >& rOutParamIndex, Sequence< Any >& rOutParam ) throw( CannotConvertException, InvocationTargetException ); + + // XComponent + virtual void SAL_CALL dispose() throw(RuntimeException); + virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException); + virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException); }; ModuleInvocationProxy::ModuleInvocationProxy( const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj ) : m_aPrefix( aPrefix + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_") ) ) , m_xScopeObj( xScopeObj ) + , m_aListeners( m_aMutex ) { m_bProxyIsClassModuleObject = xScopeObj.Is() ? xScopeObj->ISA(SbClassModuleObject) : false; } @@ -4408,13 +4641,27 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const ::rtl::OUString& rFunction, SolarMutexGuard guard; Any aRet; - if( !m_xScopeObj.Is() ) + SbxObjectRef xScopeObj = m_xScopeObj; + if( !xScopeObj.Is() ) return aRet; ::rtl::OUString aFunctionName = m_aPrefix; aFunctionName += rFunction; - SbxVariable* p = m_xScopeObj->Find( aFunctionName, SbxCLASS_METHOD ); + sal_Bool bSetRescheduleBack = sal_False; + sal_Bool bOldReschedule = sal_True; + SbiInstance* pInst = pINST; + if( pInst && pInst->IsCompatibility() ) + { + bOldReschedule = pInst->IsReschedule(); + if ( bOldReschedule ) + { + pInst->EnableReschedule( sal_False ); + bSetRescheduleBack = sal_True; + } + } + + SbxVariable* p = xScopeObj->Find( aFunctionName, SbxCLASS_METHOD ); SbMethod* pMeth = p != NULL ? PTR_CAST(SbMethod,p) : NULL; if( pMeth == NULL ) { @@ -4434,7 +4681,7 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const ::rtl::OUString& rFunction, { SbxVariableRef xVar = new SbxVariable( SbxVARIANT ); unoToSbxValue( (SbxVariable*)xVar, pArgs[i] ); - xArray->Put( xVar, sal::static_int_cast< USHORT >(i+1) ); + xArray->Put( xVar, sal::static_int_cast< sal_uInt16 >(i+1) ); } } @@ -4446,11 +4693,38 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const ::rtl::OUString& rFunction, aRet = sbxToUnoValue( xValue ); pMeth->SetParameters( NULL ); + if( bSetRescheduleBack ) + pInst->EnableReschedule( bOldReschedule ); + // TODO: OutParameter? return aRet; } +void SAL_CALL ModuleInvocationProxy::dispose() + throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + EventObject aEvent( (XComponent*)this ); + m_aListeners.disposeAndClear( aEvent ); + + m_xScopeObj = NULL; +} + +void SAL_CALL ModuleInvocationProxy::addEventListener( const Reference< XEventListener >& xListener ) + throw (RuntimeException) +{ + m_aListeners.addInterface( xListener ); +} + +void SAL_CALL ModuleInvocationProxy::removeEventListener( const Reference< XEventListener >& xListener ) + throw (RuntimeException) +{ + m_aListeners.removeInterface( xListener ); +} + + Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::OUString& aVBAType, const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj ) { @@ -4480,6 +4754,97 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl:: return xRet; } +typedef std::vector< WeakReference< XComponent > > ComponentRefVector; + +struct StarBasicDisposeItem +{ + StarBASIC* m_pBasic; + SbxArrayRef m_pRegisteredVariables; + ComponentRefVector m_vComImplementsObjects; + + StarBasicDisposeItem( StarBASIC* pBasic ) + : m_pBasic( pBasic ) + { + m_pRegisteredVariables = new SbxArray(); + } +}; + +typedef std::vector< StarBasicDisposeItem* > DisposeItemVector; + +static DisposeItemVector GaDisposeItemVector; + +DisposeItemVector::iterator lcl_findItemForBasic( StarBASIC* pBasic ) +{ + DisposeItemVector::iterator it; + for( it = GaDisposeItemVector.begin() ; it != GaDisposeItemVector.end() ; ++it ) + { + StarBasicDisposeItem* pItem = *it; + if( pItem->m_pBasic == pBasic ) + return it; + } + return GaDisposeItemVector.end(); +} + +StarBasicDisposeItem* lcl_getOrCreateItemForBasic( StarBASIC* pBasic ) +{ + DisposeItemVector::iterator it = lcl_findItemForBasic( pBasic ); + StarBasicDisposeItem* pItem = (it != GaDisposeItemVector.end()) ? *it : NULL; + if( pItem == NULL ) + { + pItem = new StarBasicDisposeItem( pBasic ); + GaDisposeItemVector.push_back( pItem ); + } + return pItem; +} + +void registerComponentToBeDisposedForBasic + ( Reference< XComponent > xComponent, StarBASIC* pBasic ) +{ + StarBasicDisposeItem* pItem = lcl_getOrCreateItemForBasic( pBasic ); + pItem->m_vComImplementsObjects.push_back( xComponent ); +} + +void registerComListenerVariableForBasic( SbxVariable* pVar, StarBASIC* pBasic ) +{ + StarBasicDisposeItem* pItem = lcl_getOrCreateItemForBasic( pBasic ); + SbxArray* pArray = pItem->m_pRegisteredVariables; + pArray->Put( pVar, pArray->Count() ); +} + +void disposeComVariablesForBasic( StarBASIC* pBasic ) +{ + DisposeItemVector::iterator it = lcl_findItemForBasic( pBasic ); + if( it != GaDisposeItemVector.end() ) + { + StarBasicDisposeItem* pItem = *it; + + SbxArray* pArray = pItem->m_pRegisteredVariables; + sal_uInt16 nCount = pArray->Count(); + for( sal_uInt16 i = 0 ; i < nCount ; ++i ) + { + SbxVariable* pVar = pArray->Get( i ); + pVar->ClearComListener(); + } + + ComponentRefVector& rv = pItem->m_vComImplementsObjects; + ComponentRefVector::iterator itCRV; + for( itCRV = rv.begin() ; itCRV != rv.end() ; ++itCRV ) + { + try + { + Reference< XComponent > xComponent( (*itCRV).get(), UNO_QUERY_THROW ); + xComponent->dispose(); + } + catch( Exception& ) + {} + } + + delete pItem; + GaDisposeItemVector.erase( it ); + } +} + + // Handle module implements mechanism for OLE types bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject ) { @@ -4500,8 +4865,8 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP bool bSuccess = false; SbxArray* pModIfaces = pClassData->mxIfaces; - USHORT nCount = pModIfaces->Count(); - for( USHORT i = 0 ; i < nCount ; ++i ) + sal_uInt16 nCount = pModIfaces->Count(); + for( sal_uInt16 i = 0 ; i < nCount ; ++i ) { SbxVariable* pVar = pModIfaces->Get( i ); ::rtl::OUString aIfaceName = pVar->GetName(); @@ -4533,6 +4898,23 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP if( bSuccess ) { + Reference< XComponent > xComponent( xProxy, UNO_QUERY ); + if( xComponent.is() ) + { + StarBASIC* pParentBasic = NULL; + SbxObject* pCurObject = this; + do + { + SbxObject* pObjParent = pCurObject->GetParent(); + pParentBasic = PTR_CAST( StarBASIC, pObjParent ); + pCurObject = pObjParent; + } + while( pParentBasic == NULL && pCurObject != NULL ); + + OSL_ASSERT( pParentBasic != NULL ); + registerComponentToBeDisposedForBasic( xComponent, pParentBasic ); + } + o_rRetAny <<= xRet; break; } @@ -4542,4 +4924,31 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP return bSuccess; } + +// Due to an incorrect behavior IE returns an object instead of a string +// in some scenarios. Calling toString at the object may correct this. +// Helper function used in sbxvalue.cxx +bool handleToStringForCOMObjects( SbxObject* pObj, SbxValue* pVal ) +{ + bool bSuccess = false; + + SbUnoObject* pUnoObj = NULL; + if( pObj != NULL && (pUnoObj = PTR_CAST(SbUnoObject,(SbxObject*)pObj)) != NULL ) + { + // Only for native COM objects + if( pUnoObj->isNativeCOMObject() ) + { + SbxVariableRef pMeth = pObj->Find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "toString" ) ), SbxCLASS_METHOD ); + if ( pMeth.Is() ) + { + SbxValues aRes; + pMeth->Get( aRes ); + pVal->Put( aRes ); + bSuccess = true; + } + } + } + return bSuccess; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 28b783c3d7d8..55c3d9037ef9 100644..100755 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -51,12 +51,16 @@ #include <basic/basrdll.hxx> #include <osl/mutex.hxx> #include <basic/sbobjmod.hxx> -#include <cppuhelper/implbase2.hxx> +#include <basic/vbahelper.hxx> +#include <cppuhelper/implbase3.hxx> +#include <unotools/eventcfg.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/script/ModuleType.hpp> #include <com/sun/star/script/vba/XVBACompatibility.hpp> #include <com/sun/star/document/XVbaMethodParameter.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/document/XEventBroadcaster.hpp> +#include <com/sun/star/document/XEventListener.hpp> using namespace com::sun::star; @@ -263,7 +267,7 @@ DocObjectWrapper::invoke( const ::rtl::OUString& aFunctionName, const Sequence< if ( pInfo ) { sal_Int32 nSbxOptional = 0; - USHORT n = 1; + sal_uInt16 n = 1; for ( const SbxParamInfo* pParamInfo = pInfo->GetParam( n ); pParamInfo; pParamInfo = pInfo->GetParam( ++n ) ) { if ( ( pParamInfo->nFlags & SBX_OPTIONAL ) != 0 ) @@ -287,7 +291,7 @@ DocObjectWrapper::invoke( const ::rtl::OUString& aFunctionName, const Sequence< { SbxVariableRef xSbxVar = new SbxVariable( SbxVARIANT ); unoToSbxValue( static_cast< SbxVariable* >( xSbxVar ), pParams[i] ); - xSbxParams->Put( xSbxVar, static_cast< USHORT >( i ) + 1 ); + xSbxParams->Put( xSbxVar, static_cast< sal_uInt16 >( i ) + 1 ); // Enable passing by ref if ( xSbxVar->GetType() != SbxVARIANT ) @@ -309,7 +313,7 @@ DocObjectWrapper::invoke( const ::rtl::OUString& aFunctionName, const Sequence< if ( pInfo_ ) { OutParamMap aOutParamMap; - for ( USHORT n = 1, nCount = xSbxParams->Count(); n < nCount; ++n ) + for ( sal_uInt16 n = 1, nCount = xSbxParams->Count(); n < nCount; ++n ) { const SbxParamInfo* pParamInfo = pInfo_->GetParam( n ); if ( pParamInfo && ( pParamInfo->eType & SbxBYREF ) != 0 ) @@ -407,7 +411,7 @@ SbMethodRef DocObjectWrapper::getMethod( const rtl::OUString& aName ) throw (Run SbMethodRef pMethod = NULL; if ( m_pMod ) { - USHORT nSaveFlgs = m_pMod->GetFlags(); + sal_uInt16 nSaveFlgs = m_pMod->GetFlags(); // Limit search to this module m_pMod->ResetFlag( SBX_GBLSEARCH ); pMethod = (SbMethod*) m_pMod->SbModule::Find( aName, SbxCLASS_METHOD ); @@ -422,7 +426,7 @@ SbPropertyRef DocObjectWrapper::getProperty( const rtl::OUString& aName ) throw SbPropertyRef pProperty = NULL; if ( m_pMod ) { - USHORT nSaveFlgs = m_pMod->GetFlags(); + sal_uInt16 nSaveFlgs = m_pMod->GetFlags(); // Limit search to this module. m_pMod->ResetFlag( SBX_GBLSEARCH ); pProperty = (SbProperty*)m_pMod->SbModule::Find( aName, SbxCLASS_PROPERTY ); @@ -441,11 +445,7 @@ TYPEINIT1(SbJScriptMethod,SbMethod) TYPEINIT1(SbObjModule,SbModule) TYPEINIT1(SbUserFormModule,SbObjModule) -SV_DECL_VARARR(SbiBreakpoints,USHORT,4,4) -SV_IMPL_VARARR(SbiBreakpoints,USHORT) - - -SV_IMPL_VARARR(HighlightPortions, HighlightPortion) +typedef std::vector<HighlightPortion> HighlightPortions; bool getDefaultVBAMode( StarBASIC* pb ) { @@ -497,30 +497,18 @@ IMPL_LINK( AsyncQuitHandler, OnAsyncQuit, void*, /*pNull*/ ) return 0L; } -bool UnlockControllerHack( StarBASIC* pBasic ) +void VBAUnlockDocuments( StarBASIC* pBasic ) { - bool bRes = false; if ( pBasic && pBasic->IsDocBasic() ) { - uno::Any aUnoVar; - ::rtl::OUString sVarName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" )) ); - SbUnoObject* pGlobs = dynamic_cast<SbUnoObject*>( pBasic->Find( sVarName, SbxCLASS_DONTCARE ) ); + SbUnoObject* pGlobs = dynamic_cast< SbUnoObject* >( pBasic->Find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" ) ), SbxCLASS_DONTCARE ) ); if ( pGlobs ) - aUnoVar = pGlobs->getUnoAny(); - uno::Reference< frame::XModel > xModel( aUnoVar, uno::UNO_QUERY); - if ( xModel.is() ) { - try - { - xModel->unlockControllers(); - bRes = true; - } - catch( uno::Exception& ) - { - } + uno::Reference< frame::XModel > xModel( pGlobs->getUnoAny(), uno::UNO_QUERY ); + ::basic::vba::lockControllersOfAllDocuments( xModel, sal_False ); + ::basic::vba::enableContainerWindowsOfAllDocuments( xModel, sal_True ); } } - return bRes; } ///////////////////////////////////////////////////////////////////////////// @@ -528,7 +516,7 @@ bool UnlockControllerHack( StarBASIC* pBasic ) // A Basic module has set EXTSEARCH, so that the elements, that the modul contains, // could be found from other module. -SbModule::SbModule( const String& rName, BOOL bVBACompat ) +SbModule::SbModule( const String& rName, sal_Bool bVBACompat ) : SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASICModule") ) ), pImage( NULL ), pBreaks( NULL ), pClassData( NULL ), mbVBACompat( bVBACompat ), pDocObject( NULL ), bIsProxyModule( false ) { @@ -564,9 +552,9 @@ SbModule::GetUnoModule() return mxWrapper; } -BOOL SbModule::IsCompiled() const +sal_Bool SbModule::IsCompiled() const { - return BOOL( pImage != 0 ); + return sal_Bool( pImage != 0 ); } const SbxObject* SbModule::FindType( String aTypeName ) const @@ -585,12 +573,12 @@ void SbModule::StartDefinitions() // methods and properties persist, but they are invalid; // at least are the information under certain conditions clogged - USHORT i; + sal_uInt16 i; for( i = 0; i < pMethods->Count(); i++ ) { SbMethod* p = PTR_CAST(SbMethod,pMethods->Get( i ) ); if( p ) - p->bInvalid = TRUE; + p->bInvalid = sal_True; } for( i = 0; i < pProps->Count(); ) { @@ -616,11 +604,11 @@ SbMethod* SbModule::GetMethod( const String& rName, SbxDataType t ) pMeth->SetParent( this ); pMeth->SetFlags( SBX_READ ); pMethods->Put( pMeth, pMethods->Count() ); - StartListening( pMeth->GetBroadcaster(), TRUE ); + StartListening( pMeth->GetBroadcaster(), sal_True ); } // The method is per default valid, because it could be // created from the compiler (code generator) as well. - pMeth->bInvalid = FALSE; + pMeth->bInvalid = sal_False; pMeth->ResetFlag( SBX_FIXED ); pMeth->SetFlag( SBX_WRITE ); pMeth->SetType( t ); @@ -644,7 +632,7 @@ SbProperty* SbModule::GetProperty( const String& rName, SbxDataType t ) pProp->SetFlag( SBX_READWRITE ); pProp->SetParent( this ); pProps->Put( pProp, pProps->Count() ); - StartListening( pProp->GetBroadcaster(), TRUE ); + StartListening( pProp->GetBroadcaster(), sal_True ); } return pProp; } @@ -662,7 +650,7 @@ SbProcedureProperty* SbModule::GetProcedureProperty pProp->SetFlag( SBX_READWRITE ); pProp->SetParent( this ); pProps->Put( pProp, pProps->Count() ); - StartListening( pProp->GetBroadcaster(), TRUE ); + StartListening( pProp->GetBroadcaster(), sal_True ); } return pProp; } @@ -681,7 +669,7 @@ SbIfaceMapperMethod* SbModule::GetIfaceMapperMethod pMapperMethod->SetFlags( SBX_READ ); pMethods->Put( pMapperMethod, pMethods->Count() ); } - pMapperMethod->bInvalid = FALSE; + pMapperMethod->bInvalid = sal_False; return pMapperMethod; } @@ -694,9 +682,9 @@ TYPEINIT1(SbIfaceMapperMethod,SbMethod) // From the code generator: remove invalid entries -void SbModule::EndDefinitions( BOOL bNewState ) +void SbModule::EndDefinitions( sal_Bool bNewState ) { - for( USHORT i = 0; i < pMethods->Count(); ) + for( sal_uInt16 i = 0; i < pMethods->Count(); ) { SbMethod* p = PTR_CAST(SbMethod,pMethods->Get( i ) ); if( p ) @@ -712,7 +700,7 @@ void SbModule::EndDefinitions( BOOL bNewState ) else i++; } - SetModified( TRUE ); + SetModified( sal_True ); } void SbModule::Clear() @@ -808,12 +796,12 @@ void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, aVals.eType = SbxVARIANT; SbxArray* pArg = pVar->GetParameters(); - USHORT nVarParCount = (pArg != NULL) ? pArg->Count() : 0; + sal_uInt16 nVarParCount = (pArg != NULL) ? pArg->Count() : 0; if( nVarParCount > 1 ) { SbxArrayRef xMethParameters = new SbxArray; xMethParameters->Put( pMethVar, 0 ); // Method as parameter 0 - for( USHORT i = 1 ; i < nVarParCount ; ++i ) + for( sal_uInt16 i = 1 ; i < nVarParCount ; ++i ) { SbxVariable* pPar = pArg->Get( i ); xMethParameters->Put( pPar, i ); @@ -895,7 +883,7 @@ void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, // side effects when using name as variable implicitely bool bForwardToSbxObject = true; - ULONG nId = pHint->GetId(); + sal_uIntPtr nId = pHint->GetId(); if( (nId == SBX_HINT_DATAWANTED || nId == SBX_HINT_DATACHANGED) && pVar->GetName().EqualsIgnoreCaseAscii( "name" ) ) bForwardToSbxObject = false; @@ -953,7 +941,7 @@ void SbModule::SetSource32( const ::rtl::OUString& r ) aTok.SetCompatible( true ); else if ( ( eCurTok == VBASUPPORT ) && ( aTok.Next() == NUMBER ) ) { - BOOL bIsVBA = ( aTok.GetDbl()== 1 ); + sal_Bool bIsVBA = ( aTok.GetDbl()== 1 ); SetVBACompat( bIsVBA ); aTok.SetCompatible( bIsVBA ); } @@ -965,7 +953,7 @@ void SbModule::SetSource32( const ::rtl::OUString& r ) SbMethod* pMeth = NULL; if( eEndTok != NIL ) { - USHORT nLine1 = aTok.GetLine(); + sal_uInt16 nLine1 = aTok.GetLine(); if( aTok.Next() == SYMBOL ) { String aName_( aTok.GetSym() ); @@ -975,7 +963,7 @@ void SbModule::SetSource32( const ::rtl::OUString& r ) pMeth = GetMethod( aName_, t ); pMeth->nLine1 = pMeth->nLine2 = nLine1; // The method is for a start VALID - pMeth->bInvalid = FALSE; + pMeth->bInvalid = sal_False; } else eEndTok = NIL; @@ -995,18 +983,18 @@ void SbModule::SetSource32( const ::rtl::OUString& r ) pMeth->nLine2 = aTok.GetLine(); } } - EndDefinitions( TRUE ); + EndDefinitions( sal_True ); } void SbModule::SetComment( const String& r ) { aComment = r; - SetModified( TRUE ); + SetModified( sal_True ); } -SbMethod* SbModule::GetFunctionForLine( USHORT nLine ) +SbMethod* SbModule::GetFunctionForLine( sal_uInt16 nLine ) { - for( USHORT i = 0; i < pMethods->Count(); i++ ) + for( sal_uInt16 i = 0; i < pMethods->Count(); i++ ) { SbMethod* p = (SbMethod*) pMethods->Get( i ); if( p->GetSbxId() == SBXID_BASICMETHOD ) @@ -1020,14 +1008,14 @@ SbMethod* SbModule::GetFunctionForLine( USHORT nLine ) // Broadcast of a hint to all Basics -static void _SendHint( SbxObject* pObj, ULONG nId, SbMethod* p ) +static void _SendHint( SbxObject* pObj, sal_uIntPtr nId, SbMethod* p ) { // Self a BASIC? if( pObj->IsA( TYPE(StarBASIC) ) && pObj->IsBroadcaster() ) pObj->GetBroadcaster().Broadcast( SbxHint( nId, p ) ); // Then ask for the subobjects SbxArray* pObjs = pObj->GetObjects(); - for( USHORT i = 0; i < pObjs->Count(); i++ ) + for( sal_uInt16 i = 0; i < pObjs->Count(); i++ ) { SbxVariable* pVar = pObjs->Get( i ); if( pVar->IsA( TYPE(SbxObject) ) ) @@ -1035,7 +1023,7 @@ static void _SendHint( SbxObject* pObj, ULONG nId, SbMethod* p ) } } -static void SendHint( SbxObject* pObj, ULONG nId, SbMethod* p ) +static void SendHint( SbxObject* pObj, sal_uIntPtr nId, SbMethod* p ) { while( pObj->GetParent() ) pObj = pObj->GetParent(); @@ -1072,8 +1060,8 @@ void ClearUnoObjectsInRTL_Impl_Rek( StarBASIC* pBasic ) // Go over all Sub-Basics SbxArray* pObjs = pBasic->GetObjects(); - USHORT nCount = pObjs->Count(); - for( USHORT i = 0 ; i < nCount ; i++ ) + sal_uInt16 nCount = pObjs->Count(); + for( sal_uInt16 i = 0 ; i < nCount ; i++ ) { SbxVariable* pObjVar = pObjs->Get( i ); StarBASIC* pSubBasic = PTR_CAST( StarBASIC, pObjVar ); @@ -1097,25 +1085,25 @@ void ClearUnoObjectsInRTL_Impl( StarBASIC* pBasic ) if( ((StarBASIC*)p) != pBasic ) ClearUnoObjectsInRTL_Impl_Rek( (StarBASIC*)p ); } -BOOL SbModule::IsVBACompat() const +sal_Bool SbModule::IsVBACompat() const { return mbVBACompat; } -void SbModule::SetVBACompat( BOOL bCompat ) +void SbModule::SetVBACompat( sal_Bool bCompat ) { mbVBACompat = bCompat; } // Run a Basic-subprogram -USHORT SbModule::Run( SbMethod* pMeth ) +sal_uInt16 SbModule::Run( SbMethod* pMeth ) { OSL_TRACE("About to run %s, vba compatmode is %d", rtl::OUStringToOString( pMeth->GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), mbVBACompat ); - static USHORT nMaxCallLevel = 0; + static sal_uInt16 nMaxCallLevel = 0; static String aMSOMacroRuntimeLibName = String::CreateFromAscii( "Launcher" ); static String aMSOMacroRuntimeAppSymbol = String::CreateFromAscii( "Application" ); - USHORT nRes = 0; - BOOL bDelInst = BOOL( pINST == NULL ); + sal_uInt16 nRes = 0; + sal_Bool bDelInst = sal_Bool( pINST == NULL ); bool bQuit = false; StarBASICRef xBasic; if( bDelInst ) @@ -1160,7 +1148,7 @@ USHORT SbModule::Run( SbMethod* pMeth ) GlobalRunInit( /* bBasicStart = */ bDelInst ); // Appeared a compiler error? Then we don't launch - if( GetSbData()->bGlobalInitErr == FALSE ) + if( GetSbData()->bGlobalInitErr == sal_False ) { if( bDelInst ) { @@ -1182,7 +1170,7 @@ USHORT SbModule::Run( SbMethod* pMeth ) pINST->pRun = pRt; if ( mbVBACompat ) { - pINST->EnableCompatibility( TRUE ); + pINST->EnableCompatibility( sal_True ); } while( pRt->Step() ) {} if( pRt->pNext ) @@ -1202,7 +1190,7 @@ USHORT SbModule::Run( SbMethod* pMeth ) GetpApp()->Yield(); } - nRes = TRUE; + nRes = sal_True; pINST->pRun = pRt->pNext; pINST->nCallLvl--; // Call-Level down again @@ -1214,29 +1202,30 @@ USHORT SbModule::Run( SbMethod* pMeth ) delete pRt; pMOD = pOldMod; - if ( pINST->nCallLvl == 0 && IsVBACompat() ) - { - // VBA always ensure screenupdating is enabled after completing - StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent()); - if ( pBasic && pBasic->IsDocBasic() ) - { - UnlockControllerHack( pBasic ); - } - } if( bDelInst ) { // #57841 Clear Uno-Objects, which were helt in RTL functions, // at the end of the program, so that nothing were helt. ClearUnoObjectsInRTL_Impl( xBasic ); + clearNativeObjectWrapperVector(); + DBG_ASSERT(pINST->nCallLvl==0,"BASIC-Call-Level > 0"); - delete pINST, pINST = NULL, bDelInst = FALSE; + delete pINST, pINST = NULL, bDelInst = sal_False; // #i30690 SolarMutexGuard aSolarGuard; SendHint( GetParent(), SBX_HINT_BASICSTOP, pMeth ); GlobalRunDeInit(); + + // VBA always ensures screenupdating is enabled after completing + if ( mbVBACompat ) + VBAUnlockDocuments( PTR_CAST( StarBASIC, GetParent() ) ); + +#ifdef DBG_TRACE_BASIC + dbg_DeInitTrace(); +#endif } } else @@ -1248,10 +1237,7 @@ USHORT SbModule::Run( SbMethod* pMeth ) StarBASIC::FatalError( SbERR_STACK_OVERFLOW ); } - // VBA always ensure screenupdating is enabled after completing StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent()); - if ( pBasic && pBasic->IsDocBasic() && !pINST ) - UnlockControllerHack( pBasic ); if( bDelInst ) { // #57841 Clear Uno-Objects, which were helt in RTL functions, @@ -1281,9 +1267,9 @@ void SbModule::RunInit() && pImage->GetFlag( SBIMG_INITCODE ) ) { // Set flag, so that RunInit get activ (Testtool) - GetSbData()->bRunInit = TRUE; + GetSbData()->bRunInit = sal_True; - // BOOL bDelInst = BOOL( pINST == NULL ); + // sal_Bool bDelInst = sal_Bool( pINST == NULL ); // if( bDelInst ) // pINST = new SbiInstance( (StarBASIC*) GetParent() ); SbModule* pOldMod = pMOD; @@ -1300,11 +1286,11 @@ void SbModule::RunInit() pMOD = pOldMod; // if( bDelInst ) // delete pINST, pINST = NULL; - pImage->bInit = TRUE; - pImage->bFirstInit = FALSE; + pImage->bInit = sal_True; + pImage->bFirstInit = sal_False; // RunInit is not activ anymore - GetSbData()->bRunInit = FALSE; + GetSbData()->bRunInit = sal_False; } } @@ -1338,7 +1324,7 @@ void SbModule::RemoveVars() void SbModule::ClearPrivateVars() { - for( USHORT i = 0 ; i < pProps->Count() ; i++ ) + for( sal_uInt16 i = 0 ; i < pProps->Count() ; i++ ) { SbProperty* p = PTR_CAST(SbProperty,pProps->Get( i ) ); if( p ) @@ -1349,12 +1335,12 @@ void SbModule::ClearPrivateVars() SbxArray* pArray = PTR_CAST(SbxArray,p->GetObject()); if( pArray ) { - for( USHORT j = 0 ; j < pArray->Count() ; j++ ) + for( sal_uInt16 j = 0 ; j < pArray->Count() ; j++ ) { SbxVariable* pj = PTR_CAST(SbxVariable,pArray->Get( j )); pj->SbxValue::Clear(); /* - USHORT nFlags = pj->GetFlags(); + sal_uInt16 nFlags = pj->GetFlags(); pj->SetFlags( (nFlags | SBX_WRITE) & (~SBX_FIXED) ); pj->PutEmpty(); pj->SetFlags( nFlags ); @@ -1366,7 +1352,7 @@ void SbModule::ClearPrivateVars() { p->SbxValue::Clear(); /* - USHORT nFlags = p->GetFlags(); + sal_uInt16 nFlags = p->GetFlags(); p->SetFlags( (nFlags | SBX_WRITE) & (~SBX_FIXED) ); p->PutEmpty(); p->SetFlags( nFlags ); @@ -1376,23 +1362,76 @@ void SbModule::ClearPrivateVars() } } -// At first in this module, to remain 358-capable -// (Avoid branch in sb.cxx) +void SbModule::implClearIfVarDependsOnDeletedBasic( SbxVariable* pVar, StarBASIC* pDeletedBasic ) +{ + if( pVar->SbxValue::GetType() != SbxOBJECT || pVar->ISA( SbProcedureProperty ) ) + return; + + SbxObject* pObj = PTR_CAST(SbxObject,pVar->GetObject()); + if( pObj != NULL ) + { + SbxObject* p = pObj; + + SbModule* pMod = PTR_CAST( SbModule, p ); + if( pMod != NULL ) + pMod->ClearVarsDependingOnDeletedBasic( pDeletedBasic ); + + while( (p = p->GetParent()) != NULL ) + { + StarBASIC* pBasic = PTR_CAST( StarBASIC, p ); + if( pBasic != NULL && pBasic == pDeletedBasic ) + { + pVar->SbxValue::Clear(); + break; + } + } + } +} + +void SbModule::ClearVarsDependingOnDeletedBasic( StarBASIC* pDeletedBasic ) +{ + (void)pDeletedBasic; + + for( sal_uInt16 i = 0 ; i < pProps->Count() ; i++ ) + { + SbProperty* p = PTR_CAST(SbProperty,pProps->Get( i ) ); + if( p ) + { + if( p->GetType() & SbxARRAY ) + { + SbxArray* pArray = PTR_CAST(SbxArray,p->GetObject()); + if( pArray ) + { + for( sal_uInt16 j = 0 ; j < pArray->Count() ; j++ ) + { + SbxVariable* pVar = PTR_CAST(SbxVariable,pArray->Get( j )); + implClearIfVarDependsOnDeletedBasic( pVar, pDeletedBasic ); + } + } + } + else + { + implClearIfVarDependsOnDeletedBasic( p, pDeletedBasic ); + } + } + } +} + void StarBASIC::ClearAllModuleVars( void ) { // Initialise the own module - for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ ) + for ( sal_uInt16 nMod = 0; nMod < pModules->Count(); nMod++ ) { SbModule* pModule = (SbModule*)pModules->Get( nMod ); // Initialise only, if the startcode was already executed - if( pModule->pImage && pModule->pImage->bInit ) + if( pModule->pImage && pModule->pImage->bInit && !pModule->isProxyModule() && !pModule->ISA(SbObjModule) ) pModule->ClearPrivateVars(); } } // Execution of the init-code of all module -void SbModule::GlobalRunInit( BOOL bBasicStart ) +void SbModule::GlobalRunInit( sal_Bool bBasicStart ) { // If no Basic-Start, only initialise, if the module is not initialised if( !bBasicStart ) @@ -1403,7 +1442,7 @@ void SbModule::GlobalRunInit( BOOL bBasicStart ) // With the help of this flags could be located in SbModule::Run() after the call of // GlobalRunInit, if at the intialising of the module // an error occurred. Then it will not be launched. - GetSbData()->bGlobalInitErr = FALSE; + GetSbData()->bGlobalInitErr = sal_False; // Parent of the module is a Basic StarBASIC *pBasic = PTR_CAST(StarBASIC,GetParent()); @@ -1450,15 +1489,15 @@ void SbModule::GlobalRunDeInit( void ) // Search for the next STMNT-Command in the code. This was used from the STMNT- // Opcode to set the endcolumn. -const BYTE* SbModule::FindNextStmnt( const BYTE* p, USHORT& nLine, USHORT& nCol ) const +const sal_uInt8* SbModule::FindNextStmnt( const sal_uInt8* p, sal_uInt16& nLine, sal_uInt16& nCol ) const { - return FindNextStmnt( p, nLine, nCol, FALSE ); + return FindNextStmnt( p, nLine, nCol, sal_False ); } -const BYTE* SbModule::FindNextStmnt( const BYTE* p, USHORT& nLine, USHORT& nCol, - BOOL bFollowJumps, const SbiImage* pImg ) const +const sal_uInt8* SbModule::FindNextStmnt( const sal_uInt8* p, sal_uInt16& nLine, sal_uInt16& nCol, + sal_Bool bFollowJumps, const SbiImage* pImg ) const { - UINT32 nPC = (UINT32) ( p - (const BYTE*) pImage->GetCode() ); + sal_uInt32 nPC = (sal_uInt32) ( p - (const sal_uInt8*) pImage->GetCode() ); while( nPC < pImage->GetCodeSize() ) { SbiOpcode eOp = (SbiOpcode ) ( *p++ ); @@ -1466,20 +1505,20 @@ const BYTE* SbModule::FindNextStmnt( const BYTE* p, USHORT& nLine, USHORT& nCol, if( bFollowJumps && eOp == _JUMP && pImg ) { DBG_ASSERT( pImg, "FindNextStmnt: pImg==NULL with FollowJumps option" ); - UINT32 nOp1 = *p++; nOp1 |= *p++ << 8; + sal_uInt32 nOp1 = *p++; nOp1 |= *p++ << 8; nOp1 |= *p++ << 16; nOp1 |= *p++ << 24; - p = (const BYTE*) pImg->GetCode() + nOp1; + p = (const sal_uInt8*) pImg->GetCode() + nOp1; } else if( eOp >= SbOP1_START && eOp <= SbOP1_END ) p += 4, nPC += 4; else if( eOp == _STMNT ) { - UINT32 nl, nc; + sal_uInt32 nl, nc; nl = *p++; nl |= *p++ << 8; nl |= *p++ << 16 ; nl |= *p++ << 24; nc = *p++; nc |= *p++ << 8; nc |= *p++ << 16 ; nc |= *p++ << 24; - nLine = (USHORT)nl; nCol = (USHORT)nc; + nLine = (sal_uInt16)nl; nCol = (sal_uInt16)nc; return p; } else if( eOp >= SbOP2_START && eOp <= SbOP2_END ) @@ -1495,67 +1534,63 @@ const BYTE* SbModule::FindNextStmnt( const BYTE* p, USHORT& nLine, USHORT& nCol, // Test, if a line contains STMNT-Opcodes -BOOL SbModule::IsBreakable( USHORT nLine ) const +sal_Bool SbModule::IsBreakable( sal_uInt16 nLine ) const { if( !pImage ) - return FALSE; - const BYTE* p = (const BYTE* ) pImage->GetCode(); - USHORT nl, nc; + return sal_False; + const sal_uInt8* p = (const sal_uInt8* ) pImage->GetCode(); + sal_uInt16 nl, nc; while( ( p = FindNextStmnt( p, nl, nc ) ) != NULL ) if( nl == nLine ) - return TRUE; - return FALSE; + return sal_True; + return sal_False; } -USHORT SbModule::GetBPCount() const +size_t SbModule::GetBPCount() const { - return pBreaks ? pBreaks->Count() : 0; + return pBreaks ? pBreaks->size() : 0; } -USHORT SbModule::GetBP( USHORT n ) const +sal_uInt16 SbModule::GetBP( size_t n ) const { - if( pBreaks && n < pBreaks->Count() ) - return pBreaks->GetObject( n ); + if( pBreaks && n < pBreaks->size() ) + return pBreaks->operator[]( n ); else return 0; } -BOOL SbModule::IsBP( USHORT nLine ) const +sal_Bool SbModule::IsBP( sal_uInt16 nLine ) const { if( pBreaks ) { - const USHORT* p = pBreaks->GetData(); - USHORT n = pBreaks->Count(); - for( USHORT i = 0; i < n; i++, p++ ) + for( size_t i = 0; i < pBreaks->size(); i++ ) { - USHORT b = *p; + sal_uInt16 b = pBreaks->operator[]( i ); if( b == nLine ) - return TRUE; + return sal_True; if( b < nLine ) break; } } - return FALSE; + return sal_False; } -BOOL SbModule::SetBP( USHORT nLine ) +sal_Bool SbModule::SetBP( sal_uInt16 nLine ) { if( !IsBreakable( nLine ) ) - return FALSE; + return sal_False; if( !pBreaks ) pBreaks = new SbiBreakpoints; - const USHORT* p = pBreaks->GetData(); - USHORT n = pBreaks->Count(); - USHORT i; - for( i = 0; i < n; i++, p++ ) + size_t i; + for( i = 0; i < pBreaks->size(); i++ ) { - USHORT b = *p; + sal_uInt16 b = pBreaks->operator[]( i ); if( b == nLine ) - return TRUE; + return sal_True; if( b < nLine ) break; } - pBreaks->Insert( &nLine, 1, i ); + pBreaks->insert( pBreaks->begin() + i, nLine ); // #38568: Set during runtime as well here SbDEBUG_BREAK if( pINST && pINST->pRun ) @@ -1564,24 +1599,24 @@ BOOL SbModule::SetBP( USHORT nLine ) return IsBreakable( nLine ); } -BOOL SbModule::ClearBP( USHORT nLine ) +sal_Bool SbModule::ClearBP( sal_uInt16 nLine ) { - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if( pBreaks ) { - const USHORT* p = pBreaks->GetData(); - USHORT n = pBreaks->Count(); - for( USHORT i = 0; i < n; i++, p++ ) + for( size_t i = 0; i < pBreaks->size(); i++ ) { - USHORT b = *p; + sal_uInt16 b = pBreaks->operator[]( i ); if( b == nLine ) { - pBreaks->Remove( i, 1 ); bRes = TRUE; break; + pBreaks->erase( pBreaks->begin() + i ); + bRes = sal_True; + break; } if( b < nLine ) break; } - if( !pBreaks->Count() ) + if( pBreaks->empty() ) delete pBreaks, pBreaks = NULL; } return bRes; @@ -1589,7 +1624,8 @@ BOOL SbModule::ClearBP( USHORT nLine ) void SbModule::ClearAllBP() { - delete pBreaks; pBreaks = NULL; + delete pBreaks; + pBreaks = NULL; } void @@ -1597,39 +1633,39 @@ SbModule::fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg ) const { if ( !pImg ) pImg = pImage; - for( UINT32 i = 0; i < pMethods->Count(); i++ ) + for( sal_uInt32 i = 0; i < pMethods->Count(); i++ ) { - SbMethod* pMeth = PTR_CAST(SbMethod,pMethods->Get( (USHORT)i ) ); + SbMethod* pMeth = PTR_CAST(SbMethod,pMethods->Get( (sal_uInt16)i ) ); if( pMeth ) { //fixup method start positions if ( bCvtToLegacy ) pMeth->nStart = pImg->CalcLegacyOffset( pMeth->nStart ); else - pMeth->nStart = pImg->CalcNewOffset( (USHORT)pMeth->nStart ); + pMeth->nStart = pImg->CalcNewOffset( (sal_uInt16)pMeth->nStart ); } } } -BOOL SbModule::LoadData( SvStream& rStrm, USHORT nVer ) +sal_Bool SbModule::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { Clear(); if( !SbxObject::LoadData( rStrm, 1 ) ) - return FALSE; + return sal_False; // As a precaution... SetFlag( SBX_EXTSEARCH | SBX_GBLSEARCH ); - BYTE bImage; + sal_uInt8 bImage; rStrm >> bImage; if( bImage ) { SbiImage* p = new SbiImage; - UINT32 nImgVer = 0; + sal_uInt32 nImgVer = 0; if( !p->Load( rStrm, nImgVer ) ) { delete p; - return FALSE; + return sal_False; } // If the image is in old format, we fix up the method start offsets if ( nImgVer < B_EXT_IMG_VERSION ) @@ -1657,24 +1693,24 @@ BOOL SbModule::LoadData( SvStream& rStrm, USHORT nVer ) delete p; } } - return TRUE; + return sal_True; } -BOOL SbModule::StoreData( SvStream& rStrm ) const +sal_Bool SbModule::StoreData( SvStream& rStrm ) const { - BOOL bFixup = ( pImage && !pImage->ExceedsLegacyLimits() ); + sal_Bool bFixup = ( pImage && !pImage->ExceedsLegacyLimits() ); if ( bFixup ) fixUpMethodStart( true ); - BOOL bRet = SbxObject::StoreData( rStrm ); + sal_Bool bRet = SbxObject::StoreData( rStrm ); if ( !bRet ) - return FALSE; + return sal_False; if( pImage ) { pImage->aOUSource = aOUSource; pImage->aComment = aComment; pImage->aName = GetName(); - rStrm << (BYTE) 1; + rStrm << (sal_uInt8) 1; // # PCode is saved only for legacy formats only // It should be noted that it probably isn't necessary // It would be better not to store the image ( more flexible with @@ -1691,12 +1727,12 @@ BOOL SbModule::StoreData( SvStream& rStrm ) const aImg.aOUSource = aOUSource; aImg.aComment = aComment; aImg.aName = GetName(); - rStrm << (BYTE) 1; + rStrm << (sal_uInt8) 1; return aImg.Save( rStrm ); } } -BOOL SbModule::ExceedsLegacyModuleSize() +sal_Bool SbModule::ExceedsLegacyModuleSize() { if ( !IsCompiled() ) Compile(); @@ -1753,17 +1789,17 @@ bool SbModule::HasExeCode() } // Store only image, no source -BOOL SbModule::StoreBinaryData( SvStream& rStrm ) +sal_Bool SbModule::StoreBinaryData( SvStream& rStrm ) { return StoreBinaryData( rStrm, 0 ); } -BOOL SbModule::StoreBinaryData( SvStream& rStrm, USHORT nVer ) +sal_Bool SbModule::StoreBinaryData( SvStream& rStrm, sal_uInt16 nVer ) { - BOOL bRet = Compile(); + sal_Bool bRet = Compile(); if( bRet ) { - BOOL bFixup = ( !nVer && !pImage->ExceedsLegacyLimits() );// save in old image format, fix up method starts + sal_Bool bFixup = ( !nVer && !pImage->ExceedsLegacyLimits() );// save in old image format, fix up method starts if ( bFixup ) // save in old image format, fix up method starts fixUpMethodStart( true ); @@ -1774,7 +1810,7 @@ BOOL SbModule::StoreBinaryData( SvStream& rStrm, USHORT nVer ) pImage->aComment = aComment; pImage->aName = GetName(); - rStrm << (BYTE) 1; + rStrm << (sal_uInt8) 1; if ( nVer ) bRet = pImage->Save( rStrm, B_EXT_IMG_VERSION ); else @@ -1791,7 +1827,7 @@ BOOL SbModule::StoreBinaryData( SvStream& rStrm, USHORT nVer ) // Called for >= OO 1.0 passwd protected libraries only // -BOOL SbModule::LoadBinaryData( SvStream& rStrm ) +sal_Bool SbModule::LoadBinaryData( SvStream& rStrm ) { ::rtl::OUString aKeepSource = aOUSource; bool bRet = LoadData( rStrm, 2 ); @@ -1800,10 +1836,10 @@ BOOL SbModule::LoadBinaryData( SvStream& rStrm ) return bRet; } -BOOL SbModule::LoadCompleted() +sal_Bool SbModule::LoadCompleted() { SbxArray* p = GetMethods(); - USHORT i; + sal_uInt16 i; for( i = 0; i < p->Count(); i++ ) { SbMethod* q = PTR_CAST(SbMethod,p->Get( i ) ); @@ -1817,9 +1853,101 @@ BOOL SbModule::LoadCompleted() if( q ) q->pMod = this; } - return TRUE; + return sal_True; +} + +void SbModule::handleProcedureProperties( SfxBroadcaster& rBC, const SfxHint& rHint ) +{ + bool bDone = false; + + const SbxHint* pHint = PTR_CAST(SbxHint,&rHint); + if( pHint ) + { + SbxVariable* pVar = pHint->GetVar(); + SbProcedureProperty* pProcProperty = PTR_CAST( SbProcedureProperty, pVar ); + if( pProcProperty ) + { + bDone = true; + + if( pHint->GetId() == SBX_HINT_DATAWANTED ) + { + String aProcName; + aProcName.AppendAscii( "Property Get " ); + aProcName += pProcProperty->GetName(); + + SbxVariable* pMeth = Find( aProcName, SbxCLASS_METHOD ); + if( pMeth ) + { + SbxValues aVals; + aVals.eType = SbxVARIANT; + + SbxArray* pArg = pVar->GetParameters(); + sal_uInt16 nVarParCount = (pArg != NULL) ? pArg->Count() : 0; + if( nVarParCount > 1 ) + { + SbxArrayRef xMethParameters = new SbxArray; + xMethParameters->Put( pMeth, 0 ); // Method as parameter 0 + for( sal_uInt16 i = 1 ; i < nVarParCount ; ++i ) + { + SbxVariable* pPar = pArg->Get( i ); + xMethParameters->Put( pPar, i ); + } + + pMeth->SetParameters( xMethParameters ); + pMeth->Get( aVals ); + pMeth->SetParameters( NULL ); + } + else + { + pMeth->Get( aVals ); + } + + pVar->Put( aVals ); + } + } + else if( pHint->GetId() == SBX_HINT_DATACHANGED ) + { + SbxVariable* pMeth = NULL; + + bool bSet = pProcProperty->isSet(); + if( bSet ) + { + pProcProperty->setSet( false ); + + String aProcName; + aProcName.AppendAscii( "Property Set " ); + aProcName += pProcProperty->GetName(); + pMeth = Find( aProcName, SbxCLASS_METHOD ); + } + if( !pMeth ) // Let + { + String aProcName; + aProcName.AppendAscii( "Property Let " ); + aProcName += pProcProperty->GetName(); + pMeth = Find( aProcName, SbxCLASS_METHOD ); + } + + if( pMeth ) + { + // Setup parameters + SbxArrayRef xArray = new SbxArray; + xArray->Put( pMeth, 0 ); // Method as parameter 0 + xArray->Put( pVar, 1 ); + pMeth->SetParameters( xArray ); + + SbxValues aVals; + pMeth->Get( aVals ); + pMeth->SetParameters( NULL ); + } + } + } + } + + if( !bDone ) + SbModule::Notify( rBC, rHint ); } + ///////////////////////////////////////////////////////////////////////// // Implementation SbJScriptModule (Basic-Modul fuer JavaScript-Sourcen) SbJScriptModule::SbJScriptModule( const String& rName ) @@ -1827,32 +1955,32 @@ SbJScriptModule::SbJScriptModule( const String& rName ) { } -BOOL SbJScriptModule::LoadData( SvStream& rStrm, USHORT nVer ) +sal_Bool SbJScriptModule::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { (void)nVer; Clear(); if( !SbxObject::LoadData( rStrm, 1 ) ) - return FALSE; + return sal_False; // Get the source string String aTmp; rStrm.ReadByteString( aTmp, gsl_getSystemTextEncoding() ); aOUSource = aTmp; //rStrm >> aSource; - return TRUE; + return sal_True; } -BOOL SbJScriptModule::StoreData( SvStream& rStrm ) const +sal_Bool SbJScriptModule::StoreData( SvStream& rStrm ) const { if( !SbxObject::StoreData( rStrm ) ) - return FALSE; + return sal_False; // Write the source string String aTmp = aOUSource; rStrm.WriteByteString( aTmp, gsl_getSystemTextEncoding() ); //rStrm << aSource; - return TRUE; + return sal_True; } @@ -1861,7 +1989,7 @@ BOOL SbJScriptModule::StoreData( SvStream& rStrm ) const SbMethod::SbMethod( const String& r, SbxDataType t, SbModule* p ) : SbxMethod( r, t ), pMod( p ) { - bInvalid = TRUE; + bInvalid = sal_True; nStart = nDebugFlags = nLine1 = @@ -1908,35 +2036,35 @@ SbxArray* SbMethod::GetStatics() return refStatics; } -BOOL SbMethod::LoadData( SvStream& rStrm, USHORT nVer ) +sal_Bool SbMethod::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { if( !SbxMethod::LoadData( rStrm, 1 ) ) - return FALSE; - INT16 n; + return sal_False; + sal_Int16 n; rStrm >> n; - INT16 nTempStart = (INT16)nStart; + sal_Int16 nTempStart = (sal_Int16)nStart; // nDebugFlags = n; // From 1996-01-16: no longer take over if( nVer == 2 ) rStrm >> nLine1 >> nLine2 >> nTempStart >> bInvalid; // From: 1996-07-02: HACK ue to 'Referenz could not be saved' SetFlag( SBX_NO_MODIFY ); nStart = nTempStart; - return TRUE; + return sal_True; } -BOOL SbMethod::StoreData( SvStream& rStrm ) const +sal_Bool SbMethod::StoreData( SvStream& rStrm ) const { if( !SbxMethod::StoreData( rStrm ) ) - return FALSE; - rStrm << (INT16) nDebugFlags - << (INT16) nLine1 - << (INT16) nLine2 - << (INT16) nStart - << (BYTE) bInvalid; - return TRUE; + return sal_False; + rStrm << (sal_Int16) nDebugFlags + << (sal_Int16) nLine1 + << (sal_Int16) nLine2 + << (sal_Int16) nStart + << (sal_uInt8) bInvalid; + return sal_True; } -void SbMethod::GetLineRange( USHORT& l1, USHORT& l2 ) +void SbMethod::GetLineRange( sal_uInt16& l1, sal_uInt16& l2 ) { l1 = nLine1; l2 = nLine2; } @@ -1991,7 +2119,7 @@ ErrCode SbMethod::Call( SbxValue* pRet, SbxVariable* pCaller ) // #100883 Own Broadcast for SbMethod -void SbMethod::Broadcast( ULONG nHintId ) +void SbMethod::Broadcast( sal_uIntPtr nHintId ) { if( pCst && !IsSet( SBX_NO_BROADCAST ) && StaticIsEnabledBroadcasting() ) { @@ -2023,7 +2151,7 @@ void SbMethod::Broadcast( ULONG nHintId ) pCst = pSave; pSave->Broadcast( SbxHint( nHintId, pThisCopy ) ); - USHORT nSaveFlags = GetFlags(); + sal_uInt16 nSaveFlags = GetFlags(); SetFlag( SBX_READWRITE ); pCst = NULL; Put( pThisCopy->GetValues_Impl() ); @@ -2057,6 +2185,11 @@ SbObjModule::SbObjModule( const String& rName, const com::sun::star::script::Mod else if ( mInfo.ModuleObject.is() ) SetUnoObject( uno::makeAny( mInfo.ModuleObject ) ); } + +SbObjModule::~SbObjModule() +{ +} + void SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException ) { @@ -2093,22 +2226,34 @@ SbObjModule::Find( const XubString& rName, SbxClassType t ) return pVar; } -typedef ::cppu::WeakImplHelper2< awt::XTopWindowListener, awt::XWindowListener > FormObjEventListener_BASE; +void SbObjModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ) +{ + SbModule::handleProcedureProperties( rBC, rHint ); +} + + +typedef ::cppu::WeakImplHelper3< + awt::XTopWindowListener, + awt::XWindowListener, + document::XEventListener > FormObjEventListener_BASE; class FormObjEventListenerImpl : public FormObjEventListener_BASE { SbUserFormModule* mpUserForm; uno::Reference< lang::XComponent > mxComponent; + uno::Reference< frame::XModel > mxModel; bool mbDisposed; sal_Bool mbOpened; sal_Bool mbActivated; sal_Bool mbShowing; - FormObjEventListenerImpl(); // not defined + FormObjEventListenerImpl(const FormObjEventListenerImpl&); // not defined + FormObjEventListenerImpl& operator=(const FormObjEventListenerImpl&); // not defined public: - FormObjEventListenerImpl( SbUserFormModule* pUserForm, const uno::Reference< lang::XComponent >& xComponent ) : - mpUserForm( pUserForm ), mxComponent( xComponent) , + FormObjEventListenerImpl( SbUserFormModule* pUserForm, const uno::Reference< lang::XComponent >& xComponent, const uno::Reference< frame::XModel >& xModel ) : + mpUserForm( pUserForm ), mxComponent( xComponent), mxModel( xModel ), mbDisposed( false ), mbOpened( sal_False ), mbActivated( sal_False ), mbShowing( sal_False ) { if ( mxComponent.is() ) @@ -2125,6 +2270,15 @@ public: } catch( uno::Exception& ) {} } + + if ( mxModel.is() ) + { + try + { + uno::Reference< document::XEventBroadcaster >( mxModel, uno::UNO_QUERY_THROW )->addEventListener( this ); + } + catch( uno::Exception& ) {} + } } virtual ~FormObjEventListenerImpl() @@ -2151,6 +2305,16 @@ public: catch( uno::Exception& ) {} } mxComponent.clear(); + + if ( mxModel.is() && !mbDisposed ) + { + try + { + uno::Reference< document::XEventBroadcaster >( mxModel, uno::UNO_QUERY_THROW )->removeEventListener( this ); + } + catch( uno::Exception& ) {} + } + mxModel.clear(); } virtual void SAL_CALL windowOpened( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) @@ -2256,13 +2420,25 @@ public: { } + virtual void SAL_CALL notifyEvent( const document::EventObject& rEvent ) throw (uno::RuntimeException) + { + // early dosposing on document event "OnUnload", to be sure Basic still exists when calling VBA "UserForm_Terminate" + if( rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ) ) + { + removeListener(); + mbDisposed = true; + if ( mpUserForm ) + mpUserForm->ResetApiObj(); // will trigger "UserForm_Terminate" + } + } + virtual void SAL_CALL disposing( const lang::EventObject& /*Source*/ ) throw (uno::RuntimeException) { OSL_TRACE("** Userform/Dialog disposing"); + removeListener(); mbDisposed = true; - mxComponent.clear(); if ( mpUserForm ) - mpUserForm->ResetApiObj(); + mpUserForm->ResetApiObj( false ); // pass false (too late to trigger VBA events here) } }; @@ -2278,9 +2454,9 @@ SbUserFormModule::~SbUserFormModule() { } -void SbUserFormModule::ResetApiObj() +void SbUserFormModule::ResetApiObj( bool bTriggerTerminateEvent ) { - if ( m_xDialog.is() ) // probably someone close the dialog window + if ( bTriggerTerminateEvent && m_xDialog.is() ) // probably someone close the dialog window { triggerTerminateEvent(); } @@ -2310,7 +2486,7 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any { SbxVariableRef xSbxVar = new SbxVariable( SbxVARIANT ); unoToSbxValue( static_cast< SbxVariable* >( xSbxVar ), aArguments[i] ); - xArray->Put( xSbxVar, static_cast< USHORT >( i ) + 1 ); + xArray->Put( xSbxVar, static_cast< sal_uInt16 >( i ) + 1 ); // Enable passing by ref if ( xSbxVar->GetType() != SbxVARIANT ) @@ -2323,7 +2499,7 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any for ( sal_Int32 i = 0; i < aArguments.getLength(); ++i ) { - aArguments[i] = sbxToUnoValue( xArray->Get( static_cast< USHORT >(i) + 1) ); + aArguments[i] = sbxToUnoValue( xArray->Get( static_cast< sal_uInt16 >(i) + 1) ); } pMeth->SetParameters( NULL ); } @@ -2392,10 +2568,10 @@ SbUserFormModuleInstance::SbUserFormModuleInstance( SbUserFormModule* pParentMod { } -BOOL SbUserFormModuleInstance::IsClass( const XubString& rName ) const +sal_Bool SbUserFormModuleInstance::IsClass( const XubString& rName ) const { - BOOL bParentNameMatches = m_pParentModule->GetName().EqualsIgnoreCaseAscii( rName ); - BOOL bRet = bParentNameMatches || SbxObject::IsClass( rName ); + sal_Bool bParentNameMatches = m_pParentModule->GetName().EqualsIgnoreCaseAscii( rName ); + sal_Bool bRet = bParentNameMatches || SbxObject::IsClass( rName ); return bRet; } @@ -2466,11 +2642,12 @@ void SbUserFormModule::Unload() } +void registerComponentToBeDisposedForBasic( Reference< XComponent > xComponent, StarBASIC* pBasic ); + void SbUserFormModule::InitObject() { try { - String aHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) ); SbUnoObject* pGlobs = (SbUnoObject*)GetParent()->Find( aHook, SbxCLASS_DONTCARE ); if ( m_xModel.is() && pGlobs ) @@ -2503,11 +2680,27 @@ void SbUserFormModule::InitObject() aArgs[ 2 ] <<= m_xModel; aArgs[ 3 ] <<= sProjectName; pDocObject = new SbUnoObject( GetName(), uno::makeAny( xVBAFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.UserForm")), aArgs ) ) ); - uno::Reference< lang::XComponent > xComponent( aArgs[ 1 ], uno::UNO_QUERY_THROW ); - // remove old listener if it exists - if ( m_DialogListener.get() ) + + uno::Reference< lang::XComponent > xComponent( m_xDialog, uno::UNO_QUERY_THROW ); + + // the dialog must be disposed at the end! + StarBASIC* pParentBasic = NULL; + SbxObject* pCurObject = this; + do + { + SbxObject* pObjParent = pCurObject->GetParent(); + pParentBasic = PTR_CAST( StarBASIC, pObjParent ); + pCurObject = pObjParent; + } + while( pParentBasic == NULL && pCurObject != NULL ); + + OSL_ASSERT( pParentBasic != NULL ); + registerComponentToBeDisposedForBasic( xComponent, pParentBasic ); + + // if old listener object exists, remove it from dialog and document model + if( m_DialogListener.is() ) m_DialogListener->removeListener(); - m_DialogListener = new FormObjEventListenerImpl( this, xComponent ); + m_DialogListener.set( new FormObjEventListenerImpl( this, xComponent, m_xModel ) ); triggerInitializeEvent(); } @@ -2530,7 +2723,7 @@ SbUserFormModule::Find( const XubString& rName, SbxClassType t ) SbProperty::SbProperty( const String& r, SbxDataType t, SbModule* p ) : SbxProperty( r, t ), pMod( p ) { - bInvalid = FALSE; + bInvalid = sal_False; } SbProperty::~SbProperty() diff --git a/basic/source/comp/buffer.cxx b/basic/source/comp/buffer.cxx index c248d4100675..2e0fb542d3c2 100644..100755 --- a/basic/source/comp/buffer.cxx +++ b/basic/source/comp/buffer.cxx @@ -33,7 +33,7 @@ #include "buffer.hxx" #include <string.h> -const static UINT32 UP_LIMIT=0xFFFFFF00L; +const static sal_uInt32 UP_LIMIT=0xFFFFFF00L; // The SbiBuffer will be expanded in increments of at least 16 Bytes. // This is necessary, because many classes emanate from a buffer length @@ -70,24 +70,24 @@ char* SbiBuffer::GetBuffer() // Test, if the buffer can contain n Bytes. // In case of doubt it will be enlarged -BOOL SbiBuffer::Check( USHORT n ) +sal_Bool SbiBuffer::Check( sal_uInt16 n ) { - if( !n ) return TRUE; - if( ( static_cast<UINT32>( nOff )+ n ) > static_cast<UINT32>( nSize ) ) + if( !n ) return sal_True; + if( ( static_cast<sal_uInt32>( nOff )+ n ) > static_cast<sal_uInt32>( nSize ) ) { if( nInc == 0 ) - return FALSE; - USHORT nn = 0; + return sal_False; + sal_uInt16 nn = 0; while( nn < n ) nn = nn + nInc; char* p; - if( ( static_cast<UINT32>( nSize ) + nn ) > UP_LIMIT ) p = NULL; + if( ( static_cast<sal_uInt32>( nSize ) + nn ) > UP_LIMIT ) p = NULL; else p = new char [nSize + nn]; if( !p ) { pParser->Error( SbERR_PROG_TOO_LARGE ); nInc = 0; delete[] pBuf; pBuf = NULL; - return FALSE; + return sal_False; } else { @@ -98,19 +98,19 @@ BOOL SbiBuffer::Check( USHORT n ) nSize = nSize + nn; } } - return TRUE; + return sal_True; } // Conditioning of the buffer onto the passed Byte limit -void SbiBuffer::Align( INT32 n ) +void SbiBuffer::Align( sal_Int32 n ) { if( nOff % n ) { - UINT32 nn =( ( nOff + n ) / n ) * n; + sal_uInt32 nn =( ( nOff + n ) / n ) * n; if( nn <= UP_LIMIT ) { nn = nn - nOff; - if( Check( static_cast<USHORT>(nn) ) ) + if( Check( static_cast<sal_uInt16>(nn) ) ) { memset( pCur, 0, nn ); pCur += nn; @@ -122,13 +122,13 @@ void SbiBuffer::Align( INT32 n ) // Patch of a Location -void SbiBuffer::Patch( UINT32 off, UINT32 val ) +void SbiBuffer::Patch( sal_uInt32 off, sal_uInt32 val ) { - if( ( off + sizeof( UINT32 ) ) < nOff ) + if( ( off + sizeof( sal_uInt32 ) ) < nOff ) { - UINT16 val1 = static_cast<UINT16>( val & 0xFFFF ); - UINT16 val2 = static_cast<UINT16>( val >> 16 ); - BYTE* p = (BYTE*) pBuf + off; + sal_uInt16 val1 = static_cast<sal_uInt16>( val & 0xFFFF ); + sal_uInt16 val2 = static_cast<sal_uInt16>( val >> 16 ); + sal_uInt8* p = (sal_uInt8*) pBuf + off; *p++ = (char) ( val1 & 0xFF ); *p++ = (char) ( val1 >> 8 ); *p++ = (char) ( val2 & 0xFF ); @@ -140,18 +140,18 @@ void SbiBuffer::Patch( UINT32 off, UINT32 val ) // establish a linkage. The beginning of the linkage is at the passed parameter, // the end of the linkage is 0. -void SbiBuffer::Chain( UINT32 off ) +void SbiBuffer::Chain( sal_uInt32 off ) { if( off && pBuf ) { - BYTE *ip; - UINT32 i = off; - UINT32 val1 = (nOff & 0xFFFF); - UINT32 val2 = (nOff >> 16); + sal_uInt8 *ip; + sal_uInt32 i = off; + sal_uInt32 val1 = (nOff & 0xFFFF); + sal_uInt32 val2 = (nOff >> 16); do { - ip = (BYTE*) pBuf + i; - BYTE* pTmp = ip; + ip = (sal_uInt8*) pBuf + i; + sal_uInt8* pTmp = ip; i = *pTmp++; i |= *pTmp++ << 8; i |= *pTmp++ << 16; i |= *pTmp++ << 24; if( i >= nOff ) @@ -167,84 +167,84 @@ void SbiBuffer::Chain( UINT32 off ) } } -BOOL SbiBuffer::operator +=( INT8 n ) +sal_Bool SbiBuffer::operator +=( sal_Int8 n ) { if( Check( 1 ) ) { - *pCur++ = (char) n; nOff++; return TRUE; - } else return FALSE; + *pCur++ = (char) n; nOff++; return sal_True; + } else return sal_False; } -BOOL SbiBuffer::operator +=( UINT8 n ) +sal_Bool SbiBuffer::operator +=( sal_uInt8 n ) { if( Check( 1 ) ) { - *pCur++ = (char) n; nOff++; return TRUE; - } else return FALSE; + *pCur++ = (char) n; nOff++; return sal_True; + } else return sal_False; } -BOOL SbiBuffer::operator +=( INT16 n ) +sal_Bool SbiBuffer::operator +=( sal_Int16 n ) { if( Check( 2 ) ) { *pCur++ = (char) ( n & 0xFF ); *pCur++ = (char) ( n >> 8 ); - nOff += 2; return TRUE; - } else return FALSE; + nOff += 2; return sal_True; + } else return sal_False; } -BOOL SbiBuffer::operator +=( UINT16 n ) +sal_Bool SbiBuffer::operator +=( sal_uInt16 n ) { if( Check( 2 ) ) { *pCur++ = (char) ( n & 0xFF ); *pCur++ = (char) ( n >> 8 ); - nOff += 2; return TRUE; - } else return FALSE; + nOff += 2; return sal_True; + } else return sal_False; } -BOOL SbiBuffer::operator +=( UINT32 n ) +sal_Bool SbiBuffer::operator +=( sal_uInt32 n ) { if( Check( 4 ) ) { - UINT16 n1 = static_cast<UINT16>( n & 0xFFFF ); - UINT16 n2 = static_cast<UINT16>( n >> 16 ); + sal_uInt16 n1 = static_cast<sal_uInt16>( n & 0xFFFF ); + sal_uInt16 n2 = static_cast<sal_uInt16>( n >> 16 ); if ( operator +=( n1 ) && operator +=( n2 ) ) - return TRUE; - return TRUE; + return sal_True; + return sal_True; } - return FALSE; + return sal_False; } -BOOL SbiBuffer::operator +=( INT32 n ) +sal_Bool SbiBuffer::operator +=( sal_Int32 n ) { - return operator +=( (UINT32) n ); + return operator +=( (sal_uInt32) n ); } -BOOL SbiBuffer::operator +=( const String& n ) +sal_Bool SbiBuffer::operator +=( const String& n ) { - USHORT l = n.Len() + 1; + sal_uInt16 l = n.Len() + 1; if( Check( l ) ) { ByteString aByteStr( n, gsl_getSystemTextEncoding() ); memcpy( pCur, aByteStr.GetBuffer(), l ); pCur += l; nOff = nOff + l; - return TRUE; + return sal_True; } - else return FALSE; + else return sal_False; } -BOOL SbiBuffer::Add( const void* p, USHORT len ) +sal_Bool SbiBuffer::Add( const void* p, sal_uInt16 len ) { if( Check( len ) ) { memcpy( pCur, p, len ); pCur += len; nOff = nOff + len; - return TRUE; - } else return FALSE; + return sal_True; + } else return sal_False; } diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx index b6791156dbf3..83d1a1965840 100644..100755 --- a/basic/source/comp/codegen.cxx +++ b/basic/source/comp/codegen.cxx @@ -42,13 +42,13 @@ SbiCodeGen::SbiCodeGen( SbModule& r, SbiParser* p, short nInc ) : rMod( r ), aCode( p, nInc ) { pParser = p; - bStmnt = FALSE; + bStmnt = sal_False; nLine = 0; nCol = 0; nForLevel = 0; } -UINT32 SbiCodeGen::GetPC() +sal_uInt32 SbiCodeGen::GetPC() { return aCode.GetSize(); } @@ -57,7 +57,7 @@ UINT32 SbiCodeGen::GetPC() void SbiCodeGen::Statement() { - bStmnt = TRUE; + bStmnt = sal_True; nLine = pParser->GetLine(); nCol = pParser->GetCol1(); @@ -73,7 +73,7 @@ void SbiCodeGen::GenStmnt() { if( bStmnt ) { - bStmnt = FALSE; + bStmnt = sal_False; Gen( _STMNT, nLine, nCol ); } } @@ -81,39 +81,39 @@ void SbiCodeGen::GenStmnt() // The Gen-Routines return the offset of the 1. operand, // so that jumps can sink their backchain there. -UINT32 SbiCodeGen::Gen( SbiOpcode eOpcode ) +sal_uInt32 SbiCodeGen::Gen( SbiOpcode eOpcode ) { #ifdef DBG_UTIL if( eOpcode < SbOP0_START || eOpcode > SbOP0_END ) pParser->Error( SbERR_INTERNAL_ERROR, "OPCODE1" ); #endif GenStmnt(); - aCode += (UINT8) eOpcode; + aCode += (sal_uInt8) eOpcode; return GetPC(); } -UINT32 SbiCodeGen::Gen( SbiOpcode eOpcode, UINT32 nOpnd ) +sal_uInt32 SbiCodeGen::Gen( SbiOpcode eOpcode, sal_uInt32 nOpnd ) { #ifdef DBG_UTIL if( eOpcode < SbOP1_START || eOpcode > SbOP1_END ) pParser->Error( SbERR_INTERNAL_ERROR, "OPCODE2" ); #endif GenStmnt(); - aCode += (UINT8) eOpcode; - UINT32 n = GetPC(); + aCode += (sal_uInt8) eOpcode; + sal_uInt32 n = GetPC(); aCode += nOpnd; return n; } -UINT32 SbiCodeGen::Gen( SbiOpcode eOpcode, UINT32 nOpnd1, UINT32 nOpnd2 ) +sal_uInt32 SbiCodeGen::Gen( SbiOpcode eOpcode, sal_uInt32 nOpnd1, sal_uInt32 nOpnd2 ) { #ifdef DBG_UTIL if( eOpcode < SbOP2_START || eOpcode > SbOP2_END ) pParser->Error( SbERR_INTERNAL_ERROR, "OPCODE3" ); #endif GenStmnt(); - aCode += (UINT8) eOpcode; - UINT32 n = GetPC(); + aCode += (sal_uInt8) eOpcode; + sal_uInt32 n = GetPC(); aCode += nOpnd1; aCode += nOpnd2; return n; @@ -178,7 +178,7 @@ void SbiCodeGen::Save() String aProcName = pProc->GetName(); String aIfaceProcName; String aIfaceName; - USHORT nPassCount = 1; + sal_uInt16 nPassCount = 1; if( nIfaceCount ) { int nPropPrefixFound = @@ -206,7 +206,7 @@ void SbiCodeGen::Save() } } SbMethod* pMeth = NULL; - for( USHORT nPass = 0 ; nPass < nPassCount ; nPass++ ) + for( sal_uInt16 nPass = 0 ; nPass < nPassCount ; nPass++ ) { if( nPass == 1 ) aProcName = aIfaceProcName; @@ -271,7 +271,7 @@ void SbiCodeGen::Save() // The parameter: SbxInfo* pInfo = pMeth->GetInfo(); String aHelpFile, aComment; - ULONG nHelpId = 0; + sal_uIntPtr nHelpId = 0; if( pInfo ) { // Rescue the additional data @@ -284,7 +284,7 @@ void SbiCodeGen::Save() pInfo->SetComment( aComment ); SbiSymPool* pPool = &pProc->GetParams(); // The first element is always the value of the function! - for( USHORT i = 1; i < pPool->GetSize(); i++ ) + for( sal_uInt16 i = 1; i < pPool->GetSize(); i++ ) { SbiSymDef* pPar = pPool->Get( i ); SbxDataType t = pPar->GetType(); @@ -293,14 +293,14 @@ void SbiCodeGen::Save() if( pPar->GetDims() ) t = (SbxDataType) ( t | SbxARRAY ); // #33677 hand-over an Optional-Info - USHORT nFlags = SBX_READ; + sal_uInt16 nFlags = SBX_READ; if( pPar->IsOptional() ) nFlags |= SBX_OPTIONAL; pInfo->AddParam( pPar->GetName(), t, nFlags ); - UINT32 nUserData = 0; - USHORT nDefaultId = pPar->GetDefaultId(); + sal_uInt32 nUserData = 0; + sal_uInt16 nDefaultId = pPar->GetDefaultId(); if( nDefaultId ) nUserData |= nDefaultId; if( pPar->IsParamArray() ) @@ -322,14 +322,14 @@ void SbiCodeGen::Save() // The global StringPool. 0 is not occupied. SbiStringPool* pPool = &pParser->aGblStrings; - USHORT nSize = pPool->GetSize(); + sal_uInt16 nSize = pPool->GetSize(); p->MakeStrings( nSize ); - USHORT i; + sal_uInt16 i; for( i = 1; i <= nSize; i++ ) p->AddString( pPool->Find( i ) ); // Insert types - USHORT nCount = pParser->rTypeArray->Count(); + sal_uInt16 nCount = pParser->rTypeArray->Count(); for (i = 0; i < nCount; i++) p->AddType((SbxObject *)pParser->rTypeArray->Get(i)); @@ -352,7 +352,7 @@ class PCodeVisitor public: virtual ~PCodeVisitor(); - virtual void start( BYTE* pStart ) = 0; + virtual void start( sal_uInt8* pStart ) = 0; virtual void processOpCode0( SbiOpcode eOp ) = 0; virtual void processOpCode1( SbiOpcode eOp, T nOp1 ) = 0; virtual void processOpCode2( SbiOpcode eOp, T nOp1, T nOp2 ) = 0; @@ -368,8 +368,8 @@ class PCodeBufferWalker { private: T m_nBytes; - BYTE* m_pCode; - T readParam( BYTE*& pCode ) + sal_uInt8* m_pCode; + T readParam( sal_uInt8*& pCode ) { short nBytes = sizeof( T ); T nOp1=0; @@ -378,15 +378,15 @@ private: return nOp1; } public: - PCodeBufferWalker( BYTE* pCode, T nBytes ): m_nBytes( nBytes ), m_pCode( pCode ) + PCodeBufferWalker( sal_uInt8* pCode, T nBytes ): m_nBytes( nBytes ), m_pCode( pCode ) { } void visitBuffer( PCodeVisitor< T >& visitor ) { - BYTE* pCode = m_pCode; + sal_uInt8* pCode = m_pCode; if ( !pCode ) return; - BYTE* pEnd = pCode + m_nBytes; + sal_uInt8* pEnd = pCode + m_nBytes; visitor.start( m_pCode ); T nOp1 = 0, nOp2 = 0; for( ; pCode < pEnd; ) @@ -428,7 +428,7 @@ class OffSetAccumulator : public PCodeVisitor< T > public: OffSetAccumulator() : m_nNumOp0(0), m_nNumSingleParams(0), m_nNumDoubleParams(0){} - virtual void start( BYTE* /*pStart*/ ){} + virtual void start( sal_uInt8* /*pStart*/ ){} virtual void processOpCode0( SbiOpcode /*eOp*/ ){ ++m_nNumOp0; } virtual void processOpCode1( SbiOpcode /*eOp*/, T /*nOp1*/ ){ ++m_nNumSingleParams; } virtual void processOpCode2( SbiOpcode /*eOp*/, T /*nOp1*/, T /*nOp2*/ ) { ++m_nNumDoubleParams; } @@ -449,18 +449,18 @@ template < class T, class S > class BufferTransformer : public PCodeVisitor< T > { - BYTE* m_pStart; + sal_uInt8* m_pStart; SbiBuffer m_ConvertedBuf; public: BufferTransformer():m_pStart(NULL), m_ConvertedBuf( NULL, 1024 ) {} - virtual void start( BYTE* pStart ){ m_pStart = pStart; } + virtual void start( sal_uInt8* pStart ){ m_pStart = pStart; } virtual void processOpCode0( SbiOpcode eOp ) { - m_ConvertedBuf += (UINT8)eOp; + m_ConvertedBuf += (sal_uInt8)eOp; } virtual void processOpCode1( SbiOpcode eOp, T nOp1 ) { - m_ConvertedBuf += (UINT8)eOp; + m_ConvertedBuf += (sal_uInt8)eOp; switch( eOp ) { case _JUMP: @@ -485,7 +485,7 @@ public: } virtual void processOpCode2( SbiOpcode eOp, T nOp1, T nOp2 ) { - m_ConvertedBuf += (UINT8)eOp; + m_ConvertedBuf += (sal_uInt8)eOp; if ( eOp == _CASEIS ) if ( nOp1 ) nOp1 = static_cast<T>( convertBufferOffSet(m_pStart, nOp1) ); @@ -502,7 +502,7 @@ public: { return m_ConvertedBuf; } - static S convertBufferOffSet( BYTE* pStart, T nOp1 ) + static S convertBufferOffSet( sal_uInt8* pStart, T nOp1 ) { PCodeBufferWalker< T > aBuff( pStart, nOp1); OffSetAccumulator< T, S > aVisitor; @@ -511,16 +511,16 @@ public: } }; -UINT32 -SbiCodeGen::calcNewOffSet( BYTE* pCode, UINT16 nOffset ) +sal_uInt32 +SbiCodeGen::calcNewOffSet( sal_uInt8* pCode, sal_uInt16 nOffset ) { - return BufferTransformer< UINT16, UINT32 >::convertBufferOffSet( pCode, nOffset ); + return BufferTransformer< sal_uInt16, sal_uInt32 >::convertBufferOffSet( pCode, nOffset ); } -UINT16 -SbiCodeGen::calcLegacyOffSet( BYTE* pCode, UINT32 nOffset ) +sal_uInt16 +SbiCodeGen::calcLegacyOffSet( sal_uInt8* pCode, sal_uInt32 nOffset ) { - return BufferTransformer< UINT32, UINT16 >::convertBufferOffSet( pCode, nOffset ); + return BufferTransformer< sal_uInt32, sal_uInt16 >::convertBufferOffSet( pCode, nOffset ); } template <class T, class S> @@ -530,11 +530,11 @@ PCodeBuffConvertor<T,S>::convert() PCodeBufferWalker< T > aBuf( m_pStart, m_nSize ); BufferTransformer< T, S > aTrnsfrmer; aBuf.visitBuffer( aTrnsfrmer ); - m_pCnvtdBuf = (BYTE*)aTrnsfrmer.buffer().GetBuffer(); + m_pCnvtdBuf = (sal_uInt8*)aTrnsfrmer.buffer().GetBuffer(); m_nCnvtdSize = static_cast<S>( aTrnsfrmer.buffer().GetSize() ); } -template class PCodeBuffConvertor< UINT16, UINT32 >; -template class PCodeBuffConvertor< UINT32, UINT16 >; +template class PCodeBuffConvertor< sal_uInt16, sal_uInt32 >; +template class PCodeBuffConvertor< sal_uInt32, sal_uInt16 >; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx index 88ad0f8c25f1..a24f4ea9e7e3 100644..100755 --- a/basic/source/comp/dim.cxx +++ b/basic/source/comp/dim.cxx @@ -40,7 +40,7 @@ SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj ); // Return-value: a new instance, which were inserted and then deleted. // Array-Indexex were returned as SbiDimList -SbiSymDef* SbiParser::VarDecl( SbiDimList** ppDim, BOOL bStatic, BOOL bConst ) +SbiSymDef* SbiParser::VarDecl( SbiDimList** ppDim, sal_Bool bStatic, sal_Bool bConst ) { bool bWithEvents = false; if( Peek() == WITHEVENTS ) @@ -75,7 +75,7 @@ SbiSymDef* SbiParser::VarDecl( SbiDimList** ppDim, BOOL bStatic, BOOL bConst ) // Resolving of a AS-Type-Declaration // The data type were inserted into the handed over variable -void SbiParser::TypeDecl( SbiSymDef& rDef, BOOL bAsNewAlreadyParsed ) +void SbiParser::TypeDecl( SbiSymDef& rDef, sal_Bool bAsNewAlreadyParsed ) { SbxDataType eType = rDef.GetType(); if( bAsNewAlreadyParsed || Peek() == AS ) @@ -196,34 +196,34 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, BOOL bAsNewAlreadyParsed ) void SbiParser::Dim() { - DefVar( _DIM, ( pProc && bVBASupportOn ) ? pProc->IsStatic() : FALSE ); + DefVar( _DIM, ( pProc && bVBASupportOn ) ? pProc->IsStatic() : sal_False ); } -void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic ) +void SbiParser::DefVar( SbiOpcode eOp, sal_Bool bStatic ) { SbiSymPool* pOldPool = pPool; - BOOL bSwitchPool = FALSE; - BOOL bPersistantGlobal = FALSE; + sal_Bool bSwitchPool = sal_False; + sal_Bool bPersistantGlobal = sal_False; SbiToken eFirstTok = eCurTok; if( pProc && ( eCurTok == GLOBAL || eCurTok == PUBLIC || eCurTok == PRIVATE ) ) Error( SbERR_NOT_IN_SUBR, eCurTok ); if( eCurTok == PUBLIC || eCurTok == GLOBAL ) { - bSwitchPool = TRUE; // at the right moment switch to the global pool + bSwitchPool = sal_True; // at the right moment switch to the global pool if( eCurTok == GLOBAL ) - bPersistantGlobal = TRUE; + bPersistantGlobal = sal_True; } // behavior in VBA is that a module scope variable's lifetime is // tied to the document. e.g. a module scope variable is global if( GetBasic()->IsDocBasic() && bVBASupportOn && !pProc ) - bPersistantGlobal = TRUE; + bPersistantGlobal = sal_True; // PRIVATE is a synonymous for DIM // _CONST_? - BOOL bConst = FALSE; + sal_Bool bConst = sal_False; if( eCurTok == _CONST_ ) - bConst = TRUE; + bConst = sal_True; else if( Peek() == _CONST_ ) - Next(), bConst = TRUE; + Next(), bConst = sal_True; // #110004 It can also be a sub/function if( !bConst && (eCurTok == SUB || eCurTok == FUNCTION || eCurTok == PROPERTY || @@ -244,10 +244,10 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic ) if( bNewGblDefs && nGblChain == 0 ) { nGblChain = aGen.Gen( _JUMP, 0 ); - bNewGblDefs = FALSE; + bNewGblDefs = sal_False; } Next(); - DefProc( FALSE, bPrivate ); + DefProc( sal_False, bPrivate ); return; } else if( eCurTok == ENUM ) @@ -294,14 +294,14 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic ) SbiDimList* pDim; // From 1997-07-09, #40689, Statics -> Modul-Initialising, skip in Sub - UINT32 nEndOfStaticLbl = 0; + sal_uInt32 nEndOfStaticLbl = 0; if( !bVBASupportOn && bStatic ) { nEndOfStaticLbl = aGen.Gen( _JUMP, 0 ); aGen.Statement(); // catch up on static here } - BOOL bDefined = FALSE; + sal_Bool bDefined = sal_False; while( ( pDef = VarDecl( &pDim, bStatic, bConst ) ) != NULL ) { EnableErrors(); @@ -310,12 +310,12 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic ) pPool = &aGlobals; SbiSymDef* pOld = pPool->Find( pDef->GetName() ); // From 1996-03-31, #25651#, search also in the Runtime-Library - BOOL bRtlSym = FALSE; + sal_Bool bRtlSym = sal_False; if( !pOld ) { pOld = CheckRTLForSym( pDef->GetName(), SbxVARIANT ); if( pOld ) - bRtlSym = TRUE; + bRtlSym = sal_True; } if( pOld && !(eOp == _REDIM || eOp == _REDIMP) ) { @@ -324,7 +324,7 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic ) } if( pOld ) { - bDefined = TRUE; + bDefined = sal_True; // always an error at a RTL-S if( !bRtlSym && (eOp == _REDIM || eOp == _REDIMP) ) { @@ -370,17 +370,20 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic ) } global: aGen.BackChain( nGblChain ); nGblChain = 0; - bGblDefs = bNewGblDefs = TRUE; + bGblDefs = bNewGblDefs = sal_True; break; default: eOp2 = _LOCAL; } - UINT32 nOpnd2 = sal::static_int_cast< UINT16 >( pDef->GetType() ); + sal_uInt32 nOpnd2 = sal::static_int_cast< sal_uInt16 >( pDef->GetType() ); if( pDef->IsWithEvents() ) nOpnd2 |= SBX_TYPE_WITH_EVENTS_FLAG; + if( bCompatible && pDef->IsNew() ) + nOpnd2 |= SBX_TYPE_DIM_AS_NEW_FLAG; + short nFixedStringLength = pDef->GetFixedStringLength(); if( nFixedStringLength >= 0 ) - nOpnd2 |= (SBX_FIXED_LEN_STRING_FLAG + (UINT32(nFixedStringLength) << 17)); // len = all bits above 0x10000 + nOpnd2 |= (SBX_FIXED_LEN_STRING_FLAG + (sal_uInt32(nFixedStringLength) << 17)); // len = all bits above 0x10000 aGen.Gen( eOp2, pDef->GetId(), nOpnd2 ); } @@ -490,10 +493,10 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic ) } pDef->SetDims( pDim->GetDims() ); if( bPersistantGlobal ) - pDef->SetGlobal( TRUE ); + pDef->SetGlobal( sal_True ); SbiExpression aExpr( this, *pDef, pDim ); aExpr.Gen(); - pDef->SetGlobal( FALSE ); + pDef->SetGlobal( sal_False ); aGen.Gen( (eOp == _STATIC) ? _DIM : eOp ); } } @@ -518,7 +521,7 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic ) { // maintain the global chain nGblChain = aGen.Gen( _JUMP, 0 ); - bGblDefs = bNewGblDefs = TRUE; + bGblDefs = bNewGblDefs = sal_True; // Register for Sub a jump to the end of statics aGen.BackChain( nEndOfStaticLbl ); @@ -531,7 +534,7 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic ) void SbiParser::ReDim() { - DefVar( _REDIM, ( pProc && bVBASupportOn ) ? pProc->IsStatic() : FALSE ); + DefVar( _REDIM, ( pProc && bVBASupportOn ) ? pProc->IsStatic() : sal_False ); } // ERASE array, ... @@ -551,10 +554,10 @@ void SbiParser::Erase() void SbiParser::Type() { - DefType( FALSE ); + DefType( sal_False ); } -void SbiParser::DefType( BOOL bPrivate ) +void SbiParser::DefType( sal_Bool bPrivate ) { // TODO: Use bPrivate (void)bPrivate; @@ -573,7 +576,7 @@ void SbiParser::DefType( BOOL bPrivate ) SbiSymDef* pElem; SbiDimList* pDim = NULL; - BOOL bDone = FALSE; + sal_Bool bDone = sal_False; while( !bDone && !IsEof() ) { @@ -581,7 +584,7 @@ void SbiParser::DefType( BOOL bPrivate ) { case ENDTYPE : pElem = NULL; - bDone = TRUE; + bDone = sal_True; Next(); break; @@ -593,9 +596,9 @@ void SbiParser::DefType( BOOL bPrivate ) default: pDim = NULL; - pElem = VarDecl(&pDim,FALSE,FALSE); + pElem = VarDecl(&pDim,sal_False,sal_False); if( !pElem ) - bDone = TRUE; // Error occurred + bDone = sal_True; // Error occurred } if( pElem ) { @@ -616,8 +619,8 @@ void SbiParser::DefType( BOOL bPrivate ) for ( short i=0; i<pDim->GetSize();++i ) { - INT32 ub = -1; - INT32 lb = nBase; + sal_Int32 ub = -1; + sal_Int32 lb = nBase; SbiExprNode* pNode = pDim->Get(i)->GetExprNode(); ub = pNode->GetNumber(); if ( !pDim->Get( i )->IsBased() ) // each dim is low/up @@ -636,7 +639,7 @@ void SbiParser::DefType( BOOL bPrivate ) } else pArray->unoAddDim( 0, -1 ); // variant array - USHORT nSavFlags = pTypeElem->GetFlags(); + sal_uInt16 nSavFlags = pTypeElem->GetFlags(); // need to reset the FIXED flag // when calling PutObject ( because the type will not match Object ) pTypeElem->ResetFlag( SBX_FIXED ); @@ -646,7 +649,7 @@ void SbiParser::DefType( BOOL bPrivate ) // Nested user type? if( eElemType == SbxOBJECT ) { - USHORT nElemTypeId = pElem->GetTypeId(); + sal_uInt16 nElemTypeId = pElem->GetTypeId(); if( nElemTypeId != 0 ) { String aTypeName( aGblStrings.Find( nElemTypeId ) ); @@ -676,10 +679,10 @@ void SbiParser::DefType( BOOL bPrivate ) void SbiParser::Enum() { - DefEnum( FALSE ); + DefEnum( sal_False ); } -void SbiParser::DefEnum( BOOL bPrivate ) +void SbiParser::DefEnum( sal_Bool bPrivate ) { // Read a the new Token. It had to be a symbol if (!TestSymbol()) @@ -698,7 +701,7 @@ void SbiParser::DefEnum( BOOL bPrivate ) SbiSymDef* pElem; SbiDimList* pDim; - BOOL bDone = FALSE; + sal_Bool bDone = sal_False; // Starting with -1 to make first default value 0 after ++ sal_Int32 nCurrentEnumValue = -1; @@ -708,7 +711,7 @@ void SbiParser::DefEnum( BOOL bPrivate ) { case ENDENUM : pElem = NULL; - bDone = TRUE; + bDone = sal_True; Next(); break; @@ -721,20 +724,20 @@ void SbiParser::DefEnum( BOOL bPrivate ) default: { // TODO: Check existing! - BOOL bDefined = FALSE; + sal_Bool bDefined = sal_False; pDim = NULL; - pElem = VarDecl( &pDim, FALSE, TRUE ); + pElem = VarDecl( &pDim, sal_False, sal_True ); if( !pElem ) { - bDone = TRUE; // Error occurred + bDone = sal_True; // Error occurred break; } else if( pDim ) { delete pDim; Error( SbERR_SYNTAX ); - bDone = TRUE; // Error occurred + bDone = sal_True; // Error occurred break; } @@ -764,7 +767,7 @@ void SbiParser::DefEnum( BOOL bPrivate ) if( pOld ) { Error( SbERR_VAR_DEFINED, pElem->GetName() ); - bDone = TRUE; // Error occurred + bDone = sal_True; // Error occurred break; } @@ -775,13 +778,13 @@ void SbiParser::DefEnum( BOOL bPrivate ) SbiOpcode eOp = _GLOBAL; aGen.BackChain( nGblChain ); nGblChain = 0; - bGblDefs = bNewGblDefs = TRUE; + bGblDefs = bNewGblDefs = sal_True; aGen.Gen( eOp, pElem->GetId(), - sal::static_int_cast< UINT16 >( pElem->GetType() ) ); + sal::static_int_cast< sal_uInt16 >( pElem->GetType() ) ); aVar.Gen(); - USHORT nStringId = aGen.GetParser()->aGblStrings.Add( nCurrentEnumValue, SbxLONG ); + sal_uInt16 nStringId = aGen.GetParser()->aGblStrings.Add( nCurrentEnumValue, SbxLONG ); aGen.Gen( _NUMBER, nStringId ); aGen.Gen( _PUTC ); } @@ -812,10 +815,10 @@ void SbiParser::DefEnum( BOOL bPrivate ) // the first Token is already read in (SUB/FUNCTION) // xxx Name [LIB "name"[ALIAS "name"]][(Parameter)][AS TYPE] -SbiProcDef* SbiParser::ProcDecl( BOOL bDecl ) +SbiProcDef* SbiParser::ProcDecl( sal_Bool bDecl ) { - BOOL bFunc = BOOL( eCurTok == FUNCTION ); - BOOL bProp = BOOL( eCurTok == GET || eCurTok == SET || eCurTok == LET ); + sal_Bool bFunc = sal_Bool( eCurTok == FUNCTION ); + sal_Bool bProp = sal_Bool( eCurTok == GET || eCurTok == SET || eCurTok == LET ); if( !TestSymbol() ) return NULL; String aName( aSym ); SbxDataType eType = eScanType; @@ -850,7 +853,7 @@ SbiProcDef* SbiParser::ProcDecl( BOOL bDecl ) Error( SbERR_UNEXPECTED, ALIAS ); if( pDef->IsCdecl() ) Error( SbERR_UNEXPECTED, _CDECL_ ); - pDef->SetCdecl( FALSE ); + pDef->SetCdecl( sal_False ); pDef->GetLib().Erase(); pDef->GetAlias().Erase(); } @@ -861,7 +864,7 @@ SbiProcDef* SbiParser::ProcDecl( BOOL bDecl ) Error( SbERR_UNEXPECTED, ALIAS ); if( pDef->IsCdecl() ) Error( SbERR_UNEXPECTED, _CDECL_ ); - pDef->SetCdecl( FALSE ); + pDef->SetCdecl( sal_False ); pDef->GetAlias().Erase(); } // Brackets? @@ -872,23 +875,23 @@ SbiProcDef* SbiParser::ProcDecl( BOOL bDecl ) Next(); else for(;;) { - BOOL bByVal = FALSE; - BOOL bOptional = FALSE; - BOOL bParamArray = FALSE; + sal_Bool bByVal = sal_False; + sal_Bool bOptional = sal_False; + sal_Bool bParamArray = sal_False; while( Peek() == BYVAL || Peek() == BYREF || Peek() == _OPTIONAL_ ) { - if ( Peek() == BYVAL ) Next(), bByVal = TRUE; - else if ( Peek() == BYREF ) Next(), bByVal = FALSE; - else if ( Peek() == _OPTIONAL_ ) Next(), bOptional = TRUE; + if ( Peek() == BYVAL ) Next(), bByVal = sal_True; + else if ( Peek() == BYREF ) Next(), bByVal = sal_False; + else if ( Peek() == _OPTIONAL_ ) Next(), bOptional = sal_True; } if( bCompatible && Peek() == PARAMARRAY ) { if( bByVal || bOptional ) Error( SbERR_UNEXPECTED, PARAMARRAY ); Next(); - bParamArray = TRUE; + bParamArray = sal_True; } - SbiSymDef* pPar = VarDecl( NULL, FALSE, FALSE ); + SbiSymDef* pPar = VarDecl( NULL, sal_False, sal_False ); if( !pPar ) break; if( bByVal ) @@ -901,13 +904,13 @@ SbiProcDef* SbiParser::ProcDecl( BOOL bDecl ) SbiToken eTok = Next(); if( eTok != COMMA && eTok != RPAREN ) { - BOOL bError2 = TRUE; + sal_Bool bError2 = sal_True; if( bOptional && bCompatible && eTok == EQ ) { SbiConstExpression* pDefaultExpr = new SbiConstExpression( this ); SbxDataType eType2 = pDefaultExpr->GetType(); - USHORT nStringId; + sal_uInt16 nStringId; if( eType2 == SbxSTRING ) nStringId = aGblStrings.Add( pDefaultExpr->GetString() ); else @@ -918,7 +921,7 @@ SbiProcDef* SbiParser::ProcDecl( BOOL bDecl ) eTok = Next(); if( eTok == COMMA || eTok == RPAREN ) - bError2 = FALSE; + bError2 = sal_False; } if( bError2 ) { @@ -945,10 +948,10 @@ SbiProcDef* SbiParser::ProcDecl( BOOL bDecl ) void SbiParser::Declare() { - DefDeclare( FALSE ); + DefDeclare( sal_False ); } -void SbiParser::DefDeclare( BOOL bPrivate ) +void SbiParser::DefDeclare( sal_Bool bPrivate ) { Next(); if( eCurTok != SUB && eCurTok != FUNCTION ) @@ -957,7 +960,7 @@ void SbiParser::DefDeclare( BOOL bPrivate ) { bool bFunction = (eCurTok == FUNCTION); - SbiProcDef* pDef = ProcDecl( TRUE ); + SbiProcDef* pDef = ProcDecl( sal_True ); if( pDef ) { if( !pDef->GetLib().Len() ) @@ -990,39 +993,39 @@ void SbiParser::DefDeclare( BOOL bPrivate ) if( bNewGblDefs && nGblChain == 0 ) { nGblChain = aGen.Gen( _JUMP, 0 ); - bNewGblDefs = FALSE; + bNewGblDefs = sal_False; } - USHORT nSavLine = nLine; + sal_uInt16 nSavLine = nLine; aGen.Statement(); pDef->Define(); pDef->SetLine1( nSavLine ); pDef->SetLine2( nSavLine ); SbiSymPool& rPool = pDef->GetParams(); - USHORT nParCount = rPool.GetSize(); + sal_uInt16 nParCount = rPool.GetSize(); SbxDataType eType = pDef->GetType(); if( bFunction ) - aGen.Gen( _PARAM, 0, sal::static_int_cast< UINT16 >( eType ) ); + aGen.Gen( _PARAM, 0, sal::static_int_cast< sal_uInt16 >( eType ) ); if( nParCount > 1 ) { aGen.Gen( _ARGC ); - for( USHORT i = 1 ; i < nParCount ; ++i ) + for( sal_uInt16 i = 1 ; i < nParCount ; ++i ) { SbiSymDef* pParDef = rPool.Get( i ); SbxDataType eParType = pParDef->GetType(); - aGen.Gen( _PARAM, i, sal::static_int_cast< UINT16 >( eParType ) ); + aGen.Gen( _PARAM, i, sal::static_int_cast< sal_uInt16 >( eParType ) ); aGen.Gen( _ARGV ); - USHORT nTyp = sal::static_int_cast< USHORT >( pParDef->GetType() ); + sal_uInt16 nTyp = sal::static_int_cast< sal_uInt16 >( pParDef->GetType() ); if( pParDef->IsByVal() ) { // Reset to avoid additional byval in call to wrapper function - pParDef->SetByVal( FALSE ); + pParDef->SetByVal( sal_False ); nTyp |= 0x8000; } aGen.Gen( _ARGTYP, nTyp ); @@ -1032,12 +1035,12 @@ void SbiParser::DefDeclare( BOOL bPrivate ) aGen.Gen( _LIB, aGblStrings.Add( pDef->GetLib() ) ); SbiOpcode eOp = pDef->IsCdecl() ? _CALLC : _CALL; - USHORT nId = pDef->GetId(); + sal_uInt16 nId = pDef->GetId(); if( pDef->GetAlias().Len() ) nId = ( nId & 0x8000 ) | aGblStrings.Add( pDef->GetAlias() ); if( nParCount > 1 ) nId |= 0x8000; - aGen.Gen( eOp, nId, sal::static_int_cast< UINT16 >( eType ) ); + aGen.Gen( eOp, nId, sal::static_int_cast< sal_uInt16 >( eType ) ); if( bFunction ) aGen.Gen( _PUT ); @@ -1079,18 +1082,18 @@ void SbiParser::Call() void SbiParser::SubFunc() { - DefProc( FALSE, FALSE ); + DefProc( sal_False, sal_False ); } // Read in of a procedure -BOOL runsInSetup( void ); +sal_Bool runsInSetup( void ); -void SbiParser::DefProc( BOOL bStatic, BOOL bPrivate ) +void SbiParser::DefProc( sal_Bool bStatic, sal_Bool bPrivate ) { - USHORT l1 = nLine, l2 = nLine; - BOOL bSub = BOOL( eCurTok == SUB ); - BOOL bProperty = BOOL( eCurTok == PROPERTY ); + sal_uInt16 l1 = nLine, l2 = nLine; + sal_Bool bSub = sal_Bool( eCurTok == SUB ); + sal_Bool bProperty = sal_Bool( eCurTok == PROPERTY ); PropertyMode ePropertyMode = PROPERTY_MODE_NONE; if( bProperty ) { @@ -1106,7 +1109,7 @@ void SbiParser::DefProc( BOOL bStatic, BOOL bPrivate ) } SbiToken eExit = eCurTok; - SbiProcDef* pDef = ProcDecl( FALSE ); + SbiProcDef* pDef = ProcDecl( sal_False ); if( !pDef ) return; pDef->setPropertyMode( ePropertyMode ); @@ -1160,13 +1163,13 @@ void SbiParser::DefProc( BOOL bStatic, BOOL bPrivate ) if( bStatic ) { if ( bVBASupportOn ) - pProc->SetStatic( TRUE ); + pProc->SetStatic( sal_True ); else Error( SbERR_NOT_IMPLEMENTED ); // STATIC SUB ... } else { - pProc->SetStatic( FALSE ); + pProc->SetStatic( sal_False ); } // Normal case: Local variable->parameter->global variable pProc->GetLocals().SetParent( &pProc->GetParams() ); @@ -1191,10 +1194,10 @@ void SbiParser::DefProc( BOOL bStatic, BOOL bPrivate ) void SbiParser::Static() { - DefStatic( FALSE ); + DefStatic( sal_False ); } -void SbiParser::DefStatic( BOOL bPrivate ) +void SbiParser::DefStatic( sal_Bool bPrivate ) { switch( Peek() ) { @@ -1206,10 +1209,10 @@ void SbiParser::DefStatic( BOOL bPrivate ) if( bNewGblDefs && nGblChain == 0 ) { nGblChain = aGen.Gen( _JUMP, 0 ); - bNewGblDefs = FALSE; + bNewGblDefs = sal_False; } Next(); - DefProc( TRUE, bPrivate ); + DefProc( sal_True, bPrivate ); break; default: { if( !pProc ) @@ -1217,7 +1220,7 @@ void SbiParser::DefStatic( BOOL bPrivate ) // Reset the Pool, so that STATIC-Declarations go into the // global Pool SbiSymPool* p = pPool; pPool = &aPublics; - DefVar( _STATIC, TRUE ); + DefVar( _STATIC, sal_True ); pPool = p; } break; } diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx index 5975314e8870..1dcd5fc73e59 100644..100755 --- a/basic/source/comp/exprgen.cxx +++ b/basic/source/comp/exprgen.cxx @@ -76,12 +76,12 @@ void SbiExprNode::Gen( RecursiveMode eRecMode ) case SbxINTEGER: pGen->Gen( _CONST, (short) nVal ); break; case SbxSTRING: { - USHORT nStringId = pGen->GetParser()->aGblStrings.Add( aStrVal, TRUE ); + sal_uInt16 nStringId = pGen->GetParser()->aGblStrings.Add( aStrVal, sal_True ); pGen->Gen( _SCONST, nStringId ); break; } default: { - USHORT nStringId = pGen->GetParser()->aGblStrings.Add( nVal, eType ); + sal_uInt16 nStringId = pGen->GetParser()->aGblStrings.Add( nVal, eType ); pGen->Gen( _NUMBER, nStringId ); } } @@ -175,7 +175,7 @@ void SbiExprNode::GenElement( SbiOpcode eOp ) // The ID is either the position or the String-ID // If the bit Bit 0x8000 is set, the variable have // a parameter list. - USHORT nId = ( eOp == _PARAM ) ? pDef->GetPos() : pDef->GetId(); + sal_uInt16 nId = ( eOp == _PARAM ) ? pDef->GetPos() : pDef->GetId(); // Build a parameter list if( aVar.pPar && aVar.pPar->GetSize() ) { @@ -183,7 +183,7 @@ void SbiExprNode::GenElement( SbiOpcode eOp ) aVar.pPar->Gen(); } - pGen->Gen( eOp, nId, sal::static_int_cast< UINT16 >( GetType() ) ); + pGen->Gen( eOp, nId, sal::static_int_cast< sal_uInt16 >( GetType() ) ); if( aVar.pvMorePar ) { @@ -208,7 +208,7 @@ void SbiExprList::Gen() { pParser->aGen.Gen( _ARGC ); // From 1996-01-10: Type adjustment at DECLARE - USHORT nCount = 1 /*, nParAnz = 0*/; + sal_uInt16 nCount = 1 /*, nParAnz = 0*/; // SbiSymPool* pPool = NULL; for( SbiExpression* pExpr = pFirst; pExpr; pExpr = pExpr->pNext,nCount++ ) { @@ -216,7 +216,7 @@ void SbiExprList::Gen() if( pExpr->GetName().Len() ) { // named arg - USHORT nSid = pParser->aGblStrings.Add( pExpr->GetName() ); + sal_uInt16 nSid = pParser->aGblStrings.Add( pExpr->GetName() ); pParser->aGen.Gen( _ARGN, nSid ); /* TODO: Check after Declare concept change @@ -227,7 +227,7 @@ void SbiExprList::Gen() pParser->Error( SbERR_NO_NAMED_ARGS ); // Later, if Named Args at DECLARE is posible - //for( USHORT i = 1 ; i < nParAnz ; i++ ) + //for( sal_uInt16 i = 1 ; i < nParAnz ; i++ ) //{ // SbiSymDef* pDef = pPool->Get( i ); // const String& rName = pDef->GetName(); @@ -261,7 +261,7 @@ void SbiExpression::Gen( RecursiveMode eRecMode ) pParser->aGen.Gen( _BYVAL ); if( bBased ) { - USHORT uBase = pParser->nBase; + sal_uInt16 uBase = pParser->nBase; if( pParser->IsCompatible() ) uBase |= 0x8000; // #109275 Flag compatiblity pParser->aGen.Gen( _BASED, uBase ); diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx index 7a3dc862cb16..f454071c0377 100644..100755 --- a/basic/source/comp/exprnode.cxx +++ b/basic/source/comp/exprnode.cxx @@ -54,7 +54,7 @@ SbiExprNode::SbiExprNode( SbiParser* p, SbiExprNode* l, SbiToken t, SbiExprNode* nVal = 0; eType = SbxVARIANT; // Nodes are always Variant eNodeType = SbxNODE; - bComposite= TRUE; + bComposite= sal_True; } SbiExprNode::SbiExprNode( SbiParser* p, double n, SbxDataType t ) @@ -87,11 +87,11 @@ SbiExprNode::SbiExprNode( SbiParser* p, const SbiSymDef& r, SbxDataType t, SbiEx aVar.pNext= NULL; // Results of functions are at no time fixed - bComposite= BOOL( aVar.pDef->GetProcDef() != NULL ); + bComposite= sal_Bool( aVar.pDef->GetProcDef() != NULL ); } // #120061 TypeOf -SbiExprNode::SbiExprNode( SbiParser* p, SbiExprNode* l, USHORT nId ) +SbiExprNode::SbiExprNode( SbiParser* p, SbiExprNode* l, sal_uInt16 nId ) { BaseInit( p ); @@ -102,7 +102,7 @@ SbiExprNode::SbiExprNode( SbiParser* p, SbiExprNode* l, USHORT nId ) } // new <type> -SbiExprNode::SbiExprNode( SbiParser* p, USHORT nId ) +SbiExprNode::SbiExprNode( SbiParser* p, sal_uInt16 nId ) { BaseInit( p ); @@ -119,8 +119,8 @@ void SbiExprNode::BaseInit( SbiParser* p ) pLeft = NULL; pRight = NULL; pWithParent = NULL; - bComposite = FALSE; - bError = FALSE; + bComposite = sal_False; + bError = sal_False; } SbiExprNode::~SbiExprNode() @@ -175,7 +175,7 @@ SbiExprNode* SbiExprNode::GetRealNode() // This method transform the type, if it fits into the Integer range -BOOL SbiExprNode::IsIntConst() +sal_Bool SbiExprNode::IsIntConst() { if( eNodeType == SbxNUMVAL ) { @@ -186,29 +186,29 @@ BOOL SbiExprNode::IsIntConst() { nVal = (double) (short) nVal; eType = SbxINTEGER; - return TRUE; + return sal_True; } } } - return FALSE; + return sal_False; } -BOOL SbiExprNode::IsNumber() +sal_Bool SbiExprNode::IsNumber() { - return BOOL( eNodeType == SbxNUMVAL ); + return sal_Bool( eNodeType == SbxNUMVAL ); } -BOOL SbiExprNode::IsString() +sal_Bool SbiExprNode::IsString() { - return BOOL( eNodeType == SbxSTRVAL ); + return sal_Bool( eNodeType == SbxSTRVAL ); } -BOOL SbiExprNode::IsVariable() +sal_Bool SbiExprNode::IsVariable() { - return BOOL( eNodeType == SbxVARVAL ); + return sal_Bool( eNodeType == SbxVARVAL ); } -BOOL SbiExprNode::IsLvalue() +sal_Bool SbiExprNode::IsLvalue() { return IsVariable(); } @@ -284,7 +284,7 @@ void SbiExprNode::FoldConstants() String rr( pRight->GetString() ); delete pLeft; pLeft = NULL; delete pRight; pRight = NULL; - bComposite = FALSE; + bComposite = sal_False; if( eTok == PLUS || eTok == CAT ) { eTok = CAT; @@ -321,7 +321,7 @@ void SbiExprNode::FoldConstants() break; default: pGen->GetParser()->Error( SbERR_CONVERSION ); - bError = TRUE; + bError = sal_True; } } } @@ -335,50 +335,50 @@ void SbiExprNode::FoldConstants() || eTok == IDIV || eTok == MOD ) { // Integer operations - BOOL err = FALSE; - if( nl > SbxMAXLNG ) err = TRUE, nl = SbxMAXLNG; + sal_Bool err = sal_False; + if( nl > SbxMAXLNG ) err = sal_True, nl = SbxMAXLNG; else - if( nl < SbxMINLNG ) err = TRUE, nl = SbxMINLNG; - if( nr > SbxMAXLNG ) err = TRUE, nr = SbxMAXLNG; + if( nl < SbxMINLNG ) err = sal_True, nl = SbxMINLNG; + if( nr > SbxMAXLNG ) err = sal_True, nr = SbxMAXLNG; else - if( nr < SbxMINLNG ) err = TRUE, nr = SbxMINLNG; + if( nr < SbxMINLNG ) err = sal_True, nr = SbxMINLNG; ll = (long) nl; lr = (long) nr; llMod = (long) (nl < 0 ? nl - 0.5 : nl + 0.5); lrMod = (long) (nr < 0 ? nr - 0.5 : nr + 0.5); if( err ) { pGen->GetParser()->Error( SbERR_MATH_OVERFLOW ); - bError = TRUE; + bError = sal_True; } } - BOOL bBothInt = BOOL( pLeft->eType < SbxSINGLE + sal_Bool bBothInt = sal_Bool( pLeft->eType < SbxSINGLE && pRight->eType < SbxSINGLE ); delete pLeft; pLeft = NULL; delete pRight; pRight = NULL; nVal = 0; eType = SbxDOUBLE; eNodeType = SbxNUMVAL; - bComposite = FALSE; - BOOL bCheckType = FALSE; + bComposite = sal_False; + sal_Bool bCheckType = sal_False; switch( eTok ) { case EXPON: nVal = pow( nl, nr ); break; case MUL: - bCheckType = TRUE; + bCheckType = sal_True; nVal = nl * nr; break; case DIV: if( !nr ) { pGen->GetParser()->Error( SbERR_ZERODIV ); nVal = HUGE_VAL; - bError = TRUE; + bError = sal_True; } else nVal = nl / nr; break; case PLUS: - bCheckType = TRUE; + bCheckType = sal_True; nVal = nl + nr; break; case MINUS: - bCheckType = TRUE; + bCheckType = sal_True; nVal = nl - nr; break; case EQ: nVal = ( nl == nr ) ? SbxTRUE : SbxFALSE; @@ -402,14 +402,14 @@ void SbiExprNode::FoldConstants() if( !lr ) { pGen->GetParser()->Error( SbERR_ZERODIV ); nVal = HUGE_VAL; - bError = TRUE; + bError = sal_True; } else nVal = ll / lr; eType = SbxLONG; break; case MOD: if( !lr ) { pGen->GetParser()->Error( SbERR_ZERODIV ); nVal = HUGE_VAL; - bError = TRUE; + bError = sal_True; } else nVal = llMod % lrMod; eType = SbxLONG; break; case AND: @@ -448,21 +448,21 @@ void SbiExprNode::FoldConstants() pLeft = NULL; eType = SbxDOUBLE; eNodeType = SbxNUMVAL; - bComposite = FALSE; + bComposite = sal_False; switch( eTok ) { case NEG: nVal = -nVal; break; case NOT: { // Integer operation! - BOOL err = FALSE; - if( nVal > SbxMAXLNG ) err = TRUE, nVal = SbxMAXLNG; + sal_Bool err = sal_False; + if( nVal > SbxMAXLNG ) err = sal_True, nVal = SbxMAXLNG; else - if( nVal < SbxMINLNG ) err = TRUE, nVal = SbxMINLNG; + if( nVal < SbxMINLNG ) err = sal_True, nVal = SbxMINLNG; if( err ) { pGen->GetParser()->Error( SbERR_MATH_OVERFLOW ); - bError = TRUE; + bError = sal_True; } nVal = (double) ~((long) nVal); eType = SbxLONG; diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx index 6cf3f36a5646..cef0542c43bc 100644..100755 --- a/basic/source/comp/exprtree.cxx +++ b/basic/source/comp/exprtree.cxx @@ -43,7 +43,7 @@ SbiExpression::SbiExpression( SbiParser* p, SbiExprType t, SbiExprMode eMode, const KeywordSymbolInfo* pKeywordSymbolInfo ) { pParser = p; - bError = bByVal = bBased = bBracket = FALSE; + bError = bByVal = bBased = bBracket = sal_False; nParenLevel = 0; eCurExpr = t; m_eMode = eMode; @@ -62,7 +62,7 @@ SbiExpression::SbiExpression( SbiParser* p, double n, SbxDataType t ) pParser = p; eCurExpr = SbOPERAND; pNext = NULL; - bError = bByVal = bBased = bBracket = FALSE; + bError = bByVal = bBased = bBracket = sal_False; pExpr = new SbiExprNode( pParser, n, t ); pExpr->Optimize(); } @@ -71,7 +71,7 @@ SbiExpression::SbiExpression( SbiParser* p, const String& r ) { pParser = p; pNext = NULL; - bError = bByVal = bBased = bBracket = FALSE; + bError = bByVal = bBased = bBracket = sal_False; eCurExpr = SbOPERAND; pExpr = new SbiExprNode( pParser, r ); } @@ -80,7 +80,7 @@ SbiExpression::SbiExpression( SbiParser* p, const SbiSymDef& r, SbiExprList* pPa { pParser = p; pNext = NULL; - bError = bByVal = bBased = bBracket = FALSE; + bError = bByVal = bBased = bBracket = sal_False; eCurExpr = SbOPERAND; pExpr = new SbiExprNode( pParser, r, SbxVARIANT, pPar ); } @@ -89,7 +89,7 @@ SbiExpression::SbiExpression( SbiParser* p, SbiToken t ) { pParser = p; pNext = NULL; - bError = bByVal = bBased = bBracket = FALSE; + bError = bByVal = bBased = bBracket = sal_False; eCurExpr = SbOPERAND; pExpr = new SbiExprNode( pParser, NULL, t, NULL ); } @@ -108,17 +108,17 @@ SbiExpression::~SbiExpression() // Folgen Parameter ohne Klammer? Dies kann eine Zahl, ein String, // ein Symbol oder auch ein Komma sein (wenn der 1. Parameter fehlt) -static BOOL DoParametersFollow( SbiParser* p, SbiExprType eCurExpr, SbiToken eTok ) +static sal_Bool DoParametersFollow( SbiParser* p, SbiExprType eCurExpr, SbiToken eTok ) { if( eTok == LPAREN ) - return TRUE; + return sal_True; // Aber nur, wenn CALL-aehnlich! if( !p->WhiteSpace() || eCurExpr != SbSYMBOL ) - return FALSE; + return sal_False; if ( eTok == NUMBER || eTok == MINUS || eTok == FIXSTRING || eTok == SYMBOL || eTok == COMMA || eTok == DOT || eTok == NOT || eTok == BYVAL ) { - return TRUE; + return sal_True; } else // check for default params with reserved names ( e.g. names of tokens ) { @@ -126,9 +126,9 @@ static BOOL DoParametersFollow( SbiParser* p, SbiExprType eCurExpr, SbiToken eTo // Urk the Next() / Peek() symantics are... weird tokens.Next(); if ( tokens.Peek() == ASSIGN ) - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // Definition eines neuen Symbols @@ -139,7 +139,7 @@ static SbiSymDef* AddSym { SbiSymDef* pDef; // A= ist keine Prozedur - BOOL bHasType = BOOL( eTok == EQ || eTok == DOT ); + sal_Bool bHasType = sal_Bool( eTok == EQ || eTok == DOT ); if( ( !bHasType && eCurExpr == SbSYMBOL ) || pPar ) { // Dies ist also eine Prozedur @@ -152,14 +152,14 @@ static SbiSymDef* AddSym // Sonderbehandlung fuer Colls wie Documents(1) if( eCurExpr == SbSTDEXPR ) - bHasType = TRUE; + bHasType = sal_True; pDef = pProc; pDef->SetType( bHasType ? eType : SbxEMPTY ); if( pPar ) { // Dummy-Parameter generieren - USHORT n = 1; + sal_uInt16 n = 1; for( short i = 0; i < pPar->GetSize(); i++ ) { String aPar = String::CreateFromAscii( "PAR" ); @@ -233,7 +233,7 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo ) else { pParser->Error( SbERR_SYNTAX ); - bError = TRUE; + bError = sal_True; } } @@ -260,18 +260,18 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo ) // Es koennte ein Objektteil sein, wenn . oder ! folgt // Bei . muss aber die Variable bereits definiert sein; wenn pDef // nach der Suche NULL ist, isses ein Objekt! - BOOL bObj = BOOL( ( eTok == DOT || eTok == EXCLAM ) + sal_Bool bObj = sal_Bool( ( eTok == DOT || eTok == EXCLAM ) && !pParser->WhiteSpace() ); if( bObj ) { - bBracket = FALSE; // Now the bracket for the first term is obsolete + bBracket = sal_False; // Now the bracket for the first term is obsolete if( eType == SbxVARIANT ) eType = SbxOBJECT; else { // Name%. geht wirklich nicht! pParser->Error( SbERR_BAD_DECLARATION, aSym ); - bError = TRUE; + bError = sal_True; } } // Suche: @@ -331,7 +331,7 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo ) { // Wie? Erst mit AS definieren und dann einen Suffix nehmen? pParser->Error( SbERR_BAD_DECLARATION, aSym ); - bError = TRUE; + bError = sal_True; } else if ( eType == SbxVARIANT ) // Falls nix angegeben, den Typ des Eintrags nehmen @@ -356,13 +356,13 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo ) else { pParser->Error( SbERR_BAD_DECLARATION, aSym ); - bError = TRUE; + bError = sal_True; } } } SbiExprNode* pNd = new SbiExprNode( pParser, *pDef, eType ); if( !pPar ) - pPar = new SbiParameters( pParser,FALSE,FALSE ); + pPar = new SbiParameters( pParser,sal_False,sal_False ); pNd->aVar.pPar = pPar; pNd->aVar.pvMorePar = pvMoreParLcl; if( bObj ) @@ -376,9 +376,9 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo ) { // defer error until runtime if in vba mode if ( !pParser->IsVBASupportOn() ) - { + { pParser->Error( SbERR_BAD_DECLARATION, aSym ); - bError = TRUE; + bError = sal_True; } } if( !bError ) @@ -404,14 +404,14 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj ) eTok != XOR && eTok != EQV && eTok != IMP && eTok != IS ) { pParser->Error( SbERR_VAR_EXPECTED ); - bError = TRUE; + bError = sal_True; } } /* #118410 Allow type for Class methods and RTL object, e.g. RTL.Chr$(97) else { if( pParser->GetType() != SbxVARIANT ) - pParser->Error( SbERR_SYNTAX ), bError = TRUE; + pParser->Error( SbERR_SYNTAX ), bError = sal_True; } */ if( bError ) @@ -442,7 +442,7 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj ) } } - BOOL bObj = BOOL( ( eTok == DOT || eTok == EXCLAM ) && !pParser->WhiteSpace() ); + sal_Bool bObj = sal_Bool( ( eTok == DOT || eTok == EXCLAM ) && !pParser->WhiteSpace() ); if( bObj ) { if( eType == SbxVARIANT ) @@ -451,7 +451,7 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj ) { // Name%. geht wirklich nicht! pParser->Error( SbERR_BAD_DECLARATION, aSym ); - bError = TRUE; + bError = sal_True; } } @@ -482,7 +482,7 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj ) if( pDef->GetType() != SbxOBJECT ) { pParser->Error( SbERR_BAD_DECLARATION, aSym ); - bError = TRUE; + bError = sal_True; } if( !bError ) { @@ -559,7 +559,7 @@ SbiExprNode* SbiExpression::Operand( bool bUsedForTypeOf ) } } nParenLevel--; - pRes->bComposite = TRUE; + pRes->bComposite = sal_True; break; default: // Zur Zeit sind Keywords hier OK! @@ -609,7 +609,7 @@ SbiExprNode* SbiExpression::Unary() pParser->TestToken( IS ); String aDummy; SbiSymDef* pTypeDef = new SbiSymDef( aDummy ); - pParser->TypeDecl( *pTypeDef, TRUE ); + pParser->TypeDecl( *pTypeDef, sal_True ); pNd = new SbiExprNode( pParser, pObjNode, pTypeDef->GetTypeId() ); break; } @@ -618,7 +618,7 @@ SbiExprNode* SbiExpression::Unary() pParser->Next(); String aStr; SbiSymDef* pTypeDef = new SbiSymDef( aStr ); - pParser->TypeDecl( *pTypeDef, TRUE ); + pParser->TypeDecl( *pTypeDef, sal_True ); pNd = new SbiExprNode( pParser, pTypeDef->GetTypeId() ); break; } @@ -847,7 +847,7 @@ SbiExprNode* SbiExpression::VBA_Imp() SbiExprNode* SbiExpression::Like() { - SbiExprNode* pNd = pParser->IsVBASupportOn() ? VBA_Imp() : Comp(); + SbiExprNode* pNd = pParser->IsVBASupportOn() ? VBA_Not() : Comp(); if( m_eMode != EXPRMODE_EMPTY_PAREN ) { short nCount = 0; @@ -859,7 +859,7 @@ SbiExprNode* SbiExpression::Like() if( nCount > 1 && !pParser->IsVBASupportOn() ) { pParser->Error( SbERR_SYNTAX ); - bError = TRUE; + bError = sal_True; } } return pNd; @@ -909,28 +909,28 @@ SbiConstExpression::SbiConstExpression( SbiParser* p ) : SbiExpression( p ) } else { - // #40204 Spezialbehandlung fuer BOOL-Konstanten - BOOL bIsBool = FALSE; + // #40204 Spezialbehandlung fuer sal_Bool-Konstanten + sal_Bool bIsBool = sal_False; if( pExpr->eNodeType == SbxVARVAL ) { SbiSymDef* pVarDef = pExpr->GetVar(); - // Ist es eine BOOL-Konstante? - BOOL bBoolVal = FALSE; + // Ist es eine sal_Bool-Konstante? + sal_Bool bBoolVal = sal_False; if( pVarDef->GetName().EqualsIgnoreCaseAscii( "true" ) ) //if( pVarDef->GetName().ICompare( "true" ) == COMPARE_EQUAL ) { - bIsBool = TRUE; - bBoolVal = TRUE; + bIsBool = sal_True; + bBoolVal = sal_True; } else if( pVarDef->GetName().EqualsIgnoreCaseAscii( "false" ) ) //else if( pVarDef->GetName().ICompare( "false" ) == COMPARE_EQUAL ) { - bIsBool = TRUE; - bBoolVal = FALSE; + bIsBool = sal_True; + bBoolVal = sal_False; } - // Wenn es ein BOOL ist, Node austauschen + // Wenn es ein sal_Bool ist, Node austauschen if( bIsBool ) { delete pExpr; @@ -982,7 +982,7 @@ SbiExprList::SbiExprList( SbiParser* p ) nExpr = nDim = 0; bError = - bBracket = FALSE; + bBracket = sal_False; } SbiExprList::~SbiExprList() @@ -1030,8 +1030,8 @@ void SbiExprList::addExpression( SbiExpression* pExpr ) // #i79918/#i80532: bConst has never been set to true // -> reused as bStandaloneExpression -//SbiParameters::SbiParameters( SbiParser* p, BOOL bConst, BOOL bPar) : -SbiParameters::SbiParameters( SbiParser* p, BOOL bStandaloneExpression, BOOL bPar) : +//SbiParameters::SbiParameters( SbiParser* p, sal_Bool bConst, sal_Bool bPar) : +SbiParameters::SbiParameters( SbiParser* p, sal_Bool bStandaloneExpression, sal_Bool bPar) : SbiExprList( p ) { if( !bPar ) @@ -1051,7 +1051,7 @@ SbiParameters::SbiParameters( SbiParser* p, BOOL bStandaloneExpression, BOOL bPa } else { - bBracket = TRUE; + bBracket = sal_True; pParser->Next(); eTok = pParser->Peek(); } @@ -1075,7 +1075,7 @@ SbiParameters::SbiParameters( SbiParser* p, BOOL bStandaloneExpression, BOOL bPa { pExpr = new SbiExpression( pParser, 0, SbxEMPTY ); //if( bConst ) - // pParser->Error( SbERR_SYNTAX ), bError = TRUE; + // pParser->Error( SbERR_SYNTAX ), bError = sal_True; } // Benannte Argumente: entweder .name= oder name:= else @@ -1091,25 +1091,25 @@ SbiParameters::SbiParameters( SbiParser* p, BOOL bStandaloneExpression, BOOL bPa if( bAssumeExprLParenMode ) { pExpr = new SbiExpression( pParser, SbSTDEXPR, EXPRMODE_LPAREN_PENDING ); - bAssumeExprLParenMode = FALSE; + bAssumeExprLParenMode = sal_False; SbiExprMode eModeAfter = pExpr->m_eMode; if( eModeAfter == EXPRMODE_LPAREN_NOT_NEEDED ) { - bBracket = TRUE; + bBracket = sal_True; } else if( eModeAfter == EXPRMODE_ARRAY_OR_OBJECT ) { // Expression "looks" like an array assignment // a(...)[(...)] = ? or a(...).b(...) // RPAREN is already parsed - bBracket = TRUE; + bBracket = sal_True; bAssumeArrayMode = true; eTok = NIL; } else if( eModeAfter == EXPRMODE_EMPTY_PAREN ) { - bBracket = TRUE; + bBracket = sal_True; delete pExpr; if( bByVal ) pParser->Error( SbERR_LVALUE_EXPECTED ); @@ -1135,7 +1135,7 @@ SbiParameters::SbiParameters( SbiParser* p, BOOL bStandaloneExpression, BOOL bPa pParser->Next(); pExpr = new SbiExpression( pParser ); //if( bConst ) - // pParser->Error( SbERR_SYNTAX ), bError = TRUE; + // pParser->Error( SbERR_SYNTAX ), bError = sal_True; } pExpr->GetName() = aName; } @@ -1160,7 +1160,7 @@ SbiParameters::SbiParameters( SbiParser* p, BOOL bStandaloneExpression, BOOL bPa pParser->Error( bBracket ? SbERR_BAD_BRACKETS : SbERR_EXPECTED, COMMA ); - bError = TRUE; + bError = sal_True; } else { @@ -1178,7 +1178,7 @@ SbiParameters::SbiParameters( SbiParser* p, BOOL bStandaloneExpression, BOOL bPa if( !bBracket ) { pParser->Error( SbERR_BAD_BRACKETS ); - bError = TRUE; + bError = sal_True; } } nDim = nExpr; @@ -1197,12 +1197,12 @@ SbiParameters::SbiParameters( SbiParser* p, BOOL bStandaloneExpression, BOOL bPa SbiDimList::SbiDimList( SbiParser* p ) : SbiExprList( p ) { - bConst = TRUE; + bConst = sal_True; if( pParser->Next() != LPAREN ) { pParser->Error( SbERR_EXPECTED, LPAREN ); - bError = TRUE; return; + bError = sal_True; return; } if( pParser->Peek() != RPAREN ) diff --git a/basic/source/comp/io.cxx b/basic/source/comp/io.cxx index 7ca4a7babdea..5c4abc680826 100644..100755 --- a/basic/source/comp/io.cxx +++ b/basic/source/comp/io.cxx @@ -36,9 +36,9 @@ // Test, ob ein I/O-Channel angegeben wurde -BOOL SbiParser::Channel( BOOL bAlways ) +sal_Bool SbiParser::Channel( sal_Bool bAlways ) { - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; Peek(); if( IsHash() ) { @@ -47,7 +47,7 @@ BOOL SbiParser::Channel( BOOL bAlways ) Next(); aExpr.Gen(); aGen.Gen( _CHANNEL ); - bRes = TRUE; + bRes = sal_True; } else if( bAlways ) Error( SbERR_EXPECTED, "#" ); @@ -61,7 +61,7 @@ BOOL SbiParser::Channel( BOOL bAlways ) void SbiParser::Print() { - BOOL bChan = Channel(); + sal_Bool bChan = Channel(); // Die Ausdruecke zum Drucken: while( !bAbort ) { @@ -92,7 +92,7 @@ void SbiParser::Print() void SbiParser::Write() { - BOOL bChan = Channel(); + sal_Bool bChan = Channel(); // Die Ausdruecke zum Drucken: while( !bAbort ) { @@ -144,8 +144,8 @@ void SbiParser::Line() void SbiParser::LineInput() { - Channel( TRUE ); - // BOOL bChan = Channel( TRUE ); + Channel( sal_True ); + // sal_Bool bChan = Channel( sal_True ); SbiExpression* pExpr = new SbiExpression( this, SbOPERAND ); /* AB 15.1.96: Keinen allgemeinen Ausdruck mehr zulassen SbiExpression* pExpr = new SbiExpression( this ); @@ -181,8 +181,8 @@ void SbiParser::LineInput() void SbiParser::Input() { aGen.Gen( _RESTART ); - Channel( TRUE ); - // BOOL bChan = Channel( TRUE ); + Channel( sal_True ); + // sal_Bool bChan = Channel( sal_True ); SbiExpression* pExpr = new SbiExpression( this, SbOPERAND ); /* ALT: Jetzt keinen allgemeinen Ausdruck mehr zulassen SbiExpression* pExpr = new SbiExpression( this ); diff --git a/basic/source/comp/loops.cxx b/basic/source/comp/loops.cxx index b5131c58dfaf..f904c9ee51f3 100644..100755 --- a/basic/source/comp/loops.cxx +++ b/basic/source/comp/loops.cxx @@ -35,7 +35,7 @@ void SbiParser::If() { - UINT32 nEndLbl; + sal_uInt32 nEndLbl; SbiToken eTok = NIL; // Ende-Tokens ignorieren: SbiExpression aCond( this ); @@ -47,8 +47,8 @@ void SbiParser::If() // eingefuegt werden, damit bei ELSEIF nicht erneut die Bedingung // ausgewertet wird. Die Tabelle nimmt alle Absprungstellen auf. #define JMP_TABLE_SIZE 100 - UINT32 pnJmpToEndLbl[JMP_TABLE_SIZE]; // 100 ELSEIFs zulaessig - USHORT iJmp = 0; // aktueller Tabellen-Index + sal_uInt32 pnJmpToEndLbl[JMP_TABLE_SIZE]; // 100 ELSEIFs zulaessig + sal_uInt16 iJmp = 0; // aktueller Tabellen-Index // multiline IF nEndLbl = aGen.Gen( _JUMPF, 0 ); @@ -59,7 +59,7 @@ void SbiParser::If() eTok = Peek(); if( IsEof() ) { - Error( SbERR_BAD_BLOCK, IF ); bAbort = TRUE; return; + Error( SbERR_BAD_BLOCK, IF ); bAbort = sal_True; return; } } // ELSEIF? @@ -68,7 +68,7 @@ void SbiParser::If() // #27720# Bei erfolgreichem IF/ELSEIF auf ENDIF springen if( iJmp >= JMP_TABLE_SIZE ) { - Error( SbERR_PROG_TOO_LARGE ); bAbort = TRUE; return; + Error( SbERR_PROG_TOO_LARGE ); bAbort = sal_True; return; } pnJmpToEndLbl[iJmp++] = aGen.Gen( _JUMP, 0 ); @@ -88,14 +88,14 @@ void SbiParser::If() eTok = Peek(); if( IsEof() ) { - Error( SbERR_BAD_BLOCK, ELSEIF ); bAbort = TRUE; return; + Error( SbERR_BAD_BLOCK, ELSEIF ); bAbort = sal_True; return; } } } if( eTok == ELSE ) { Next(); - UINT32 nElseLbl = nEndLbl; + sal_uInt32 nElseLbl = nEndLbl; nEndLbl = aGen.Gen( _JUMP, 0 ); aGen.BackChain( nElseLbl ); @@ -115,7 +115,7 @@ void SbiParser::If() else { // single line IF - bSingleLineIf = TRUE; + bSingleLineIf = sal_True; nEndLbl = aGen.Gen( _JUMPF, 0 ); Push( eCurTok ); while( !bAbort ) @@ -128,7 +128,7 @@ void SbiParser::If() if( eTok == ELSE ) { Next(); - UINT32 nElseLbl = nEndLbl; + sal_uInt32 nElseLbl = nEndLbl; nEndLbl = aGen.Gen( _JUMP, 0 ); aGen.BackChain( nElseLbl ); while( !bAbort ) @@ -139,7 +139,7 @@ void SbiParser::If() break; } } - bSingleLineIf = FALSE; + bSingleLineIf = sal_False; } aGen.BackChain( nEndLbl ); } @@ -157,7 +157,7 @@ void SbiParser::NoIf() void SbiParser::DoLoop() { - UINT32 nStartLbl = aGen.GetPC(); + sal_uInt32 nStartLbl = aGen.GetPC(); OpenBlock( DO ); SbiToken eTok = Next(); if( IsEoln( eTok ) ) @@ -184,7 +184,7 @@ void SbiParser::DoLoop() SbiExpression aCond( this ); aCond.Gen(); } - UINT32 nEndLbl = aGen.Gen( eTok == UNTIL ? _JUMPT : _JUMPF, 0 ); + sal_uInt32 nEndLbl = aGen.Gen( eTok == UNTIL ? _JUMPT : _JUMPF, 0 ); StmntBlock( LOOP ); TestEoln(); aGen.Gen( _JUMP, nStartLbl ); @@ -198,9 +198,9 @@ void SbiParser::DoLoop() void SbiParser::While() { SbiExpression aCond( this ); - UINT32 nStartLbl = aGen.GetPC(); + sal_uInt32 nStartLbl = aGen.GetPC(); aCond.Gen(); - UINT32 nEndLbl = aGen.Gen( _JUMPF, 0 ); + sal_uInt32 nEndLbl = aGen.Gen( _JUMPF, 0 ); StmntBlock( WEND ); aGen.Gen( _JUMP, nStartLbl ); aGen.BackChain( nEndLbl ); @@ -249,9 +249,9 @@ void SbiParser::For() aGen.Gen( _INITFOR ); } - UINT32 nLoop = aGen.GetPC(); + sal_uInt32 nLoop = aGen.GetPC(); // Test durchfuehren, evtl. Stack freigeben - UINT32 nEndTarget = aGen.Gen( _TESTFOR, 0 ); + sal_uInt32 nEndTarget = aGen.Gen( _TESTFOR, 0 ); OpenBlock( FOR ); StmntBlock( NEXT ); aGen.Gen( _NEXT ); @@ -306,7 +306,7 @@ void SbiParser::OnGoto() { SbiExpression aCond( this ); aCond.Gen(); - UINT32 nLabelsTarget = aGen.Gen( _ONJUMP, 0 ); + sal_uInt32 nLabelsTarget = aGen.Gen( _ONJUMP, 0 ); SbiToken eTok = Next(); if( eTok != GOTO && eTok != GOSUB ) { @@ -314,13 +314,13 @@ void SbiParser::OnGoto() eTok = GOTO; } // Label-Tabelle einlesen: - UINT32 nLbl = 0; + sal_uInt32 nLbl = 0; do { Next(); // Label holen if( MayBeLabel() ) { - UINT32 nOff = pProc->GetLabels().Reference( aSym ); + sal_uInt32 nOff = pProc->GetLabels().Reference( aSym ); aGen.Gen( _JUMP, nOff ); nLbl++; } @@ -340,7 +340,7 @@ void SbiParser::Goto() Next(); if( MayBeLabel() ) { - UINT32 nOff = pProc->GetLabels().Reference( aSym ); + sal_uInt32 nOff = pProc->GetLabels().Reference( aSym ); aGen.Gen( eOp, nOff ); } else Error( SbERR_LABEL_EXPECTED ); @@ -353,7 +353,7 @@ void SbiParser::Return() Next(); if( MayBeLabel() ) { - UINT32 nOff = pProc->GetLabels().Reference( aSym ); + sal_uInt32 nOff = pProc->GetLabels().Reference( aSym ); aGen.Gen( _RETURN, nOff ); } else aGen.Gen( _RETURN, 0 ); @@ -369,9 +369,9 @@ void SbiParser::Select() aCase.Gen(); aGen.Gen( _CASE ); TestEoln(); - UINT32 nNextTarget = 0; - UINT32 nDoneTarget = 0; - BOOL bElse = FALSE; + sal_uInt32 nNextTarget = 0; + sal_uInt32 nDoneTarget = 0; + sal_Bool bElse = sal_False; // Die Cases einlesen: while( !bAbort ) { @@ -382,13 +382,13 @@ void SbiParser::Select() aGen.BackChain( nNextTarget ), nNextTarget = 0; aGen.Statement(); // Jeden Case einlesen - BOOL bDone = FALSE; - UINT32 nTrueTarget = 0; + sal_Bool bDone = sal_False; + sal_uInt32 nTrueTarget = 0; if( Peek() == ELSE ) { // CASE ELSE Next(); - bElse = TRUE; + bElse = sal_True; } else while( !bDone ) { @@ -407,7 +407,7 @@ void SbiParser::Select() aCompare.Gen(); nTrueTarget = aGen.Gen( _CASEIS, nTrueTarget, - sal::static_int_cast< UINT16 >( + sal::static_int_cast< sal_uInt16 >( SbxEQ + ( eTok2 - EQ ) ) ); } else @@ -428,7 +428,7 @@ void SbiParser::Select() } if( Peek() == COMMA ) Next(); - else TestEoln(), bDone = TRUE; + else TestEoln(), bDone = sal_True; } // Alle Cases abgearbeitet if( !bElse ) @@ -493,7 +493,7 @@ void SbiParser::On() aGen.Gen( _STDERROR ); else { - UINT32 nOff = pProc->GetLabels().Reference( aSym ); + sal_uInt32 nOff = pProc->GetLabels().Reference( aSym ); aGen.Gen( _ERRHDL, nOff ); } } @@ -525,7 +525,7 @@ void SbiParser::On() void SbiParser::Resume() { - UINT32 nLbl; + sal_uInt32 nLbl; switch( Next() ) { diff --git a/basic/source/comp/makefile.mk b/basic/source/comp/makefile.mk index 5fe64ceae091..5fe64ceae091 100644..100755 --- a/basic/source/comp/makefile.mk +++ b/basic/source/comp/makefile.mk diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx index 6d6c02ce0308..38189bc2025c 100644..100755 --- a/basic/source/comp/parser.cxx +++ b/basic/source/comp/parser.cxx @@ -36,18 +36,18 @@ struct SbiParseStack { // "Stack" fuer Statement-Blocks SbiParseStack* pNext; // Chain SbiExprNode* pWithVar; // Variable fuer WITH SbiToken eExitTok; // Exit-Token - UINT32 nChain; // JUMP-Chain + sal_uInt32 nChain; // JUMP-Chain }; struct SbiStatement { SbiToken eTok; void( SbiParser::*Func )(); // Verarbeitungsroutine - BOOL bMain; // TRUE: ausserhalb SUBs OK - BOOL bSubr; // TRUE: in SUBs OK + sal_Bool bMain; // sal_True: ausserhalb SUBs OK + sal_Bool bSubr; // sal_True: in SUBs OK }; -#define Y TRUE -#define N FALSE +#define Y sal_True +#define N sal_False static SbiStatement StmntTable [] = { { ATTRIBUTE, &SbiParser::Attribute, Y, Y, }, // ATTRIBUTE @@ -143,7 +143,7 @@ SbiParser::SbiParser( StarBASIC* pb, SbModule* pm ) bGblDefs = bNewGblDefs = bSingleLineIf = - bExplicit = FALSE; + bExplicit = sal_False; bClassModule = ( pm->GetModuleType() == com::sun::star::script::ModuleType::CLASS ); OSL_TRACE("Parser - %s, bClassModule %d", rtl::OUStringToOString( pm->GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), bClassModule ); pPool = &aPublics; @@ -189,7 +189,7 @@ SbiSymDef* SbiParser::CheckRTLForSym( const String& rSym, SbxDataType eType ) // Globale Chainkette schliessen -BOOL SbiParser::HasGlobalCode() +sal_Bool SbiParser::HasGlobalCode() { if( bGblDefs && nGblChain ) { @@ -254,49 +254,49 @@ void SbiParser::Exit() Error( SbERR_BAD_EXIT ); } -BOOL SbiParser::TestSymbol( BOOL bKwdOk ) +sal_Bool SbiParser::TestSymbol( sal_Bool bKwdOk ) { Peek(); if( eCurTok == SYMBOL || ( bKwdOk && IsKwd( eCurTok ) ) ) { - Next(); return TRUE; + Next(); return sal_True; } Error( SbERR_SYMBOL_EXPECTED ); - return FALSE; + return sal_False; } // Testen auf ein bestimmtes Token -BOOL SbiParser::TestToken( SbiToken t ) +sal_Bool SbiParser::TestToken( SbiToken t ) { if( Peek() == t ) { - Next(); return TRUE; + Next(); return sal_True; } else { Error( SbERR_EXPECTED, t ); - return FALSE; + return sal_False; } } // Testen auf Komma oder EOLN -BOOL SbiParser::TestComma() +sal_Bool SbiParser::TestComma() { SbiToken eTok = Peek(); if( IsEoln( eTok ) ) { Next(); - return FALSE; + return sal_False; } else if( eTok != COMMA ) { Error( SbERR_EXPECTED, COMMA ); - return FALSE; + return sal_False; } Next(); - return TRUE; + return sal_True; } // Testen, ob EOLN vorliegt @@ -322,16 +322,16 @@ void SbiParser::StmntBlock( SbiToken eEnd ) if( IsEof() ) { Error( SbERR_BAD_BLOCK, eEnd ); - bAbort = TRUE; + bAbort = sal_True; } } // Die Hauptroutine. Durch wiederholten Aufrufs dieser Routine wird -// die Quelle geparst. Returnwert FALSE bei Ende/Fehlern. +// die Quelle geparst. Returnwert sal_False bei Ende/Fehlern. -BOOL SbiParser::Parse() +sal_Bool SbiParser::Parse() { - if( bAbort ) return FALSE; + if( bAbort ) return sal_False; EnableErrors(); @@ -347,16 +347,16 @@ BOOL SbiParser::Parse() // ein nGblChain vorhanden sein, daher vorher abfragen if( bNewGblDefs && nGblChain == 0 ) nGblChain = aGen.Gen( _JUMP, 0 ); - return FALSE; + return sal_False; } // Leerstatement? if( IsEoln( eCurTok ) ) { - Next(); return TRUE; + Next(); return sal_True; } - if( !bSingleLineIf && MayBeLabel( TRUE ) ) + if( !bSingleLineIf && MayBeLabel( sal_True ) ) { // Ist ein Label if( !pProc ) @@ -367,7 +367,7 @@ BOOL SbiParser::Parse() // Leerstatement? if( IsEoln( eCurTok ) ) { - Next(); return TRUE; + Next(); return sal_True; } } @@ -380,13 +380,13 @@ BOOL SbiParser::Parse() Next(); if( eCurTok != NIL ) aGen.Statement(); - return FALSE; + return sal_False; } // Kommentar? if( eCurTok == REM ) { - Next(); return TRUE; + Next(); return sal_True; } // In vba it's possible to do Error.foobar ( even if it results in @@ -442,7 +442,7 @@ BOOL SbiParser::Parse() ( eCurTok == SUB || eCurTok == FUNCTION || eCurTok == PROPERTY ) ) { nGblChain = aGen.Gen( _JUMP, 0 ); - bNewGblDefs = FALSE; + bNewGblDefs = sal_False; } // Statement-Opcode bitte auch am Anfang einer Sub if( ( p->bSubr && (eCurTok != STATIC || Peek() == SUB || Peek() == FUNCTION ) ) || @@ -473,7 +473,7 @@ BOOL SbiParser::Parse() } // Der Parser bricht am Ende ab, das naechste Token ist noch nicht // geholt! - return TRUE; + return sal_True; } // Innerste With-Variable liefern @@ -578,7 +578,7 @@ void SbiParser::Assign() SbiExpression aExpr( this ); aLvalue.Gen(); aExpr.Gen(); - USHORT nLen = 0; + sal_uInt16 nLen = 0; SbiSymDef* pDef = aLvalue.GetRealVar(); { if( pDef->GetConstDef() ) @@ -609,7 +609,7 @@ void SbiParser::Set() Next(); String aStr; SbiSymDef* pTypeDef = new SbiSymDef( aStr ); - TypeDecl( *pTypeDef, TRUE ); + TypeDecl( *pTypeDef, sal_True ); aLvalue.Gen(); // aGen.Gen( _CLASS, pDef->GetTypeId() | 0x8000 ); @@ -761,7 +761,7 @@ void SbiParser::EnableCompatibility() { if( !bCompatible ) AddConstants(); - bCompatible = TRUE; + bCompatible = sal_True; } // OPTION @@ -771,7 +771,7 @@ void SbiParser::Option() switch( Next() ) { case EXPLICIT: - bExplicit = TRUE; break; + bExplicit = sal_True; break; case BASE: if( Next() == NUMBER ) { @@ -794,9 +794,9 @@ void SbiParser::Option() { SbiToken eTok = Next(); if( eTok == BINARY ) - bText = FALSE; + bText = sal_False; else if( eTok == SYMBOL && GetSym().EqualsIgnoreCaseAscii("text") ) - bText = TRUE; + bText = sal_True; else Error( SbERR_EXPECTED, "Text/Binary" ); break; @@ -806,7 +806,7 @@ void SbiParser::Option() break; case CLASSMODULE: - bClassModule = TRUE; + bClassModule = sal_True; aGen.GetModule().SetModuleType( com::sun::star::script::ModuleType::CLASS ); break; case VBASUPPORT: // Option VBASupport used to override the module mode ( in fact this must reset the mode diff --git a/basic/source/comp/sbcomp.cxx b/basic/source/comp/sbcomp.cxx index 03c9a50c18da..8f5aa58bfe97 100644..100755 --- a/basic/source/comp/sbcomp.cxx +++ b/basic/source/comp/sbcomp.cxx @@ -32,17 +32,216 @@ #include <basic/sbx.hxx> #include "sbcomp.hxx" #include "image.hxx" +#include <basic/sbobjmod.hxx> + +// To activate tracing enable in sbtrace.hxx +#ifdef DBG_TRACE_BASIC + +// Trace Settings, used if no ini file / not found in ini file +static char GpTraceFileNameDefault[] = "d:\\zBasic.Asm\\BasicTrace.txt"; +static char* GpTraceFileName = GpTraceFileNameDefault; + +// GbTraceOn: +// true = tracing is active, false = tracing is disabled, default = true +// Set to false initially if you want to activate tracing on demand with +// TraceCommand( "TraceOn" ), see below +static bool GbTraceOn = true; + +// GbIncludePCodes: +// true = PCodes are written to trace, default = false, correspondents +// with TraceCommand( "PCodeOn" / "PCodeOff" ), see below +static bool GbIncludePCodes = false; + +static int GnIndentPerCallLevel = 4; +static int GnIndentForPCode = 2; + +/* + With trace enabled the runtime function TraceCommand + can be used to influence the trace functionality + from within the running Basic macro. + + Format: TraceCommand( command as String [, param as Variant] ) + + Supported commands (command is NOT case sensitive): + TraceCommand "TraceOn" sets GbTraceOn = true + TraceCommand "TraceOff" sets GbTraceOn = false + + TraceCommand "PCodeOn" sets GbIncludePCodes = true + TraceCommand "PCodeOff" sets GbIncludePCodes = false + + TraceCommand "Print", aVal writes aVal into the trace file as + long as it can be converted to string +*/ + +static void lcl_skipWhites( char*& rpc ) +{ + while( *rpc == ' ' || *rpc == '\t' ) + ++rpc; +} + +inline void lcl_findNextLine( char*& rpc, char* pe ) +{ + // Find line end + while( rpc < pe && *rpc != 13 && *rpc != 10 ) + ++rpc; + + // Read all + while( rpc < pe && (*rpc == 13 || *rpc == 10) ) + ++rpc; +} + +inline bool lcl_isAlpha( char c ) +{ + bool bRet = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); + return bRet; +} + +static void lcl_ReadIniFile( const char* pIniFileName ) +{ + const int BUF_SIZE = 1000; + static sal_Char TraceFileNameBuffer[BUF_SIZE]; + sal_Char Buffer[BUF_SIZE]; + sal_Char VarNameBuffer[BUF_SIZE]; + sal_Char ValBuffer[BUF_SIZE]; + + FILE* pFile = fopen( pIniFileName ,"rb" ); + if( pFile == NULL ) + return; + + size_t nRead = fread( Buffer, 1, BUF_SIZE, pFile ); + + // Scan + char* pc = Buffer; + char* pe = Buffer + nRead; + while( pc < pe ) + { + lcl_skipWhites( pc ); if( pc == pe ) break; + + // Read variable + char* pVarStart = pc; + while( pc < pe && lcl_isAlpha( *pc ) ) + ++pc; + int nVarLen = pc - pVarStart; + if( nVarLen == 0 ) + { + lcl_findNextLine( pc, pe ); + continue; + } + strncpy( VarNameBuffer, pVarStart, nVarLen ); + VarNameBuffer[nVarLen] = '\0'; + + // Check = + lcl_skipWhites( pc ); if( pc == pe ) break; + if( *pc != '=' ) + continue; + ++pc; + lcl_skipWhites( pc ); if( pc == pe ) break; + + // Read value + char* pValStart = pc; + while( pc < pe && *pc != 13 && *pc != 10 ) + ++pc; + int nValLen = pc - pValStart; + if( nValLen == 0 ) + { + lcl_findNextLine( pc, pe ); + continue; + } + strncpy( ValBuffer, pValStart, nValLen ); + ValBuffer[nValLen] = '\0'; + + // Match variables + if( strcmp( VarNameBuffer, "GpTraceFileName") == 0 ) + { + strcpy( TraceFileNameBuffer, ValBuffer ); + GpTraceFileName = TraceFileNameBuffer; + } + else + if( strcmp( VarNameBuffer, "GbTraceOn") == 0 ) + GbTraceOn = (strcmp( ValBuffer, "true" ) == 0); + else + if( strcmp( VarNameBuffer, "GbIncludePCodes") == 0 ) + GbIncludePCodes = (strcmp( ValBuffer, "true" ) == 0); + else + if( strcmp( VarNameBuffer, "GnIndentPerCallLevel") == 0 ) + GnIndentPerCallLevel = strtol( ValBuffer, NULL, 10 ); + else + if( strcmp( VarNameBuffer, "GnIndentForPCode") == 0 ) + GnIndentForPCode = strtol( ValBuffer, NULL, 10 ); + } + fclose( pFile ); +} + if( eType & SbxARRAY ) + +void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ) +{ + (void)pBasic; + (void)bWrite; + + if ( rPar.Count() < 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + String aCommand = rPar.Get(1)->GetString(); + + if( aCommand.EqualsIgnoreCaseAscii( "TraceOn" ) ) + GbTraceOn = true; + else + if( aCommand.EqualsIgnoreCaseAscii( "TraceOff" ) ) + GbTraceOn = false; + else + if( aCommand.EqualsIgnoreCaseAscii( "PCodeOn" ) ) + GbIncludePCodes = true; + else + if( aCommand.EqualsIgnoreCaseAscii( "PCodeOff" ) ) + GbIncludePCodes = false; + else + if( aCommand.EqualsIgnoreCaseAscii( "Print" ) ) + { + if ( rPar.Count() < 3 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + SbxError eOld = SbxBase::GetError(); + if( eOld != SbxERR_OK ) + SbxBase::ResetError(); + + String aValStr = rPar.Get(2)->GetString(); + SbxError eErr = SbxBase::GetError(); + if( eErr != SbxERR_OK ) + { + aValStr = String( RTL_CONSTASCII_USTRINGPARAM( "<ERROR converting value to String>" ) ); + SbxBase::ResetError(); + } + + char Buffer[500]; + const char* pValStr = OUStringToOString( rtl::OUString( aValStr ), RTL_TEXTENCODING_ASCII_US ).getStr(); + + sprintf( Buffer, "### TRACE_PRINT: %s ###", pValStr ); + int nIndent = GnLastCallLvl * GnIndentPerCallLevel; + lcl_lineOut( GpTraceFileName, Buffer, lcl_getSpaces( nIndent ) ); + + if( eOld != SbxERR_OK ) + SbxBase::SetError( eOld ); + } +} + +#endif // Diese Routine ist hier definiert, damit der Compiler als eigenes Segment // geladen werden kann. -BOOL SbModule::Compile() +sal_Bool SbModule::Compile() { if( pImage ) - return TRUE; + return sal_True; StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent()); if( !pBasic ) - return FALSE; + return sal_False; SbxBase::ResetError(); // Aktuelles Modul! SbModule* pOld = pCMOD; @@ -61,13 +260,14 @@ BOOL SbModule::Compile() // Beim Compilieren eines Moduls werden die Modul-globalen // Variablen aller Module ungueltig - BOOL bRet = IsCompiled(); + sal_Bool bRet = IsCompiled(); if( bRet ) { - pBasic->ClearAllModuleVars(); + if( !this->ISA(SbObjModule) ) + pBasic->ClearAllModuleVars(); RemoveVars(); // remove 'this' Modules variables // clear all method statics - for( USHORT i = 0; i < pMethods->Count(); i++ ) + for( sal_uInt16 i = 0; i < pMethods->Count(); i++ ) { SbMethod* p = PTR_CAST(SbMethod,pMethods->Get( i ) ); if( p ) diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index a430ae0f7460..6e9b80dde9c0 100644..100755 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -67,9 +67,9 @@ SbiScanner::SbiScanner( const ::rtl::OUString& rBuf, StarBASIC* p ) : aBuf( rBuf bUsedForHilite = bCompatible = bVBASupportOn = - bPrevLineExtentsComment = FALSE; + bPrevLineExtentsComment = sal_False; bHash = - bErrors = TRUE; + bErrors = sal_True; } SbiScanner::~SbiScanner() @@ -91,19 +91,19 @@ void SbiScanner::GenError( SbError code ) { if( GetSbData()->bBlockCompilerError ) { - bAbort = TRUE; + bAbort = sal_True; return; } if( !bError && bErrors ) { - BOOL bRes = TRUE; + sal_Bool bRes = sal_True; // Nur einen Fehler pro Statement reporten - bError = TRUE; + bError = sal_True; if( pBasic ) { // Falls EXPECTED oder UNEXPECTED kommen sollte, bezieht es sich // immer auf das letzte Token, also die Col1 uebernehmen - USHORT nc = nColLock ? nSavedCol1 : nCol1; + sal_uInt16 nc = nColLock ? nSavedCol1 : nCol1; switch( code ) { case SbERR_EXPECTED: @@ -123,16 +123,16 @@ void SbiScanner::GenError( SbError code ) nErrors++; } -// Falls sofort ein Doppelpunkt folgt, wird TRUE zurueckgeliefert. +// Falls sofort ein Doppelpunkt folgt, wird sal_True zurueckgeliefert. // Wird von SbiTokenizer::MayBeLabel() verwendet, um einen Label zu erkennen -BOOL SbiScanner::DoesColonFollow() +sal_Bool SbiScanner::DoesColonFollow() { if( pLine && *pLine == ':' ) { - pLine++; nCol++; return TRUE; + pLine++; nCol++; return sal_True; } - else return FALSE; + else return sal_False; } // Testen auf ein legales Suffix @@ -144,41 +144,55 @@ static SbxDataType GetSuffixType( sal_Unicode c ) { sal_uInt32 n = aSuffixesStr.Search( c ); if( STRING_NOTFOUND != n && c != ' ' ) - return SbxDataType( (USHORT) n + SbxINTEGER ); + return SbxDataType( (sal_uInt16) n + SbxINTEGER ); } return SbxVARIANT; } // Einlesen des naechsten Symbols in die Variablen aSym, nVal und eType -// Returnwert ist FALSE bei EOF oder Fehlern +// Returnwert ist sal_False bei EOF oder Fehlern #define BUF_SIZE 80 -BOOL SbiScanner::NextSym() +namespace { + +/** Returns true, if the passed character is a white space character. */ +inline bool lclIsWhitespace( sal_Unicode cChar ) +{ + return (cChar == ' ') || (cChar == '\t') || (cChar == '\f'); +} + +} // namespace + +sal_Bool SbiScanner::NextSym() { // Fuer den EOLN-Fall merken - USHORT nOldLine = nLine; - USHORT nOldCol1 = nCol1; - USHORT nOldCol2 = nCol2; + sal_uInt16 nOldLine = nLine; + sal_uInt16 nOldCol1 = nCol1; + sal_uInt16 nOldCol2 = nCol2; sal_Unicode buf[ BUF_SIZE ], *p = buf; - bHash = FALSE; + bHash = sal_False; eScanType = SbxVARIANT; aSym.Erase(); bSymbol = - bNumber = bSpaces = FALSE; + bNumber = bSpaces = sal_False; // Zeile einlesen? if( !pLine ) { - INT32 n = nBufPos; - INT32 nLen = aBuf.getLength(); + sal_Int32 n = nBufPos; + sal_Int32 nLen = aBuf.getLength(); if( nBufPos >= nLen ) - return FALSE; + return sal_False; const sal_Unicode* p2 = aBuf.getStr(); p2 += n; while( ( n < nLen ) && ( *p2 != '\n' ) && ( *p2 != '\r' ) ) p2++, n++; - aLine = aBuf.copy( nBufPos, n - nBufPos ); + // #163944# ignore trailing whitespace + sal_Int32 nCopyEndPos = n; + while( (nBufPos < nCopyEndPos) && lclIsWhitespace( aBuf[ nCopyEndPos - 1 ] ) ) + --nCopyEndPos; + aLine = aBuf.copy( nBufPos, nCopyEndPos - nBufPos ); if( n < nLen ) { if( *p2 == '\r' && *( p2+1 ) == '\n' ) @@ -194,8 +208,8 @@ BOOL SbiScanner::NextSym() } // Leerstellen weg: - while( *pLine && (( *pLine == ' ' ) || ( *pLine == '\t' ) || ( *pLine == '\f' )) ) - pLine++, nCol++, bSpaces = TRUE; + while( lclIsWhitespace( *pLine ) ) + pLine++, nCol++, bSpaces = sal_True; nCol1 = nCol; @@ -210,7 +224,7 @@ BOOL SbiScanner::NextSym() { pLine++; nCol++; - bHash = TRUE; + bHash = sal_True; } // Symbol? Dann Zeichen kopieren. @@ -220,11 +234,35 @@ BOOL SbiScanner::NextSym() if( *pLine == '_' && !*(pLine+1) ) { pLine++; goto eoln; } - bSymbol = TRUE; + bSymbol = sal_True; short n = nCol; for ( ; (BasicSimpleCharClass::isAlphaNumeric( *pLine, bCompatible ) || ( *pLine == '_' ) ); pLine++ ) nCol++; aSym = aLine.copy( n, nCol - n ); + + // Special handling for "go to" + if( bCompatible && *pLine && aSym.EqualsIgnoreCaseAscii( "go" ) ) + { + const sal_Unicode* pTestLine = pLine; + short nTestCol = nCol; + while( lclIsWhitespace( *pTestLine ) ) + { + pTestLine++; + nTestCol++; + } + + if( *pTestLine && *(pTestLine + 1) ) + { + String aTestSym = aLine.copy( nTestCol, 2 ); + if( aTestSym.EqualsIgnoreCaseAscii( "to" ) ) + { + aSym = String::CreateFromAscii( "goto" ); + pLine = pTestLine + 2; + nCol = nTestCol + 2; + } + } + } + // Abschliessendes '_' durch Space ersetzen, wenn Zeilenende folgt // (sonst falsche Zeilenfortsetzung) if( !bUsedForHilite && !*pLine && *(pLine-1) == '_' ) @@ -256,13 +294,13 @@ BOOL SbiScanner::NextSym() short ndig = 0; short ncdig = 0; eScanType = SbxDOUBLE; - BOOL bBufOverflow = FALSE; + sal_Bool bBufOverflow = sal_False; while( strchr( "0123456789.DEde", *pLine ) && *pLine ) { // AB 4.1.1996: Buffer voll? -> leer weiter scannen if( (p-buf) == (BUF_SIZE-1) ) { - bBufOverflow = TRUE; + bBufOverflow = sal_True; pLine++, nCol++; continue; } @@ -299,7 +337,7 @@ BOOL SbiScanner::NextSym() if (!exp) ndig++; } *p = 0; - aSym = p; bNumber = TRUE; + aSym = p; bNumber = sal_True; // Komma, Exponent mehrfach vorhanden? if( comma > 1 || exp > 1 ) { aError = '.'; @@ -359,10 +397,10 @@ BOOL SbiScanner::NextSym() // Wird als Operator angesehen pLine--; nCol--; nCol1 = nCol-1; aSym = '&'; return SYMBOL; } - bNumber = TRUE; + bNumber = sal_True; long l = 0; int i; - BOOL bBufOverflow = FALSE; + sal_Bool bBufOverflow = sal_False; while( BasicSimpleCharClass::isAlphaNumeric( *pLine & 0xFF, bCompatible ) ) { sal_Unicode ch = sal::static_int_cast< sal_Unicode >( @@ -370,7 +408,7 @@ BOOL SbiScanner::NextSym() pLine++; nCol++; // AB 4.1.1996: Buffer voll, leer weiter scannen if( (p-buf) == (BUF_SIZE-1) ) - bBufOverflow = TRUE; + bBufOverflow = sal_True; else if( String( cmp ).Search( ch ) != STRING_NOTFOUND ) //else if( strchr( cmp, ch ) ) *p++ = ch; @@ -403,7 +441,7 @@ BOOL SbiScanner::NextSym() { sal_Unicode cSep = *pLine; if( cSep == '[' ) - bSymbol = TRUE, cSep = ']'; + bSymbol = sal_True, cSep = ']'; short n = nCol+1; while( *pLine ) { @@ -423,7 +461,7 @@ BOOL SbiScanner::NextSym() // Doppelte Stringbegrenzer raus String s( cSep ); s += cSep; - USHORT nIdx = 0; + sal_uInt16 nIdx = 0; do { nIdx = aSym.Search( s, nIdx ); @@ -462,15 +500,15 @@ PrevLineCommentLbl: if( bPrevLineExtentsComment || (eScanType != SbxSTRING && ( aSym.GetBuffer()[0] == '\'' || aSym.EqualsIgnoreCaseAscii( "REM" ) ) ) ) { - bPrevLineExtentsComment = FALSE; + bPrevLineExtentsComment = sal_False; aSym = String::CreateFromAscii( "REM" ); - USHORT nLen = String( pLine ).Len(); + sal_uInt16 nLen = String( pLine ).Len(); if( bCompatible && pLine[ nLen - 1 ] == '_' && pLine[ nLen - 2 ] == ' ' ) - bPrevLineExtentsComment = TRUE; + bPrevLineExtentsComment = sal_True; nCol2 = nCol2 + nLen; pLine = NULL; } - return TRUE; + return sal_True; // Sonst Zeilen-Ende: aber bitte auf '_' testen, ob die // Zeile nicht weitergeht! @@ -485,7 +523,7 @@ eoln: // .Method // ^^^ <- spaces is legal in MSO VBA OSL_TRACE("*** resetting bSpaces***"); - bSpaces = FALSE; + bSpaces = sal_False; } return bRes; } @@ -497,7 +535,7 @@ eoln: nCol2 = nOldCol2; aSym = '\n'; nColLock = 0; - return TRUE; + return sal_True; } } diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx index 6ab16e1abf19..8e5badb5330d 100644..100755 --- a/basic/source/comp/symtbl.cxx +++ b/basic/source/comp/symtbl.cxx @@ -59,7 +59,7 @@ SbiStringPool::~SbiStringPool() // Suchen -const String& SbiStringPool::Find( USHORT n ) const +const String& SbiStringPool::Find( sal_uInt16 n ) const { if( !n || n > aData.Count() ) return aEmpty; @@ -70,10 +70,10 @@ const String& SbiStringPool::Find( USHORT n ) const // Hinzufuegen eines Strings. Der String wird Case-Insensitiv // verglichen. -short SbiStringPool::Add( const String& rVal, BOOL bNoCase ) +short SbiStringPool::Add( const String& rVal, sal_Bool bNoCase ) { - USHORT n = aData.Count(); - for( USHORT i = 0; i < n; i++ ) + sal_uInt16 n = aData.Count(); + for( sal_uInt16 i = 0; i < n; i++ ) { String* p = aData.GetObject( i ); if( ( bNoCase && p->Equals( rVal ) ) @@ -126,7 +126,7 @@ void SbiSymPool::Clear() SbiSymDef* SbiSymPool::First() { - nCur = (USHORT) -1; + nCur = (sal_uInt16) -1; return Next(); } @@ -207,9 +207,10 @@ void SbiSymPool::Add( SbiSymDef* pDef ) SbiSymDef* SbiSymPool::Find( const String& rName ) const { - for( USHORT i = 0; i < aData.Count(); i++ ) + sal_uInt16 nCount = aData.Count(); + for( sal_uInt16 i = 0; i < nCount; i++ ) { - SbiSymDef* p = aData.GetObject( i ); + SbiSymDef* p = aData.GetObject( nCount - i - 1 ); if( ( !p->nProcId || ( p->nProcId == nProcId ) ) && ( p->aName.EqualsIgnoreCaseAscii( rName ) ) ) return p; @@ -222,9 +223,9 @@ SbiSymDef* SbiSymPool::Find( const String& rName ) const // Suchen ueber ID-Nummer -SbiSymDef* SbiSymPool::FindId( USHORT n ) const +SbiSymDef* SbiSymPool::FindId( sal_uInt16 n ) const { - for( USHORT i = 0; i < aData.Count(); i++ ) + for( sal_uInt16 i = 0; i < aData.Count(); i++ ) { SbiSymDef* p = aData.GetObject( i ); if( p->nId == n && ( !p->nProcId || ( p->nProcId == nProcId ) ) ) @@ -238,7 +239,7 @@ SbiSymDef* SbiSymPool::FindId( USHORT n ) const // Suchen ueber Position (ab 0) -SbiSymDef* SbiSymPool::Get( USHORT n ) const +SbiSymDef* SbiSymPool::Get( sal_uInt16 n ) const { if( n >= aData.Count() ) return NULL; @@ -246,7 +247,7 @@ SbiSymDef* SbiSymPool::Get( USHORT n ) const return aData.GetObject( n ); } -UINT32 SbiSymPool::Define( const String& rName ) +sal_uInt32 SbiSymPool::Define( const String& rName ) { SbiSymDef* p = Find( rName ); if( p ) @@ -258,7 +259,7 @@ UINT32 SbiSymPool::Define( const String& rName ) return p->Define(); } -UINT32 SbiSymPool::Reference( const String& rName ) +sal_uInt32 SbiSymPool::Reference( const String& rName ) { SbiSymDef* p = Find( rName ); if( !p ) @@ -272,7 +273,7 @@ UINT32 SbiSymPool::Reference( const String& rName ) void SbiSymPool::CheckRefs() { - for( USHORT i = 0; i < aData.Count(); i++ ) + for( sal_uInt16 i = 0; i < aData.Count(); i++ ) { SbiSymDef* p = aData.GetObject( i ); if( !p->IsDefined() ) @@ -304,7 +305,7 @@ SbiSymDef::SbiSymDef( const String& rName ) : aName( rName ) bWithEvents = bByVal = bChained = - bGlobal = FALSE; + bGlobal = sal_False; pIn = pPool = NULL; nDefaultId = 0; @@ -360,11 +361,11 @@ void SbiSymDef::SetType( SbxDataType t ) // Es wird der Wert zurueckgeliefert, der als Operand gespeichert // werden soll. -UINT32 SbiSymDef::Reference() +sal_uInt32 SbiSymDef::Reference() { if( !bChained ) { - UINT32 n = nChain; + sal_uInt32 n = nChain; nChain = pIn->pParser->aGen.GetOffset(); return n; } @@ -374,13 +375,13 @@ UINT32 SbiSymDef::Reference() // Definition eines Symbols. // Hier wird der Backchain aufgeloest, falls vorhanden -UINT32 SbiSymDef::Define() +sal_uInt32 SbiSymDef::Define() { - UINT32 n = pIn->pParser->aGen.GetPC(); + sal_uInt32 n = pIn->pParser->aGen.GetPC(); pIn->pParser->aGen.GenStmnt(); if( nChain ) pIn->pParser->aGen.BackChain( nChain ); nChain = n; - bChained = TRUE; + bChained = sal_True; return nChain; } @@ -409,7 +410,7 @@ SbiSymScope SbiSymDef::GetScope() const // 3) aLabels: Labels SbiProcDef::SbiProcDef( SbiParser* pParser, const String& rName, - BOOL bProcDecl ) + sal_Bool bProcDecl ) : SbiSymDef( rName ) , aParams( pParser->aGblStrings, SbPARAM ) // wird gedumpt , aLabels( pParser->aLclStrings, SbLOCAL ) // wird nicht gedumpt @@ -421,9 +422,9 @@ SbiProcDef::SbiProcDef( SbiParser* pParser, const String& rName, nLine1 = nLine2 = 0; mePropMode = PROPERTY_MODE_NONE; - bPublic = TRUE; - bCdecl = FALSE; - bStatic = FALSE; + bPublic = sal_True; + bCdecl = sal_False; + bStatic = sal_False; // Fuer Returnwerte ist das erste Element der Parameterliste // immer mit dem Namen und dem Typ der Proc definiert aParams.AddSym( aName ); @@ -451,7 +452,7 @@ void SbiProcDef::Match( SbiProcDef* pOld ) { SbiSymDef* po, *pn=NULL; // Parameter 0 ist der Funktionsname - USHORT i; + sal_uInt16 i; for( i = 1; i < aParams.GetSize(); i++ ) { po = pOld->aParams.Get( i ); diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx index bd853a9bda89..c3a953118878 100644..100755 --- a/basic/source/comp/token.cxx +++ b/basic/source/comp/token.cxx @@ -388,10 +388,10 @@ SbiTokenizer::SbiTokenizer( const ::rtl::OUString& rSrc, StarBASIC* pb ) //if( StarBASIC::GetGlobalLanguageMode() == SB_LANG_JAVASCRIPT ) // pTokTable = aTokTable_Java; TokenTable *tp; - bEof = bAs = FALSE; + bEof = bAs = sal_False; eCurTok = NIL; ePush = NIL; - bEos = bKeywords = bErrorIsSymbol = TRUE; + bEos = bKeywords = bErrorIsSymbol = sal_True; if( !nToken ) for( nToken = 0, tp = pTokTable; tp->t; nToken++, tp++ ) {} } @@ -433,9 +433,9 @@ SbiToken SbiTokenizer::Peek() { if( ePush == NIL ) { - USHORT nOldLine = nLine; - USHORT nOldCol1 = nCol1; - USHORT nOldCol2 = nCol2; + sal_uInt16 nOldLine = nLine; + sal_uInt16 nOldCol1 = nCol1; + sal_uInt16 nOldCol2 = nCol2; ePush = Next(); nPLine = nLine; nLine = nOldLine; nPCol1 = nCol1; nCol1 = nOldCol1; @@ -500,15 +500,15 @@ SbiToken SbiTokenizer::Next() // Sonst einlesen: if( !NextSym() ) { - bEof = bEos = TRUE; + bEof = bEos = sal_True; return eCurTok = EOLN; } // Zeilenende? if( aSym.GetBuffer()[0] == '\n' ) { - bEos = TRUE; return eCurTok = EOLN; + bEos = sal_True; return eCurTok = EOLN; } - bEos = FALSE; + bEos = sal_False; // Zahl? if( bNumber ) @@ -575,10 +575,10 @@ special: { // AB, 15.3.96, Spezialbehandlung fuer END, beim Peek() geht die // aktuelle Zeile verloren, daher alles merken und danach restaurieren - USHORT nOldLine = nLine; - USHORT nOldCol = nCol; - USHORT nOldCol1 = nCol1; - USHORT nOldCol2 = nCol2; + sal_uInt16 nOldLine = nLine; + sal_uInt16 nOldCol = nCol; + sal_uInt16 nOldCol1 = nCol1; + sal_uInt16 nOldCol2 = nCol2; String aOldSym = aSym; SaveLine(); // pLine im Scanner sichern @@ -614,11 +614,11 @@ special: eCurTok = tp->t; // AS: Datentypen sind Keywords if( tp->t == AS ) - bAs = TRUE; + bAs = sal_True; else { if( bAs ) - bAs = FALSE; + bAs = sal_False; else if( eCurTok >= DATATYPE1 && eCurTok <= DATATYPE2 && (bErrorIsSymbol || eCurTok != _ERROR_) ) eCurTok = SYMBOL; } @@ -655,12 +655,12 @@ special: // Kann das aktuell eingelesene Token ein Label sein? -BOOL SbiTokenizer::MayBeLabel( BOOL bNeedsColon ) +sal_Bool SbiTokenizer::MayBeLabel( sal_Bool bNeedsColon ) { if( eCurTok == SYMBOL || m_aTokenLabelInfo.canTokenBeLabel( eCurTok ) ) - return bNeedsColon ? DoesColonFollow() : TRUE; + return bNeedsColon ? DoesColonFollow() : sal_True; else - return BOOL( eCurTok == NUMBER + return sal_Bool( eCurTok == NUMBER && eScanType == SbxINTEGER && nVal >= 0 ); } @@ -672,8 +672,8 @@ BOOL SbiTokenizer::MayBeLabel( BOOL bNeedsColon ) void SbiTokenizer::Hilite( SbTextPortions& rList ) { - bErrors = FALSE; - bUsedForHilite = TRUE; + bErrors = sal_False; + bUsedForHilite = sal_True; SbiToken eLastTok = NIL; for( ;; ) { @@ -711,7 +711,7 @@ void SbiTokenizer::Hilite( SbTextPortions& rList ) break; eLastTok = eCurTok; } - bUsedForHilite = FALSE; + bUsedForHilite = sal_False; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/inc/buffer.hxx b/basic/source/inc/buffer.hxx index 7a6a2092693d..24c4bc002f60 100644..100755 --- a/basic/source/inc/buffer.hxx +++ b/basic/source/inc/buffer.hxx @@ -38,27 +38,27 @@ class SbiBuffer { // Code/Konstanten-Puffer: SbiParser* pParser; // fuer Fehlermeldungen char* pBuf; // Puffer-Pointer char* pCur; // aktueller Puffer-Pointer - UINT32 nOff; // aktuelles Offset - UINT32 nSize; // aktuelle Groesse + sal_uInt32 nOff; // aktuelles Offset + sal_uInt32 nSize; // aktuelle Groesse short nInc; // Inkrement - BOOL Check( USHORT ); // Buffergroesse testen + sal_Bool Check( sal_uInt16 ); // Buffergroesse testen public: SbiBuffer( SbiParser*, short ); // Inkrement ~SbiBuffer(); - void Patch( UINT32, UINT32 ); // Patchen - void Chain( UINT32 ); // Back-Chain - void Align( INT32 ); // Alignment - BOOL Add( const void*, USHORT );// Element anfuegen - BOOL operator += (const String&);// Basic-String speichern - BOOL operator += (INT8); // Zeichen speichern - BOOL operator += (INT16); // Integer speichern - BOOL operator += (UINT8); // Zeichen speichern - BOOL operator += (UINT16); // Integer speichern - BOOL operator += (UINT32); // Integer speichern - BOOL operator += (INT32); // Integer speichern + void Patch( sal_uInt32, sal_uInt32 ); // Patchen + void Chain( sal_uInt32 ); // Back-Chain + void Align( sal_Int32 ); // Alignment + sal_Bool Add( const void*, sal_uInt16 );// Element anfuegen + sal_Bool operator += (const String&);// Basic-String speichern + sal_Bool operator += (sal_Int8); // Zeichen speichern + sal_Bool operator += (sal_Int16); // Integer speichern + sal_Bool operator += (sal_uInt8); // Zeichen speichern + sal_Bool operator += (sal_uInt16); // Integer speichern + sal_Bool operator += (sal_uInt32); // Integer speichern + sal_Bool operator += (sal_Int32); // Integer speichern char* GetBuffer(); // Puffer rausgeben (selbst loeschen!) char* GetBufferPtr(){ return pBuf; } - UINT32 GetSize() { return nOff; } + sal_uInt32 GetSize() { return nOff; } }; #endif diff --git a/basic/source/inc/codegen.hxx b/basic/source/inc/codegen.hxx index cfafcddec8e0..21d19312fd17 100644..100755 --- a/basic/source/inc/codegen.hxx +++ b/basic/source/inc/codegen.hxx @@ -41,28 +41,28 @@ class SbiCodeGen { // Code-Erzeugung: SbiBuffer aCode; // Code-Puffer short nLine, nCol; // Zeile, Spalte fuer Stmnt-Befehl short nForLevel; // #29955 for-Schleifen-Ebene - BOOL bStmnt; // TRUE: Statement-Opcode liegt an + sal_Bool bStmnt; // sal_True: Statement-Opcode liegt an public: SbiCodeGen( SbModule&, SbiParser*, short ); SbiParser* GetParser() { return pParser; } SbModule& GetModule() { return rMod; } - UINT32 Gen( SbiOpcode ); - UINT32 Gen( SbiOpcode, UINT32 ); - UINT32 Gen( SbiOpcode, UINT32, UINT32 ); - void Patch( UINT32 o, UINT32 v ){ aCode.Patch( o, v ); } - void BackChain( UINT32 off ) { aCode.Chain( off ); } + sal_uInt32 Gen( SbiOpcode ); + sal_uInt32 Gen( SbiOpcode, sal_uInt32 ); + sal_uInt32 Gen( SbiOpcode, sal_uInt32, sal_uInt32 ); + void Patch( sal_uInt32 o, sal_uInt32 v ){ aCode.Patch( o, v ); } + void BackChain( sal_uInt32 off ) { aCode.Chain( off ); } void Statement(); void GenStmnt(); // evtl. Statement-Opcode erzeugen - UINT32 GetPC(); - UINT32 GetOffset() { return GetPC() + 1; } + sal_uInt32 GetPC(); + sal_uInt32 GetOffset() { return GetPC() + 1; } void Save(); // #29955 for-Schleifen-Ebene pflegen void IncForLevel( void ) { nForLevel++; } void DecForLevel( void ) { nForLevel--; } - static UINT32 calcNewOffSet( BYTE* pCode, UINT16 nOffset ); - static UINT16 calcLegacyOffSet( BYTE* pCode, UINT32 nOffset ); + static sal_uInt32 calcNewOffSet( sal_uInt8* pCode, sal_uInt16 nOffset ); + static sal_uInt16 calcLegacyOffSet( sal_uInt8* pCode, sal_uInt32 nOffset ); }; @@ -70,8 +70,8 @@ template < class T, class S > class PCodeBuffConvertor { T m_nSize; // - BYTE* m_pStart; - BYTE* m_pCnvtdBuf; + sal_uInt8* m_pStart; + sal_uInt8* m_pCnvtdBuf; S m_nCnvtdSize; // // Disable usual copying symantics and bodgy default ctor @@ -79,11 +79,11 @@ class PCodeBuffConvertor PCodeBuffConvertor(const PCodeBuffConvertor& ); PCodeBuffConvertor& operator = ( const PCodeBuffConvertor& ); public: - PCodeBuffConvertor( BYTE* pCode, T nSize ): m_nSize( nSize ), m_pStart( pCode ), m_pCnvtdBuf( NULL ), m_nCnvtdSize( 0 ){ convert(); } + PCodeBuffConvertor( sal_uInt8* pCode, T nSize ): m_nSize( nSize ), m_pStart( pCode ), m_pCnvtdBuf( NULL ), m_nCnvtdSize( 0 ){ convert(); } S GetSize(){ return m_nCnvtdSize; } void convert(); // Caller owns the buffer returned - BYTE* GetBuffer() { return m_pCnvtdBuf; } + sal_uInt8* GetBuffer() { return m_pCnvtdBuf; } }; // #111897 PARAM_INFO flags start at 0x00010000 to not diff --git a/basic/source/inc/collelem.hxx b/basic/source/inc/collelem.hxx index 2c39e711f993..2c39e711f993 100644..100755 --- a/basic/source/inc/collelem.hxx +++ b/basic/source/inc/collelem.hxx diff --git a/basic/source/inc/disas.hxx b/basic/source/inc/disas.hxx index 93929dab42a9..1756d36bfacf 100644..100755 --- a/basic/source/inc/disas.hxx +++ b/basic/source/inc/disas.hxx @@ -38,14 +38,14 @@ class SbiDisas { const SbiImage& rImg; SbModule* pMod; char cLabels[ MAX_LABELS ]; // Bitvektor fuer Labels - UINT32 nOff; // aktuelle Position - UINT32 nPC; // Position des Opcodes + sal_uInt32 nOff; // aktuelle Position + sal_uInt32 nPC; // Position des Opcodes SbiOpcode eOp; // Opcode - UINT32 nOp1, nOp2; // Operanden - UINT32 nParts; // 1, 2 oder 3 - UINT32 nLine; // aktuelle Zeile - BOOL DisasLine( String& ); - BOOL Fetch(); // naechster Opcode + sal_uInt32 nOp1, nOp2; // Operanden + sal_uInt32 nParts; // 1, 2 oder 3 + sal_uInt32 nLine; // aktuelle Zeile + sal_Bool DisasLine( String& ); + sal_Bool Fetch(); // naechster Opcode public: SbiDisas( SbModule*, const SbiImage* ); void Disas( SvStream& ); diff --git a/basic/source/inc/dlgcont.hxx b/basic/source/inc/dlgcont.hxx index 94c10ca86b2e..94c10ca86b2e 100644..100755 --- a/basic/source/inc/dlgcont.hxx +++ b/basic/source/inc/dlgcont.hxx diff --git a/basic/source/inc/errobject.hxx b/basic/source/inc/errobject.hxx index 1e94a3927e93..1e94a3927e93 100644..100755 --- a/basic/source/inc/errobject.hxx +++ b/basic/source/inc/errobject.hxx diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx index 1819877f5c43..0ae218d14c18 100644..100755 --- a/basic/source/inc/expr.hxx +++ b/basic/source/inc/expr.hxx @@ -99,7 +99,7 @@ class SbiExprNode { // Operatoren (und Operanden) friend class SbiExpression; friend class SbiConstExpression; union { - USHORT nTypeStrId; // gepoolter String-ID, #i59791/#i45570 Now only for TypeOf + sal_uInt16 nTypeStrId; // gepoolter String-ID, #i59791/#i45570 Now only for TypeOf double nVal; // numerischer Wert SbVar aVar; // oder Variable }; @@ -111,19 +111,19 @@ class SbiExprNode { // Operatoren (und Operanden) SbiNodeType eNodeType; // Art des Nodes SbxDataType eType; // aktueller Datentyp SbiToken eTok; // Token des Operators - BOOL bComposite; // TRUE: Zusammengesetzter Ausdruck - BOOL bError; // TRUE: Fehlerhaft + sal_Bool bComposite; // sal_True: Zusammengesetzter Ausdruck + sal_Bool bError; // sal_True: Fehlerhaft void FoldConstants(); // Constant Folding durchfuehren void CollectBits(); // Umwandeln von Zahlen in Strings - BOOL IsOperand() // TRUE, wenn Operand - { return BOOL( eNodeType != SbxNODE && eNodeType != SbxTYPEOF && eNodeType != SbxNEW ); } - BOOL IsTypeOf() - { return BOOL( eNodeType == SbxTYPEOF ); } - BOOL IsNew() - { return BOOL( eNodeType == SbxNEW ); } - BOOL IsNumber(); // TRUE bei Zahlen - BOOL IsString(); // TRUE bei Strings - BOOL IsLvalue(); // TRUE, falls als Lvalue verwendbar + sal_Bool IsOperand() // sal_True, wenn Operand + { return sal_Bool( eNodeType != SbxNODE && eNodeType != SbxTYPEOF && eNodeType != SbxNEW ); } + sal_Bool IsTypeOf() + { return sal_Bool( eNodeType == SbxTYPEOF ); } + sal_Bool IsNew() + { return sal_Bool( eNodeType == SbxNEW ); } + sal_Bool IsNumber(); // sal_True bei Zahlen + sal_Bool IsString(); // sal_True bei Strings + sal_Bool IsLvalue(); // sal_True, falls als Lvalue verwendbar void GenElement( SbiOpcode ); // Element void BaseInit( SbiParser* p ); // Hilfsfunktion fuer Ctor, AB 17.12.95 public: @@ -132,15 +132,15 @@ public: SbiExprNode( SbiParser*, const String& ); SbiExprNode( SbiParser*, const SbiSymDef&, SbxDataType, SbiExprList* = NULL ); SbiExprNode( SbiParser*, SbiExprNode*, SbiToken, SbiExprNode* ); - SbiExprNode( SbiParser*, SbiExprNode*, USHORT ); // #120061 TypeOf - SbiExprNode( SbiParser*, USHORT ); // new <type> + SbiExprNode( SbiParser*, SbiExprNode*, sal_uInt16 ); // #120061 TypeOf + SbiExprNode( SbiParser*, sal_uInt16 ); // new <type> virtual ~SbiExprNode(); - BOOL IsValid() { return BOOL( !bError ); } - BOOL IsConstant() // TRUE bei konstantem Operanden - { return BOOL( eNodeType == SbxSTRVAL || eNodeType == SbxNUMVAL ); } - BOOL IsIntConst(); // TRUE bei Integer-Konstanten - BOOL IsVariable(); // TRUE, wenn Variable + sal_Bool IsValid() { return sal_Bool( !bError ); } + sal_Bool IsConstant() // sal_True bei konstantem Operanden + { return sal_Bool( eNodeType == SbxSTRVAL || eNodeType == SbxNUMVAL ); } + sal_Bool IsIntConst(); // sal_True bei Integer-Konstanten + sal_Bool IsVariable(); // sal_True, wenn Variable SbiExprNode* GetWithParent() { return pWithParent; } void SetWithParent( SbiExprNode* p ) { pWithParent = p; } @@ -173,11 +173,11 @@ protected: SbiExprNode* pExpr; // Der Expression-Baum SbiExprType eCurExpr; // Art des Ausdrucks SbiExprMode m_eMode; // Expression context - BOOL bBased; // TRUE: einfacher DIM-Teil (+BASE) - BOOL bError; // TRUE: Fehler - BOOL bByVal; // TRUE: ByVal-Parameter - BOOL bBracket; // TRUE: Parameter list with brackets - USHORT nParenLevel; + sal_Bool bBased; // sal_True: einfacher DIM-Teil (+BASE) + sal_Bool bError; // sal_True: Fehler + sal_Bool bByVal; // sal_True: ByVal-Parameter + sal_Bool bBracket; // sal_True: Parameter list with brackets + sal_uInt16 nParenLevel; SbiExprNode* Term( const KeywordSymbolInfo* pKeywordSymbolInfo = NULL ); SbiExprNode* ObjTerm( SbiSymDef& ); SbiExprNode* Operand( bool bUsedForTypeOf = false ); @@ -206,16 +206,16 @@ public: SbiExpression( SbiParser*, SbiToken ); // Spezial-Expr mit Spezial-Tokens ~SbiExpression(); String& GetName() { return aArgName; } - void SetBased() { bBased = TRUE; } - BOOL IsBased() { return bBased; } - void SetByVal() { bByVal = TRUE; } - BOOL IsByVal() { return bByVal; } - BOOL IsBracket() { return bBracket; } - BOOL IsValid() { return pExpr->IsValid(); } - BOOL IsConstant() { return pExpr->IsConstant(); } - BOOL IsVariable() { return pExpr->IsVariable(); } - BOOL IsLvalue() { return pExpr->IsLvalue(); } - BOOL IsIntConstant() { return pExpr->IsIntConst(); } + void SetBased() { bBased = sal_True; } + sal_Bool IsBased() { return bBased; } + void SetByVal() { bByVal = sal_True; } + sal_Bool IsByVal() { return bByVal; } + sal_Bool IsBracket() { return bBracket; } + sal_Bool IsValid() { return pExpr->IsValid(); } + sal_Bool IsConstant() { return pExpr->IsConstant(); } + sal_Bool IsVariable() { return pExpr->IsVariable(); } + sal_Bool IsLvalue() { return pExpr->IsLvalue(); } + sal_Bool IsIntConstant() { return pExpr->IsIntConst(); } const String& GetString() { return pExpr->GetString(); } SbiSymDef* GetVar() { return pExpr->GetVar(); } SbiSymDef* GetRealVar() { return pExpr->GetRealVar(); } @@ -243,31 +243,31 @@ protected: SbiExpression* pFirst; // Expressions short nExpr; // Anzahl Expressions short nDim; // Anzahl Dimensionen - BOOL bError; // TRUE: Fehler - BOOL bBracket; // TRUE: Klammern + sal_Bool bError; // sal_True: Fehler + sal_Bool bBracket; // sal_True: Klammern public: SbiExprList( SbiParser* ); virtual ~SbiExprList(); - BOOL IsBracket() { return bBracket; } - BOOL IsValid() { return BOOL( !bError ); } + sal_Bool IsBracket() { return bBracket; } + sal_Bool IsValid() { return sal_Bool( !bError ); } short GetSize() { return nExpr; } short GetDims() { return nDim; } SbiExpression* Get( short ); - BOOL Test( const SbiProcDef& ); // Parameter-Checks + sal_Bool Test( const SbiProcDef& ); // Parameter-Checks void Gen(); // Code-Erzeugung void addExpression( SbiExpression* pExpr ); }; class SbiParameters : public SbiExprList { public: - SbiParameters( SbiParser*, BOOL bConst = FALSE, BOOL bPar = TRUE);// parsender Ctor + SbiParameters( SbiParser*, sal_Bool bConst = sal_False, sal_Bool bPar = sal_True);// parsender Ctor }; class SbiDimList : public SbiExprList { - BOOL bConst; // TRUE: Alles sind Integer-Konstanten + sal_Bool bConst; // sal_True: Alles sind Integer-Konstanten public: SbiDimList( SbiParser* ); // Parsender Ctor - BOOL IsConstant() { return bConst; } + sal_Bool IsConstant() { return bConst; } }; #endif diff --git a/basic/source/inc/filefmt.hxx b/basic/source/inc/filefmt.hxx index 0319daf7261b..087581617297 100644..100755 --- a/basic/source/inc/filefmt.hxx +++ b/basic/source/inc/filefmt.hxx @@ -58,9 +58,9 @@ class SvStream; // Diese Records enthalten wiederum weitere Records. Jeder Record hat // den folgenden Header: -// UINT16 Kennung -// UINT32 Laenge des Records ohne Header -// UINT16 Anzahl Unterelemente +// sal_uInt16 Kennung +// sal_uInt32 Laenge des Records ohne Header +// sal_uInt16 Anzahl Unterelemente // Alle Datei-Offsets in Records sind relativ zum Start des Moduls! @@ -85,33 +85,33 @@ class SvStream; #endif // Ein Library Record enthaelt nur Module Records -// UINT16 Kennung BL -// UINT32 Laenge des Records -// UINT16 Anzahl Module +// sal_uInt16 Kennung BL +// sal_uInt32 Laenge des Records +// sal_uInt16 Anzahl Module // Ein Modul-Record enthaelt alle anderen Recordtypen -// UINT16 Kennung BM -// UINT32 Laenge des Records -// UINT16 1 +// sal_uInt16 Kennung BM +// sal_uInt32 Laenge des Records +// sal_uInt16 1 // Daten: -// UINT32 Versionsnummer -// UINT32 Zeichensatz -// UINT32 Startadresse Initialisierungscode -// UINT32 Startadresse Sub Main -// UINT32 Reserviert -// UINT32 Reserviert +// sal_uInt32 Versionsnummer +// sal_uInt32 Zeichensatz +// sal_uInt32 Startadresse Initialisierungscode +// sal_uInt32 Startadresse Sub Main +// sal_uInt32 Reserviert +// sal_uInt32 Reserviert // Modulname, Kommentar und Quellcode: -// UINT16 Kennung MN, MC oder SC -// UINT32 Laenge des Records -// UINT16 1 +// sal_uInt16 Kennung MN, MC oder SC +// sal_uInt32 Laenge des Records +// sal_uInt16 1 // Daten: // String-Instanz // P-Code: -// UINT16 Kennung PC -// UINT32 Laenge des Records -// UINT16 1 +// sal_uInt16 Kennung PC +// sal_uInt32 Laenge des Records +// sal_uInt16 1 // Daten: // Der P-Code als Bytesack @@ -119,62 +119,62 @@ class SvStream; // Verweise auf diese Strings sind in Form eines Indexes in diesen Pool. // Liste aller Publics: -// UINT16 Kennung PU oder Pu -// UINT32 Laenge des Records -// UINT16 Anzahl der Publics +// sal_uInt16 Kennung PU oder Pu +// sal_uInt32 Laenge des Records +// sal_uInt16 Anzahl der Publics // Daten fuer jeden Public-Eintrag: -// UINT16 String-Index -// UINT32 Startadresse im P-Code-Image (UINT16 fuer alte Publics) -// UINT16 Datentyp des Returnwertes (ab Version 2) +// sal_uInt16 String-Index +// sal_uInt32 Startadresse im P-Code-Image (sal_uInt16 fuer alte Publics) +// sal_uInt16 Datentyp des Returnwertes (ab Version 2) // Verzeichnis der Symbol-Tabellen: -// UINT16 Kennung SP -// UINT32 Laenge des Records -// UINT16 Anzahl der Symboltabellen +// sal_uInt16 Kennung SP +// sal_uInt32 Laenge des Records +// sal_uInt16 Anzahl der Symboltabellen // Daten fuer jede Symboltabelle: -// UINT16 Stringindex des Namens -// UINT16 Anzahl Symbole -// UINT16 Scope-Kennung +// sal_uInt16 Stringindex des Namens +// sal_uInt16 Anzahl Symbole +// sal_uInt16 Scope-Kennung // Symboltabelle: -// UINT16 Kennung SY -// UINT32 Laenge des Records -// UINT16 Anzahl der Symbole +// sal_uInt16 Kennung SY +// sal_uInt32 Laenge des Records +// sal_uInt16 Anzahl der Symbole // Daten: -// UINT16 Stringindex des Namens -// UINT16 Anzahl Symbole +// sal_uInt16 Stringindex des Namens +// sal_uInt16 Anzahl Symbole // Daten fuer jedes Symbol: -// UINT16 Stringindex des Namens -// UINT16 Datentyp -// UINT16 Laenge bei STRING*n-Symbolen (0x8000: STATIC-Variable) +// sal_uInt16 Stringindex des Namens +// sal_uInt16 Datentyp +// sal_uInt16 Laenge bei STRING*n-Symbolen (0x8000: STATIC-Variable) // Stringpool: -// UINT16 Kennung ST -// UINT32 Laenge des Records -// UINT16 Anzahl der Strings +// sal_uInt16 Kennung ST +// sal_uInt32 Laenge des Records +// sal_uInt16 Anzahl der Strings // Daten fuer jeden String: -// UINT32 Offset in den Block aller Strings +// sal_uInt32 Offset in den Block aller Strings // Danach folgt der Block aller Strings, die dort als ASCIIZ-Strings liegen. // Line Ranges: -// UINT16 Kennung LR -// UINT32 Laenge des Records -// UINT16 Anzahl der Strings +// sal_uInt16 Kennung LR +// sal_uInt32 Laenge des Records +// sal_uInt16 Anzahl der Strings // Daten fuer jedes Public: -// UINT16 1. Zeile (Sub XXX) -// UINT16 2. Zeile (End Sub) +// sal_uInt16 1. Zeile (Sub XXX) +// sal_uInt16 2. Zeile (End Sub) // SBX-Objekte: -// UINT16 Anzahl Objekte +// sal_uInt16 Anzahl Objekte // .... Objektdaten //////////////////////////////////////////////////////////////////////////// // Service-Routinen (in IMAGE.CXX) -BOOL SbGood( SvStream& r ); -ULONG SbOpenRecord( SvStream&, UINT16 nSignature, UINT16 nElem ); -void SbCloseRecord( SvStream&, ULONG ); +sal_Bool SbGood( SvStream& r ); +sal_uIntPtr SbOpenRecord( SvStream&, sal_uInt16 nSignature, sal_uInt16 nElem ); +void SbCloseRecord( SvStream&, sal_uIntPtr ); #endif diff --git a/basic/source/inc/image.hxx b/basic/source/inc/image.hxx index 24a530ed1061..b852ba1e427f 100644..100755 --- a/basic/source/inc/image.hxx +++ b/basic/source/inc/image.hxx @@ -43,25 +43,25 @@ class SbiImage { SbxArrayRef rTypes; // User defined types SbxArrayRef rEnums; // Enum types - UINT32* pStringOff; // StringId-Offsets + sal_uInt32* pStringOff; // StringId-Offsets sal_Unicode* pStrings; // StringPool char* pCode; // Code-Image char* pLegacyPCode; // Code-Image - BOOL bError; // TRUE: Fehler - USHORT nFlags; // Flags (s.u.) + sal_Bool bError; // sal_True: Fehler + sal_uInt16 nFlags; // Flags (s.u.) short nStrings; // Anzahl Strings - UINT32 nStringSize; // Groesse des String-Puffers - UINT32 nCodeSize; // Groesse des Code-Blocks - UINT16 nLegacyCodeSize; // Groesse des Code-Blocks - UINT16 nDimBase; // OPTION BASE-Wert + sal_uInt32 nStringSize; // Groesse des String-Puffers + sal_uInt32 nCodeSize; // Groesse des Code-Blocks + sal_uInt16 nLegacyCodeSize; // Groesse des Code-Blocks + sal_uInt16 nDimBase; // OPTION BASE-Wert rtl_TextEncoding eCharSet; // Zeichensatz fuer Strings // temporaere Verwaltungs-Variable: short nStringIdx; // aktueller String-Index - UINT32 nStringOff; // aktuelle Pos im Stringpuffer + sal_uInt32 nStringOff; // aktuelle Pos im Stringpuffer // Routinen fuer Compiler: void MakeStrings( short ); // StringPool einrichten void AddString( const String& );// String zufuegen - void AddCode( char*, UINT32 ); // Codeblock dazu + void AddCode( char*, sal_uInt32 ); // Codeblock dazu void AddType(SbxObject *); // User-Type mit aufnehmen void AddEnum(SbxObject *); // Register enum type @@ -69,35 +69,35 @@ public: String aName; // Makroname ::rtl::OUString aOUSource; // Quellcode String aComment; // Kommentar - BOOL bInit; // TRUE: Init-Code ist gelaufen - BOOL bFirstInit; // TRUE, wenn das Image das erste mal nach + sal_Bool bInit; // sal_True: Init-Code ist gelaufen + sal_Bool bFirstInit; // sal_True, wenn das Image das erste mal nach // dem Compilieren initialisiert wird. SbiImage(); ~SbiImage(); void Clear(); // Inhalt loeschen - BOOL Load( SvStream&, UINT32& nVer ); // Loads image from stream + sal_Bool Load( SvStream&, sal_uInt32& nVer ); // Loads image from stream // nVer is set to version // of image - BOOL Load( SvStream& ); - BOOL Save( SvStream&, UINT32 = B_CURVERSION ); - BOOL IsError() { return bError; } + sal_Bool Load( SvStream& ); + sal_Bool Save( SvStream&, sal_uInt32 = B_CURVERSION ); + sal_Bool IsError() { return bError; } const char* GetCode() const { return pCode; } - UINT32 GetCodeSize() const { return nCodeSize; } + sal_uInt32 GetCodeSize() const { return nCodeSize; } ::rtl::OUString& GetSource32() { return aOUSource; } - USHORT GetBase() const { return nDimBase; } + sal_uInt16 GetBase() const { return nDimBase; } String GetString( short nId ) const; //const char* GetString( short nId ) const; const SbxObject* FindType (String aTypeName) const; SbxArrayRef GetEnums() { return rEnums; } - void SetFlag( USHORT n ) { nFlags |= n; } - USHORT GetFlag( USHORT n ) const { return nFlags & n; } - UINT16 CalcLegacyOffset( INT32 nOffset ); - UINT32 CalcNewOffset( INT16 nOffset ); + void SetFlag( sal_uInt16 n ) { nFlags |= n; } + sal_uInt16 GetFlag( sal_uInt16 n ) const { return nFlags & n; } + sal_uInt16 CalcLegacyOffset( sal_Int32 nOffset ); + sal_uInt32 CalcNewOffset( sal_Int16 nOffset ); void ReleaseLegacyBuffer(); - BOOL ExceedsLegacyLimits(); + sal_Bool ExceedsLegacyLimits(); }; diff --git a/basic/source/inc/iosys.hxx b/basic/source/inc/iosys.hxx index 6d04889776b7..48d6ce39d506 100644..100755 --- a/basic/source/inc/iosys.hxx +++ b/basic/source/inc/iosys.hxx @@ -48,10 +48,10 @@ class SvStream; class SbiStream { SvStream* pStrm; // der Stream - ULONG nExpandOnWriteTo; // bei Schreibzugriff, den Stream + sal_uIntPtr nExpandOnWriteTo; // bei Schreibzugriff, den Stream // bis zu dieser Groesse aufblasen ByteString aLine; // aktuelle Zeile - ULONG nLine; // aktuelle Zeilennummer + sal_uIntPtr nLine; // aktuelle Zeilennummer short nLen; // Pufferlaenge short nMode; // Bits: short nChan; // aktueller Kanal @@ -63,9 +63,9 @@ public: ~SbiStream(); SbError Open( short, const ByteString&, short, short, short ); SbError Close(); - SbError Read( ByteString&, USHORT = 0, bool bForceReadingPerByte=false ); + SbError Read( ByteString&, sal_uInt16 = 0, bool bForceReadingPerByte=false ); SbError Read( char& ); - SbError Write( const ByteString&, USHORT = 0 ); + SbError Write( const ByteString&, sal_uInt16 = 0 ); bool IsText() const { return (nMode & SBSTRM_BINARY) == 0; } bool IsRandom() const { return (nMode & SBSTRM_RANDOM) != 0; } @@ -74,8 +74,8 @@ public: bool IsAppend() const { return (nMode & SBSTRM_APPEND) != 0; } short GetBlockLen() const { return nLen; } short GetMode() const { return nMode; } - ULONG GetLine() const { return nLine; } - void SetExpandOnWriteTo( ULONG n ) { nExpandOnWriteTo = n; } + sal_uIntPtr GetLine() const { return nLine; } + void SetExpandOnWriteTo( sal_uIntPtr n ) { nExpandOnWriteTo = n; } void ExpandFile(); SvStream* GetStrm() { return pStrm; } }; diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx index 419230c1c2b6..419230c1c2b6 100644..100755 --- a/basic/source/inc/namecont.hxx +++ b/basic/source/inc/namecont.hxx diff --git a/basic/source/inc/object.hxx b/basic/source/inc/object.hxx index c1fdad21d1ce..1b25ee41a25d 100644..100755 --- a/basic/source/inc/object.hxx +++ b/basic/source/inc/object.hxx @@ -59,7 +59,7 @@ using SbxVariable::GetInfo; public: #endif typedef void( SampleObject::*pMeth ) - ( SbxVariable* pThis, SbxArray* pArgs, BOOL bWrite ); + ( SbxVariable* pThis, SbxArray* pArgs, sal_Bool bWrite ); #if defined ( ICC ) private: #endif @@ -73,10 +73,10 @@ private: static Methods aMethods[]; // Methodentabelle // Methoden - void Display( SbxVariable*, SbxArray*, BOOL ); - void Event( SbxVariable*, SbxArray*, BOOL ); - void Square( SbxVariable*, SbxArray*, BOOL ); - void Create( SbxVariable*, SbxArray*, BOOL ); + void Display( SbxVariable*, SbxArray*, sal_Bool ); + void Event( SbxVariable*, SbxArray*, sal_Bool ); + void Square( SbxVariable*, SbxArray*, sal_Bool ); + void Create( SbxVariable*, SbxArray*, sal_Bool ); // Infoblock auffuellen SbxInfo* GetInfo( short nIdx ); // Broadcaster Notification diff --git a/basic/source/inc/opcodes.hxx b/basic/source/inc/opcodes.hxx index cbc98ac22fd4..cbc98ac22fd4 100644..100755 --- a/basic/source/inc/opcodes.hxx +++ b/basic/source/inc/opcodes.hxx diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx index 3db87e49817c..1b58e5d39f0b 100644..100755 --- a/basic/source/inc/parser.hxx +++ b/basic/source/inc/parser.hxx @@ -47,24 +47,24 @@ class SbiParser : public SbiTokenizer SbiProcDef* pProc; // aktuelle Prozedur SbiExprNode* pWithVar; // aktuelle With-Variable SbiToken eEndTok; // das Ende-Token - UINT32 nGblChain; // Chainkette fuer globale DIMs - BOOL bGblDefs; // TRUE globale Definitionen allgemein - BOOL bNewGblDefs; // TRUE globale Definitionen vor Sub - BOOL bSingleLineIf; // TRUE einzeiliges if-Statement - - SbiSymDef* VarDecl( SbiDimList**,BOOL,BOOL );// Variablen-Deklaration - SbiProcDef* ProcDecl(BOOL bDecl);// Prozedur-Deklaration - void DefStatic( BOOL bPrivate ); - void DefProc( BOOL bStatic, BOOL bPrivate ); // Prozedur einlesen - void DefVar( SbiOpcode eOp, BOOL bStatic ); // DIM/REDIM einlesen - void TypeDecl( SbiSymDef&, BOOL bAsNewAlreadyParsed=FALSE ); // AS-Deklaration + sal_uInt32 nGblChain; // Chainkette fuer globale DIMs + sal_Bool bGblDefs; // sal_True globale Definitionen allgemein + sal_Bool bNewGblDefs; // sal_True globale Definitionen vor Sub + sal_Bool bSingleLineIf; // sal_True einzeiliges if-Statement + + SbiSymDef* VarDecl( SbiDimList**,sal_Bool,sal_Bool );// Variablen-Deklaration + SbiProcDef* ProcDecl(sal_Bool bDecl);// Prozedur-Deklaration + void DefStatic( sal_Bool bPrivate ); + void DefProc( sal_Bool bStatic, sal_Bool bPrivate ); // Prozedur einlesen + void DefVar( SbiOpcode eOp, sal_Bool bStatic ); // DIM/REDIM einlesen + void TypeDecl( SbiSymDef&, sal_Bool bAsNewAlreadyParsed=sal_False ); // AS-Deklaration void OpenBlock( SbiToken, SbiExprNode* = NULL ); // Block oeffnen void CloseBlock(); // Block aufloesen - BOOL Channel( BOOL=FALSE ); // Kanalnummer parsen + sal_Bool Channel( sal_Bool=sal_False ); // Kanalnummer parsen void StmntBlock( SbiToken ); // Statement-Block abarbeiten - void DefType( BOOL bPrivate ); // Parse type declaration - void DefEnum( BOOL bPrivate ); // Parse enum declaration - void DefDeclare( BOOL bPrivate ); + void DefType( sal_Bool bPrivate ); // Parse type declaration + void DefEnum( sal_Bool bPrivate ); // Parse enum declaration + void DefDeclare( sal_Bool bPrivate ); void EnableCompatibility(); public: SbxArrayRef rTypeArray; // das Type-Array @@ -79,26 +79,26 @@ public: SbiSymPool* pPool; // aktueller Pool SbiExprType eCurExpr; // aktueller Expr-Typ short nBase; // OPTION BASE-Wert - BOOL bText; // OPTION COMPARE TEXT - BOOL bExplicit; // TRUE: OPTION EXPLICIT - BOOL bClassModule; // TRUE: OPTION ClassModule + sal_Bool bText; // OPTION COMPARE TEXT + sal_Bool bExplicit; // sal_True: OPTION EXPLICIT + sal_Bool bClassModule; // sal_True: OPTION ClassModule StringVector aIfaceVector; // Holds all interfaces implemented by a class module StringVector aRequiredTypes; // Types used in Dim As New <type> outside subs SbxDataType eDefTypes[26]; // DEFxxx-Datentypen SbiParser( StarBASIC*, SbModule* ); - BOOL Parse(); // die Aktion + sal_Bool Parse(); // die Aktion SbiExprNode* GetWithVar(); // Innerste With-Variable liefern // AB 31.3.1996, Symbol in Runtime-Library suchen SbiSymDef* CheckRTLForSym( const String& rSym, SbxDataType eType ); void AddConstants( void ); - BOOL HasGlobalCode(); // Globaler Code definiert? + sal_Bool HasGlobalCode(); // Globaler Code definiert? - BOOL TestToken( SbiToken ); // bestimmtes TOken? - BOOL TestSymbol( BOOL=FALSE ); // Symbol? - BOOL TestComma(); // Komma oder EOLN? + sal_Bool TestToken( SbiToken ); // bestimmtes TOken? + sal_Bool TestSymbol( sal_Bool=sal_False ); // Symbol? + sal_Bool TestComma(); // Komma oder EOLN? void TestEoln(); // EOLN? void Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo = NULL ); // Let oder Call diff --git a/basic/source/inc/propacc.hxx b/basic/source/inc/propacc.hxx index 1381d082dcdd..1497bbc0df9d 100644..100755 --- a/basic/source/inc/propacc.hxx +++ b/basic/source/inc/propacc.hxx @@ -56,7 +56,7 @@ class SbPropertyValues: public SbPropertyValuesHelper NS_UNO::Reference< ::com::sun::star::beans::XPropertySetInfo > _xInfo; private: - INT32 GetIndex_Impl( const ::rtl::OUString &rPropName ) const; + sal_Int32 GetIndex_Impl( const ::rtl::OUString &rPropName ) const; public: SbPropertyValues(); @@ -157,7 +157,7 @@ public: // XPropertyContainer virtual void SAL_CALL addProperty( const ::rtl::OUString& Name, - INT16 Attributes, + sal_Int16 Attributes, const NS_UNO::Any& DefaultValue) throw( NS_BEANS::PropertyExistException, NS_BEANS::IllegalTypeException, NS_LANG::IllegalArgumentException, NS_UNO::RuntimeException ); @@ -181,7 +181,7 @@ public: class StarBASIC; class SbxArray; -void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); +void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ); #undef NS_BEANS diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx index b6b0814d1e33..df694e548844 100644..100755 --- a/basic/source/inc/runtime.hxx +++ b/basic/source/inc/runtime.hxx @@ -103,10 +103,10 @@ struct SbiForStack { // for/next stack: // For each support ForType eForType; - INT32 nCurCollectionIndex; - INT32* pArrayCurIndices; - INT32* pArrayLowerBounds; - INT32* pArrayUpperBounds; + sal_Int32 nCurCollectionIndex; + sal_Int32* pArrayCurIndices; + sal_Int32* pArrayLowerBounds; + sal_Int32* pArrayUpperBounds; Reference< XEnumeration > xEnumeration; SbiForStack( void ) @@ -124,8 +124,8 @@ struct SbiForStack { // for/next stack: struct SbiGosubStack { // GOSUB-Stack: SbiGosubStack* pNext; // Chain - const BYTE* pCode; // Return-Pointer - USHORT nStartForLvl; // #118235: For Level in moment of gosub + const sal_uInt8* pCode; // Return-Pointer + sal_uInt16 nStartForLvl; // #118235: For Level in moment of gosub }; #define MAXRECURSION 500 // max. 500 Rekursionen @@ -150,7 +150,7 @@ public: #else ::osl::Directory* pDir; #endif - INT16 nDirFlags; + sal_Int16 nDirFlags; short nCurDirPos; String sFullNameToBeChecked; @@ -192,9 +192,9 @@ class SbiInstance SbError nErr; // aktueller Fehlercode String aErrorMsg; // letzte Error-Message fuer $ARG - USHORT nErl; // aktuelle Fehlerzeile - BOOL bReschedule; // Flag: TRUE = Reschedule in Hauptschleife - BOOL bCompatibility; // Flag: TRUE = VBA runtime compatibility mode + sal_uInt16 nErl; // aktuelle Fehlerzeile + sal_Bool bReschedule; // Flag: sal_True = Reschedule in Hauptschleife + sal_Bool bCompatibility; // Flag: sal_True = VBA runtime compatibility mode ComponentVector_t ComponentVector; public: @@ -203,9 +203,9 @@ public: // #31460 Neues Konzept fuer StepInto/Over/Out, // Erklaerung siehe runtime.cxx bei SbiInstance::CalcBreakCallLevel() - USHORT nCallLvl; // Call-Level (wg. Rekursion) - USHORT nBreakCallLvl; // Call-Level zum Anhalten - void CalcBreakCallLevel( USHORT nFlags ); // Gemaess Flags setzen + sal_uInt16 nCallLvl; // Call-Level (wg. Rekursion) + sal_uInt16 nBreakCallLvl; // Call-Level zum Anhalten + void CalcBreakCallLevel( sal_uInt16 nFlags ); // Gemaess Flags setzen SbiInstance( StarBASIC* ); ~SbiInstance(); @@ -222,14 +222,14 @@ public: SbError GetErr() { return nErr; } String GetErrorMsg() { return aErrorMsg; } xub_StrLen GetErl() { return nErl; } - void EnableReschedule( BOOL bEnable ) { bReschedule = bEnable; } - BOOL IsReschedule( void ) { return bReschedule; } - void EnableCompatibility( BOOL bEnable ) { bCompatibility = bEnable; } - BOOL IsCompatibility( void ) { return bCompatibility; } + void EnableReschedule( sal_Bool bEnable ) { bReschedule = bEnable; } + sal_Bool IsReschedule( void ) { return bReschedule; } + void EnableCompatibility( sal_Bool bEnable ) { bCompatibility = bEnable; } + sal_Bool IsCompatibility( void ) { return bCompatibility; } ComponentVector_t& getComponentVector( void ) { return ComponentVector; } - SbMethod* GetCaller( USHORT ); + SbMethod* GetCaller( sal_uInt16 ); SbModule* GetActiveModule(); SbxArray* GetLocals( SbMethod* ); @@ -269,9 +269,11 @@ struct RefSaveItem class SbiRuntime { + friend void SbRtl_CallByName( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ); + typedef void( SbiRuntime::*pStep0 )(); - typedef void( SbiRuntime::*pStep1 )( UINT32 nOp1 ); - typedef void( SbiRuntime::*pStep2 )( UINT32 nOp1, UINT32 nOp2 ); + typedef void( SbiRuntime::*pStep1 )( sal_uInt32 nOp1 ); + typedef void( SbiRuntime::*pStep2 )( sal_uInt32 nOp1, sal_uInt32 nOp2 ); static pStep0 aStep0[]; // Opcode-Tabelle Gruppe 0 static pStep1 aStep1[]; // Opcode-Tabelle Gruppe 1 static pStep2 aStep2[]; // Opcode-Tabelle Gruppe 2 @@ -291,15 +293,15 @@ class SbiRuntime SbiArgvStack* pArgvStk; // ARGV-Stack SbiGosubStack* pGosubStk; // GOSUB stack SbiForStack* pForStk; // FOR/NEXT-Stack - USHORT nExprLvl; // Tiefe des Expr-Stacks - USHORT nGosubLvl; // Zum Vermeiden von Tot-Rekursionen - USHORT nForLvl; // #118235: Maintain for level - const BYTE* pCode; // aktueller Code-Pointer - const BYTE* pStmnt; // Beginn des lezten Statements - const BYTE* pError; // Adresse des aktuellen Error-Handlers - const BYTE* pRestart; // Restart-Adresse - const BYTE* pErrCode; // Restart-Adresse RESUME NEXT - const BYTE* pErrStmnt; // Restart-Adresse RESUMT 0 + sal_uInt16 nExprLvl; // Tiefe des Expr-Stacks + sal_uInt16 nGosubLvl; // Zum Vermeiden von Tot-Rekursionen + sal_uInt16 nForLvl; // #118235: Maintain for level + const sal_uInt8* pCode; // aktueller Code-Pointer + const sal_uInt8* pStmnt; // Beginn des lezten Statements + const sal_uInt8* pError; // Adresse des aktuellen Error-Handlers + const sal_uInt8* pRestart; // Restart-Adresse + const sal_uInt8* pErrCode; // Restart-Adresse RESUME NEXT + const sal_uInt8* pErrStmnt; // Restart-Adresse RESUMT 0 String aLibName; // Lib-Name fuer Declare-Call SbxArrayRef refParams; // aktuelle Prozedur-Parameter SbxArrayRef refLocals; // lokale Variable @@ -307,14 +309,14 @@ class SbiRuntime // AB, 28.3.2000 #74254, Ein refSaveObj reicht nicht! Neu: pRefSaveList (s.u.) //SbxVariableRef refSaveObj; // #56368 Bei StepElem Referenz sichern short nArgc; // aktueller Argc - BOOL bRun; // TRUE: Programm ist aktiv - BOOL bError; // TRUE: Fehler behandeln - BOOL bInError; // TRUE: in einem Fehler-Handler - BOOL bBlocked; // TRUE: blocked by next call level, #i48868 - BOOL bVBAEnabled; - USHORT nFlags; // Debugging-Flags + sal_Bool bRun; // sal_True: Programm ist aktiv + sal_Bool bError; // sal_True: Fehler behandeln + sal_Bool bInError; // sal_True: in einem Fehler-Handler + sal_Bool bBlocked; // sal_True: blocked by next call level, #i48868 + sal_Bool bVBAEnabled; + sal_uInt16 nFlags; // Debugging-Flags SbError nError; // letzter Fehler - USHORT nOps; // Opcode-Zaehler + sal_uInt16 nOps; // Opcode-Zaehler sal_uInt32 m_nLastTime; RefSaveItem* pRefSaveList; // #74254 Temporaere Referenzen sichern @@ -343,17 +345,17 @@ class SbiRuntime } SbxVariable* FindElement - ( SbxObject* pObj, UINT32 nOp1, UINT32 nOp2, SbError, BOOL bLocal, BOOL bStatic = FALSE ); - void SetupArgs( SbxVariable*, UINT32 ); + ( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2, SbError, sal_Bool bLocal, sal_Bool bStatic = sal_False ); + void SetupArgs( SbxVariable*, sal_uInt32 ); SbxVariable* CheckArray( SbxVariable* ); void PushVar( SbxVariable* ); // Variable push SbxVariableRef PopVar(); // Variable pop SbxVariable* GetTOS( short=0 ); // Variable vom TOS holen void TOSMakeTemp(); // TOS in temp. Variable wandeln - BOOL ClearExprStack(); // Expr-Stack freigeben + sal_Bool ClearExprStack(); // Expr-Stack freigeben - void PushGosub( const BYTE* ); // GOSUB-Element push + void PushGosub( const sal_uInt8* ); // GOSUB-Element push void PopGosub(); // GOSUB-Element pop void ClearGosubStack(); // GOSUB-Stack freigeben @@ -373,7 +375,7 @@ class SbiRuntime void SetParameters( SbxArray* );// Parameter uebernehmen // MUSS NOCH IMPLEMENTIERT WERDEN - void DllCall( const String&, const String&, SbxArray*, SbxDataType, BOOL ); + void DllCall( const String&, const String&, SbxArray*, SbxDataType, sal_Bool ); // #56204 DIM-Funktionalitaet in Hilfsmethode auslagern (step0.cxx) void DimImpl( SbxVariableRef refVar ); @@ -381,7 +383,7 @@ class SbiRuntime // #115829 bool implIsClass( SbxObject* pObj, const String& aClass ); - void StepSETCLASS_impl( UINT32 nOp1, bool bHandleDflt = false ); + void StepSETCLASS_impl( sal_uInt32 nOp1, bool bHandleDflt = false ); // Die nachfolgenden Routinen werden vom Single Stepper // gerufen und implementieren die einzelnen Opcodes @@ -404,40 +406,40 @@ class SbiRuntime void StepLSET(), StepRSET(), StepREDIMP_ERASE(), StepERASE_CLEAR(); void StepARRAYACCESS(), StepBYVAL(); // Alle Opcodes mit einem Operanden - void StepLOADNC( UINT32 ), StepLOADSC( UINT32 ), StepLOADI( UINT32 ); - void StepARGN( UINT32 ), StepBASED( UINT32 ), StepPAD( UINT32 ); - void StepJUMP( UINT32 ), StepJUMPT( UINT32 ); - void StepJUMPF( UINT32 ), StepONJUMP( UINT32 ); - void StepGOSUB( UINT32 ), StepRETURN( UINT32 ); - void StepTESTFOR( UINT32 ), StepCASETO( UINT32 ), StepERRHDL( UINT32 ); - void StepRESUME( UINT32 ), StepSETCLASS( UINT32 ), StepVBASETCLASS( UINT32 ), StepTESTCLASS( UINT32 ), StepLIB( UINT32 ); + void StepLOADNC( sal_uInt32 ), StepLOADSC( sal_uInt32 ), StepLOADI( sal_uInt32 ); + void StepARGN( sal_uInt32 ), StepBASED( sal_uInt32 ), StepPAD( sal_uInt32 ); + void StepJUMP( sal_uInt32 ), StepJUMPT( sal_uInt32 ); + void StepJUMPF( sal_uInt32 ), StepONJUMP( sal_uInt32 ); + void StepGOSUB( sal_uInt32 ), StepRETURN( sal_uInt32 ); + void StepTESTFOR( sal_uInt32 ), StepCASETO( sal_uInt32 ), StepERRHDL( sal_uInt32 ); + void StepRESUME( sal_uInt32 ), StepSETCLASS( sal_uInt32 ), StepVBASETCLASS( sal_uInt32 ), StepTESTCLASS( sal_uInt32 ), StepLIB( sal_uInt32 ); bool checkClass_Impl( const SbxVariableRef& refVal, const String& aClass, bool bRaiseErrors, bool bDefault = true ); - void StepCLOSE( UINT32 ), StepPRCHAR( UINT32 ), StepARGTYP( UINT32 ); + void StepCLOSE( sal_uInt32 ), StepPRCHAR( sal_uInt32 ), StepARGTYP( sal_uInt32 ); // Alle Opcodes mit zwei Operanden - void StepRTL( UINT32, UINT32 ), StepPUBLIC( UINT32, UINT32 ), StepPUBLIC_P( UINT32, UINT32 ); - void StepPUBLIC_Impl( UINT32, UINT32, bool bUsedForClassModule ); - void StepFIND_Impl( SbxObject* pObj, UINT32 nOp1, UINT32 nOp2, SbError, BOOL bLocal, BOOL bStatic = FALSE ); - void StepFIND( UINT32, UINT32 ), StepELEM( UINT32, UINT32 ); - void StepGLOBAL( UINT32, UINT32 ), StepLOCAL( UINT32, UINT32 ); - void StepPARAM( UINT32, UINT32), StepCREATE( UINT32, UINT32 ); - void StepCALL( UINT32, UINT32 ), StepCALLC( UINT32, UINT32 ); - void StepCASEIS( UINT32, UINT32 ), StepSTMNT( UINT32, UINT32 ); + void StepRTL( sal_uInt32, sal_uInt32 ), StepPUBLIC( sal_uInt32, sal_uInt32 ), StepPUBLIC_P( sal_uInt32, sal_uInt32 ); + void StepPUBLIC_Impl( sal_uInt32, sal_uInt32, bool bUsedForClassModule ); + void StepFIND_Impl( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2, SbError, sal_Bool bLocal, sal_Bool bStatic = sal_False ); + void StepFIND( sal_uInt32, sal_uInt32 ), StepELEM( sal_uInt32, sal_uInt32 ); + void StepGLOBAL( sal_uInt32, sal_uInt32 ), StepLOCAL( sal_uInt32, sal_uInt32 ); + void StepPARAM( sal_uInt32, sal_uInt32), StepCREATE( sal_uInt32, sal_uInt32 ); + void StepCALL( sal_uInt32, sal_uInt32 ), StepCALLC( sal_uInt32, sal_uInt32 ); + void StepCASEIS( sal_uInt32, sal_uInt32 ), StepSTMNT( sal_uInt32, sal_uInt32 ); SbxVariable* StepSTATIC_Impl( String& aName, SbxDataType& t ); - void StepOPEN( UINT32, UINT32 ), StepSTATIC( UINT32, UINT32 ); - void StepTCREATE(UINT32,UINT32), StepDCREATE(UINT32,UINT32); - void StepGLOBAL_P( UINT32, UINT32 ),StepFIND_G( UINT32, UINT32 ); - void StepDCREATE_REDIMP(UINT32,UINT32), StepDCREATE_IMPL(UINT32,UINT32); - void StepFIND_CM( UINT32, UINT32 ); - void StepFIND_STATIC( UINT32, UINT32 ); - void implCreateFixedString( SbxVariable* pStrVar, UINT32 nOp2 ); + void StepOPEN( sal_uInt32, sal_uInt32 ), StepSTATIC( sal_uInt32, sal_uInt32 ); + void StepTCREATE(sal_uInt32,sal_uInt32), StepDCREATE(sal_uInt32,sal_uInt32); + void StepGLOBAL_P( sal_uInt32, sal_uInt32 ),StepFIND_G( sal_uInt32, sal_uInt32 ); + void StepDCREATE_REDIMP(sal_uInt32,sal_uInt32), StepDCREATE_IMPL(sal_uInt32,sal_uInt32); + void StepFIND_CM( sal_uInt32, sal_uInt32 ); + void StepFIND_STATIC( sal_uInt32, sal_uInt32 ); + void implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, sal_uInt32 nOp2 ); public: void SetVBAEnabled( bool bEnabled ); - USHORT GetImageFlag( USHORT n ) const; - USHORT GetBase(); + sal_uInt16 GetImageFlag( sal_uInt16 n ) const; + sal_uInt16 GetBase(); xub_StrLen nLine,nCol1,nCol2; // aktuelle Zeile, Spaltenbereich SbiRuntime* pNext; // Stack-Chain - SbiRuntime( SbModule*, SbMethod*, UINT32 ); + SbiRuntime( SbModule*, SbMethod*, sal_uInt32 ); ~SbiRuntime(); void Error( SbError, bool bVBATranslationAlreadyDone = false ); // Fehler setzen, falls != 0 void Error( SbError, const String& ); // Fehler setzen, falls != 0 @@ -445,15 +447,15 @@ public: void FatalError( SbError, const String& ); // Fehlerbehandlung=Standard, Fehler setzen static sal_Int32 translateErrorToVba( SbError nError, String& rMsg ); void DumpPCode(); - BOOL Step(); // Einzelschritt (ein Opcode) - void Stop() { bRun = FALSE; } - BOOL IsRun() { return bRun; } - void block( void ) { bBlocked = TRUE; } - void unblock( void ) { bBlocked = FALSE; } + sal_Bool Step(); // Einzelschritt (ein Opcode) + void Stop() { bRun = sal_False; } + sal_Bool IsRun() { return bRun; } + void block( void ) { bBlocked = sal_True; } + void unblock( void ) { bBlocked = sal_False; } SbMethod* GetMethod() { return pMeth; } SbModule* GetModule() { return pMod; } - USHORT GetDebugFlags() { return nFlags; } - void SetDebugFlags( USHORT nFl ) { nFlags = nFl; } + sal_uInt16 GetDebugFlags() { return nFlags; } + void SetDebugFlags( sal_uInt16 nFl ) { nFlags = nFl; } SbMethod* GetCaller(); SbxArray* GetLocals(); SbxArray* GetParams(); @@ -487,12 +489,12 @@ StarBASIC* GetCurrentBasic( StarBASIC* pRTBasic ); // no DDE functionality, no DLLCALL) in basic because // of portal "virtual" users (portal user != UNIX user) // (Implemented in iosys.cxx) -BOOL needSecurityRestrictions( void ); +sal_Bool needSecurityRestrictions( void ); -// Returns TRUE if UNO is available, otherwise the old +// Returns sal_True if UNO is available, otherwise the old // file system implementation has to be used // (Implemented in iosys.cxx) -BOOL hasUno( void ); +sal_Bool hasUno( void ); // Converts possibly relative paths to absolute paths // according to the setting done by ChDir/ChDrive diff --git a/basic/source/inc/sbcomp.hxx b/basic/source/inc/sbcomp.hxx index 2918e67880f0..2918e67880f0 100644..100755 --- a/basic/source/inc/sbcomp.hxx +++ b/basic/source/inc/sbcomp.hxx diff --git a/basic/source/inc/sbintern.hxx b/basic/source/inc/sbintern.hxx index 7003b5a0a1bb..34d08f6e8c21 100644..100755 --- a/basic/source/inc/sbintern.hxx +++ b/basic/source/inc/sbintern.hxx @@ -47,7 +47,7 @@ class SbModule; class SbiFactory : public SbxFactory { public: - virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX ); + virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX ); virtual SbxObject* CreateObject( const String& ); }; @@ -80,7 +80,7 @@ public: void AddClassModule( SbModule* pClassModule ); void RemoveClassModule( SbModule* pClassModule ); - virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX ); + virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX ); virtual SbxObject* CreateObject( const String& ); SbModule* FindClass( const String& rClassName ); @@ -118,14 +118,14 @@ struct SbiGlobals SbError nCode; // aktueller Fehlercode xub_StrLen nLine; // aktuelle Zeile xub_StrLen nCol1,nCol2; // aktuelle Spalten (von,bis) - BOOL bCompiler; // Flag fuer Compiler-Error - BOOL bGlobalInitErr; // Beim GlobalInit trat ein Compiler-Fehler auf - BOOL bRunInit; // TRUE, wenn RunInit vom Basic aktiv ist + sal_Bool bCompiler; // Flag fuer Compiler-Error + sal_Bool bGlobalInitErr; // Beim GlobalInit trat ein Compiler-Fehler auf + sal_Bool bRunInit; // sal_True, wenn RunInit vom Basic aktiv ist String aErrMsg; // Puffer fuer GetErrorText() SbLanguageMode eLanguageMode; // Flag fuer Visual-Basic-Script-Modus SbErrorStack* pErrStack; // Stack fuer die im Fehlerfall abgebaute SbiRuntime Kette ::utl::TransliterationWrapper* pTransliterationWrapper; // For StrComp - BOOL bBlockCompilerError; + sal_Bool bBlockCompilerError; BasicManager* pAppBasMgr; StarBASIC* pMSOMacroRuntimLib; // Lib containing MSO Macro Runtime API entry symbols diff --git a/basic/source/inc/sbjsmeth.hxx b/basic/source/inc/sbjsmeth.hxx index f2cc8a3d3865..f2cc8a3d3865 100644..100755 --- a/basic/source/inc/sbjsmeth.hxx +++ b/basic/source/inc/sbjsmeth.hxx diff --git a/basic/source/inc/sbjsmod.hxx b/basic/source/inc/sbjsmod.hxx index b3aa275aec0d..55091dc681c5 100644..100755 --- a/basic/source/inc/sbjsmod.hxx +++ b/basic/source/inc/sbjsmod.hxx @@ -37,8 +37,8 @@ class SbJScriptModule : public SbModule { - virtual BOOL LoadData( SvStream&, USHORT ); - virtual BOOL StoreData( SvStream& ) const; + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; public: SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_JSCRIPTMOD,1); TYPEINFO(); diff --git a/basic/source/inc/sbtrace.hxx b/basic/source/inc/sbtrace.hxx new file mode 100755 index 000000000000..50e344fb63d2 --- /dev/null +++ b/basic/source/inc/sbtrace.hxx @@ -0,0 +1,44 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SBTRACE_HXX +#define _SBTRACE_HXX + +//#define DBG_TRACE_BASIC + +#ifdef DBG_TRACE_BASIC +void dbg_InitTrace( void ); +void dbg_DeInitTrace( void ); +void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl ); +void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl, bool bLeave = false ); +void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, INT32 nCallLvl ); +void dbg_RegisterTraceTextForPC( SbModule* pModule, UINT32 nPC, + const String& aTraceStr_STMNT, const String& aTraceStr_PCode ); +void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); +#endif + +#endif diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx index faf913229ad3..5905f7f4640f 100644..100755 --- a/basic/source/inc/sbunoobj.hxx +++ b/basic/source/inc/sbunoobj.hxx @@ -52,8 +52,8 @@ class SbUnoObject: public SbxObject ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > mxInvocation; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XExactName > mxExactName; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XExactName > mxExactNameInvocation; - BOOL bNeedIntrospection; - BOOL bIgnoreNativeCOMObjectMembers; + sal_Bool bNeedIntrospection; + sal_Bool bNativeCOMObject; ::com::sun::star::uno::Any maTmpUnoObj; // Only to save obj for doIntrospection! // Hilfs-Methode zum Anlegen der dbg_-Properties @@ -85,17 +85,22 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > getInvocation( void ) { return mxInvocation; } void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& ); + + bool isNativeCOMObject( void ) + { return bNativeCOMObject; } }; SV_DECL_IMPL_REF(SbUnoObject); // #67781 Rueckgabewerte der Uno-Methoden loeschen void clearUnoMethods( void ); +void clearUnoMethodsForBasic( StarBASIC* pBasic ); class SbUnoMethod : public SbxMethod { friend class SbUnoObject; friend void clearUnoMethods( void ); + friend void clearUnoMethodsForBasic( StarBASIC* pBasic ); ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlMethod > m_xUnoMethod; ::com::sun::star::uno::Sequence< ::com::sun::star::reflection::ParamInfo >* pParamInfoSeq; @@ -104,13 +109,15 @@ class SbUnoMethod : public SbxMethod SbUnoMethod* pPrev; SbUnoMethod* pNext; - bool mbInvocation; // Method is based on invocation + bool mbInvocation; // Method is based on invocation + bool mbDirectInvocation; // Method should be used with XDirectInvocation interface public: TYPEINFO(); SbUnoMethod( const String& aName_, SbxDataType eSbxType, ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlMethod > xUnoMethod_, - bool bInvocation ); + bool bInvocation, + bool bDirect = false ); virtual ~SbUnoMethod(); virtual SbxInfo* GetInfo(); @@ -118,6 +125,8 @@ public: bool isInvocationBased( void ) { return mbInvocation; } + bool needsDirectInvocation( void ) + { return mbDirectInvocation; } }; @@ -127,7 +136,7 @@ class SbUnoProperty : public SbxProperty // Daten der Uno-Property ::com::sun::star::beans::Property aUnoProp; - INT32 nId; + sal_Int32 nId; bool mbInvocation; // Property is based on invocation @@ -135,7 +144,7 @@ class SbUnoProperty : public SbxProperty public: TYPEINFO(); SbUnoProperty( const String& aName_, SbxDataType eSbxType, - const ::com::sun::star::beans::Property& aUnoProp_, INT32 nId_, bool bInvocation ); + const ::com::sun::star::beans::Property& aUnoProp_, sal_Int32 nId_, bool bInvocation ); bool isInvocationBased( void ) { return mbInvocation; } @@ -145,7 +154,7 @@ public: class SbUnoFactory : public SbxFactory { public: - virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX ); + virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX ); virtual SbxObject* CreateObject( const String& ); }; @@ -284,15 +293,18 @@ public: class StarBASIC; // Impl-Methoden fuer RTL -void RTL_Impl_CreateUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); -void RTL_Impl_CreateUnoService( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); -void RTL_Impl_CreateUnoServiceWithArguments( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); -void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); -void RTL_Impl_GetProcessServiceManager( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); -void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); -void RTL_Impl_IsUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); -void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); -void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); +void RTL_Impl_CreateUnoStruct( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ); +void RTL_Impl_CreateUnoService( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ); +void RTL_Impl_CreateUnoServiceWithArguments( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ); +void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ); +void RTL_Impl_GetProcessServiceManager( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ); +void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ); +void RTL_Impl_IsUnoStruct( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ); +void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ); +void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ); + +void disposeComVariablesForBasic( StarBASIC* pBasic ); +void clearNativeObjectWrapperVector( void ); //======================================================================== @@ -309,8 +321,8 @@ class BasicCollection : public SbxObject virtual ~BasicCollection(); virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType ); - INT32 implGetIndex( SbxVariable* pIndexVar ); - INT32 implGetIndexForName( const String& rName ); + sal_Int32 implGetIndex( SbxVariable* pIndexVar ); + sal_Int32 implGetIndexForName( const String& rName ); void CollAdd( SbxArray* pPar_ ); void CollItem( SbxArray* pPar_ ); void CollRemove( SbxArray* pPar_ ); diff --git a/basic/source/inc/scanner.hxx b/basic/source/inc/scanner.hxx index 5a6a29c1a9c7..5abfc1efdd3c 100644..100755 --- a/basic/source/inc/scanner.hxx +++ b/basic/source/inc/scanner.hxx @@ -57,33 +57,33 @@ protected: short nCol; // aktuelle Spaltennummer short nErrors; // Anzahl Fehler short nColLock; // Lock-Zaehler fuer Col1 - INT32 nBufPos; // aktuelle Buffer-Pos - USHORT nLine; // aktuelle Zeile - USHORT nCol1, nCol2; // aktuelle 1. und 2. Spalte - BOOL bSymbol; // TRUE: Symbol gescannt - BOOL bNumber; // TRUE: Zahl gescannt - BOOL bSpaces; // TRUE: Whitespace vor Token - BOOL bErrors; // TRUE: Fehler generieren - BOOL bAbort; // TRUE: abbrechen - BOOL bHash; // TRUE: # eingelesen - BOOL bError; // TRUE: Fehler generieren - BOOL bUsedForHilite; // TRUE: Nutzung fuer Highlighting - BOOL bCompatible; // TRUE: OPTION Compatibl - BOOL bVBASupportOn; // TRUE: OPTION VBASupport 1 otherwise default False - BOOL bPrevLineExtentsComment; // TRUE: Previous line is comment and ends on "... _" + sal_Int32 nBufPos; // aktuelle Buffer-Pos + sal_uInt16 nLine; // aktuelle Zeile + sal_uInt16 nCol1, nCol2; // aktuelle 1. und 2. Spalte + sal_Bool bSymbol; // sal_True: Symbol gescannt + sal_Bool bNumber; // sal_True: Zahl gescannt + sal_Bool bSpaces; // sal_True: Whitespace vor Token + sal_Bool bErrors; // sal_True: Fehler generieren + sal_Bool bAbort; // sal_True: abbrechen + sal_Bool bHash; // sal_True: # eingelesen + sal_Bool bError; // sal_True: Fehler generieren + sal_Bool bUsedForHilite; // sal_True: Nutzung fuer Highlighting + sal_Bool bCompatible; // sal_True: OPTION Compatibl + sal_Bool bVBASupportOn; // sal_True: OPTION VBASupport 1 otherwise default False + sal_Bool bPrevLineExtentsComment; // sal_True: Previous line is comment and ends on "... _" void GenError( SbError ); public: SbiScanner( const ::rtl::OUString&, StarBASIC* = NULL ); ~SbiScanner(); - void EnableErrors() { bError = FALSE; } - BOOL IsHash() { return bHash; } - BOOL IsCompatible() { return bCompatible; } + void EnableErrors() { bError = sal_False; } + sal_Bool IsHash() { return bHash; } + sal_Bool IsCompatible() { return bCompatible; } void SetCompatible( bool b ) { bCompatible = b; } // #118206 - BOOL IsVBASupportOn() { return bVBASupportOn; } + sal_Bool IsVBASupportOn() { return bVBASupportOn; } void SetVBASupportOn( bool b ) { bVBASupportOn = b; } - BOOL WhiteSpace() { return bSpaces; } + sal_Bool WhiteSpace() { return bSpaces; } short GetErrors() { return nErrors; } short GetLine() { return nLine; } short GetCol1() { return nCol1; } @@ -94,9 +94,9 @@ public: void RestoreLine(void) { pLine = pSaveLine; } void LockColumn(); void UnlockColumn(); - BOOL DoesColonFollow(); + sal_Bool DoesColonFollow(); - BOOL NextSym(); // naechstes Symbol lesen + sal_Bool NextSym(); // naechstes Symbol lesen const String& GetSym() { return aSym; } SbxDataType GetType() { return eScanType; } double GetDbl() { return nVal; } @@ -122,22 +122,22 @@ class BasicSimpleCharClass static LetterTable aLetterTable; public: - static BOOL isAlpha( sal_Unicode c, bool bCompatible ) + static sal_Bool isAlpha( sal_Unicode c, bool bCompatible ) { - BOOL bRet = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') + sal_Bool bRet = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (bCompatible && aLetterTable.isLetter( c )); return bRet; } - static BOOL isDigit( sal_Unicode c ) + static sal_Bool isDigit( sal_Unicode c ) { - BOOL bRet = (c >= '0' && c <= '9'); + sal_Bool bRet = (c >= '0' && c <= '9'); return bRet; } - static BOOL isAlphaNumeric( sal_Unicode c, bool bCompatible ) + static sal_Bool isAlphaNumeric( sal_Unicode c, bool bCompatible ) { - BOOL bRet = isDigit( c ) || isAlpha( c, bCompatible ); + sal_Bool bRet = isDigit( c ) || isAlpha( c, bCompatible ); return bRet; } }; diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx index f7f948bd0b31..0966c258380a 100644..100755 --- a/basic/source/inc/scriptcont.hxx +++ b/basic/source/inc/scriptcont.hxx @@ -44,6 +44,7 @@ namespace basic class SfxScriptLibraryContainer : public SfxLibraryContainer, public OldBasicPassword { ::rtl::OUString maScriptLanguage; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > mxCodeNameAccess; // Methods to distinguish between deffirent library types virtual SfxLibrary* SAL_CALL implCreateLibrary( const ::rtl::OUString& aName ); diff --git a/basic/source/inc/stdobj.hxx b/basic/source/inc/stdobj.hxx index 9087b81e3028..7abaf47492f1 100644..100755 --- a/basic/source/inc/stdobj.hxx +++ b/basic/source/inc/stdobj.hxx @@ -46,7 +46,7 @@ class SbiStdObject : public SbxObject public: SbiStdObject( const String&, StarBASIC* ); virtual SbxVariable* Find( const String&, SbxClassType ); - virtual void SetModified( BOOL ); + virtual void SetModified( sal_Bool ); }; #endif diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx index b8457b3c811b..adfee46b4aed 100644..100755 --- a/basic/source/inc/symtbl.hxx +++ b/basic/source/inc/symtbl.hxx @@ -59,12 +59,12 @@ class SbiStringPool { // String-Pool public: SbiStringPool( SbiParser* ); ~SbiStringPool(); - USHORT GetSize() const { return aData.Count(); } - // AB 8.4.1999, Default wegen #64236 auf TRUE geaendert - // Wenn der Bug sauber behoben ist, wieder auf FALSE aendern. - short Add( const String&, BOOL=TRUE ); + sal_uInt16 GetSize() const { return aData.Count(); } + // AB 8.4.1999, Default wegen #64236 auf sal_True geaendert + // Wenn der Bug sauber behoben ist, wieder auf sal_False aendern. + short Add( const String&, sal_Bool=sal_True ); short Add( double, SbxDataType ); - const String& Find( USHORT ) const; + const String& Find( sal_uInt16 ) const; SbiParser* GetParser() { return pParser; } }; @@ -81,8 +81,8 @@ protected: SbiSymPool* pParent; // uebergeordneter Symbol-Pool SbiParser* pParser; // der Parser SbiSymScope eScope; // Scope des Pools - USHORT nProcId; // aktuelles ProcId fuer STATIC-Variable - USHORT nCur; // Iterator + sal_uInt16 nProcId; // aktuelles ProcId fuer STATIC-Variable + sal_uInt16 nCur; // Iterator public: SbiSymPool( SbiStringPool&, SbiSymScope ); ~SbiSymPool(); @@ -91,7 +91,7 @@ public: void SetParent( SbiSymPool* p ) { pParent = p; } void SetProcId( short n ) { nProcId = n; } - USHORT GetSize() const { return aData.Count(); } + sal_uInt16 GetSize() const { return aData.Count(); } SbiSymScope GetScope() const { return eScope; } void SetScope( SbiSymScope s ) { eScope = s; } SbiParser* GetParser() { return pParser; } @@ -100,12 +100,12 @@ public: SbiProcDef* AddProc( const String& );// Prozedur hinzufuegen void Add( SbiSymDef* ); // Symbol uebernehmen SbiSymDef* Find( const String& ) const;// Variablenname - SbiSymDef* FindId( USHORT ) const; // Variable per ID suchen - SbiSymDef* Get( USHORT ) const; // Variable per Position suchen + SbiSymDef* FindId( sal_uInt16 ) const; // Variable per ID suchen + SbiSymDef* Get( sal_uInt16 ) const; // Variable per Position suchen SbiSymDef* First(), *Next(); // Iteratoren - UINT32 Define( const String& ); // Label definieren - UINT32 Reference( const String& ); // Label referenzieren + sal_uInt32 Define( const String& ); // Label definieren + sal_uInt32 Reference( const String& ); // Label referenzieren void CheckRefs(); // offene Referenzen suchen }; @@ -120,21 +120,21 @@ protected: SbiSymPool* pPool; // Pool fuer Unterelemente short nLen; // Stringlaenge bei STRING*n short nDims; // Array-Dimensionen - USHORT nId; // Symbol-Nummer - USHORT nTypeId; // String-ID des Datentyps (Dim X AS Dytentyp) - USHORT nProcId; // aktuelles ProcId fuer STATIC-Variable - USHORT nPos; // Positions-Nummer - UINT32 nChain; // Backchain-Kette - BOOL bNew : 1; // TRUE: Dim As New... - BOOL bChained : 1; // TRUE: Symbol ist in Code definiert - BOOL bByVal : 1; // TRUE: ByVal-Parameter - BOOL bOpt : 1; // TRUE: optionaler Parameter - BOOL bStatic : 1; // TRUE: STATIC-Variable - BOOL bAs : 1; // TRUE: Datentyp per AS XXX definiert - BOOL bGlobal : 1; // TRUE: Global-Variable - BOOL bParamArray : 1; // TRUE: ParamArray parameter - BOOL bWithEvents : 1; // TRUE: Declared WithEvents - USHORT nDefaultId; // Symbol number of default value + sal_uInt16 nId; // Symbol-Nummer + sal_uInt16 nTypeId; // String-ID des Datentyps (Dim X AS Dytentyp) + sal_uInt16 nProcId; // aktuelles ProcId fuer STATIC-Variable + sal_uInt16 nPos; // Positions-Nummer + sal_uInt32 nChain; // Backchain-Kette + sal_Bool bNew : 1; // sal_True: Dim As New... + sal_Bool bChained : 1; // sal_True: Symbol ist in Code definiert + sal_Bool bByVal : 1; // sal_True: ByVal-Parameter + sal_Bool bOpt : 1; // sal_True: optionaler Parameter + sal_Bool bStatic : 1; // sal_True: STATIC-Variable + sal_Bool bAs : 1; // sal_True: Datentyp per AS XXX definiert + sal_Bool bGlobal : 1; // sal_True: Global-Variable + sal_Bool bParamArray : 1; // sal_True: ParamArray parameter + sal_Bool bWithEvents : 1; // sal_True: Declared WithEvents + sal_uInt16 nDefaultId; // Symbol number of default value short nFixedStringLength; // String length in: Dim foo As String*Length public: SbiSymDef( const String& ); @@ -146,42 +146,42 @@ public: virtual void SetType( SbxDataType ); const String& GetName(); SbiSymScope GetScope() const; - USHORT GetProcId() const{ return nProcId; } - UINT32 GetAddr() const { return nChain; } - USHORT GetId() const { return nId; } - USHORT GetTypeId() const{ return nTypeId; } - void SetTypeId( USHORT n ) { nTypeId = n; eType = SbxOBJECT; } - USHORT GetPos() const { return nPos; } + sal_uInt16 GetProcId() const{ return nProcId; } + sal_uInt32 GetAddr() const { return nChain; } + sal_uInt16 GetId() const { return nId; } + sal_uInt16 GetTypeId() const{ return nTypeId; } + void SetTypeId( sal_uInt16 n ) { nTypeId = n; eType = SbxOBJECT; } + sal_uInt16 GetPos() const { return nPos; } void SetLen( short n ){ nLen = n; } short GetLen() const { return nLen; } void SetDims( short n ) { nDims = n; } short GetDims() const { return nDims; } - BOOL IsDefined() const{ return bChained; } - void SetOptional() { bOpt = TRUE; } - void SetParamArray() { bParamArray = TRUE; } - void SetWithEvents() { bWithEvents = TRUE; } - void SetByVal( BOOL bByVal_ = TRUE ) + sal_Bool IsDefined() const{ return bChained; } + void SetOptional() { bOpt = sal_True; } + void SetParamArray() { bParamArray = sal_True; } + void SetWithEvents() { bWithEvents = sal_True; } + void SetByVal( sal_Bool bByVal_ = sal_True ) { bByVal = bByVal_; } - void SetStatic( BOOL bAsStatic = TRUE ) { bStatic = bAsStatic; } - void SetNew() { bNew = TRUE; } - void SetDefinedAs() { bAs = TRUE; } - void SetGlobal(BOOL b){ bGlobal = b; } - void SetDefaultId( USHORT n ) { nDefaultId = n; } - USHORT GetDefaultId( void ) { return nDefaultId; } - BOOL IsOptional() const{ return bOpt; } - BOOL IsParamArray() const{ return bParamArray; } - BOOL IsWithEvents() const{ return bWithEvents; } - BOOL IsByVal() const { return bByVal; } - BOOL IsStatic() const { return bStatic; } - BOOL IsNew() const { return bNew; } - BOOL IsDefinedAs() const { return bAs; } - BOOL IsGlobal() const { return bGlobal; } + void SetStatic( sal_Bool bAsStatic = sal_True ) { bStatic = bAsStatic; } + void SetNew() { bNew = sal_True; } + void SetDefinedAs() { bAs = sal_True; } + void SetGlobal(sal_Bool b){ bGlobal = b; } + void SetDefaultId( sal_uInt16 n ) { nDefaultId = n; } + sal_uInt16 GetDefaultId( void ) { return nDefaultId; } + sal_Bool IsOptional() const{ return bOpt; } + sal_Bool IsParamArray() const{ return bParamArray; } + sal_Bool IsWithEvents() const{ return bWithEvents; } + sal_Bool IsByVal() const { return bByVal; } + sal_Bool IsStatic() const { return bStatic; } + sal_Bool IsNew() const { return bNew; } + sal_Bool IsDefinedAs() const { return bAs; } + sal_Bool IsGlobal() const { return bGlobal; } short GetFixedStringLength( void ) const { return nFixedStringLength; } void SetFixedStringLength( short n ) { nFixedStringLength = n; } SbiSymPool& GetPool(); - UINT32 Define(); // Symbol in Code definieren - UINT32 Reference(); // Symbol in Code referenzieren + sal_uInt32 Define(); // Symbol in Code definieren + sal_uInt32 Reference(); // Symbol in Code referenzieren private: SbiSymDef( const SbiSymDef& ); @@ -193,14 +193,14 @@ class SbiProcDef : public SbiSymDef { // Prozedur-Definition (aus Basic): SbiSymPool aLabels; // lokale Sprungziele String aLibName; // LIB "name" String aAlias; // ALIAS "name" - USHORT nLine1, nLine2; // Zeilenbereich + sal_uInt16 nLine1, nLine2; // Zeilenbereich PropertyMode mePropMode; // Marks if this is a property procedure and which String maPropName; // Property name if property procedure (!= proc name) - BOOL bCdecl : 1; // TRUE: CDECL angegeben - BOOL bPublic : 1; // TRUE: proc ist PUBLIC - BOOL mbProcDecl : 1; // TRUE: instanciated by SbiParser::ProcDecl + sal_Bool bCdecl : 1; // sal_True: CDECL angegeben + sal_Bool bPublic : 1; // sal_True: proc ist PUBLIC + sal_Bool mbProcDecl : 1; // sal_True: instanciated by SbiParser::ProcDecl public: - SbiProcDef( SbiParser*, const String&, BOOL bProcDecl=false ); + SbiProcDef( SbiParser*, const String&, sal_Bool bProcDecl=false ); virtual ~SbiProcDef(); virtual SbiProcDef* GetProcDef(); virtual void SetType( SbxDataType ); @@ -209,15 +209,15 @@ public: SbiSymPool& GetLocals() { return GetPool();} String& GetLib() { return aLibName; } String& GetAlias() { return aAlias; } - void SetPublic( BOOL b ) { bPublic = b; } - BOOL IsPublic() const { return bPublic; } - void SetCdecl( BOOL b = TRUE) { bCdecl = b; } - BOOL IsCdecl() const { return bCdecl; } - BOOL IsUsedForProcDecl() const { return mbProcDecl; } - void SetLine1( USHORT n ) { nLine1 = n; } - USHORT GetLine1() const { return nLine1; } - void SetLine2( USHORT n ) { nLine2 = n; } - USHORT GetLine2() const { return nLine2; } + void SetPublic( sal_Bool b ) { bPublic = b; } + sal_Bool IsPublic() const { return bPublic; } + void SetCdecl( sal_Bool b = sal_True) { bCdecl = b; } + sal_Bool IsCdecl() const { return bCdecl; } + sal_Bool IsUsedForProcDecl() const { return mbProcDecl; } + void SetLine1( sal_uInt16 n ) { nLine1 = n; } + sal_uInt16 GetLine1() const { return nLine1; } + void SetLine2( sal_uInt16 n ) { nLine2 = n; } + sal_uInt16 GetLine2() const { return nLine2; } PropertyMode getPropertyMode() { return mePropMode; } void setPropertyMode( PropertyMode ePropMode ); const String& GetPropName() { return maPropName; } diff --git a/basic/source/inc/token.hxx b/basic/source/inc/token.hxx index 544eef119e01..deb6764f2e2c 100644..100755 --- a/basic/source/inc/token.hxx +++ b/basic/source/inc/token.hxx @@ -141,25 +141,25 @@ class SbiTokenizer : public SbiScanner { protected: SbiToken eCurTok; // aktuelles Token SbiToken ePush; // Pushback-Token - USHORT nPLine, nPCol1, nPCol2; // Pushback-Location - BOOL bEof; // TRUE bei Dateiende - BOOL bEos; // TRUE bei Statement-Ende - BOOL bKeywords; // TRUE, falls Keywords geparst werden - BOOL bAs; // letztes Keyword war AS - BOOL bErrorIsSymbol; // Handle Error token as Symbol, not keyword + sal_uInt16 nPLine, nPCol1, nPCol2; // Pushback-Location + sal_Bool bEof; // sal_True bei Dateiende + sal_Bool bEos; // sal_True bei Statement-Ende + sal_Bool bKeywords; // sal_True, falls Keywords geparst werden + sal_Bool bAs; // letztes Keyword war AS + sal_Bool bErrorIsSymbol; // Handle Error token as Symbol, not keyword public: SbiTokenizer( const ::rtl::OUString&, StarBASIC* = NULL ); ~SbiTokenizer(); - inline BOOL IsEof() { return bEof; } - inline BOOL IsEos() { return bEos; } + inline sal_Bool IsEof() { return bEof; } + inline sal_Bool IsEos() { return bEos; } void Push( SbiToken ); // Pushback eines Tokens const String& Symbol( SbiToken );// Rueckumwandlung SbiToken Peek(); // das naechste Token lesen SbiToken Next(); // Ein Token lesen - BOOL MayBeLabel( BOOL= FALSE ); // Kann es ein Label sein? + sal_Bool MayBeLabel( sal_Bool= sal_False ); // Kann es ein Label sein? void Hilite( SbTextPortions& ); // Syntax-Highlighting @@ -168,14 +168,14 @@ public: void Error( SbError, const char* ); void Error( SbError, String ); - void Keywords( BOOL b ) { bKeywords = b; } + void Keywords( sal_Bool b ) { bKeywords = b; } - static BOOL IsEoln( SbiToken t ) - { return BOOL( t == EOS || t == EOLN || t == REM ); } - static BOOL IsKwd( SbiToken t ) - { return BOOL( t >= FIRSTKWD && t <= LASTKWD ); } - static BOOL IsExtra( SbiToken t ) - { return BOOL( t >= FIRSTEXTRA ); } + static sal_Bool IsEoln( SbiToken t ) + { return sal_Bool( t == EOS || t == EOLN || t == REM ); } + static sal_Bool IsKwd( SbiToken t ) + { return sal_Bool( t >= FIRSTKWD && t <= LASTKWD ); } + static sal_Bool IsExtra( SbiToken t ) + { return sal_Bool( t >= FIRSTEXTRA ); } }; diff --git a/basic/source/runtime/basrdll.cxx b/basic/source/runtime/basrdll.cxx index a705aa24aa00..910ecce98f72 100644..100755 --- a/basic/source/runtime/basrdll.cxx +++ b/basic/source/runtime/basrdll.cxx @@ -55,8 +55,8 @@ BasicDLL::BasicDLL() ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale(); pSttResMgr = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(stt), aLocale ); pBasResMgr = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(sb), aLocale ); - bDebugMode = FALSE; - bBreakEnabled = TRUE; + bDebugMode = sal_False; + bBreakEnabled = sal_True; } BasicDLL::~BasicDLL() @@ -65,7 +65,7 @@ BasicDLL::~BasicDLL() delete pBasResMgr; } -void BasicDLL::EnableBreak( BOOL bEnable ) +void BasicDLL::EnableBreak( sal_Bool bEnable ) { BasicDLL* pThis = *(BasicDLL**)GetAppData(SHL_BASIC); DBG_ASSERT( pThis, "BasicDLL::EnableBreak: Noch keine Instanz!" ); @@ -73,7 +73,7 @@ void BasicDLL::EnableBreak( BOOL bEnable ) pThis->bBreakEnabled = bEnable; } -void BasicDLL::SetDebugMode( BOOL bDebugMode ) +void BasicDLL::SetDebugMode( sal_Bool bDebugMode ) { BasicDLL* pThis = *(BasicDLL**)GetAppData(SHL_BASIC); DBG_ASSERT( pThis, "BasicDLL::EnableBreak: Noch keine Instanz!" ); @@ -86,7 +86,7 @@ void BasicDLL::BasicBreak() { //bJustStopping: Wenn jemand wie wild x-mal STOP drueckt, aber das Basic // nicht schnell genug anhaelt, kommt die Box ggf. oefters... - static BOOL bJustStopping = FALSE; + static sal_Bool bJustStopping = sal_False; BasicDLL* pThis = *(BasicDLL**)GetAppData(SHL_BASIC); DBG_ASSERT( pThis, "BasicDLL::EnableBreak: Noch keine Instanz!" ); @@ -94,11 +94,11 @@ void BasicDLL::BasicBreak() { if ( StarBASIC::IsRunning() && !bJustStopping && ( pThis->bBreakEnabled || pThis->bDebugMode ) ) { - bJustStopping = TRUE; + bJustStopping = sal_True; StarBASIC::Stop(); String aMessageStr( BasResId( IDS_SBERR_TERMINATED ) ); InfoBox( 0, aMessageStr ).Execute(); - bJustStopping = FALSE; + bJustStopping = sal_False; } } } diff --git a/basic/source/runtime/comenumwrapper.cxx b/basic/source/runtime/comenumwrapper.cxx new file mode 100755 index 000000000000..ba3def41838f --- /dev/null +++ b/basic/source/runtime/comenumwrapper.cxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_basic.hxx" +#include "comenumwrapper.hxx" + +using namespace ::com::sun::star; + +::sal_Bool SAL_CALL ComEnumerationWrapper::hasMoreElements() + throw ( uno::RuntimeException ) +{ + sal_Bool bResult = sal_False; + + try + { + if ( m_xInvocation.is() ) + { + sal_Int32 nLength = 0; + bResult = + ( ( m_xInvocation->getValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "length" ) ) ) >>= nLength ) + && nLength > m_nCurInd ); + } + } + catch( uno::Exception& ) + {} + + return bResult; +} + +uno::Any SAL_CALL ComEnumerationWrapper::nextElement() + throw ( container::NoSuchElementException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + try + { + if ( m_xInvocation.is() ) + { + uno::Sequence< sal_Int16 > aNamedParamIndex; + uno::Sequence< uno::Any > aNamedParam; + uno::Sequence< uno::Any > aArgs( 1 ); + + aArgs[0] <<= m_nCurInd++; + + return m_xInvocation->invoke( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "item" ) ), + aArgs, + aNamedParamIndex, + aNamedParam ); + } + } + catch( uno::Exception& ) + {} + + throw container::NoSuchElementException(); +} + + diff --git a/basic/source/runtime/comenumwrapper.hxx b/basic/source/runtime/comenumwrapper.hxx new file mode 100755 index 000000000000..b2464d686f67 --- /dev/null +++ b/basic/source/runtime/comenumwrapper.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _COMENUMWRAPPER_HXX +#define _COMENUMWRAPPER_HXX + +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/script/XInvocation.hpp> + +#include <cppuhelper/implbase1.hxx> + +class ComEnumerationWrapper : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XEnumeration > +{ + ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > m_xInvocation; + sal_Int32 m_nCurInd; + +public: + ComEnumerationWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation >& xInvocation ) + : m_xInvocation( xInvocation ) + , m_nCurInd( 0 ) + { + } + + // container::XEnumeration + virtual ::sal_Bool SAL_CALL hasMoreElements() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL nextElement() throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); +}; + +#endif // _COMENUMWRAPPER_HXX + diff --git a/basic/source/runtime/ddectrl.cxx b/basic/source/runtime/ddectrl.cxx index a2536bfab045..83ce5b05adb5 100644..100755 --- a/basic/source/runtime/ddectrl.cxx +++ b/basic/source/runtime/ddectrl.cxx @@ -92,12 +92,12 @@ SbiDdeControl::~SbiDdeControl() delete pConvList; } -INT16 SbiDdeControl::GetFreeChannel() +sal_Int16 SbiDdeControl::GetFreeChannel() { - INT16 nListSize = (INT16)pConvList->Count(); + sal_Int16 nListSize = (sal_Int16)pConvList->Count(); DdeConnection* pPtr = pConvList->First(); pPtr = pConvList->Next(); // nullten eintrag ueberspringen - INT16 nChannel; + sal_Int16 nChannel; for( nChannel = 1; nChannel < nListSize; nChannel++ ) { if( pPtr == DDE_FREECHANNEL ) @@ -110,7 +110,7 @@ INT16 SbiDdeControl::GetFreeChannel() } SbError SbiDdeControl::Initiate( const String& rService, const String& rTopic, - INT16& rnHandle ) + sal_Int16& rnHandle ) { SbError nErr; DdeConnection* pConv = new DdeConnection( rService, rTopic ); @@ -122,26 +122,26 @@ SbError SbiDdeControl::Initiate( const String& rService, const String& rTopic, } else { - INT16 nChannel = GetFreeChannel(); - pConvList->Replace( pConv, (ULONG)nChannel ); + sal_Int16 nChannel = GetFreeChannel(); + pConvList->Replace( pConv, (sal_uIntPtr)nChannel ); rnHandle = nChannel; } return 0; } -SbError SbiDdeControl::Terminate( INT16 nChannel ) +SbError SbiDdeControl::Terminate( sal_Int16 nChannel ) { - DdeConnection* pConv = pConvList->GetObject( (ULONG)nChannel ); + DdeConnection* pConv = pConvList->GetObject( (sal_uIntPtr)nChannel ); if( !nChannel || !pConv || pConv == DDE_FREECHANNEL ) return SbERR_DDE_NO_CHANNEL; - pConvList->Replace( DDE_FREECHANNEL, (ULONG)nChannel ); + pConvList->Replace( DDE_FREECHANNEL, (sal_uIntPtr)nChannel ); delete pConv; return 0L; } SbError SbiDdeControl::TerminateAll() { - INT16 nChannel = (INT16)pConvList->Count(); + sal_Int16 nChannel = (sal_Int16)pConvList->Count(); while( nChannel ) { nChannel--; @@ -155,9 +155,9 @@ SbError SbiDdeControl::TerminateAll() return 0; } -SbError SbiDdeControl::Request( INT16 nChannel, const String& rItem, String& rResult ) +SbError SbiDdeControl::Request( sal_Int16 nChannel, const String& rItem, String& rResult ) { - DdeConnection* pConv = pConvList->GetObject( (ULONG)nChannel ); + DdeConnection* pConv = pConvList->GetObject( (sal_uIntPtr)nChannel ); if( !nChannel || !pConv || pConv == DDE_FREECHANNEL ) return SbERR_DDE_NO_CHANNEL; @@ -168,9 +168,9 @@ SbError SbiDdeControl::Request( INT16 nChannel, const String& rItem, String& rRe return GetLastErr( pConv ); } -SbError SbiDdeControl::Execute( INT16 nChannel, const String& rCommand ) +SbError SbiDdeControl::Execute( sal_Int16 nChannel, const String& rCommand ) { - DdeConnection* pConv = pConvList->GetObject( (ULONG)nChannel ); + DdeConnection* pConv = pConvList->GetObject( (sal_uIntPtr)nChannel ); if( !nChannel || !pConv || pConv == DDE_FREECHANNEL ) return SbERR_DDE_NO_CHANNEL; DdeExecute aRequest( *pConv, rCommand, 30000 ); @@ -178,9 +178,9 @@ SbError SbiDdeControl::Execute( INT16 nChannel, const String& rCommand ) return GetLastErr( pConv ); } -SbError SbiDdeControl::Poke( INT16 nChannel, const String& rItem, const String& rData ) +SbError SbiDdeControl::Poke( sal_Int16 nChannel, const String& rItem, const String& rData ) { - DdeConnection* pConv = pConvList->GetObject( (ULONG)nChannel ); + DdeConnection* pConv = pConvList->GetObject( (sal_uIntPtr)nChannel ); if( !nChannel || !pConv || pConv == DDE_FREECHANNEL ) return SbERR_DDE_NO_CHANNEL; DdePoke aRequest( *pConv, rItem, DdeData(rData), 30000 ); diff --git a/basic/source/runtime/ddectrl.hxx b/basic/source/runtime/ddectrl.hxx index 65be2e76ecff..2f12e8128791 100644..100755 --- a/basic/source/runtime/ddectrl.hxx +++ b/basic/source/runtime/ddectrl.hxx @@ -42,7 +42,7 @@ class SbiDdeControl private: DECL_LINK( Data, DdeData* ); SbError GetLastErr( DdeConnection* ); - INT16 GetFreeChannel(); + sal_Int16 GetFreeChannel(); DdeConnections* pConvList; String aData; @@ -52,12 +52,12 @@ public: ~SbiDdeControl(); SbError Initiate( const String& rService, const String& rTopic, - INT16& rnHandle ); - SbError Terminate( INT16 nChannel ); + sal_Int16& rnHandle ); + SbError Terminate( sal_Int16 nChannel ); SbError TerminateAll(); - SbError Request( INT16 nChannel, const String& rItem, String& rResult ); - SbError Execute( INT16 nChannel, const String& rCommand ); - SbError Poke( INT16 nChannel, const String& rItem, const String& rData ); + SbError Request( sal_Int16 nChannel, const String& rItem, String& rResult ); + SbError Execute( sal_Int16 nChannel, const String& rCommand ); + SbError Poke( sal_Int16 nChannel, const String& rItem, const String& rData ); }; #endif diff --git a/basic/source/runtime/dllmgr-none.cxx b/basic/source/runtime/dllmgr-none.cxx index db32b646b619..db32b646b619 100644..100755 --- a/basic/source/runtime/dllmgr-none.cxx +++ b/basic/source/runtime/dllmgr-none.cxx diff --git a/basic/source/runtime/dllmgr-x64.cxx b/basic/source/runtime/dllmgr-x64.cxx index 87be0587bb81..1a5845e10ee2 100644..100755 --- a/basic/source/runtime/dllmgr-x64.cxx +++ b/basic/source/runtime/dllmgr-x64.cxx @@ -158,7 +158,7 @@ std::size_t alignment(SbxVariable * variable) { std::size_t n = 1; SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())-> GetProperties(); - for (USHORT i = 0; i < props->Count(); ++i) { + for (sal_uInt16 i = 0; i < props->Count(); ++i) { n = std::max(n, alignment(props->Get(i))); } return n; @@ -173,9 +173,9 @@ std::size_t alignment(SbxVariable * variable) { } else { SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject()); int dims = arr->GetDims(); - std::vector< INT32 > low(dims); + std::vector< sal_Int32 > low(dims); for (int i = 0; i < dims; ++i) { - INT32 up; + sal_Int32 up; arr->GetDim32(i + 1, low[i], up); } return alignment(arr->Get32(&low[0])); @@ -209,7 +209,7 @@ SbError marshalStruct( OSL_ASSERT(variable != 0); SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())-> GetProperties(); - for (USHORT i = 0; i < props->Count(); ++i) { + for (sal_uInt16 i = 0; i < props->Count(); ++i) { SbError e = marshal(false, props->Get(i), false, blob, offset, data); if (e != ERRCODE_NONE) { return e; @@ -225,12 +225,12 @@ SbError marshalArray( OSL_ASSERT(variable != 0); SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject()); int dims = arr->GetDims(); - std::vector< INT32 > low(dims); - std::vector< INT32 > up(dims); + std::vector< sal_Int32 > low(dims); + std::vector< sal_Int32 > up(dims); for (int i = 0; i < dims; ++i) { arr->GetDim32(i + 1, low[i], up[i]); } - for (std::vector< INT32 > idx = low;;) { + for (std::vector< sal_Int32 > idx = low;;) { SbError e = marshal( false, arr->Get32(&idx[0]), false, blob, offset, data); if (e != ERRCODE_NONE) { @@ -395,7 +395,7 @@ void const * unmarshal(SbxVariable * variable, void const * data) { alignment(variable))); SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())-> GetProperties(); - for (USHORT i = 0; i < props->Count(); ++i) { + for (sal_uInt16 i = 0; i < props->Count(); ++i) { data = unmarshal(props->Get(i), data); } break; @@ -413,12 +413,12 @@ void const * unmarshal(SbxVariable * variable, void const * data) { } else { SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject()); int dims = arr->GetDims(); - std::vector< INT32 > low(dims); - std::vector< INT32 > up(dims); + std::vector< sal_Int32 > low(dims); + std::vector< sal_Int32 > up(dims); for (int i = 0; i < dims; ++i) { arr->GetDim32(i + 1, low[i], up[i]); } - for (std::vector< INT32 > idx = low;;) { + for (std::vector< sal_Int32 > idx = low;;) { data = unmarshal(arr->Get32(&idx[0]), data); int i = dims - 1; while (idx[i] == up[i]) { diff --git a/basic/source/runtime/dllmgr-x86.cxx b/basic/source/runtime/dllmgr-x86.cxx index 64419c9e3b6e..b2f48bd0ab1a 100644..100755 --- a/basic/source/runtime/dllmgr-x86.cxx +++ b/basic/source/runtime/dllmgr-x86.cxx @@ -165,7 +165,7 @@ std::size_t alignment(SbxVariable * variable) { std::size_t n = 1; SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())-> GetProperties(); - for (USHORT i = 0; i < props->Count(); ++i) { + for (sal_uInt16 i = 0; i < props->Count(); ++i) { n = std::max(n, alignment(props->Get(i))); } return n; @@ -180,9 +180,9 @@ std::size_t alignment(SbxVariable * variable) { } else { SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject()); int dims = arr->GetDims(); - std::vector< INT32 > low(dims); + std::vector< sal_Int32 > low(dims); for (int i = 0; i < dims; ++i) { - INT32 up; + sal_Int32 up; arr->GetDim32(i + 1, low[i], up); } return alignment(arr->Get32(&low[0])); @@ -203,7 +203,8 @@ SbError marshalString( return e; } std::vector< char > * blob = data.newBlob(); - blob->insert(blob->begin(), str.getStr(), str.getStr() + str.getLength() + 1 ); + blob->insert( + blob->begin(), str.getStr(), str.getStr() + str.getLength() + 1); *buffer = address(*blob); data.unmarshalStrings.push_back(StringData(variable, *buffer, special)); return ERRCODE_NONE; @@ -216,7 +217,7 @@ SbError marshalStruct( OSL_ASSERT(variable != 0); SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())-> GetProperties(); - for (USHORT i = 0; i < props->Count(); ++i) { + for (sal_uInt16 i = 0; i < props->Count(); ++i) { SbError e = marshal(false, props->Get(i), false, blob, offset, data); if (e != ERRCODE_NONE) { return e; @@ -232,12 +233,12 @@ SbError marshalArray( OSL_ASSERT(variable != 0); SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject()); int dims = arr->GetDims(); - std::vector< INT32 > low(dims); - std::vector< INT32 > up(dims); + std::vector< sal_Int32 > low(dims); + std::vector< sal_Int32 > up(dims); for (int i = 0; i < dims; ++i) { arr->GetDim32(i + 1, low[i], up[i]); } - for (std::vector< INT32 > idx = low;;) { + for (std::vector< sal_Int32 > idx = low;;) { SbError e = marshal( false, arr->Get32(&idx[0]), false, blob, offset, data); if (e != ERRCODE_NONE) { @@ -402,7 +403,7 @@ void const * unmarshal(SbxVariable * variable, void const * data) { alignment(variable))); SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())-> GetProperties(); - for (USHORT i = 0; i < props->Count(); ++i) { + for (sal_uInt16 i = 0; i < props->Count(); ++i) { data = unmarshal(props->Get(i), data); } break; @@ -420,12 +421,12 @@ void const * unmarshal(SbxVariable * variable, void const * data) { } else { SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject()); int dims = arr->GetDims(); - std::vector< INT32 > low(dims); - std::vector< INT32 > up(dims); + std::vector< sal_Int32 > low(dims); + std::vector< sal_Int32 > up(dims); for (int i = 0; i < dims; ++i) { arr->GetDim32(i + 1, low[i], up[i]); } - for (std::vector< INT32 > idx = low;;) { + for (std::vector< sal_Int32 > idx = low;;) { data = unmarshal(arr->Get32(&idx[0]), data); int i = dims - 1; while (idx[i] == up[i]) { @@ -485,7 +486,7 @@ SbError call( RTL_CONSTASCII_STRINGPARAM("KERNEL32.DLL")) && (proc.name == rtl::OString(RTL_CONSTASCII_STRINGPARAM("GetLogicalDriveStringsA"))); - for (USHORT i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) { + for (sal_uInt16 i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) { SbError e = marshal( true, arguments->Get(i), special && i == 2, stack, stack.size(), data); @@ -547,7 +548,7 @@ SbError call( OSL_ASSERT(false); break; } - for (USHORT i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) { + for (sal_uInt16 i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) { arguments->Get(i)->ResetFlag(SBX_REFERENCE); //TODO: skipped for errors?!? } diff --git a/basic/source/runtime/dllmgr.hxx b/basic/source/runtime/dllmgr.hxx index 1507ffe7f94f..1507ffe7f94f 100644..100755 --- a/basic/source/runtime/dllmgr.hxx +++ b/basic/source/runtime/dllmgr.hxx diff --git a/basic/source/runtime/inputbox.cxx b/basic/source/runtime/inputbox.cxx index cc385ce4a199..a21d3e794eee 100644..100755 --- a/basic/source/runtime/inputbox.cxx +++ b/basic/source/runtime/inputbox.cxx @@ -161,14 +161,14 @@ RTLFUNC(InputBox) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count(); + sal_uIntPtr nArgCount = rPar.Count(); if ( nArgCount < 2 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { String aTitle; String aDefault; - INT32 nX = -1, nY = -1; // zentrieren + sal_Int32 nX = -1, nY = -1; // zentrieren const String& rPrompt = rPar.Get(1)->GetString(); if ( nArgCount > 2 && !rPar.Get(2)->IsErr() ) aTitle = rPar.Get(2)->GetString(); diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index 10990fc9fb39..cea9f7a01d3e 100644..100755 --- a/basic/source/runtime/iosys.cxx +++ b/basic/source/runtime/iosys.cxx @@ -215,13 +215,13 @@ void SbiStream::MapError() // Hack for #83750 -BOOL runsInSetup( void ); +sal_Bool runsInSetup( void ); -BOOL needSecurityRestrictions( void ) +sal_Bool needSecurityRestrictions( void ) { #ifdef _USE_UNO - static BOOL bNeedInit = TRUE; - static BOOL bRetVal = TRUE; + static sal_Bool bNeedInit = sal_True; + static sal_Bool bRetVal = sal_True; if( bNeedInit ) { @@ -230,11 +230,11 @@ BOOL needSecurityRestrictions( void ) if( runsInSetup() ) { // Setup is not critical - bRetVal = FALSE; + bRetVal = sal_False; return bRetVal; } - bNeedInit = FALSE; + bNeedInit = sal_False; // Get system user to compare to portal user oslSecurity aSecurity = osl_getCurrentSecurity(); @@ -243,12 +243,12 @@ BOOL needSecurityRestrictions( void ) if( !bRet ) { // No valid security! -> Secure mode! - return TRUE; + return sal_True; } Reference< XMultiServiceFactory > xSMgr = getProcessServiceFactory(); if( !xSMgr.is() ) - return TRUE; + return sal_True; Reference< XBridgeFactory > xBridgeFac( xSMgr->createInstance ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.bridge.BridgeFactory" )) ), UNO_QUERY ); @@ -263,13 +263,13 @@ BOOL needSecurityRestrictions( void ) if( nBridgeCount == 0 ) { // No bridges -> local - bRetVal = FALSE; + bRetVal = sal_False; return bRetVal; } // Iterate through all bridges to find (portal) user property const Reference< XBridge >* pBridges = aBridgeSeq.getConstArray(); - bRetVal = FALSE; // Now only TRUE if user different from portal user is found + bRetVal = sal_False; // Now only sal_True if user different from portal user is found sal_Int32 i; for( i = 0 ; i < nBridgeCount ; i++ ) { @@ -287,7 +287,7 @@ BOOL needSecurityRestrictions( void ) else { // Different user -> Secure mode! - bRetVal = TRUE; + bRetVal = sal_True; break; } } @@ -297,27 +297,27 @@ BOOL needSecurityRestrictions( void ) return bRetVal; #else - return FALSE; + return sal_False; #endif } -// Returns TRUE if UNO is available, otherwise the old file +// Returns sal_True if UNO is available, otherwise the old file // system implementation has to be used // #89378 New semantic: Don't just ask for UNO but for UCB -BOOL hasUno( void ) +sal_Bool hasUno( void ) { #ifdef _USE_UNO - static BOOL bNeedInit = TRUE; - static BOOL bRetVal = TRUE; + static sal_Bool bNeedInit = sal_True; + static sal_Bool bRetVal = sal_True; if( bNeedInit ) { - bNeedInit = FALSE; + bNeedInit = sal_False; Reference< XMultiServiceFactory > xSMgr = getProcessServiceFactory(); if( !xSMgr.is() ) { // No service manager at all - bRetVal = FALSE; + bRetVal = sal_False; } else { @@ -327,13 +327,13 @@ BOOL hasUno( void ) if ( !( xManager.is() && xManager->queryContentProvider( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "file:///" )) ).is() ) ) { // No UCB - bRetVal = FALSE; + bRetVal = sal_False; } } } return bRetVal; #else - return FALSE; + return sal_False; #endif } @@ -349,11 +349,11 @@ class OslStream : public SvStream public: OslStream( const String& rName, short nStrmMode ); ~OslStream(); - virtual ULONG GetData( void* pData, ULONG nSize ); - virtual ULONG PutData( const void* pData, ULONG nSize ); - virtual ULONG SeekPos( ULONG nPos ); + virtual sal_uIntPtr GetData( void* pData, sal_uIntPtr nSize ); + virtual sal_uIntPtr PutData( const void* pData, sal_uIntPtr nSize ); + virtual sal_uIntPtr SeekPos( sal_uIntPtr nPos ); virtual void FlushData(); - virtual void SetSize( ULONG nSize ); + virtual void SetSize( sal_uIntPtr nSize ); }; OslStream::OslStream( const String& rName, short nStrmMode ) @@ -394,21 +394,21 @@ OslStream::~OslStream() maFile.close(); } -ULONG OslStream::GetData( void* pData, ULONG nSize ) +sal_uIntPtr OslStream::GetData( void* pData, sal_uIntPtr nSize ) { sal_uInt64 nBytesRead = nSize; maFile.read( pData, nBytesRead, nBytesRead ); - return (ULONG)nBytesRead; + return (sal_uIntPtr)nBytesRead; } -ULONG OslStream::PutData( const void* pData, ULONG nSize ) +sal_uIntPtr OslStream::PutData( const void* pData, sal_uIntPtr nSize ) { sal_uInt64 nBytesWritten; maFile.write( pData, (sal_uInt64)nSize, nBytesWritten ); - return (ULONG)nBytesWritten; + return (sal_uIntPtr)nBytesWritten; } -ULONG OslStream::SeekPos( ULONG nPos ) +sal_uIntPtr OslStream::SeekPos( sal_uIntPtr nPos ) { if( nPos == STREAM_SEEK_TO_END ) maFile.setPos( Pos_End, 0 ); @@ -416,14 +416,14 @@ ULONG OslStream::SeekPos( ULONG nPos ) maFile.setPos( Pos_Absolut, (sal_uInt64)nPos ); sal_uInt64 nRealPos(0); maFile.getPos( nRealPos ); - return sal::static_int_cast<ULONG>(nRealPos); + return sal::static_int_cast<sal_uIntPtr>(nRealPos); } void OslStream::FlushData() { } -void OslStream::SetSize( ULONG nSize ) +void OslStream::SetSize( sal_uIntPtr nSize ) { maFile.setSize( (sal_uInt64)nSize ); } @@ -444,17 +444,17 @@ public: UCBStream( Reference< XOutputStream > & xOS ); UCBStream( Reference< XStream > & xS ); ~UCBStream(); - virtual ULONG GetData( void* pData, ULONG nSize ); - virtual ULONG PutData( const void* pData, ULONG nSize ); - virtual ULONG SeekPos( ULONG nPos ); + virtual sal_uIntPtr GetData( void* pData, sal_uIntPtr nSize ); + virtual sal_uIntPtr PutData( const void* pData, sal_uIntPtr nSize ); + virtual sal_uIntPtr SeekPos( sal_uIntPtr nPos ); virtual void FlushData(); - virtual void SetSize( ULONG nSize ); + virtual void SetSize( sal_uIntPtr nSize ); }; /* -ULONG UCBErrorToSvStramError( ucb::IOErrorCode nError ) +sal_uIntPtr UCBErrorToSvStramError( ucb::IOErrorCode nError ) { - ULONG eReturn = ERRCODE_IO_GENERAL; + sal_uIntPtr eReturn = ERRCODE_IO_GENERAL; switch( nError ) { case ucb::IOErrorCode_ABORT: eReturn = SVSTREAM_GENERALERROR; break; @@ -525,7 +525,7 @@ UCBStream::~UCBStream() } } -ULONG UCBStream::GetData( void* pData, ULONG nSize ) +sal_uIntPtr UCBStream::GetData( void* pData, sal_uIntPtr nSize ) { try { @@ -554,7 +554,7 @@ ULONG UCBStream::GetData( void* pData, ULONG nSize ) return 0; } -ULONG UCBStream::PutData( const void* pData, ULONG nSize ) +sal_uIntPtr UCBStream::PutData( const void* pData, sal_uIntPtr nSize ) { try { @@ -581,13 +581,13 @@ ULONG UCBStream::PutData( const void* pData, ULONG nSize ) return 0; } -ULONG UCBStream::SeekPos( ULONG nPos ) +sal_uIntPtr UCBStream::SeekPos( sal_uIntPtr nPos ) { try { if( xSeek.is() ) { - ULONG nLen = sal::static_int_cast<ULONG>( xSeek->getLength() ); + sal_uIntPtr nLen = sal::static_int_cast<sal_uIntPtr>( xSeek->getLength() ); if( nPos > nLen ) nPos = nLen; xSeek->seek( nPos ); @@ -621,7 +621,7 @@ void UCBStream::FlushData() } } -void UCBStream::SetSize( ULONG nSize ) +void UCBStream::SetSize( sal_uIntPtr nSize ) { (void)nSize; @@ -728,7 +728,7 @@ SbError SbiStream::Close() return nError; } -SbError SbiStream::Read( ByteString& rBuf, USHORT n, bool bForceReadingPerByte ) +SbError SbiStream::Read( ByteString& rBuf, sal_uInt16 n, bool bForceReadingPerByte ) { nExpandOnWriteTo = 0; if( !bForceReadingPerByte && IsText() ) @@ -767,10 +767,10 @@ void SbiStream::ExpandFile() { if ( nExpandOnWriteTo ) { - ULONG nCur = pStrm->Seek(STREAM_SEEK_TO_END); + sal_uIntPtr nCur = pStrm->Seek(STREAM_SEEK_TO_END); if( nCur < nExpandOnWriteTo ) { - ULONG nDiff = nExpandOnWriteTo - nCur; + sal_uIntPtr nDiff = nExpandOnWriteTo - nCur; char c = 0; while( nDiff-- ) *pStrm << c; @@ -783,7 +783,7 @@ void SbiStream::ExpandFile() } } -SbError SbiStream::Write( const ByteString& rBuf, USHORT n ) +SbError SbiStream::Write( const ByteString& rBuf, sal_uInt16 n ) { ExpandFile(); if( IsAppend() ) @@ -794,7 +794,7 @@ SbError SbiStream::Write( const ByteString& rBuf, USHORT n ) aLine += rBuf; // Raus damit, wenn das Ende ein LF ist, aber CRLF vorher // strippen, da der SvStrm ein CRLF anfuegt! - USHORT nLineLen = aLine.Len(); + sal_uInt16 nLineLen = aLine.Len(); if( nLineLen && aLine.GetBuffer()[ --nLineLen ] == 0x0A ) { aLine.Erase( nLineLen ); @@ -1013,8 +1013,8 @@ void SbiIoSystem::ReadCon( ByteString& rIn ) void SbiIoSystem::WriteCon( const ByteString& rText ) { aOut += rText; - USHORT n1 = aOut.Search( '\n' ); - USHORT n2 = aOut.Search( '\r' ); + sal_uInt16 n1 = aOut.Search( '\n' ); + sal_uInt16 n2 = aOut.Search( '\r' ); if( n1 != STRING_NOTFOUND || n2 != STRING_NOTFOUND ) { if( n1 == STRING_NOTFOUND ) n1 = n2; diff --git a/basic/source/runtime/makefile.mk b/basic/source/runtime/makefile.mk index 64d9a6ff446d..29969416caab 100644..100755 --- a/basic/source/runtime/makefile.mk +++ b/basic/source/runtime/makefile.mk @@ -41,6 +41,7 @@ ENABLE_EXCEPTIONS = TRUE SLOFILES= \ $(SLO)$/basrdll.obj \ + $(SLO)$/comenumwrapper.obj \ $(SLO)$/inputbox.obj\ $(SLO)$/runtime.obj \ $(SLO)$/step0.obj \ diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 380064bb0da8..8335d6f88d26 100644..100755 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -36,7 +36,7 @@ #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include <vcl/sound.hxx> -#include <vcl/wintypes.hxx> +#include <tools/wintypes.hxx> #include <vcl/msgbox.hxx> #include <basic/sbx.hxx> #include <svl/zforlist.hxx> @@ -105,15 +105,10 @@ using namespace com::sun::star::script; SbxVariable* getDefaultProp( SbxVariable* pRef ); -#if defined (WIN) || defined (WNT) || defined (OS2) +#if defined (WNT) || defined (OS2) #include <direct.h> // _getdcwd get current work directory, _chdrive #endif -#ifdef WIN -#include <dos.h> // _dos_getfileattr -#include <errno.h> -#endif - #ifdef UNX #include <errno.h> #include <unistd.h> @@ -164,7 +159,7 @@ static CharClass& GetCharClass( void ) return aCharClass; } -static inline BOOL isFolder( FileStatus::Type aType ) +static inline sal_Bool isFolder( FileStatus::Type aType ) { return ( aType == FileStatus::Directory || aType == FileStatus::Volume ); } @@ -230,8 +225,8 @@ static com::sun::star::uno::Reference< XSimpleFileAccess3 > getFileAccess( void -// Properties und Methoden legen beim Get (bPut = FALSE) den Returnwert -// im Element 0 des Argv ab; beim Put (bPut = TRUE) wird der Wert aus +// Properties und Methoden legen beim Get (bPut = sal_False) den Returnwert +// im Element 0 des Argv ab; beim Put (bPut = sal_True) wird der Wert aus // Element 0 gespeichert. // CreateObject( class ) @@ -264,7 +259,7 @@ RTLFUNC(Error) { String aErrorMsg; SbError nErr = 0L; - INT32 nCode = 0; + sal_Int32 nCode = 0; if( rPar.Count() == 1 ) { nErr = StarBASIC::GetErrBasic(); @@ -276,7 +271,7 @@ RTLFUNC(Error) if( nCode > 65535L ) StarBASIC::Error( SbERR_CONVERSION ); else - nErr = StarBASIC::GetSfxFromVBError( (USHORT)nCode ); + nErr = StarBASIC::GetSfxFromVBError( (sal_uInt16)nCode ); } bool bVBA = SbiRuntime::isVBAEnabled(); @@ -425,7 +420,7 @@ RTLFUNC(CurDir) // zu ermitteln, dass eine virtuelle URL geliefert werden koennte. // rPar.Get(0)->PutEmpty(); -#if defined (WIN) || defined (WNT) || defined (OS2) +#if defined (WNT) || defined (OS2) int nCurDir = 0; // Current dir // JSM if ( rPar.Count() == 2 ) { @@ -462,7 +457,7 @@ RTLFUNC(CurDir) int nSize = _PATH_INCR; char* pMem; - while( TRUE ) + while( sal_True ) { pMem = new char[nSize]; if( !pMem ) @@ -499,17 +494,17 @@ RTLFUNC(ChDir) // JSM { #ifdef _ENABLE_CUR_DIR String aPath = rPar.Get(1)->GetString(); - BOOL bError = FALSE; + sal_Bool bError = sal_False; #ifdef WNT // #55997 Laut MI hilft es bei File-URLs einen DirEntry zwischenzuschalten // #40996 Harmoniert bei Verwendung der WIN32-Funktion nicht mit getdir DirEntry aEntry( aPath ); ByteString aFullPath( aEntry.GetFull(), gsl_getSystemTextEncoding() ); if( chdir( aFullPath.GetBuffer()) ) - bError = TRUE; + bError = sal_True; #else if (!DirEntry(aPath).SetCWD()) - bError = TRUE; + bError = sal_True; #endif if( bError ) StarBASIC::Error( SbERR_PATH_NOT_FOUND ); @@ -532,7 +527,7 @@ RTLFUNC(ChDrive) // JSM #ifndef UNX String aPar1 = rPar.Get(1)->GetString(); -#if defined (WIN) || defined (WNT) || defined (OS2) +#if defined (WNT) || defined (OS2) if (aPar1.Len() > 0) { int nCurDrive = (int)aPar1.GetBuffer()[0]; ; @@ -727,7 +722,7 @@ RTLFUNC(MkDir) // JSM SbxArrayRef pPar = new SbxArray; SbxVariableRef pVar = new SbxVariable(); pPar->Put( pVar, 0 ); - SbRtl_CurDir( pBasic, *pPar, FALSE ); + SbRtl_CurDir( pBasic, *pPar, sal_False ); String aCurPath = pPar->Get(0)->GetString(); File::getFileURLFromSystemPath( aCurPath, sCurDirURL ); @@ -920,7 +915,7 @@ RTLFUNC(FileLen) { SbxVariableRef pArg = rPar.Get( 1 ); String aStr( pArg->GetString() ); - INT32 nLen = 0; + sal_Int32 nLen = 0; // <-- UCB if( hasUno() ) { @@ -948,7 +943,7 @@ RTLFUNC(FileLen) DirectoryItem::get( getFullPathUNC( aStr ), aItem ); FileStatus aFileStatus( FileStatusMask_FileSize ); aItem.getFileStatus( aFileStatus ); - nLen = (INT32)aFileStatus.getFileSize(); + nLen = (sal_Int32)aFileStatus.getFileSize(); #endif } rPar.Get(0)->PutLong( (long)nLen ); @@ -1002,23 +997,23 @@ RTLFUNC(InStr) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uIntPtr nArgCount = rPar.Count()-1; if ( nArgCount < 2 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - USHORT nStartPos = 1; + sal_uInt16 nStartPos = 1; - USHORT nFirstStringPos = 1; + sal_uInt16 nFirstStringPos = 1; if ( nArgCount >= 3 ) { - INT32 lStartPos = rPar.Get(1)->GetLong(); + sal_Int32 lStartPos = rPar.Get(1)->GetLong(); if( lStartPos <= 0 || lStartPos > 0xffff ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); lStartPos = 1; } - nStartPos = (USHORT)lStartPos; + nStartPos = (sal_uInt16)lStartPos; nFirstStringPos++; } @@ -1028,7 +1023,7 @@ RTLFUNC(InStr) if( bCompatibility ) { SbiRuntime* pRT = pInst ? pInst->pRun : NULL; - bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : FALSE; + bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : sal_False; } else { @@ -1037,7 +1032,7 @@ RTLFUNC(InStr) if ( nArgCount == 4 ) bTextMode = rPar.Get(4)->GetInteger(); - USHORT nPos; + sal_uInt16 nPos; const String& rToken = rPar.Get(nFirstStringPos+1)->GetString(); // #97545 Always find empty string @@ -1084,7 +1079,7 @@ RTLFUNC(InStrRev) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uIntPtr nArgCount = rPar.Count()-1; if ( nArgCount < 2 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else @@ -1092,7 +1087,7 @@ RTLFUNC(InStrRev) String aStr1 = rPar.Get(1)->GetString(); String aToken = rPar.Get(2)->GetString(); - INT32 lStartPos = -1; + sal_Int32 lStartPos = -1; if ( nArgCount >= 3 ) { lStartPos = rPar.Get(3)->GetLong(); @@ -1109,7 +1104,7 @@ RTLFUNC(InStrRev) if( bCompatibility ) { SbiRuntime* pRT = pInst ? pInst->pRun : NULL; - bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : FALSE; + bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : sal_False; } else { @@ -1118,13 +1113,13 @@ RTLFUNC(InStrRev) if ( nArgCount == 4 ) bTextMode = rPar.Get(4)->GetInteger(); - USHORT nStrLen = aStr1.Len(); - USHORT nStartPos = lStartPos == -1 ? nStrLen : (USHORT)lStartPos; + sal_uInt16 nStrLen = aStr1.Len(); + sal_uInt16 nStartPos = lStartPos == -1 ? nStrLen : (sal_uInt16)lStartPos; - USHORT nPos = 0; + sal_uInt16 nPos = 0; if( nStartPos <= nStrLen ) { - USHORT nTokenLen = aToken.Len(); + sal_uInt16 nTokenLen = aToken.Len(); if( !nTokenLen ) { // Always find empty string @@ -1140,7 +1135,7 @@ RTLFUNC(InStrRev) if( nRet == -1 ) nPos = 0; else - nPos = (USHORT)nRet + 1; + nPos = (sal_uInt16)nRet + 1; } else { @@ -1154,7 +1149,7 @@ RTLFUNC(InStrRev) if( nRet == -1 ) nPos = 0; else - nPos = (USHORT)nRet + 1; + nPos = (sal_uInt16)nRet + 1; } } } @@ -1238,7 +1233,7 @@ RTLFUNC(Left) else { String aStr( rPar.Get(1)->GetString() ); - INT32 lResultLen = rPar.Get(2)->GetLong(); + sal_Int32 lResultLen = rPar.Get(2)->GetLong(); if( lResultLen > 0xffff ) { lResultLen = 0xffff; @@ -1248,7 +1243,7 @@ RTLFUNC(Left) lResultLen = 0; StarBASIC::Error( SbERR_BAD_ARGUMENT ); } - aStr.Erase( (USHORT)lResultLen ); + aStr.Erase( (sal_uInt16)lResultLen ); rPar.Get(0)->PutString( aStr ); } } @@ -1297,7 +1292,7 @@ RTLFUNC(Mid) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uIntPtr nArgCount = rPar.Count()-1; if ( nArgCount < 2 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else @@ -1307,23 +1302,23 @@ RTLFUNC(Mid) // Anders als im Original kann in dieser Variante der 3. Parameter // nLength nicht weggelassen werden. Ist ueber bWrite schon vorgesehen. if( nArgCount == 4 ) - bWrite = TRUE; + bWrite = sal_True; String aArgStr = rPar.Get(1)->GetString(); - USHORT nStartPos = (USHORT)(rPar.Get(2)->GetLong() ); + sal_uInt16 nStartPos = (sal_uInt16)(rPar.Get(2)->GetLong() ); if ( nStartPos == 0 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { nStartPos--; - USHORT nLen = 0xffff; + sal_uInt16 nLen = 0xffff; bool bWriteNoLenParam = false; if ( nArgCount == 3 || bWrite ) { - INT32 n = rPar.Get(3)->GetLong(); + sal_Int32 n = rPar.Get(3)->GetLong(); if( bWrite && n == -1 ) bWriteNoLenParam = true; - nLen = (USHORT)n; + nLen = (sal_uInt16)n; } String aResultStr; if ( bWrite ) @@ -1332,7 +1327,7 @@ RTLFUNC(Mid) bool bCompatibility = ( pInst && pInst->IsCompatibility() ); if( bCompatibility ) { - USHORT nArgLen = aArgStr.Len(); + sal_uInt16 nArgLen = aArgStr.Len(); if( nStartPos + 1 > nArgLen ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -1340,8 +1335,8 @@ RTLFUNC(Mid) } String aReplaceStr = rPar.Get(4)->GetString(); - USHORT nReplaceStrLen = aReplaceStr.Len(); - USHORT nReplaceLen; + sal_uInt16 nReplaceStrLen = aReplaceStr.Len(); + sal_uInt16 nReplaceLen; if( bWriteNoLenParam ) { nReplaceLen = nReplaceStrLen; @@ -1353,12 +1348,12 @@ RTLFUNC(Mid) nReplaceLen = nReplaceStrLen; } - USHORT nReplaceEndPos = nStartPos + nReplaceLen; + sal_uInt16 nReplaceEndPos = nStartPos + nReplaceLen; if( nReplaceEndPos > nArgLen ) nReplaceLen -= (nReplaceEndPos - nArgLen); aResultStr = aArgStr; - USHORT nErase = nReplaceLen; + sal_uInt16 nErase = nReplaceLen; aResultStr.Erase( nStartPos, nErase ); aResultStr.Insert( aReplaceStr, 0, nReplaceLen, nStartPos ); } @@ -1406,7 +1401,7 @@ RTLFUNC(Replace) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uIntPtr nArgCount = rPar.Count()-1; if ( nArgCount < 3 || nArgCount > 6 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else @@ -1415,7 +1410,7 @@ RTLFUNC(Replace) String aFindStr = rPar.Get(2)->GetString(); String aReplaceStr = rPar.Get(3)->GetString(); - INT32 lStartPos = 1; + sal_Int32 lStartPos = 1; if ( nArgCount >= 4 ) { if( rPar.Get(4)->GetType() != SbxEMPTY ) @@ -1427,7 +1422,7 @@ RTLFUNC(Replace) } } - INT32 lCount = -1; + sal_Int32 lCount = -1; if( nArgCount >=5 ) { if( rPar.Get(5)->GetType() != SbxEMPTY ) @@ -1445,7 +1440,7 @@ RTLFUNC(Replace) if( bCompatibility ) { SbiRuntime* pRT = pInst ? pInst->pRun : NULL; - bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : FALSE; + bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : sal_False; } else { @@ -1454,14 +1449,14 @@ RTLFUNC(Replace) if ( nArgCount == 6 ) bTextMode = rPar.Get(6)->GetInteger(); - USHORT nExpStrLen = aExpStr.Len(); - USHORT nFindStrLen = aFindStr.Len(); - USHORT nReplaceStrLen = aReplaceStr.Len(); + sal_uInt16 nExpStrLen = aExpStr.Len(); + sal_uInt16 nFindStrLen = aFindStr.Len(); + sal_uInt16 nReplaceStrLen = aReplaceStr.Len(); if( lStartPos <= nExpStrLen ) { - USHORT nPos = static_cast<USHORT>( lStartPos - 1 ); - USHORT nCounts = 0; + sal_uInt16 nPos = static_cast<sal_uInt16>( lStartPos - 1 ); + sal_uInt16 nCounts = 0; while( lCount == -1 || lCount > nCounts ) { String aSrcStr( aExpStr ); @@ -1483,7 +1478,7 @@ RTLFUNC(Replace) } } } - rPar.Get(0)->PutString( aExpStr.Copy( static_cast<USHORT>(lStartPos - 1) ) ); + rPar.Get(0)->PutString( aExpStr.Copy( static_cast<sal_uInt16>(lStartPos - 1) ) ); } } @@ -1497,7 +1492,7 @@ RTLFUNC(Right) else { const String& rStr = rPar.Get(1)->GetString(); - INT32 lResultLen = rPar.Get(2)->GetLong(); + sal_Int32 lResultLen = rPar.Get(2)->GetLong(); if( lResultLen > 0xffff ) { lResultLen = 0xffff; @@ -1507,8 +1502,8 @@ RTLFUNC(Right) lResultLen = 0; StarBASIC::Error( SbERR_BAD_ARGUMENT ); } - USHORT nResultLen = (USHORT)lResultLen; - USHORT nStrLen = rStr.Len(); + sal_uInt16 nResultLen = (sal_uInt16)lResultLen; + sal_uInt16 nStrLen = rStr.Len(); if ( nResultLen > nStrLen ) nResultLen = nStrLen; String aResultStr = rStr.Copy( nStrLen-nResultLen ); @@ -1549,7 +1544,7 @@ RTLFUNC(Sgn) else { double aDouble = rPar.Get(1)->GetDouble(); - INT16 nResult = 0; + sal_Int16 nResult = 0; if ( aDouble > 0 ) nResult = 1; else if ( aDouble < 0 ) @@ -1568,7 +1563,7 @@ RTLFUNC(Space) else { String aStr; - aStr.Fill( (USHORT)(rPar.Get(1)->GetLong() )); + aStr.Fill( (sal_uInt16)(rPar.Get(1)->GetLong() )); rPar.Get(0)->PutString( aStr ); } } @@ -1583,7 +1578,7 @@ RTLFUNC(Spc) else { String aStr; - aStr.Fill( (USHORT)(rPar.Get(1)->GetLong() )); + aStr.Fill( (sal_uInt16)(rPar.Get(1)->GetLong() )); rPar.Get(0)->PutString( aStr ); } } @@ -1633,11 +1628,11 @@ RTLFUNC(Str) const sal_Unicode* pBuf = aStr.GetBuffer(); bool bNeg = ( pBuf[0] == '-' ); - USHORT iZeroSearch = 0; + sal_uInt16 iZeroSearch = 0; if( bNeg ) iZeroSearch++; - USHORT iNext = iZeroSearch + 1; + sal_uInt16 iNext = iZeroSearch + 1; if( pBuf[iZeroSearch] == '0' && nLen > iNext && pBuf[iNext] == '.' ) { aStr.Erase( iZeroSearch, 1 ); @@ -1668,16 +1663,16 @@ RTLFUNC(StrComp) const String& rStr2 = rPar.Get(2)->GetString(); SbiInstance* pInst = pINST; - INT16 nTextCompare; + sal_Int16 nTextCompare; bool bCompatibility = ( pInst && pInst->IsCompatibility() ); if( bCompatibility ) { SbiRuntime* pRT = pInst ? pInst->pRun : NULL; - nTextCompare = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : FALSE; + nTextCompare = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : sal_False; } else { - nTextCompare = TRUE; + nTextCompare = sal_True; } if ( rPar.Count() == 4 ) nTextCompare = rPar.Get(3)->GetInteger(); @@ -1713,7 +1708,7 @@ RTLFUNC(StrComp) nRetValue = 1; } - rPar.Get(0)->PutInteger( sal::static_int_cast< INT16 >( nRetValue ) ); + rPar.Get(0)->PutInteger( sal::static_int_cast< sal_Int16 >( nRetValue ) ); } RTLFUNC(String) @@ -1727,10 +1722,10 @@ RTLFUNC(String) { String aStr; sal_Unicode aFiller; - INT32 lCount = rPar.Get(1)->GetLong(); + sal_Int32 lCount = rPar.Get(1)->GetLong(); if( lCount < 0 || lCount > 0xffff ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); - USHORT nCount = (USHORT)lCount; + sal_uInt16 nCount = (sal_uInt16)lCount; if( rPar.Get(2)->GetType() == SbxINTEGER ) aFiller = (sal_Unicode)rPar.Get(2)->GetInteger(); else @@ -1788,7 +1783,7 @@ RTLFUNC(Val) String aStr( rPar.Get(1)->GetString() ); // lt. Mikkysoft bei Kommas abbrechen! -// for( USHORT n=0; n < aStr.Len(); n++ ) +// for( sal_uInt16 n=0; n < aStr.Len(); n++ ) // if( aStr[n] == ',' ) aStr[n] = '.'; FilterWhiteSpace( aStr ); @@ -1803,7 +1798,7 @@ RTLFUNC(Val) if ( nRadix != 10 ) { ByteString aByteStr( aStr, gsl_getSystemTextEncoding() ); - INT16 nlResult = (INT16)strtol( aByteStr.GetBuffer()+2, &pEndPtr, nRadix); + sal_Int16 nlResult = (sal_Int16)strtol( aByteStr.GetBuffer()+2, &pEndPtr, nRadix); nResult = (double)nlResult; } } @@ -1821,46 +1816,46 @@ RTLFUNC(Val) // Helper functions for date conversion -INT16 implGetDateDay( double aDate ) +sal_Int16 implGetDateDay( double aDate ) { aDate -= 2.0; // normieren: 1.1.1900 => 0.0 Date aRefDate( 1, 1, 1900 ); if ( aDate >= 0.0 ) { aDate = floor( aDate ); - aRefDate += (ULONG)aDate; + aRefDate += (sal_uIntPtr)aDate; } else { aDate = ceil( aDate ); - aRefDate -= (ULONG)(-1.0 * aDate); + aRefDate -= (sal_uIntPtr)(-1.0 * aDate); } - INT16 nRet = (INT16)( aRefDate.GetDay() ); + sal_Int16 nRet = (sal_Int16)( aRefDate.GetDay() ); return nRet; } -INT16 implGetDateMonth( double aDate ) +sal_Int16 implGetDateMonth( double aDate ) { Date aRefDate( 1,1,1900 ); long nDays = (long)aDate; nDays -= 2; // normieren: 1.1.1900 => 0.0 aRefDate += nDays; - INT16 nRet = (INT16)( aRefDate.GetMonth() ); + sal_Int16 nRet = (sal_Int16)( aRefDate.GetMonth() ); return nRet; } -INT16 implGetDateYear( double aDate ) +sal_Int16 implGetDateYear( double aDate ) { Date aRefDate( 1,1,1900 ); long nDays = (long) aDate; nDays -= 2; // normieren: 1.1.1900 => 0.0 aRefDate += nDays; - INT16 nRet = (INT16)( aRefDate.GetYear() ); + sal_Int16 nRet = (sal_Int16)( aRefDate.GetYear() ); return nRet; } -BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet ) +sal_Bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double& rdRet ) { if ( nYear < 30 && SbiRuntime::isVBAEnabled() ) nYear += 2000; @@ -1870,7 +1865,7 @@ BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet ) if ((nYear < 100 || nYear > 9999) ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); - return FALSE; + return sal_False; } if ( !SbiRuntime::isVBAEnabled() ) { @@ -1878,7 +1873,7 @@ BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet ) (nDay < 1 || nDay > 31 ) ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); - return FALSE; + return sal_False; } } else @@ -1893,7 +1888,7 @@ BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet ) { // inacurrate around leap year, don't use days to calculate, // just modify the months directory - INT16 nYearAdj = ( nMonth /12 ); // default to positive months inputed + sal_Int16 nYearAdj = ( nMonth /12 ); // default to positive months inputed if ( nMonth <=0 ) nYearAdj = ( ( nMonth -12 ) / 12 ); aCurDate.SetYear( aCurDate.GetYear() + nYearAdj ); @@ -1910,7 +1905,7 @@ BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet ) long nDiffDays = GetDayDiff( aCurDate ); rdRet = (double)nDiffDays; - return TRUE; + return sal_True; } // Function to convert date to ISO 8601 date format @@ -1944,14 +1939,14 @@ RTLFUNC(CDateFromIso) if ( rPar.Count() == 2 ) { String aStr = rPar.Get(1)->GetString(); - INT16 iMonthStart = aStr.Len() - 4; + sal_Int16 iMonthStart = aStr.Len() - 4; String aYearStr = aStr.Copy( 0, iMonthStart ); String aMonthStr = aStr.Copy( iMonthStart, 2 ); String aDayStr = aStr.Copy( iMonthStart+2, 2 ); double dDate; - if( implDateSerial( (INT16)aYearStr.ToInt32(), - (INT16)aMonthStr.ToInt32(), (INT16)aDayStr.ToInt32(), dDate ) ) + if( implDateSerial( (sal_Int16)aYearStr.ToInt32(), + (sal_Int16)aMonthStr.ToInt32(), (sal_Int16)aDayStr.ToInt32(), dDate ) ) { rPar.Get(0)->PutDate( dDate ); } @@ -1970,9 +1965,9 @@ RTLFUNC(DateSerial) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - INT16 nYear = rPar.Get(1)->GetInteger(); - INT16 nMonth = rPar.Get(2)->GetInteger(); - INT16 nDay = rPar.Get(3)->GetInteger(); + sal_Int16 nYear = rPar.Get(1)->GetInteger(); + sal_Int16 nMonth = rPar.Get(2)->GetInteger(); + sal_Int16 nDay = rPar.Get(3)->GetInteger(); double dDate; if( implDateSerial( nYear, nMonth, nDay, dDate ) ) @@ -1989,11 +1984,11 @@ RTLFUNC(TimeSerial) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - INT16 nHour = rPar.Get(1)->GetInteger(); + sal_Int16 nHour = rPar.Get(1)->GetInteger(); if ( nHour == 24 ) nHour = 0; // Wegen UNO DateTimes, die bis 24 Uhr gehen - INT16 nMinute = rPar.Get(2)->GetInteger(); - INT16 nSecond = rPar.Get(3)->GetInteger(); + sal_Int16 nMinute = rPar.Get(2)->GetInteger(); + sal_Int16 nSecond = rPar.Get(3)->GetInteger(); if ((nHour < 0 || nHour > 23) || (nMinute < 0 || nMinute > 59 ) || (nSecond < 0 || nSecond > 59 )) @@ -2002,7 +1997,7 @@ RTLFUNC(TimeSerial) return; } - INT32 nSeconds = nHour; + sal_Int32 nSeconds = nHour; nSeconds *= 3600; nSeconds += nMinute * 60; nSeconds += nSecond; @@ -2032,7 +2027,7 @@ RTLFUNC(DateValue) sal_uInt32 nIndex; double fResult; String aStr( rPar.Get(1)->GetString() ); - BOOL bSuccess = pFormatter->IsNumberFormat( aStr, nIndex, fResult ); + sal_Bool bSuccess = pFormatter->IsNumberFormat( aStr, nIndex, fResult ); short nType = pFormatter->GetType( nIndex ); // DateValue("February 12, 1969") raises error if the system locale is not en_US @@ -2093,7 +2088,7 @@ RTLFUNC(TimeValue) sal_uInt32 nIndex; double fResult; - BOOL bSuccess = pFormatter->IsNumberFormat( rPar.Get(1)->GetString(), + sal_Bool bSuccess = pFormatter->IsNumberFormat( rPar.Get(1)->GetString(), nIndex, fResult ); short nType = pFormatter->GetType(nIndex); if(bSuccess && (nType==NUMBERFORMAT_TIME||nType==NUMBERFORMAT_DATETIME)) @@ -2124,7 +2119,7 @@ RTLFUNC(Day) SbxVariableRef pArg = rPar.Get( 1 ); double aDate = pArg->GetDate(); - INT16 nDay = implGetDateDay( aDate ); + sal_Int16 nDay = implGetDateDay( aDate ); rPar.Get(0)->PutInteger( nDay ); } } @@ -2138,19 +2133,19 @@ RTLFUNC(Year) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - INT16 nYear = implGetDateYear( rPar.Get(1)->GetDate() ); + sal_Int16 nYear = implGetDateYear( rPar.Get(1)->GetDate() ); rPar.Get(0)->PutInteger( nYear ); } } -INT16 implGetHour( double dDate ) +sal_Int16 implGetHour( double dDate ) { if( dDate < 0.0 ) dDate *= -1.0; double nFrac = dDate - floor( dDate ); nFrac *= 86400.0; - INT32 nSeconds = (INT32)(nFrac + 0.5); - INT16 nHour = (INT16)(nSeconds / 3600); + sal_Int32 nSeconds = (sal_Int32)(nFrac + 0.5); + sal_Int16 nHour = (sal_Int16)(nSeconds / 3600); return nHour; } @@ -2164,20 +2159,20 @@ RTLFUNC(Hour) else { double nArg = rPar.Get(1)->GetDate(); - INT16 nHour = implGetHour( nArg ); + sal_Int16 nHour = implGetHour( nArg ); rPar.Get(0)->PutInteger( nHour ); } } -INT16 implGetMinute( double dDate ) +sal_Int16 implGetMinute( double dDate ) { if( dDate < 0.0 ) dDate *= -1.0; double nFrac = dDate - floor( dDate ); nFrac *= 86400.0; - INT32 nSeconds = (INT32)(nFrac + 0.5); - INT16 nTemp = (INT16)(nSeconds % 3600); - INT16 nMin = nTemp / 60; + sal_Int32 nSeconds = (sal_Int32)(nFrac + 0.5); + sal_Int16 nTemp = (sal_Int16)(nSeconds % 3600); + sal_Int16 nMin = nTemp / 60; return nMin; } @@ -2191,7 +2186,7 @@ RTLFUNC(Minute) else { double nArg = rPar.Get(1)->GetDate(); - INT16 nMin = implGetMinute( nArg ); + sal_Int16 nMin = implGetMinute( nArg ); rPar.Get(0)->PutInteger( nMin ); } } @@ -2205,24 +2200,24 @@ RTLFUNC(Month) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - INT16 nMonth = implGetDateMonth( rPar.Get(1)->GetDate() ); + sal_Int16 nMonth = implGetDateMonth( rPar.Get(1)->GetDate() ); rPar.Get(0)->PutInteger( nMonth ); } } -INT16 implGetSecond( double dDate ) +sal_Int16 implGetSecond( double dDate ) { if( dDate < 0.0 ) dDate *= -1.0; double nFrac = dDate - floor( dDate ); nFrac *= 86400.0; - INT32 nSeconds = (INT32)(nFrac + 0.5); - INT16 nTemp = (INT16)(nSeconds / 3600); + sal_Int32 nSeconds = (sal_Int32)(nFrac + 0.5); + sal_Int16 nTemp = (sal_Int16)(nSeconds / 3600); nSeconds -= nTemp * 3600; - nTemp = (INT16)(nSeconds / 60); + nTemp = (sal_Int16)(nSeconds / 60); nSeconds -= nTemp * 60; - INT16 nRet = (INT16)nSeconds; + sal_Int16 nRet = (sal_Int16)nSeconds; return nRet; } @@ -2236,7 +2231,7 @@ RTLFUNC(Second) else { double nArg = rPar.Get(1)->GetDate(); - INT16 nSecond = implGetSecond( nArg ); + sal_Int16 nSecond = implGetSecond( nArg ); rPar.Get(0)->PutInteger( nSecond ); } } @@ -2388,7 +2383,7 @@ RTLFUNC(IsArray) if ( rPar.Count() < 2 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else - rPar.Get(0)->PutBool((rPar.Get(1)->GetType() & SbxARRAY) ? TRUE : FALSE ); + rPar.Get(0)->PutBool((rPar.Get(1)->GetType() & SbxARRAY) ? sal_True : sal_False ); } RTLFUNC(IsObject) @@ -2407,7 +2402,7 @@ RTLFUNC(IsObject) SbxBase::ResetError(); SbUnoClass* pUnoClass; - BOOL bObject; + sal_Bool bObject; if( pObj && NULL != ( pUnoClass=PTR_CAST(SbUnoClass,pObj) ) ) { bObject = pUnoClass->getUnoClass().is(); @@ -2429,14 +2424,14 @@ RTLFUNC(IsDate) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - // #46134 Nur String wird konvertiert, andere Typen ergeben FALSE + // #46134 Nur String wird konvertiert, andere Typen ergeben sal_False SbxVariableRef xArg = rPar.Get( 1 ); SbxDataType eType = xArg->GetType(); - BOOL bDate = FALSE; + sal_Bool bDate = sal_False; if( eType == SbxDATE ) { - bDate = TRUE; + bDate = sal_True; } else if( eType == SbxSTRING ) { @@ -2518,12 +2513,12 @@ RTLFUNC(IsNull) // #51475 Wegen Uno-Objekten auch true liefern, // wenn der pObj-Wert NULL ist SbxVariableRef pArg = rPar.Get( 1 ); - BOOL bNull = rPar.Get(1)->IsNull(); + sal_Bool bNull = rPar.Get(1)->IsNull(); if( !bNull && pArg->GetType() == SbxOBJECT ) { SbxBase* pObj = pArg->GetObject(); if( !pObj ) - bNull = TRUE; + bNull = sal_True; } rPar.Get( 0 )->PutBool( bNull ); } @@ -2663,7 +2658,7 @@ inline sal_Bool implCheckWildcard( const String& rName, SbiRTLData* pRTLData ) bool isRootDir( String aDirURLStr ) { INetURLObject aDirURLObj( aDirURLStr ); - BOOL bRoot = FALSE; + sal_Bool bRoot = sal_False; // Check if it's a root directory sal_Int32 nCount = aDirURLObj.getSegmentCount(); @@ -2671,22 +2666,22 @@ bool isRootDir( String aDirURLStr ) // No segment means Unix root directory "file:///" if( nCount == 0 ) { - bRoot = TRUE; + bRoot = sal_True; } // Exactly one segment needs further checking, because it // can be Unix "file:///foo/" -> no root // or Windows "file:///c:/" -> root else if( nCount == 1 ) { - ::rtl::OUString aSeg1 = aDirURLObj.getName( 0, TRUE, + ::rtl::OUString aSeg1 = aDirURLObj.getName( 0, sal_True, INetURLObject::DECODE_WITH_CHARSET ); if( aSeg1.getStr()[1] == (sal_Unicode)':' ) { - bRoot = TRUE; + bRoot = sal_True; } } // More than one segments can never be root - // so bRoot remains FALSE + // so bRoot remains sal_False return bRoot; } @@ -2698,7 +2693,7 @@ RTLFUNC(Dir) String aPath; - USHORT nParCount = rPar.Count(); + sal_uInt16 nParCount = rPar.Count(); if( nParCount > 3 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else @@ -2753,7 +2748,7 @@ RTLFUNC(Dir) rPar.Get(0)->PutString( aEmptyStr ); } - USHORT nFlags = 0; + sal_uInt16 nFlags = 0; if ( nParCount > 2 ) pRTLData->nDirFlags = nFlags = rPar.Get(2)->GetInteger(); else @@ -2767,7 +2762,7 @@ RTLFUNC(Dir) // #78651 Add "." and ".." directories for VB compatibility if( bIncludeFolders ) { - BOOL bRoot = isRootDir( aDirURLStr ); + sal_Bool bRoot = isRootDir( aDirURLStr ); // If it's no root directory we flag the need for // the "." and ".." directories by the value -2 @@ -2837,7 +2832,7 @@ RTLFUNC(Dir) } INetURLObject aURL( aFile ); - aPath = aURL.getName( INetURLObject::LAST_SEGMENT, TRUE, + aPath = aURL.getName( INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::DECODE_WITH_CHARSET ); } @@ -2868,23 +2863,19 @@ RTLFUNC(Dir) rPar.Get(0)->PutString( aEntry.GetName() ); return; } - USHORT nFlags = 0; + sal_uInt16 nFlags = 0; if ( nParCount > 2 ) pRTLData->nDirFlags = nFlags = rPar.Get(2)->GetInteger(); else pRTLData->nDirFlags = 0; - // Nur diese Bitmaske ist unter Windows erlaubt - #ifdef WIN - if( nFlags & ~0x1E ) - StarBASIC::Error( SbERR_BAD_ARGUMENT ), pRTLData->nDirFlags = 0; - #endif + // Sb_ATTR_VOLUME wird getrennt gehandelt if( pRTLData->nDirFlags & Sb_ATTR_VOLUME ) aPath = aEntry.GetVolume(); else { // Die richtige Auswahl treffen - USHORT nMode = FSYS_KIND_FILE; + sal_uInt16 nMode = FSYS_KIND_FILE; if( nFlags & Sb_ATTR_DIRECTORY ) nMode |= FSYS_KIND_DIR; if( nFlags == Sb_ATTR_DIRECTORY ) @@ -2907,31 +2898,7 @@ RTLFUNC(Dir) } DirEntry aNextEntry=(*(pRTLData->pDir))[pRTLData->nCurDirPos++]; aPath = aNextEntry.GetName(); //Full(); - #ifdef WIN - aNextEntry.ToAbs(); - String sFull(aNextEntry.GetFull()); - unsigned nFlags; - - if (_dos_getfileattr( sFull.GetStr(), &nFlags )) - StarBASIC::Error( SbERR_FILE_NOT_FOUND ); - else - { - INT16 nCurFlags = pRTLData->nDirFlags; - if( (nCurFlags == Sb_ATTR_NORMAL) - && !(nFlags & ( _A_HIDDEN | _A_SYSTEM | _A_VOLID | _A_SUBDIR ) ) ) - break; - else if( (nCurFlags & Sb_ATTR_HIDDEN) && (nFlags & _A_HIDDEN) ) - break; - else if( (nCurFlags & Sb_ATTR_SYSTEM) && (nFlags & _A_SYSTEM) ) - break; - else if( (nCurFlags & Sb_ATTR_VOLUME) && (nFlags & _A_VOLID) ) - break; - else if( (nCurFlags & Sb_ATTR_DIRECTORY) && (nFlags & _A_SUBDIR) ) - break; - } - #else break; - #endif } } rPar.Get(0)->PutString( aPath ); @@ -2943,7 +2910,7 @@ RTLFUNC(Dir) String aDirURL = implSetupWildcard( aFileParam, pRTLData ); - USHORT nFlags = 0; + sal_uInt16 nFlags = 0; if ( nParCount > 2 ) pRTLData->nDirFlags = nFlags = rPar.Get(2)->GetInteger(); else @@ -2965,7 +2932,7 @@ RTLFUNC(Dir) pRTLData->nCurDirPos = 0; if( bIncludeFolders ) { - BOOL bRoot = isRootDir( aDirURL ); + sal_Bool bRoot = isRootDir( aDirURL ); // If it's no root directory we flag the need for // the "." and ".." directories by the value -2 @@ -3045,7 +3012,7 @@ RTLFUNC(GetAttr) if ( rPar.Count() == 2 ) { - INT16 nFlags = 0; + sal_Int16 nFlags = 0; // In Windows, We want to use Windows API to get the file attributes // for VBA interoperability. @@ -3062,7 +3029,7 @@ RTLFUNC(GetAttr) { if (nRealFlags == FILE_ATTRIBUTE_NORMAL) nRealFlags = 0; - nFlags = (INT16) (nRealFlags); + nFlags = (sal_Int16) (nRealFlags); } else StarBASIC::Error( SbERR_FILE_NOT_FOUND ); @@ -3228,7 +3195,7 @@ RTLFUNC(EOF) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - INT16 nChannel = rPar.Get(1)->GetInteger(); + sal_Int16 nChannel = rPar.Get(1)->GetInteger(); // nChannel--; // macht MD beim Oeffnen auch nicht SbiIoSystem* pIO = pINST->GetIoSystem(); SbiStream* pSbStrm = pIO->GetStream( nChannel ); @@ -3237,7 +3204,7 @@ RTLFUNC(EOF) StarBASIC::Error( SbERR_BAD_CHANNEL ); return; } - BOOL bIsEof; + sal_Bool bIsEof; SvStream* pSvStrm = pSbStrm->GetStrm(); if ( pSbStrm->IsText() ) { @@ -3268,7 +3235,7 @@ RTLFUNC(FileAttr) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - INT16 nChannel = rPar.Get(1)->GetInteger(); + sal_Int16 nChannel = rPar.Get(1)->GetInteger(); // nChannel--; SbiIoSystem* pIO = pINST->GetIoSystem(); SbiStream* pSbStrm = pIO->GetStream( nChannel ); @@ -3277,9 +3244,9 @@ RTLFUNC(FileAttr) StarBASIC::Error( SbERR_BAD_CHANNEL ); return; } - INT16 nRet; + sal_Int16 nRet; if ( rPar.Get(2)->GetInteger() == 1 ) - nRet = (INT16)(pSbStrm->GetMode()); + nRet = (sal_Int16)(pSbStrm->GetMode()); else nRet = 0; // System file handle not supported @@ -3296,7 +3263,7 @@ RTLFUNC(Loc) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - INT16 nChannel = rPar.Get(1)->GetInteger(); + sal_Int16 nChannel = rPar.Get(1)->GetInteger(); SbiIoSystem* pIO = pINST->GetIoSystem(); SbiStream* pSbStrm = pIO->GetStream( nChannel ); if ( !pSbStrm ) @@ -3305,7 +3272,7 @@ RTLFUNC(Loc) return; } SvStream* pSvStrm = pSbStrm->GetStrm(); - ULONG nPos; + sal_uIntPtr nPos; if( pSbStrm->IsRandom()) { short nBlockLen = pSbStrm->GetBlockLen(); @@ -3320,7 +3287,7 @@ RTLFUNC(Loc) nPos = ( pSvStrm->Tell()+1 ) / 128; else nPos = pSvStrm->Tell(); - rPar.Get(0)->PutLong( (INT32)nPos ); + rPar.Get(0)->PutLong( (sal_Int32)nPos ); } } @@ -3334,7 +3301,7 @@ RTLFUNC(Lof) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - INT16 nChannel = rPar.Get(1)->GetInteger(); + sal_Int16 nChannel = rPar.Get(1)->GetInteger(); SbiIoSystem* pIO = pINST->GetIoSystem(); SbiStream* pSbStrm = pIO->GetStream( nChannel ); if ( !pSbStrm ) @@ -3343,10 +3310,10 @@ RTLFUNC(Lof) return; } SvStream* pSvStrm = pSbStrm->GetStrm(); - ULONG nOldPos = pSvStrm->Tell(); - ULONG nLen = pSvStrm->Seek( STREAM_SEEK_TO_END ); + sal_uIntPtr nOldPos = pSvStrm->Tell(); + sal_uIntPtr nLen = pSvStrm->Seek( STREAM_SEEK_TO_END ); pSvStrm->Seek( nOldPos ); - rPar.Get(0)->PutLong( (INT32)nLen ); + rPar.Get(0)->PutLong( (sal_Int32)nLen ); } } @@ -3363,7 +3330,7 @@ RTLFUNC(Seek) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - INT16 nChannel = rPar.Get(1)->GetInteger(); + sal_Int16 nChannel = rPar.Get(1)->GetInteger(); // nChannel--; SbiIoSystem* pIO = pINST->GetIoSystem(); SbiStream* pSbStrm = pIO->GetStream( nChannel ); @@ -3376,15 +3343,15 @@ RTLFUNC(Seek) if ( nArgs == 2 ) // Seek-Function { - ULONG nPos = pStrm->Tell(); + sal_uIntPtr nPos = pStrm->Tell(); if( pSbStrm->IsRandom() ) nPos = nPos / pSbStrm->GetBlockLen(); nPos++; // Basic zaehlt ab 1 - rPar.Get(0)->PutLong( (INT32)nPos ); + rPar.Get(0)->PutLong( (sal_Int32)nPos ); } else // Seek-Statement { - INT32 nPos = rPar.Get(2)->GetLong(); + sal_Int32 nPos = rPar.Get(2)->GetLong(); if ( nPos < 1 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -3394,7 +3361,7 @@ RTLFUNC(Seek) pSbStrm->SetExpandOnWriteTo( 0 ); if ( pSbStrm->IsRandom() ) nPos *= pSbStrm->GetBlockLen(); - pStrm->Seek( (ULONG)nPos ); + pStrm->Seek( (sal_uIntPtr)nPos ); pSbStrm->SetExpandOnWriteTo( nPos ); } } @@ -3404,7 +3371,7 @@ RTLFUNC(Format) (void)pBasic; (void)bWrite; - USHORT nArgCount = (USHORT)rPar.Count(); + sal_uInt16 nArgCount = (sal_uInt16)rPar.Count(); if ( nArgCount < 2 || nArgCount > 3 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else @@ -3428,11 +3395,11 @@ RTLFUNC(Randomize) if ( rPar.Count() > 2 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); - INT16 nSeed; + sal_Int16 nSeed; if( rPar.Count() == 2 ) - nSeed = (INT16)rPar.Get(1)->GetInteger(); + nSeed = (sal_Int16)rPar.Get(1)->GetInteger(); else - nSeed = (INT16)rand(); + nSeed = (sal_Int16)rand(); srand( nSeed ); } @@ -3453,7 +3420,7 @@ RTLFUNC(Rnd) // -// Syntax: Shell("Path",[ Window-Style,[ "Params", [ bSync = FALSE ]]]) +// Syntax: Shell("Path",[ Window-Style,[ "Params", [ bSync = sal_False ]]]) // // WindowStyles (VBA-kompatibel): // 2 == Minimized @@ -3477,7 +3444,7 @@ RTLFUNC(Shell) return; } - ULONG nArgCount = rPar.Count(); + sal_uIntPtr nArgCount = rPar.Count(); if ( nArgCount < 2 || nArgCount > 5 ) { rPar.Get(0)->PutLong(0); @@ -3499,13 +3466,13 @@ RTLFUNC(Shell) // Spezial-Behandlung (leere Liste) vermeiden aCmdLine.AppendAscii( " " ); } - USHORT nLen = aCmdLine.Len(); + sal_uInt16 nLen = aCmdLine.Len(); // #55735 Wenn Parameter dabei sind, muessen die abgetrennt werden // #72471 Auch die einzelnen Parameter trennen std::list<String> aTokenList; String aToken; - USHORT i = 0; + sal_uInt16 i = 0; sal_Unicode c; while( i < nLen ) { @@ -3519,7 +3486,7 @@ RTLFUNC(Shell) if( c == '\"' || c == '\'' ) { - USHORT iFoundPos = aCmdLine.Search( c, i + 1 ); + sal_uInt16 iFoundPos = aCmdLine.Search( c, i + 1 ); // Wenn nichts gefunden wurde, Rest kopieren if( iFoundPos == STRING_NOTFOUND ) @@ -3535,9 +3502,9 @@ RTLFUNC(Shell) } else { - USHORT iFoundSpacePos = aCmdLine.Search( ' ', i ); - USHORT iFoundTabPos = aCmdLine.Search( '\t', i ); - USHORT iFoundPos = Min( iFoundSpacePos, iFoundTabPos ); + sal_uInt16 iFoundSpacePos = aCmdLine.Search( ' ', i ); + sal_uInt16 iFoundTabPos = aCmdLine.Search( '\t', i ); + sal_uInt16 iFoundPos = Min( iFoundSpacePos, iFoundTabPos ); // Wenn nichts gefunden wurde, Rest kopieren if( iFoundPos == STRING_NOTFOUND ) @@ -3557,7 +3524,7 @@ RTLFUNC(Shell) } // #55735 / #72471 Ende - INT16 nWinStyle = 0; + sal_Int16 nWinStyle = 0; if( nArgCount >= 3 ) { nWinStyle = rPar.Get(2)->GetInteger(); @@ -3574,7 +3541,7 @@ RTLFUNC(Shell) break; } - BOOL bSync = FALSE; + sal_Bool bSync = sal_False; if( nArgCount >= 5 ) bSync = rPar.Get(4)->GetBool(); if( bSync ) @@ -3589,7 +3556,7 @@ RTLFUNC(Shell) ++iter; - USHORT nParamCount = sal::static_int_cast< USHORT >( + sal_uInt16 nParamCount = sal::static_int_cast< sal_uInt16 >( aTokenList.size() - 1 ); rtl_uString** pParamList = NULL; if( nParamCount ) @@ -3605,7 +3572,7 @@ RTLFUNC(Shell) } oslProcess pApp; - BOOL bSucc = osl_executeProcess( + sal_Bool bSucc = osl_executeProcess( aOUStrProgUNC.pData, pParamList, nParamCount, @@ -3650,7 +3617,7 @@ RTLFUNC(VarType) else { SbxDataType eType = rPar.Get(1)->GetType(); - rPar.Get(0)->PutInteger( (INT16)eType ); + rPar.Get(0)->PutInteger( (sal_Int16)eType ); } } @@ -3700,7 +3667,7 @@ String getBasicTypeName( SbxDataType eType ) }; int nPos = ((int)eType) & 0x0FFF; - USHORT nTypeNameCount = sizeof( pTypeNames ) / sizeof( char* ); + sal_uInt16 nTypeNameCount = sizeof( pTypeNames ) / sizeof( char* ); if ( nPos < 0 || nPos >= nTypeNameCount ) nPos = nTypeNameCount - 1; String aRetStr = String::CreateFromAscii( pTypeNames[nPos] ); @@ -3776,7 +3743,7 @@ RTLFUNC(TypeName) else { SbxDataType eType = rPar.Get(1)->GetType(); - BOOL bIsArray = ( ( eType & SbxARRAY ) != 0 ); + sal_Bool bIsArray = ( ( eType & SbxARRAY ) != 0 ); String aRetStr; if ( SbiRuntime::isVBAEnabled() && eType == SbxOBJECT ) @@ -3799,7 +3766,7 @@ RTLFUNC(Len) else { const String& rStr = rPar.Get(1)->GetString(); - rPar.Get(0)->PutLong( (INT32)rStr.Len() ); + rPar.Get(0)->PutLong( (sal_Int32)rStr.Len() ); } } @@ -3825,7 +3792,7 @@ RTLFUNC(DDEInitiate) const String& rTopic = rPar.Get(2)->GetString(); SbiDdeControl* pDDE = pINST->GetDdeControl(); - INT16 nChannel; + sal_Int16 nChannel; SbError nDdeErr = pDDE->Initiate( rApp, rTopic, nChannel ); if( nDdeErr ) StarBASIC::Error( nDdeErr ); @@ -3852,7 +3819,7 @@ RTLFUNC(DDETerminate) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - INT16 nChannel = rPar.Get(1)->GetInteger(); + sal_Int16 nChannel = rPar.Get(1)->GetInteger(); SbiDdeControl* pDDE = pINST->GetDdeControl(); SbError nDdeErr = pDDE->Terminate( nChannel ); if( nDdeErr ) @@ -3904,7 +3871,7 @@ RTLFUNC(DDERequest) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - INT16 nChannel = rPar.Get(1)->GetInteger(); + sal_Int16 nChannel = rPar.Get(1)->GetInteger(); const String& rItem = rPar.Get(2)->GetString(); SbiDdeControl* pDDE = pINST->GetDdeControl(); String aResult; @@ -3934,7 +3901,7 @@ RTLFUNC(DDEExecute) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - INT16 nChannel = rPar.Get(1)->GetInteger(); + sal_Int16 nChannel = rPar.Get(1)->GetInteger(); const String& rCommand = rPar.Get(2)->GetString(); SbiDdeControl* pDDE = pINST->GetDdeControl(); SbError nDdeErr = pDDE->Execute( nChannel, rCommand ); @@ -3961,7 +3928,7 @@ RTLFUNC(DDEPoke) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - INT16 nChannel = rPar.Get(1)->GetInteger(); + sal_Int16 nChannel = rPar.Get(1)->GetInteger(); const String& rItem = rPar.Get(2)->GetString(); const String& rData = rPar.Get(3)->GetString(); SbiDdeControl* pDDE = pINST->GetDdeControl(); @@ -4001,7 +3968,7 @@ RTLFUNC(LBound) (void)pBasic; (void)bWrite; - USHORT nParCount = rPar.Count(); + sal_uInt16 nParCount = rPar.Count(); if ( nParCount != 3 && nParCount != 2 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -4011,7 +3978,7 @@ RTLFUNC(LBound) SbxDimArray* pArr = PTR_CAST(SbxDimArray,pParObj); if( pArr ) { - INT32 nLower, nUpper; + sal_Int32 nLower, nUpper; short nDim = (nParCount == 3) ? (short)rPar.Get(2)->GetInteger() : 1; if( !pArr->GetDim32( nDim, nLower, nUpper ) ) StarBASIC::Error( SbERR_OUT_OF_RANGE ); @@ -4027,7 +3994,7 @@ RTLFUNC(UBound) (void)pBasic; (void)bWrite; - USHORT nParCount = rPar.Count(); + sal_uInt16 nParCount = rPar.Count(); if ( nParCount != 3 && nParCount != 2 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -4038,7 +4005,7 @@ RTLFUNC(UBound) SbxDimArray* pArr = PTR_CAST(SbxDimArray,pParObj); if( pArr ) { - INT32 nLower, nUpper; + sal_Int32 nLower, nUpper; short nDim = (nParCount == 3) ? (short)rPar.Get(2)->GetInteger() : 1; if( !pArr->GetDim32( nDim, nLower, nUpper ) ) StarBASIC::Error( SbERR_OUT_OF_RANGE ); @@ -4060,10 +4027,10 @@ RTLFUNC(RGB) return; } - ULONG nRed = rPar.Get(1)->GetInteger() & 0xFF; - ULONG nGreen = rPar.Get(2)->GetInteger() & 0xFF; - ULONG nBlue = rPar.Get(3)->GetInteger() & 0xFF; - ULONG nRGB; + sal_uIntPtr nRed = rPar.Get(1)->GetInteger() & 0xFF; + sal_uIntPtr nGreen = rPar.Get(2)->GetInteger() & 0xFF; + sal_uIntPtr nBlue = rPar.Get(3)->GetInteger() & 0xFF; + sal_uIntPtr nRGB; SbiInstance* pInst = pINST; bool bCompatibility = ( pInst && pInst->IsCompatibility() ); @@ -4083,7 +4050,7 @@ RTLFUNC(QBColor) (void)pBasic; (void)bWrite; - static const INT32 pRGB[] = + static const sal_Int32 pRGB[] = { 0x000000, 0x800000, @@ -4109,13 +4076,13 @@ RTLFUNC(QBColor) return; } - INT16 nCol = rPar.Get(1)->GetInteger(); + sal_Int16 nCol = rPar.Get(1)->GetInteger(); if( nCol < 0 || nCol > 15 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - INT32 nRGB = pRGB[ nCol ]; + sal_Int32 nRGB = pRGB[ nCol ]; rPar.Get(0)->PutLong( nRGB ); } @@ -4125,7 +4092,7 @@ RTLFUNC(StrConv) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uIntPtr nArgCount = rPar.Count()-1; if( nArgCount < 2 || nArgCount > 3 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -4133,16 +4100,16 @@ RTLFUNC(StrConv) } String aOldStr = rPar.Get(1)->GetString(); - INT32 nConversion = rPar.Get(2)->GetLong(); + sal_Int32 nConversion = rPar.Get(2)->GetLong(); - USHORT nLanguage = LANGUAGE_SYSTEM; + sal_uInt16 nLanguage = LANGUAGE_SYSTEM; if( nArgCount == 3 ) { // LCID not supported now //nLanguage = rPar.Get(3)->GetInteger(); } - USHORT nOldLen = aOldStr.Len(); + sal_uInt16 nOldLen = aOldStr.Len(); if( nOldLen == 0 ) { // null string,return @@ -4150,7 +4117,7 @@ RTLFUNC(StrConv) return; } - INT32 nType = 0; + sal_Int32 nType = 0; if ( (nConversion & 0x03) == 3 ) // vbProperCase { CharClass& rCharClass = GetCharClass(); @@ -4184,10 +4151,10 @@ RTLFUNC(StrConv) if ( (nConversion & 0x40) == 64 ) // vbUnicode { // convert the string to byte string, preserving unicode (2 bytes per character) - USHORT nSize = aNewStr.Len()*2; + sal_uInt16 nSize = aNewStr.Len()*2; const sal_Unicode* pSrc = aNewStr.GetBuffer(); sal_Char* pChar = new sal_Char[nSize+1]; - for( USHORT i=0; i < nSize; i++ ) + for( sal_uInt16 i=0; i < nSize; i++ ) { pChar[i] = static_cast< sal_Char >( i%2 ? ((*pSrc) >> 8) & 0xff : (*pSrc) & 0xff ); if( i%2 ) @@ -4208,7 +4175,7 @@ RTLFUNC(StrConv) // there is no concept about default codepage in unix. so it is incorrectly in unix ::rtl::OString aOStr = ::rtl::OUStringToOString(aNewStr,osl_getThreadTextEncoding()); const sal_Char* pChar = aOStr.getStr(); - USHORT nArraySize = static_cast< USHORT >( aOStr.getLength() ); + sal_uInt16 nArraySize = static_cast< sal_uInt16 >( aOStr.getLength() ); SbxDimArray* pArray = new SbxDimArray(SbxBYTE); bool bIncIndex = (IsBaseIndexOne() && SbiRuntime::isVBAEnabled() ); if(nArraySize) @@ -4223,7 +4190,7 @@ RTLFUNC(StrConv) pArray->unoAddDim( 0, -1 ); } - for( USHORT i=0; i< nArraySize; i++) + for( sal_uInt16 i=0; i< nArraySize; i++) { SbxVariable* pNew = new SbxVariable( SbxBYTE ); pNew->PutByte(*pChar); @@ -4236,7 +4203,7 @@ RTLFUNC(StrConv) } SbxVariableRef refVar = rPar.Get(0); - USHORT nFlags = refVar->GetFlags(); + sal_uInt16 nFlags = refVar->GetFlags(); refVar->ResetFlag( SBX_FIXED ); refVar->PutObject( pArray ); refVar->SetFlags( nFlags ); @@ -4392,17 +4359,17 @@ RTLFUNC(MsgBox) WB_YES_NO, // MB_YESNO WB_RETRY_CANCEL // MB_RETRYCANCEL }; - static const INT16 nButtonMap[] = + static const sal_Int16 nButtonMap[] = { - 2, // #define RET_CANCEL FALSE - 1, // #define RET_OK TRUE + 2, // #define RET_CANCEL sal_False + 1, // #define RET_OK sal_True 6, // #define RET_YES 2 7, // #define RET_NO 3 4 // #define RET_RETRY 4 }; - USHORT nArgCount = (USHORT)rPar.Count(); + sal_uInt16 nArgCount = (sal_uInt16)rPar.Count(); if( nArgCount < 2 || nArgCount > 6 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -4469,11 +4436,11 @@ RTLFUNC(MsgBox) pBox = new MessBox( pParent, nWinBits, aTitle, aMsg ); } pBox->SetText( aTitle ); - USHORT nRet = (USHORT)pBox->Execute(); - if( nRet == TRUE ) + sal_uInt16 nRet = (sal_uInt16)pBox->Execute(); + if( nRet == sal_True ) nRet = 1; - INT16 nMappedRet; + sal_Int16 nMappedRet; if( nStyle == 2 ) { nMappedRet = nRet; @@ -4496,7 +4463,7 @@ RTLFUNC(SetAttr) // JSM if ( rPar.Count() == 3 ) { String aStr = rPar.Get(1)->GetString(); - INT16 nFlags = rPar.Get(2)->GetInteger(); + sal_Int16 nFlags = rPar.Get(2)->GetInteger(); // <-- UCB if( hasUno() ) @@ -4524,16 +4491,6 @@ RTLFUNC(SetAttr) // JSM // #57064 Bei virtuellen URLs den Real-Path extrahieren DirEntry aEntry( aStr ); String aFile = aEntry.GetFull(); - #ifdef WIN - int nErr = _dos_setfileattr( aFile.GetStr(),(unsigned ) nFlags ); - if ( nErr ) - { - if (errno == EACCES) - StarBASIC::Error( SbERR_ACCESS_DENIED ); - else - StarBASIC::Error( SbERR_FILE_NOT_FOUND ); - } - #endif ByteString aByteFile( aFile, gsl_getSystemTextEncoding() ); #ifdef WNT if (!SetFileAttributes (aByteFile.GetBuffer(),(DWORD)nFlags)) @@ -4582,7 +4539,7 @@ RTLFUNC(DumpAllObjects) (void)pBasic; (void)bWrite; - USHORT nArgCount = (USHORT)rPar.Count(); + sal_uInt16 nArgCount = (sal_uInt16)rPar.Count(); if( nArgCount < 2 || nArgCount > 3 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else if( !pBasic ) @@ -4610,7 +4567,7 @@ RTLFUNC(FileExists) if ( rPar.Count() == 2 ) { String aStr = rPar.Get(1)->GetString(); - BOOL bExists = FALSE; + sal_Bool bExists = sal_False; // <-- UCB if( hasUno() ) @@ -4657,10 +4614,10 @@ RTLFUNC(Partition) return; } - INT32 nNumber = rPar.Get(1)->GetLong(); - INT32 nStart = rPar.Get(2)->GetLong(); - INT32 nStop = rPar.Get(3)->GetLong(); - INT32 nInterval = rPar.Get(4)->GetLong(); + sal_Int32 nNumber = rPar.Get(1)->GetLong(); + sal_Int32 nStart = rPar.Get(2)->GetLong(); + sal_Int32 nStop = rPar.Get(3)->GetLong(); + sal_Int32 nInterval = rPar.Get(4)->GetLong(); if( nStart < 0 || nStop <= nStart || nInterval < 1 ) { @@ -4677,9 +4634,9 @@ RTLFUNC(Partition) // calculate the maximun number of characters before lowervalue and uppervalue ::rtl::OUString aBeforeStart = ::rtl::OUString::valueOf( nStart - 1 ); ::rtl::OUString aAfterStop = ::rtl::OUString::valueOf( nStop + 1 ); - INT32 nLen1 = aBeforeStart.getLength(); - INT32 nLen2 = aAfterStop.getLength(); - INT32 nLen = nLen1 >= nLen2 ? nLen1:nLen2; + sal_Int32 nLen1 = aBeforeStart.getLength(); + sal_Int32 nLen2 = aAfterStop.getLength(); + sal_Int32 nLen = nLen1 >= nLen2 ? nLen1:nLen2; ::rtl::OUStringBuffer aRetStr( nLen * 2 + 1); ::rtl::OUString aLowerValue; @@ -4694,8 +4651,8 @@ RTLFUNC(Partition) } else { - INT32 nLowerValue = nNumber; - INT32 nUpperValue = nLowerValue; + sal_Int32 nLowerValue = nNumber; + sal_Int32 nUpperValue = nLowerValue; if( nInterval > 1 ) { nLowerValue = ((( nNumber - nStart ) / nInterval ) * nInterval ) + nStart; @@ -4712,14 +4669,14 @@ RTLFUNC(Partition) if( nLen > nLen1 ) { // appending the leading spaces for the lowervalue - for ( INT32 i= (nLen - nLen1) ; i > 0; --i ) + for ( sal_Int32 i= (nLen - nLen1) ; i > 0; --i ) aRetStr.appendAscii(" "); } aRetStr.append( aLowerValue ).appendAscii(":"); if( nLen > nLen2 ) { // appending the leading spaces for the uppervalue - for ( INT32 i= (nLen - nLen2) ; i > 0; --i ) + for ( sal_Int32 i= (nLen - nLen2) ; i > 0; --i ) aRetStr.appendAscii(" "); } aRetStr.append( aUpperValue ); diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 4c4cecb08b04..4d8b0380ff2f 100644..100755 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -29,11 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_basic.hxx" -#if defined(WIN) -#include <string.h> -#else #include <stdlib.h> // getenv -#endif #include <vcl/svapp.hxx> #include <vcl/mapmod.hxx> #include <vcl/wrkwin.hxx> @@ -51,10 +47,6 @@ #include <svpm.h> #endif -#if defined(WIN) -#include <tools/svwin.h> -#endif - #ifndef CLK_TCK #define CLK_TCK CLOCKS_PER_SEC #endif @@ -123,13 +115,133 @@ static Reference< XCalendar > getLocaleCalendar( void ) return xCalendar; } +RTLFUNC(CallByName) +{ + (void)pBasic; + (void)bWrite; + + const sal_Int16 vbGet = 2; + const sal_Int16 vbLet = 4; + const sal_Int16 vbMethod = 1; + const sal_Int16 vbSet = 8; + + // At least 3 parameter needed plus function itself -> 4 + sal_uInt16 nParCount = rPar.Count(); + if ( nParCount < 4 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + // 1. parameter is object + SbxBase* pObjVar = (SbxObject*)rPar.Get(1)->GetObject(); + SbxObject* pObj = NULL; + if( pObjVar ) + pObj = PTR_CAST(SbxObject,pObjVar); + if( !pObj && pObjVar && pObjVar->ISA(SbxVariable) ) + { + SbxBase* pObjVarObj = ((SbxVariable*)pObjVar)->GetObject(); + pObj = PTR_CAST(SbxObject,pObjVarObj); + } + if( !pObj ) + { + StarBASIC::Error( SbERR_BAD_PARAMETER ); + return; + } + + // 2. parameter is ProcedureName + String aNameStr = rPar.Get(2)->GetString(); + + // 3. parameter is CallType + sal_Int16 nCallType = rPar.Get(3)->GetInteger(); + + //SbxObject* pFindObj = NULL; + SbxVariable* pFindVar = pObj->Find( aNameStr, SbxCLASS_DONTCARE ); + if( pFindVar == NULL ) + { + StarBASIC::Error( SbERR_PROC_UNDEFINED ); + return; + } + + switch( nCallType ) + { + case vbGet: + { + SbxValues aVals; + aVals.eType = SbxVARIANT; + pFindVar->Get( aVals ); + + SbxVariableRef refVar = rPar.Get(0); + refVar->Put( aVals ); + } + break; + case vbLet: + case vbSet: + { + if ( nParCount != 5 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + SbxVariableRef pValVar = rPar.Get(4); + if( nCallType == vbLet ) + { + SbxValues aVals; + aVals.eType = SbxVARIANT; + pValVar->Get( aVals ); + pFindVar->Put( aVals ); + } + else + { + SbxVariableRef rFindVar = pFindVar; + SbiInstance* pInst = pINST; + SbiRuntime* pRT = pInst ? pInst->pRun : NULL; + if( pRT != NULL ) + pRT->StepSET_Impl( pValVar, rFindVar, false ); + } + } + break; + case vbMethod: + { + SbMethod* pMeth = PTR_CAST(SbMethod,pFindVar); + if( pMeth == NULL ) + { + StarBASIC::Error( SbERR_PROC_UNDEFINED ); + return; + } + + // Setup parameters + SbxArrayRef xArray; + sal_uInt16 nMethParamCount = nParCount - 4; + if( nMethParamCount > 0 ) + { + xArray = new SbxArray; + for( sal_uInt16 i = 0 ; i < nMethParamCount ; i++ ) + { + SbxVariable* pPar = rPar.Get( i + 4 ); + xArray->Put( pPar, i + 1 ); + } + } + + // Call method + SbxVariableRef refVar = rPar.Get(0); + if( xArray.Is() ) + pMeth->SetParameters( xArray ); + pMeth->Call( refVar ); + pMeth->SetParameters( NULL ); + } + break; + default: + StarBASIC::Error( SbERR_PROC_UNDEFINED ); + } +} RTLFUNC(CBool) // JSM { (void)pBasic; (void)bWrite; - BOOL bVal = FALSE; + sal_Bool bVal = sal_False; if ( rPar.Count() == 2 ) { SbxVariable *pSbxVariable = rPar.Get(1); @@ -146,7 +258,7 @@ RTLFUNC(CByte) // JSM (void)pBasic; (void)bWrite; - BYTE nByte = 0; + sal_uInt8 nByte = 0; if ( rPar.Count() == 2 ) { SbxVariable *pSbxVariable = rPar.Get(1); @@ -247,7 +359,7 @@ RTLFUNC(CInt) // JSM (void)pBasic; (void)bWrite; - INT16 nVal = 0; + sal_Int16 nVal = 0; if ( rPar.Count() == 2 ) { SbxVariable *pSbxVariable = rPar.Get(1); @@ -264,7 +376,7 @@ RTLFUNC(CLng) // JSM (void)pBasic; (void)bWrite; - INT32 nVal = 0; + sal_Int32 nVal = 0; if ( rPar.Count() == 2 ) { SbxVariable *pSbxVariable = rPar.Get(1); @@ -290,7 +402,7 @@ RTLFUNC(CSng) // JSM // AB #41690 , String holen double dVal = 0.0; String aScanStr = pSbxVariable->GetString(); - SbError Error = SbxValue::ScanNumIntnl( aScanStr, dVal, /*bSingle=*/TRUE ); + SbError Error = SbxValue::ScanNumIntnl( aScanStr, dVal, /*bSingle=*/sal_True ); if( SbxBase::GetError() == SbxERR_OK && Error != SbxERR_OK ) StarBASIC::Error( Error ); nVal = (float)dVal; @@ -345,7 +457,7 @@ RTLFUNC(CVErr) (void)pBasic; (void)bWrite; - INT16 nErrCode = 0; + sal_Int16 nErrCode = 0; if ( rPar.Count() == 2 ) { SbxVariable *pSbxVariable = rPar.Get(1); @@ -416,10 +528,10 @@ RTLFUNC(Red) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - ULONG nRGB = (ULONG)rPar.Get(1)->GetLong(); + sal_uIntPtr nRGB = (sal_uIntPtr)rPar.Get(1)->GetLong(); nRGB &= 0x00FF0000; nRGB >>= 16; - rPar.Get(0)->PutInteger( (INT16)nRGB ); + rPar.Get(0)->PutInteger( (sal_Int16)nRGB ); } } @@ -432,10 +544,10 @@ RTLFUNC(Green) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - ULONG nRGB = (ULONG)rPar.Get(1)->GetLong(); + sal_uIntPtr nRGB = (sal_uIntPtr)rPar.Get(1)->GetLong(); nRGB &= 0x0000FF00; nRGB >>= 8; - rPar.Get(0)->PutInteger( (INT16)nRGB ); + rPar.Get(0)->PutInteger( (sal_Int16)nRGB ); } } @@ -448,9 +560,9 @@ RTLFUNC(Blue) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - ULONG nRGB = (ULONG)rPar.Get(1)->GetLong(); + sal_uIntPtr nRGB = (sal_uIntPtr)rPar.Get(1)->GetLong(); nRGB &= 0x000000FF; - rPar.Get(0)->PutInteger( (INT16)nRGB ); + rPar.Get(0)->PutInteger( (sal_Int16)nRGB ); } } @@ -460,11 +572,11 @@ RTLFUNC(Switch) (void)pBasic; (void)bWrite; - USHORT nCount = rPar.Count(); + sal_uInt16 nCount = rPar.Count(); if( !(nCount & 0x0001 )) // Anzahl der Argumente muss ungerade sein StarBASIC::Error( SbERR_BAD_ARGUMENT ); - USHORT nCurExpr = 1; + sal_uInt16 nCurExpr = 1; while( nCurExpr < (nCount-1) ) { if( rPar.Get( nCurExpr )->GetBool()) @@ -536,6 +648,7 @@ RTLFUNC(DoEvents) // basic runtime pcode ( on a timed basis ) // always return 0 rPar.Get(0)->PutInteger( 0 ); + Application::Reschedule( true ); } RTLFUNC(GetGUIVersion) @@ -559,8 +672,8 @@ RTLFUNC(Choose) if ( rPar.Count() < 2 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); - INT16 nIndex = rPar.Get(1)->GetInteger(); - USHORT nCount = rPar.Count(); + sal_Int16 nIndex = rPar.Get(1)->GetInteger(); + sal_uInt16 nCount = rPar.Count(); nCount--; if( nCount == 1 || nIndex > (nCount-1) || nIndex < 1 ) { @@ -592,7 +705,7 @@ RTLFUNC(GetSolarVersion) (void)pBasic; (void)bWrite; - rPar.Get(0)->PutLong( (INT32)SUPD ); + rPar.Get(0)->PutLong( (sal_Int32)SUPD ); } RTLFUNC(TwipsPerPixelX) @@ -600,7 +713,7 @@ RTLFUNC(TwipsPerPixelX) (void)pBasic; (void)bWrite; - INT32 nResult = 0; + sal_Int32 nResult = 0; Size aSize( 100,0 ); MapMode aMap( MAP_TWIP ); OutputDevice* pDevice = Application::GetDefaultDevice(); @@ -617,7 +730,7 @@ RTLFUNC(TwipsPerPixelY) (void)pBasic; (void)bWrite; - INT32 nResult = 0; + sal_Int32 nResult = 0; Size aSize( 0,100 ); MapMode aMap( MAP_TWIP ); OutputDevice* pDevice = Application::GetDefaultDevice(); @@ -644,7 +757,7 @@ bool IsBaseIndexOne() bool result = false; if ( pINST && pINST->pRun ) { - USHORT res = pINST->pRun->GetBase(); + sal_uInt16 res = pINST->pRun->GetBase(); if ( res ) result = true; } @@ -657,7 +770,7 @@ RTLFUNC(Array) (void)bWrite; SbxDimArray* pArray = new SbxDimArray( SbxVARIANT ); - USHORT nArraySize = rPar.Count() - 1; + sal_uInt16 nArraySize = rPar.Count() - 1; // Option Base zunaechst ignorieren (kennt leider nur der Compiler) bool bIncIndex = (IsBaseIndexOne() && SbiRuntime::isVBAEnabled() ); @@ -674,10 +787,10 @@ RTLFUNC(Array) } // Parameter ins Array uebernehmen - // ATTENTION: Using type USHORT for loop variable is + // ATTENTION: Using type sal_uInt16 for loop variable is // mandatory to workaround a problem with the // Solaris Intel compiler optimizer! See i104354 - for( USHORT i = 0 ; i < nArraySize ; i++ ) + for( sal_uInt16 i = 0 ; i < nArraySize ; i++ ) { SbxVariable* pVar = rPar.Get(i+1); SbxVariable* pNew = new SbxVariable( *pVar ); @@ -690,7 +803,7 @@ RTLFUNC(Array) // Array zurueckliefern SbxVariableRef refVar = rPar.Get(0); - USHORT nFlags = refVar->GetFlags(); + sal_uInt16 nFlags = refVar->GetFlags(); refVar->ResetFlag( SBX_FIXED ); refVar->PutObject( pArray ); refVar->SetFlags( nFlags ); @@ -711,12 +824,12 @@ RTLFUNC(DimArray) (void)bWrite; SbxDimArray * pArray = new SbxDimArray( SbxVARIANT ); - USHORT nArrayDims = rPar.Count() - 1; + sal_uInt16 nArrayDims = rPar.Count() - 1; if( nArrayDims > 0 ) { - for( USHORT i = 0; i < nArrayDims ; i++ ) + for( sal_uInt16 i = 0; i < nArrayDims ; i++ ) { - INT32 ub = rPar.Get(i+1)->GetLong(); + sal_Int32 ub = rPar.Get(i+1)->GetLong(); if( ub < 0 ) { StarBASIC::Error( SbERR_OUT_OF_RANGE ); @@ -730,7 +843,7 @@ RTLFUNC(DimArray) // Array zurueckliefern SbxVariableRef refVar = rPar.Get(0); - USHORT nFlags = refVar->GetFlags(); + sal_uInt16 nFlags = refVar->GetFlags(); refVar->ResetFlag( SBX_FIXED ); refVar->PutObject( pArray ); refVar->SetFlags( nFlags ); @@ -849,12 +962,12 @@ RTLFUNC(FindPropertyObject) -BOOL lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm, - BOOL bBinary, short nBlockLen, BOOL bIsArray ) +sal_Bool lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm, + sal_Bool bBinary, short nBlockLen, sal_Bool bIsArray ) { - ULONG nFPos = pStrm->Tell(); + sal_uIntPtr nFPos = pStrm->Tell(); - BOOL bIsVariant = !rVar.IsFixed(); + sal_Bool bIsVariant = !rVar.IsFixed(); SbxDataType eType = rVar.GetType(); switch( eType ) @@ -863,7 +976,7 @@ BOOL lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm, case SbxCHAR: case SbxBYTE: if( bIsVariant ) - *pStrm << (USHORT)SbxBYTE; // VarType Id + *pStrm << (sal_uInt16)SbxBYTE; // VarType Id *pStrm << rVar.GetByte(); break; @@ -875,25 +988,25 @@ BOOL lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm, case SbxINT: case SbxUINT: if( bIsVariant ) - *pStrm << (USHORT)SbxINTEGER; // VarType Id + *pStrm << (sal_uInt16)SbxINTEGER; // VarType Id *pStrm << rVar.GetInteger(); break; case SbxLONG: case SbxULONG: if( bIsVariant ) - *pStrm << (USHORT)SbxLONG; // VarType Id + *pStrm << (sal_uInt16)SbxLONG; // VarType Id *pStrm << rVar.GetLong(); break; case SbxSALINT64: case SbxSALUINT64: if( bIsVariant ) - *pStrm << (USHORT)SbxSALINT64; // VarType Id + *pStrm << (sal_uInt16)SbxSALINT64; // VarType Id *pStrm << (sal_uInt64)rVar.GetInt64(); break; case SbxSINGLE: if( bIsVariant ) - *pStrm << (USHORT)eType; // VarType Id + *pStrm << (sal_uInt16)eType; // VarType Id *pStrm << rVar.GetSingle(); break; @@ -901,7 +1014,7 @@ BOOL lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm, case SbxCURRENCY: case SbxDATE: if( bIsVariant ) - *pStrm << (USHORT)eType; // VarType Id + *pStrm << (sal_uInt16)eType; // VarType Id *pStrm << rVar.GetDouble(); break; @@ -912,7 +1025,7 @@ BOOL lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm, if( !bBinary || bIsArray ) { if( bIsVariant ) - *pStrm << (USHORT)SbxSTRING; + *pStrm << (sal_uInt16)SbxSTRING; pStrm->WriteByteString( rStr, gsl_getSystemTextEncoding() ); //*pStrm << rStr; } @@ -929,31 +1042,31 @@ BOOL lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm, default: StarBASIC::Error( SbERR_BAD_ARGUMENT ); - return FALSE; + return sal_False; } if( nBlockLen ) pStrm->Seek( nFPos + nBlockLen ); - return pStrm->GetErrorCode() ? FALSE : TRUE; + return pStrm->GetErrorCode() ? sal_False : sal_True; } -BOOL lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm, - BOOL bBinary, short nBlockLen, BOOL bIsArray ) +sal_Bool lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm, + sal_Bool bBinary, short nBlockLen, sal_Bool bIsArray ) { (void)bBinary; (void)bIsArray; double aDouble; - ULONG nFPos = pStrm->Tell(); + sal_uIntPtr nFPos = pStrm->Tell(); - BOOL bIsVariant = !rVar.IsFixed(); + sal_Bool bIsVariant = !rVar.IsFixed(); SbxDataType eVarType = rVar.GetType(); SbxDataType eSrcType = eVarType; if( bIsVariant ) { - USHORT nTemp; + sal_uInt16 nTemp; *pStrm >> nTemp; eSrcType = (SbxDataType)nTemp; } @@ -964,7 +1077,7 @@ BOOL lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm, case SbxCHAR: case SbxBYTE: { - BYTE aByte; + sal_uInt8 aByte; *pStrm >> aByte; rVar.PutByte( aByte ); } @@ -978,7 +1091,7 @@ BOOL lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm, case SbxINT: case SbxUINT: { - INT16 aInt; + sal_Int16 aInt; *pStrm >> aInt; rVar.PutInteger( aInt ); } @@ -987,7 +1100,7 @@ BOOL lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm, case SbxLONG: case SbxULONG: { - INT32 aInt; + sal_Int32 aInt; *pStrm >> aInt; rVar.PutLong( aInt ); } @@ -1034,23 +1147,23 @@ BOOL lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm, default: StarBASIC::Error( SbERR_BAD_ARGUMENT ); - return FALSE; + return sal_False; } if( nBlockLen ) pStrm->Seek( nFPos + nBlockLen ); - return pStrm->GetErrorCode() ? FALSE : TRUE; + return pStrm->GetErrorCode() ? sal_False : sal_True; } // nCurDim = 1...n -BOOL lcl_WriteReadSbxArray( SbxDimArray& rArr, SvStream* pStrm, - BOOL bBinary, short nCurDim, short* pOtherDims, BOOL bWrite ) +sal_Bool lcl_WriteReadSbxArray( SbxDimArray& rArr, SvStream* pStrm, + sal_Bool bBinary, short nCurDim, short* pOtherDims, sal_Bool bWrite ) { DBG_ASSERT( nCurDim > 0,"Bad Dim"); short nLower, nUpper; if( !rArr.GetDim( nCurDim, nLower, nUpper ) ) - return FALSE; + return sal_False; for( short nCur = nLower; nCur <= nUpper; nCur++ ) { pOtherDims[ nCurDim-1 ] = nCur; @@ -1059,19 +1172,19 @@ BOOL lcl_WriteReadSbxArray( SbxDimArray& rArr, SvStream* pStrm, else { SbxVariable* pVar = rArr.Get( (const short*)pOtherDims ); - BOOL bRet; + sal_Bool bRet; if( bWrite ) - bRet = lcl_WriteSbxVariable(*pVar, pStrm, bBinary, 0, TRUE ); + bRet = lcl_WriteSbxVariable(*pVar, pStrm, bBinary, 0, sal_True ); else - bRet = lcl_ReadSbxVariable(*pVar, pStrm, bBinary, 0, TRUE ); + bRet = lcl_ReadSbxVariable(*pVar, pStrm, bBinary, 0, sal_True ); if( !bRet ) - return FALSE; + return sal_False; } } - return TRUE; + return sal_True; } -void PutGet( SbxArray& rPar, BOOL bPut ) +void PutGet( SbxArray& rPar, sal_Bool bPut ) { // Wir brauchen 3 Parameter if ( rPar.Count() != 4 ) @@ -1079,9 +1192,9 @@ void PutGet( SbxArray& rPar, BOOL bPut ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - INT16 nFileNo = rPar.Get(1)->GetInteger(); + sal_Int16 nFileNo = rPar.Get(1)->GetInteger(); SbxVariable* pVar2 = rPar.Get(2); - BOOL bHasRecordNo = (BOOL)(pVar2->GetType() != SbxEMPTY); + sal_Bool bHasRecordNo = (sal_Bool)(pVar2->GetType() != SbxEMPTY); long nRecordNo = pVar2->GetLong(); if ( nFileNo < 1 || ( bHasRecordNo && nRecordNo < 1 ) ) { @@ -1099,7 +1212,7 @@ void PutGet( SbxArray& rPar, BOOL bPut ) } SvStream* pStrm = pSbStrm->GetStrm(); - BOOL bRandom = pSbStrm->IsRandom(); + sal_Bool bRandom = pSbStrm->IsRandom(); short nBlockLen = bRandom ? pSbStrm->GetBlockLen() : 0; if( bPut ) @@ -1111,7 +1224,7 @@ void PutGet( SbxArray& rPar, BOOL bPut ) // auf die Startposition seeken if( bHasRecordNo ) { - ULONG nFilePos = bRandom ? (ULONG)(nBlockLen*nRecordNo) : (ULONG)nRecordNo; + sal_uIntPtr nFilePos = bRandom ? (sal_uIntPtr)(nBlockLen*nRecordNo) : (sal_uIntPtr)nRecordNo; pStrm->Seek( nFilePos ); } @@ -1123,11 +1236,11 @@ void PutGet( SbxArray& rPar, BOOL bPut ) pArr = PTR_CAST(SbxDimArray,pParObj); } - BOOL bRet; + sal_Bool bRet; if( pArr ) { - ULONG nFPos = pStrm->Tell(); + sal_uIntPtr nFPos = pStrm->Tell(); short nDims = pArr->GetDims(); short* pDims = new short[ nDims ]; bRet = lcl_WriteReadSbxArray(*pArr,pStrm,!bRandom,nDims,pDims,bPut); @@ -1138,9 +1251,9 @@ void PutGet( SbxArray& rPar, BOOL bPut ) else { if( bPut ) - bRet = lcl_WriteSbxVariable(*pVar, pStrm, !bRandom, nBlockLen, FALSE); + bRet = lcl_WriteSbxVariable(*pVar, pStrm, !bRandom, nBlockLen, sal_False); else - bRet = lcl_ReadSbxVariable(*pVar, pStrm, !bRandom, nBlockLen, FALSE); + bRet = lcl_ReadSbxVariable(*pVar, pStrm, !bRandom, nBlockLen, sal_False); } if( !bRet || pStrm->GetErrorCode() ) StarBASIC::Error( SbERR_IO_ERROR ); @@ -1151,7 +1264,7 @@ RTLFUNC(Put) (void)pBasic; (void)bWrite; - PutGet( rPar, TRUE ); + PutGet( rPar, sal_True ); } RTLFUNC(Get) @@ -1159,7 +1272,7 @@ RTLFUNC(Get) (void)pBasic; (void)bWrite; - PutGet( rPar, FALSE ); + PutGet( rPar, sal_False ); } RTLFUNC(Environ) @@ -1174,46 +1287,21 @@ RTLFUNC(Environ) } String aResult; // sollte ANSI sein, aber unter Win16 in DLL nicht moeglich -#if defined(WIN) - LPSTR lpszEnv = GetDOSEnvironment(); - String aCompareStr( rPar.Get(1)->GetString() ); - aCompareStr += '='; - const char* pCompare = aCompareStr.GetStr(); - int nCompareLen = aCompareStr.Len(); - while ( *lpszEnv ) - { - // Es werden alle EnvString in der Form ENV=VAL 0-terminiert - // aneinander gehaengt. - - if ( strnicmp( pCompare, lpszEnv, nCompareLen ) == 0 ) - { - aResult = (const char*)(lpszEnv+nCompareLen); - rPar.Get(0)->PutString( aResult ); - return; - } - lpszEnv += lstrlen( lpszEnv ) + 1; // Next Enviroment-String - } -#else ByteString aByteStr( rPar.Get(1)->GetString(), gsl_getSystemTextEncoding() ); const char* pEnvStr = getenv( aByteStr.GetBuffer() ); if ( pEnvStr ) aResult = String::CreateFromAscii( pEnvStr ); -#endif rPar.Get(0)->PutString( aResult ); } -static double GetDialogZoomFactor( BOOL bX, long nValue ) +static double GetDialogZoomFactor( sal_Bool bX, long nValue ) { OutputDevice* pDevice = Application::GetDefaultDevice(); double nResult = 0; if( pDevice ) { Size aRefSize( nValue, nValue ); -#ifndef WIN Fraction aFracX( 1, 26 ); -#else - Fraction aFracX( 1, 23 ); -#endif Fraction aFracY( 1, 24 ); MapMode aMap( MAP_APPFONT, Point(), aFracX, aFracY ); Size aScaledSize = pDevice->LogicToPixel( aRefSize, aMap ); @@ -1246,7 +1334,7 @@ RTLFUNC(GetDialogZoomFactorX) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - rPar.Get(0)->PutDouble( GetDialogZoomFactor( TRUE, rPar.Get(1)->GetLong() )); + rPar.Get(0)->PutDouble( GetDialogZoomFactor( sal_True, rPar.Get(1)->GetLong() )); } RTLFUNC(GetDialogZoomFactorY) @@ -1259,7 +1347,7 @@ RTLFUNC(GetDialogZoomFactorY) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - rPar.Get(0)->PutDouble( GetDialogZoomFactor( FALSE, rPar.Get(1)->GetLong())); + rPar.Get(0)->PutDouble( GetDialogZoomFactor( sal_False, rPar.Get(1)->GetLong())); } @@ -1328,7 +1416,7 @@ RTLFUNC(TypeLen) else { SbxDataType eType = rPar.Get(1)->GetType(); - INT16 nLen = 0; + sal_Int16 nLen = 0; switch( eType ) { case SbxEMPTY: @@ -1383,7 +1471,7 @@ RTLFUNC(TypeLen) case SbxLPWSTR: case SbxCoreSTRING: case SbxSTRING: - nLen = (INT16)rPar.Get(1)->GetString().Len(); + nLen = (sal_Int16)rPar.Get(1)->GetString().Len(); break; default: @@ -1482,7 +1570,7 @@ RTLFUNC(EqualUnoObjects) // Instanciate "com.sun.star.awt.UnoControlDialog" on basis // of a DialogLibrary entry: Convert from XML-ByteSequence // and attach events. Implemented in classes\eventatt.cxx -void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); +void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ); RTLFUNC(CreateUnoDialog) { @@ -1555,13 +1643,19 @@ RTLFUNC(GetDefaultContext) RTL_Impl_GetDefaultContext( pBasic, rPar, bWrite ); } +#ifdef DBG_TRACE_BASIC +RTLFUNC(TraceCommand) +{ + RTL_Impl_TraceCommand( pBasic, rPar, bWrite ); +} +#endif RTLFUNC(Join) { (void)pBasic; (void)bWrite; - USHORT nParCount = rPar.Count(); + sal_uInt16 nParCount = rPar.Count(); if ( nParCount != 3 && nParCount != 2 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -1602,7 +1696,7 @@ RTLFUNC(Split) (void)pBasic; (void)bWrite; - USHORT nParCount = rPar.Count(); + sal_uInt16 nParCount = rPar.Count(); if ( nParCount < 2 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -1620,7 +1714,7 @@ RTLFUNC(Split) else aDelim = String::CreateFromAscii( " " ); - INT32 nCount = -1; + sal_Int32 nCount = -1; if( nParCount == 4 ) nCount = rPar.Get(3)->GetLong(); @@ -1674,7 +1768,7 @@ RTLFUNC(Split) // Array zurueckliefern SbxVariableRef refVar = rPar.Get(0); - USHORT nFlags = refVar->GetFlags(); + sal_uInt16 nFlags = refVar->GetFlags(); refVar->ResetFlag( SBX_FIXED ); refVar->PutObject( pArray ); refVar->SetFlags( nFlags ); @@ -1687,7 +1781,7 @@ RTLFUNC(MonthName) (void)pBasic; (void)bWrite; - USHORT nParCount = rPar.Count(); + sal_uInt16 nParCount = rPar.Count(); if( nParCount != 2 && nParCount != 3 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -1703,14 +1797,14 @@ RTLFUNC(MonthName) Sequence< CalendarItem > aMonthSeq = xCalendar->getMonths(); sal_Int32 nMonthCount = aMonthSeq.getLength(); - INT16 nVal = rPar.Get(1)->GetInteger(); + sal_Int16 nVal = rPar.Get(1)->GetInteger(); if( nVal < 1 || nVal > nMonthCount ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - BOOL bAbbreviate = false; + sal_Bool bAbbreviate = false; if( nParCount == 3 ) bAbbreviate = rPar.Get(2)->GetBool(); @@ -1727,7 +1821,7 @@ RTLFUNC(WeekdayName) (void)pBasic; (void)bWrite; - USHORT nParCount = rPar.Count(); + sal_uInt16 nParCount = rPar.Count(); if( nParCount < 2 || nParCount > 4 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -1742,9 +1836,9 @@ RTLFUNC(WeekdayName) } Sequence< CalendarItem > aDaySeq = xCalendar->getDays(); - INT16 nDayCount = (INT16)aDaySeq.getLength(); - INT16 nDay = rPar.Get(1)->GetInteger(); - INT16 nFirstDay = 0; + sal_Int16 nDayCount = (sal_Int16)aDaySeq.getLength(); + sal_Int16 nDay = rPar.Get(1)->GetInteger(); + sal_Int16 nFirstDay = 0; if( nParCount == 4 ) { nFirstDay = rPar.Get(3)->GetInteger(); @@ -1755,7 +1849,7 @@ RTLFUNC(WeekdayName) } } if( nFirstDay == 0 ) - nFirstDay = INT16( xCalendar->getFirstDayOfWeek() + 1 ); + nFirstDay = sal_Int16( xCalendar->getFirstDayOfWeek() + 1 ); nDay = 1 + (nDay + nDayCount + nFirstDay - 2) % nDayCount; if( nDay < 1 || nDay > nDayCount ) @@ -1764,7 +1858,7 @@ RTLFUNC(WeekdayName) return; } - BOOL bAbbreviate = false; + sal_Bool bAbbreviate = false; if( nParCount >= 3 ) { SbxVariable* pPar2 = rPar.Get(2); @@ -1779,16 +1873,16 @@ RTLFUNC(WeekdayName) rPar.Get(0)->PutString( String(aRetStr) ); } -INT16 implGetWeekDay( double aDate, bool bFirstDayParam = false, INT16 nFirstDay = 0 ) +sal_Int16 implGetWeekDay( double aDate, bool bFirstDayParam = false, sal_Int16 nFirstDay = 0 ) { Date aRefDate( 1,1,1900 ); long nDays = (long) aDate; nDays -= 2; // normieren: 1.1.1900 => 0 aRefDate += nDays; DayOfWeek aDay = aRefDate.GetDayOfWeek(); - INT16 nDay; + sal_Int16 nDay; if ( aDay != SUNDAY ) - nDay = (INT16)aDay + 2; + nDay = (sal_Int16)aDay + 2; else nDay = 1; // 1==Sonntag @@ -1808,7 +1902,7 @@ INT16 implGetWeekDay( double aDate, bool bFirstDayParam = false, INT16 nFirstDay StarBASIC::Error( SbERR_INTERNAL_ERROR ); return 0; } - nFirstDay = INT16( xCalendar->getFirstDayOfWeek() + 1 ); + nFirstDay = sal_Int16( xCalendar->getFirstDayOfWeek() + 1 ); } nDay = 1 + (nDay + 7 - nFirstDay) % 7; } @@ -1820,7 +1914,7 @@ RTLFUNC(Weekday) (void)pBasic; (void)bWrite; - USHORT nParCount = rPar.Count(); + sal_uInt16 nParCount = rPar.Count(); if ( nParCount < 2 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else @@ -1828,13 +1922,13 @@ RTLFUNC(Weekday) double aDate = rPar.Get(1)->GetDate(); bool bFirstDay = false; - INT16 nFirstDay = 0; + sal_Int16 nFirstDay = 0; if ( nParCount > 2 ) { nFirstDay = rPar.Get(2)->GetInteger(); bFirstDay = true; } - INT16 nDay = implGetWeekDay( aDate, bFirstDay, nFirstDay ); + sal_Int16 nDay = implGetWeekDay( aDate, bFirstDay, nFirstDay ); rPar.Get(0)->PutInteger( nDay ); } } @@ -1888,7 +1982,7 @@ static IntervalInfo pIntervalTable[] = IntervalInfo* getIntervalInfo( const String& rStringCode ) { IntervalInfo* pInfo = NULL; - INT16 i = 0; + sal_Int16 i = 0; while( (pInfo = pIntervalTable + i)->mpStringCode != NULL ) { if( rStringCode.EqualsIgnoreCaseAscii( pInfo->mpStringCode ) ) @@ -1899,30 +1993,30 @@ IntervalInfo* getIntervalInfo( const String& rStringCode ) } // From methods.cxx -BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet ); -INT16 implGetDateDay( double aDate ); -INT16 implGetDateMonth( double aDate ); -INT16 implGetDateYear( double aDate ); +sal_Bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double& rdRet ); +sal_Int16 implGetDateDay( double aDate ); +sal_Int16 implGetDateMonth( double aDate ); +sal_Int16 implGetDateYear( double aDate ); -INT16 implGetHour( double dDate ); -INT16 implGetMinute( double dDate ); -INT16 implGetSecond( double dDate ); +sal_Int16 implGetHour( double dDate ); +sal_Int16 implGetMinute( double dDate ); +sal_Int16 implGetSecond( double dDate ); -inline void implGetDayMonthYear( INT16& rnYear, INT16& rnMonth, INT16& rnDay, double dDate ) +inline void implGetDayMonthYear( sal_Int16& rnYear, sal_Int16& rnMonth, sal_Int16& rnDay, double dDate ) { rnDay = implGetDateDay( dDate ); rnMonth = implGetDateMonth( dDate ); rnYear = implGetDateYear( dDate ); } -inline INT16 limitToINT16( INT32 n32 ) +inline sal_Int16 limitToINT16( sal_Int32 n32 ) { if( n32 > 32767 ) n32 = 32767; else if( n32 < -32768 ) n32 = -32768; - return (INT16)n32; + return (sal_Int16)n32; } RTLFUNC(DateAdd) @@ -1930,7 +2024,7 @@ RTLFUNC(DateAdd) (void)pBasic; (void)bWrite; - USHORT nParCount = rPar.Count(); + sal_uInt16 nParCount = rPar.Count(); if( nParCount != 4 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -1945,7 +2039,7 @@ RTLFUNC(DateAdd) return; } - INT32 lNumber = rPar.Get(2)->GetLong(); + sal_Int32 lNumber = rPar.Get(2)->GetLong(); double dDate = rPar.Get(3)->GetDate(); double dNewDate = 0; if( pInfo->mbSimple ) @@ -1958,15 +2052,15 @@ RTLFUNC(DateAdd) // Keep hours, minutes, seconds double dHoursMinutesSeconds = dDate - floor( dDate ); - BOOL bOk = TRUE; - INT16 nYear, nMonth, nDay; - INT16 nTargetYear16 = 0, nTargetMonth = 0; + sal_Bool bOk = sal_True; + sal_Int16 nYear, nMonth, nDay; + sal_Int16 nTargetYear16 = 0, nTargetMonth = 0; implGetDayMonthYear( nYear, nMonth, nDay, dDate ); switch( pInfo->meInterval ) { case INTERVAL_YYYY: { - INT32 nTargetYear = lNumber + nYear; + sal_Int32 nTargetYear = lNumber + nYear; nTargetYear16 = limitToINT16( nTargetYear ); nTargetMonth = nMonth; bOk = implDateSerial( nTargetYear16, nTargetMonth, nDay, dNewDate ); @@ -1978,20 +2072,20 @@ RTLFUNC(DateAdd) bool bNeg = (lNumber < 0); if( bNeg ) lNumber = -lNumber; - INT32 nYearsAdd; - INT16 nMonthAdd; + sal_Int32 nYearsAdd; + sal_Int16 nMonthAdd; if( pInfo->meInterval == INTERVAL_Q ) { nYearsAdd = lNumber / 4; - nMonthAdd = (INT16)( 3 * (lNumber % 4) ); + nMonthAdd = (sal_Int16)( 3 * (lNumber % 4) ); } else { nYearsAdd = lNumber / 12; - nMonthAdd = (INT16)( lNumber % 12 ); + nMonthAdd = (sal_Int16)( lNumber % 12 ); } - INT32 nTargetYear; + sal_Int32 nTargetYear; if( bNeg ) { nTargetMonth = nMonth - nMonthAdd; @@ -2000,7 +2094,7 @@ RTLFUNC(DateAdd) nTargetMonth += 12; nYearsAdd++; } - nTargetYear = (INT32)nYear - nYearsAdd; + nTargetYear = (sal_Int32)nYear - nYearsAdd; } else { @@ -2010,7 +2104,7 @@ RTLFUNC(DateAdd) nTargetMonth -= 12; nYearsAdd++; } - nTargetYear = (INT32)nYear + nYearsAdd; + nTargetYear = (sal_Int32)nYear + nYearsAdd; } nTargetYear16 = limitToINT16( nTargetYear ); bOk = implDateSerial( nTargetYear16, nTargetMonth, nDay, dNewDate ); @@ -2022,14 +2116,14 @@ RTLFUNC(DateAdd) if( bOk ) { // Overflow? - INT16 nNewYear, nNewMonth, nNewDay; + sal_Int16 nNewYear, nNewMonth, nNewDay; implGetDayMonthYear( nNewYear, nNewMonth, nNewDay, dNewDate ); if( nNewYear > 9999 || nNewYear < 100 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - INT16 nCorrectionDay = nDay; + sal_Int16 nCorrectionDay = nDay; while( nNewMonth > nTargetMonth ) { nCorrectionDay--; @@ -2055,7 +2149,7 @@ RTLFUNC(DateDiff) // DateDiff(interval, date1, date2[, firstdayofweek[, firstweekofyear]]) - USHORT nParCount = rPar.Count(); + sal_uInt16 nParCount = rPar.Count(); if( nParCount < 4 || nParCount > 6 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -2078,30 +2172,30 @@ RTLFUNC(DateDiff) { case INTERVAL_YYYY: { - INT16 nYear1 = implGetDateYear( dDate1 ); - INT16 nYear2 = implGetDateYear( dDate2 ); + sal_Int16 nYear1 = implGetDateYear( dDate1 ); + sal_Int16 nYear2 = implGetDateYear( dDate2 ); dRet = nYear2 - nYear1; break; } case INTERVAL_Q: { - INT16 nYear1 = implGetDateYear( dDate1 ); - INT16 nYear2 = implGetDateYear( dDate2 ); - INT16 nQ1 = 1 + (implGetDateMonth( dDate1 ) - 1) / 3; - INT16 nQ2 = 1 + (implGetDateMonth( dDate2 ) - 1) / 3; - INT16 nQGes1 = 4 * nYear1 + nQ1; - INT16 nQGes2 = 4 * nYear2 + nQ2; + sal_Int16 nYear1 = implGetDateYear( dDate1 ); + sal_Int16 nYear2 = implGetDateYear( dDate2 ); + sal_Int16 nQ1 = 1 + (implGetDateMonth( dDate1 ) - 1) / 3; + sal_Int16 nQ2 = 1 + (implGetDateMonth( dDate2 ) - 1) / 3; + sal_Int16 nQGes1 = 4 * nYear1 + nQ1; + sal_Int16 nQGes2 = 4 * nYear2 + nQ2; dRet = nQGes2 - nQGes1; break; } case INTERVAL_M: { - INT16 nYear1 = implGetDateYear( dDate1 ); - INT16 nYear2 = implGetDateYear( dDate2 ); - INT16 nMonth1 = implGetDateMonth( dDate1 ); - INT16 nMonth2 = implGetDateMonth( dDate2 ); - INT16 nMonthGes1 = 12 * nYear1 + nMonth1; - INT16 nMonthGes2 = 12 * nYear2 + nMonth2; + sal_Int16 nYear1 = implGetDateYear( dDate1 ); + sal_Int16 nYear2 = implGetDateYear( dDate2 ); + sal_Int16 nMonth1 = implGetDateMonth( dDate1 ); + sal_Int16 nMonth2 = implGetDateMonth( dDate2 ); + sal_Int16 nMonthGes1 = 12 * nYear1 + nMonth1; + sal_Int16 nMonthGes2 = 12 * nYear2 + nMonth2; dRet = nMonthGes2 - nMonthGes1; break; } @@ -2120,7 +2214,7 @@ RTLFUNC(DateDiff) double dDays2 = floor( dDate2 ); if( pInfo->meInterval == INTERVAL_WW ) { - INT16 nFirstDay = 1; // Default + sal_Int16 nFirstDay = 1; // Default if( nParCount >= 5 ) { nFirstDay = rPar.Get(4)->GetInteger(); @@ -2137,17 +2231,17 @@ RTLFUNC(DateDiff) StarBASIC::Error( SbERR_INTERNAL_ERROR ); return; } - nFirstDay = INT16( xCalendar->getFirstDayOfWeek() + 1 ); + nFirstDay = sal_Int16( xCalendar->getFirstDayOfWeek() + 1 ); } } - INT16 nDay1 = implGetWeekDay( dDate1 ); - INT16 nDay1_Diff = nDay1 - nFirstDay; + sal_Int16 nDay1 = implGetWeekDay( dDate1 ); + sal_Int16 nDay1_Diff = nDay1 - nFirstDay; if( nDay1_Diff < 0 ) nDay1_Diff += 7; dDays1 -= nDay1_Diff; - INT16 nDay2 = implGetWeekDay( dDate2 ); - INT16 nDay2_Diff = nDay2 - nFirstDay; + sal_Int16 nDay2 = implGetWeekDay( dDate2 ); + sal_Int16 nDay2_Diff = nDay2 - nFirstDay; if( nDay2_Diff < 0 ) nDay2_Diff += 7; dDays2 -= nDay2_Diff; @@ -2182,7 +2276,7 @@ RTLFUNC(DateDiff) } double implGetDateOfFirstDayInFirstWeek - ( INT16 nYear, INT16& nFirstDay, INT16& nFirstWeek, bool* pbError = NULL ) + ( sal_Int16 nYear, sal_Int16& nFirstDay, sal_Int16& nFirstWeek, bool* pbError = NULL ) { SbError nError = 0; if( nFirstDay < 0 || nFirstDay > 7 ) @@ -2208,9 +2302,9 @@ double implGetDateOfFirstDayInFirstWeek } if( nFirstDay == 0 ) - nFirstDay = INT16( xCalendar->getFirstDayOfWeek() + 1 ); + nFirstDay = sal_Int16( xCalendar->getFirstDayOfWeek() + 1 ); - INT16 nFirstWeekMinDays = 0; // Not used for vbFirstJan1 = default + sal_Int16 nFirstWeekMinDays = 0; // Not used for vbFirstJan1 = default if( nFirstWeek == 0 ) { nFirstWeekMinDays = xCalendar->getMinimumNumberOfDaysForFirstWeek(); @@ -2233,14 +2327,14 @@ double implGetDateOfFirstDayInFirstWeek implDateSerial( nYear, 1, 1, dBaseDate ); double dRetDate = dBaseDate; - INT16 nWeekDay0101 = implGetWeekDay( dBaseDate ); - INT16 nDayDiff = nWeekDay0101 - nFirstDay; + sal_Int16 nWeekDay0101 = implGetWeekDay( dBaseDate ); + sal_Int16 nDayDiff = nWeekDay0101 - nFirstDay; if( nDayDiff < 0 ) nDayDiff += 7; if( nFirstWeekMinDays ) { - INT16 nThisWeeksDaysInYearCount = 7 - nDayDiff; + sal_Int16 nThisWeeksDaysInYearCount = 7 - nDayDiff; if( nThisWeeksDaysInYearCount < nFirstWeekMinDays ) nDayDiff -= 7; } @@ -2255,7 +2349,7 @@ RTLFUNC(DatePart) // DatePart(interval, date[,firstdayofweek[, firstweekofyear]]) - USHORT nParCount = rPar.Count(); + sal_uInt16 nParCount = rPar.Count(); if( nParCount < 3 || nParCount > 5 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -2272,7 +2366,7 @@ RTLFUNC(DatePart) double dDate = rPar.Get(2)->GetDate(); - INT32 nRet = 0; + sal_Int32 nRet = 0; switch( pInfo->meInterval ) { case INTERVAL_YYYY: @@ -2292,10 +2386,10 @@ RTLFUNC(DatePart) } case INTERVAL_Y: { - INT16 nYear = implGetDateYear( dDate ); + sal_Int16 nYear = implGetDateYear( dDate ); double dBaseDate; implDateSerial( nYear, 1, 1, dBaseDate ); - nRet = 1 + INT32( dDate - dBaseDate ); + nRet = 1 + sal_Int32( dDate - dBaseDate ); break; } case INTERVAL_D: @@ -2306,7 +2400,7 @@ RTLFUNC(DatePart) case INTERVAL_W: { bool bFirstDay = false; - INT16 nFirstDay = 1; // Default + sal_Int16 nFirstDay = 1; // Default if( nParCount >= 4 ) { nFirstDay = rPar.Get(3)->GetInteger(); @@ -2317,15 +2411,15 @@ RTLFUNC(DatePart) } case INTERVAL_WW: { - INT16 nFirstDay = 1; // Default + sal_Int16 nFirstDay = 1; // Default if( nParCount >= 4 ) nFirstDay = rPar.Get(3)->GetInteger(); - INT16 nFirstWeek = 1; // Default + sal_Int16 nFirstWeek = 1; // Default if( nParCount == 5 ) nFirstWeek = rPar.Get(4)->GetInteger(); - INT16 nYear = implGetDateYear( dDate ); + sal_Int16 nYear = implGetDateYear( dDate ); bool bError = false; double dYearFirstDay = implGetDateOfFirstDayInFirstWeek( nYear, nFirstDay, nFirstWeek, &bError ); if( !bError ) @@ -2345,7 +2439,7 @@ RTLFUNC(DatePart) // Calculate week double dDiff = dDate - dYearFirstDay; - nRet = 1 + INT32( dDiff / 7 ); + nRet = 1 + sal_Int32( dDiff / 7 ); } break; } @@ -2376,7 +2470,7 @@ RTLFUNC(FormatDateTime) (void)pBasic; (void)bWrite; - USHORT nParCount = rPar.Count(); + sal_uInt16 nParCount = rPar.Count(); if( nParCount < 2 || nParCount > 3 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -2384,7 +2478,7 @@ RTLFUNC(FormatDateTime) } double dDate = rPar.Get(1)->GetDate(); - INT16 nNamedFormat = 0; + sal_Int16 nNamedFormat = 0; if( nParCount > 2 ) { nNamedFormat = rPar.Get(2)->GetInteger(); @@ -2434,7 +2528,7 @@ RTLFUNC(FormatDateTime) } LanguageType eLangType = GetpApp()->GetSettings().GetLanguage(); - ULONG nIndex = pFormatter->GetFormatIndex( NF_DATE_SYSTEM_LONG, eLangType ); + sal_uIntPtr nIndex = pFormatter->GetFormatIndex( NF_DATE_SYSTEM_LONG, eLangType ); Color* pCol; pFormatter->GetOutputString( dDate, nIndex, aRetStr, &pCol ); @@ -2479,7 +2573,7 @@ RTLFUNC(Round) (void)pBasic; (void)bWrite; - USHORT nParCount = rPar.Count(); + sal_uInt16 nParCount = rPar.Count(); if( nParCount != 2 && nParCount != 3 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -2498,7 +2592,7 @@ RTLFUNC(Round) dVal = -dVal; } - INT16 numdecimalplaces = 0; + sal_Int16 numdecimalplaces = 0; if( nParCount == 3 ) { numdecimalplaces = rPar.Get(2)->GetInteger(); @@ -2557,7 +2651,7 @@ RTLFUNC(SYD) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uLong nArgCount = rPar.Count()-1; if ( nArgCount < 4 ) { @@ -2581,7 +2675,7 @@ RTLFUNC(SLN) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uLong nArgCount = rPar.Count()-1; if ( nArgCount < 3 ) { @@ -2604,7 +2698,7 @@ RTLFUNC(Pmt) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uLong nArgCount = rPar.Count()-1; if ( nArgCount < 3 || nArgCount > 5 ) { @@ -2649,7 +2743,7 @@ RTLFUNC(PPmt) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uLong nArgCount = rPar.Count()-1; if ( nArgCount < 4 || nArgCount > 6 ) { @@ -2696,7 +2790,7 @@ RTLFUNC(PV) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uLong nArgCount = rPar.Count()-1; if ( nArgCount < 3 || nArgCount > 5 ) { @@ -2741,7 +2835,7 @@ RTLFUNC(NPV) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uLong nArgCount = rPar.Count()-1; if ( nArgCount < 1 || nArgCount > 2 ) { @@ -2769,7 +2863,7 @@ RTLFUNC(NPer) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uLong nArgCount = rPar.Count()-1; if ( nArgCount < 3 || nArgCount > 5 ) { @@ -2814,7 +2908,7 @@ RTLFUNC(MIRR) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uLong nArgCount = rPar.Count()-1; if ( nArgCount < 3 ) { @@ -2845,7 +2939,7 @@ RTLFUNC(IRR) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uLong nArgCount = rPar.Count()-1; if ( nArgCount < 1 || nArgCount > 2 ) { @@ -2882,7 +2976,7 @@ RTLFUNC(IPmt) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uLong nArgCount = rPar.Count()-1; if ( nArgCount < 4 || nArgCount > 6 ) { @@ -2929,7 +3023,7 @@ RTLFUNC(FV) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uLong nArgCount = rPar.Count()-1; if ( nArgCount < 3 || nArgCount > 5 ) { @@ -2974,7 +3068,7 @@ RTLFUNC(DDB) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uLong nArgCount = rPar.Count()-1; if ( nArgCount < 4 || nArgCount > 5 ) { @@ -3013,7 +3107,7 @@ RTLFUNC(Rate) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uLong nArgCount = rPar.Count()-1; if ( nArgCount < 3 || nArgCount > 6 ) { @@ -3096,7 +3190,7 @@ RTLFUNC(CompatibilityMode) (void)bWrite; bool bEnabled = false; - USHORT nCount = rPar.Count(); + sal_uInt16 nCount = rPar.Count(); if ( nCount != 1 && nCount != 2 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -3123,8 +3217,8 @@ RTLFUNC(Input) return; } - USHORT nByteCount = rPar.Get(1)->GetUShort(); - INT16 nFileNumber = rPar.Get(2)->GetInteger(); + sal_uInt16 nByteCount = rPar.Get(1)->GetUShort(); + sal_Int16 nFileNumber = rPar.Get(2)->GetInteger(); SbiIoSystem* pIosys = pINST->GetIoSystem(); SbiStream* pSbStrm = pIosys->GetStream( nFileNumber ); diff --git a/basic/source/runtime/props.cxx b/basic/source/runtime/props.cxx index 42b0dd0dddca..8f441827905f 100644..100755 --- a/basic/source/runtime/props.cxx +++ b/basic/source/runtime/props.cxx @@ -35,8 +35,8 @@ #include "errobject.hxx" -// Properties und Methoden legen beim Get (bWrite = FALSE) den Returnwert -// im Element 0 des Argv ab; beim Put (bWrite = TRUE) wird der Wert aus +// Properties und Methoden legen beim Get (bWrite = sal_False) den Returnwert +// im Element 0 des Argv ab; beim Put (bWrite = sal_True) wird der Wert aus // Element 0 gespeichert. RTLFUNC(Erl) @@ -60,9 +60,9 @@ RTLFUNC(Err) { if( bWrite ) { - INT32 nVal = rPar.Get( 0 )->GetLong(); + sal_Int32 nVal = rPar.Get( 0 )->GetLong(); if( nVal <= 65535L ) - StarBASIC::Error( StarBASIC::GetSfxFromVBError( (USHORT) nVal ) ); + StarBASIC::Error( StarBASIC::GetSfxFromVBError( (sal_uInt16) nVal ) ); } else rPar.Get( 0 )->PutLong( StarBASIC::GetVBErrorCode( StarBASIC::GetErrBasic() ) ); @@ -74,7 +74,7 @@ RTLFUNC(False) (void)pBasic; (void)bWrite; - rPar.Get(0)->PutBool( FALSE ); + rPar.Get(0)->PutBool( sal_False ); } RTLFUNC(Empty) @@ -115,7 +115,7 @@ RTLFUNC(True) (void)pBasic; (void)bWrite; - rPar.Get( 0 )->PutBool( TRUE ); + rPar.Get( 0 )->PutBool( sal_True ); } RTLFUNC(ATTR_NORMAL) diff --git a/basic/source/runtime/rtlproto.hxx b/basic/source/runtime/rtlproto.hxx index 9eb6f495f433..c129d997ca9d 100644..100755 --- a/basic/source/runtime/rtlproto.hxx +++ b/basic/source/runtime/rtlproto.hxx @@ -27,11 +27,12 @@ ************************************************************************/ #include <basic/sbstar.hxx> +#include "sbtrace.hxx" -#define RTLFUNC( name ) void SbRtl_##name( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +#define RTLFUNC( name ) void SbRtl_##name( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ) #define RTLNAME( name ) &SbRtl_##name -typedef void( *RtlCall ) ( StarBASIC* p, SbxArray& rArgs, BOOL bWrite ); +typedef void( *RtlCall ) ( StarBASIC* p, SbxArray& rArgs, sal_Bool bWrite ); // Properties @@ -285,6 +286,7 @@ extern RTLFUNC(AboutStarBasic); extern RTLFUNC(LoadPicture); extern RTLFUNC(SavePicture); +extern RTLFUNC(CallByName); extern RTLFUNC(CBool); // JSM extern RTLFUNC(CByte); // JSM extern RTLFUNC(CCur); // JSM @@ -360,6 +362,10 @@ extern RTLFUNC(CDec); extern RTLFUNC(Partition); // Fong +#ifdef DBG_TRACE_BASIC +extern RTLFUNC(TraceCommand); +#endif + extern double Now_Impl(); extern void Wait_Impl( bool bDurationBased, SbxArray& rPar ); diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index d0babeee3d96..8609c2a2c97d 100644..100755 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -46,6 +46,8 @@ #include "sbunoobj.hxx" #include "errobject.hxx" +#include "comenumwrapper.hxx" + SbxVariable* getDefaultProp( SbxVariable* pRef ); using namespace ::com::sun::star; @@ -60,13 +62,13 @@ bool SbiRuntime::isVBAEnabled() } // #91147 Global reschedule flag -static BOOL bStaticGlobalEnableReschedule = TRUE; +static sal_Bool bStaticGlobalEnableReschedule = sal_True; -void StarBASIC::StaticEnableReschedule( BOOL bReschedule ) +void StarBASIC::StaticEnableReschedule( sal_Bool bReschedule ) { bStaticGlobalEnableReschedule = bReschedule; } -void StarBASIC::SetVBAEnabled( BOOL bEnabled ) +void StarBASIC::SetVBAEnabled( sal_Bool bEnabled ) { if ( bDocBasic ) { @@ -74,15 +76,15 @@ void StarBASIC::SetVBAEnabled( BOOL bEnabled ) } } -BOOL StarBASIC::isVBAEnabled() +sal_Bool StarBASIC::isVBAEnabled() { if ( bDocBasic ) { if( SbiRuntime::isVBAEnabled() ) - return TRUE; + return sal_True; return bVBAEnabled; } - return FALSE; + return sal_False; } @@ -254,12 +256,12 @@ SbiRTLData::~SbiRTLData() // (siehe auch step2.cxx, SbiRuntime::StepSTMNT() ) // Hilfsfunktion, um den BreakCallLevel gemaess der der Debug-Flags zu ermitteln -void SbiInstance::CalcBreakCallLevel( USHORT nFlags ) +void SbiInstance::CalcBreakCallLevel( sal_uInt16 nFlags ) { // Break-Flag wegfiltern - nFlags &= ~((USHORT)SbDEBUG_BREAK); + nFlags &= ~((sal_uInt16)SbDEBUG_BREAK); - USHORT nRet; + sal_uInt16 nRet; switch( nFlags ) { case SbDEBUG_STEPINTO: @@ -292,8 +294,8 @@ SbiInstance::SbiInstance( StarBASIC* p ) nBreakCallLvl = 0; nErr = nErl = 0; - bReschedule = TRUE; - bCompatibility = FALSE; + bReschedule = sal_True; + bCompatibility = sal_False; } SbiInstance::~SbiInstance() @@ -451,7 +453,7 @@ void SbiInstance::ErrorVB( sal_Int32 nVBNumber, const String& rMsg ) { if( !bWatchMode ) { - SbError n = StarBASIC::GetSfxFromVBError( static_cast< USHORT >( nVBNumber ) ); + SbError n = StarBASIC::GetSfxFromVBError( static_cast< sal_uInt16 >( nVBNumber ) ); if ( !n ) n = nVBNumber; // force orig number, probably should have a specific table of vb ( localized ) errors @@ -465,7 +467,7 @@ void SbiInstance::ErrorVB( sal_Int32 nVBNumber, const String& rMsg ) void SbiInstance::setErrorVB( sal_Int32 nVBNumber, const String& rMsg ) { - SbError n = StarBASIC::GetSfxFromVBError( static_cast< USHORT >( nVBNumber ) ); + SbError n = StarBASIC::GetSfxFromVBError( static_cast< sal_uInt16 >( nVBNumber ) ); if( !n ) n = nVBNumber; // force orig number, probably should have a specific table of vb ( localized ) errors @@ -516,7 +518,7 @@ SbModule* SbiInstance::GetActiveModule() return NULL; } -SbMethod* SbiInstance::GetCaller( USHORT nLevel ) +SbMethod* SbiInstance::GetCaller( sal_uInt16 nLevel ) { SbiRuntime* p = pRun; while( nLevel-- && p ) @@ -544,7 +546,7 @@ SbxArray* SbiInstance::GetLocals( SbMethod* pMeth ) // Achtung: pMeth kann auch NULL sein (beim Aufruf des Init-Codes) -SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, UINT32 nStart ) +SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, sal_uInt32 nStart ) : rBasic( *(StarBASIC*)pm->pParent ), pInst( pINST ), pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), mpExtCaller(0), m_nLastTime(0) { @@ -559,11 +561,11 @@ SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, UINT32 nStart ) pRestart = NULL; pNext = NULL; pCode = - pStmnt = (const BYTE* ) pImg->GetCode() + nStart; + pStmnt = (const sal_uInt8* ) pImg->GetCode() + nStart; bRun = - bError = TRUE; - bInError = FALSE; - bBlocked = FALSE; + bError = sal_True; + bInError = sal_False; + bBlocked = sal_False; nLine = 0; nCol1 = 0; nCol2 = 0; @@ -623,10 +625,10 @@ void SbiRuntime::SetParameters( SbxArray* pParams ) refParams->Put( pMeth, 0 ); SbxInfo* pInfo = pMeth ? pMeth->GetInfo() : NULL; - USHORT nParamCount = pParams ? pParams->Count() : 1; + sal_uInt16 nParamCount = pParams ? pParams->Count() : 1; if( nParamCount > 1 ) { - for( USHORT i = 1 ; i < nParamCount ; i++ ) + for( sal_uInt16 i = 1 ; i < nParamCount ; i++ ) { const SbxParamInfo* p = pInfo ? pInfo->GetParam( i ) : NULL; @@ -634,9 +636,9 @@ void SbiRuntime::SetParameters( SbxArray* pParams ) if( p && (p->nUserData & PARAM_INFO_PARAMARRAY) != 0 ) { SbxDimArray* pArray = new SbxDimArray( SbxVARIANT ); - USHORT nParamArrayParamCount = nParamCount - i; + sal_uInt16 nParamArrayParamCount = nParamCount - i; pArray->unoAddDim( 0, nParamArrayParamCount - 1 ); - for( USHORT j = i ; j < nParamCount ; j++ ) + for( sal_uInt16 j = i ; j < nParamCount ; j++ ) { SbxVariable* v = pParams->Get( j ); short nDimIndex = j - i; @@ -654,16 +656,16 @@ void SbiRuntime::SetParameters( SbxArray* pParams ) SbxVariable* v = pParams->Get( i ); // Methoden sind immer byval! - BOOL bByVal = v->IsA( TYPE(SbxMethod) ); + sal_Bool bByVal = v->IsA( TYPE(SbxMethod) ); SbxDataType t = v->GetType(); if( p ) { - bByVal |= BOOL( ( p->eType & SbxBYREF ) == 0 ); + bByVal |= sal_Bool( ( p->eType & SbxBYREF ) == 0 ); t = (SbxDataType) ( p->eType & 0x0FFF ); if( !bByVal && t != SbxVARIANT && (!v->IsFixed() || (SbxDataType)(v->GetType() & 0x0FFF ) != t) ) - bByVal = TRUE; + bByVal = sal_True; } if( bByVal ) { @@ -709,7 +711,7 @@ void SbiRuntime::SetParameters( SbxArray* pParams ) // Einen P-Code ausfuehren -BOOL SbiRuntime::Step() +sal_Bool SbiRuntime::Step() { if( bRun ) { @@ -732,7 +734,7 @@ BOOL SbiRuntime::Step() } SbiOpcode eOp = (SbiOpcode ) ( *pCode++ ); - UINT32 nOp1, nOp2; + sal_uInt32 nOp1, nOp2; if( eOp <= SbOP0_END ) { (this->*( aStep0[ eOp ] ) )(); @@ -782,7 +784,7 @@ BOOL SbiRuntime::Step() // Im Error Handler? Dann Std-Error if ( !bInError ) { - bInError = TRUE; + bInError = sal_True; if( !bError ) // On Error Resume Next StepRESUME( 1 ); @@ -807,7 +809,7 @@ BOOL SbiRuntime::Step() while( NULL != (pRt = pRt->pNext) ) { // Gibt es einen Error-Handler? - if( pRt->bError == FALSE || pRt->pError != NULL ) + if( pRt->bError == sal_False || pRt->pError != NULL ) { pRtErrHdl = pRt; break; @@ -830,7 +832,7 @@ BOOL SbiRuntime::Step() // Fehler setzen pRt->nError = err; if( pRt != pRtErrHdl ) - pRt->bRun = FALSE; + pRt->bRun = sal_False; // In Error-Stack eintragen SbErrorStackEntry *pEntry = new SbErrorStackEntry @@ -882,11 +884,12 @@ void SbiRuntime::Error( SbError _errCode, const String& _details ) { if ( _errCode ) { - OSL_ENSURE( pInst->pRun == this, "SbiRuntime::Error: can't propagate the error message details!" ); + // Not correct for class module usage, remove for now + //OSL_ENSURE( pInst->pRun == this, "SbiRuntime::Error: can't propagate the error message details!" ); if ( pInst->pRun == this ) { pInst->Error( _errCode, _details ); - OSL_POSTCOND( nError == _errCode, "SbiRuntime::Error: the instance is expecte to propagate the error code back to me!" ); + //OSL_POSTCOND( nError == _errCode, "SbiRuntime::Error: the instance is expecte to propagate the error code back to me!" ); } else { @@ -918,7 +921,7 @@ sal_Int32 SbiRuntime::translateErrorToVba( SbError nError, String& rMsg ) { // TEST, has to be vb here always #ifdef DBG_UTIL - SbError nTmp = StarBASIC::GetSfxFromVBError( (USHORT)nError ); + SbError nTmp = StarBASIC::GetSfxFromVBError( (sal_uInt16)nError ); DBG_ASSERT( nTmp, "No VB error!" ); #endif @@ -928,7 +931,7 @@ sal_Int32 SbiRuntime::translateErrorToVba( SbError nError, String& rMsg ) rMsg = String( RTL_CONSTASCII_USTRINGPARAM("Internal Object Error:") ); } // no num? most likely then it *is* really a vba err - USHORT nVBErrorCode = StarBASIC::GetVBErrorCode( nError ); + sal_uInt16 nVBErrorCode = StarBASIC::GetVBErrorCode( nError ); sal_Int32 nVBAErrorNumber = ( nVBErrorCode == 0 ) ? nError : nVBErrorCode; return nVBAErrorNumber; } @@ -989,7 +992,7 @@ SbxVariableRef SbiRuntime::PopVar() return xVar; } -BOOL SbiRuntime::ClearExprStack() +sal_Bool SbiRuntime::ClearExprStack() { // Achtung: Clear() reicht nicht, da Methods geloescht werden muessen while ( nExprLvl ) @@ -997,7 +1000,7 @@ BOOL SbiRuntime::ClearExprStack() PopVar(); } refExprStk->Clear(); - return FALSE; + return sal_False; } // Variable auf dem Expression-Stack holen, ohne sie zu entfernen @@ -1013,7 +1016,7 @@ SbxVariable* SbiRuntime::GetTOS( short n ) return new SbxVariable; } #endif - return refExprStk->Get( (USHORT) n ); + return refExprStk->Get( (sal_uInt16) n ); } // Sicherstellen, dass TOS eine temporaere Variable ist @@ -1048,7 +1051,7 @@ void SbiRuntime::TOSMakeTemp() } // Der GOSUB-Stack nimmt Returnadressen fuer GOSUBs auf -void SbiRuntime::PushGosub( const BYTE* pc ) +void SbiRuntime::PushGosub( const sal_uInt8* pc ) { if( ++nGosubLvl > MAXRECURSION ) StarBASIC::FatalError( SbERR_STACK_OVERFLOW ); @@ -1185,6 +1188,23 @@ void SbiRuntime::PushForEach() p->xEnumeration = xEnumerationAccess->createEnumeration(); p->eForType = FOR_EACH_XENUMERATION; } + else if ( isVBAEnabled() && pUnoObj->isNativeCOMObject() ) + { + uno::Reference< script::XInvocation > xInvocation; + if ( ( aAny >>= xInvocation ) && xInvocation.is() ) + { + try + { + p->xEnumeration = new ComEnumerationWrapper( xInvocation ); + p->eForType = FOR_EACH_XENUMERATION; + } + catch( uno::Exception& ) + {} + } + + if ( !p->xEnumeration.is() ) + bError_ = true; + } else { bError_ = true; @@ -1238,7 +1258,7 @@ void SbiRuntime::DllCall const String& aDLLName, // Name der DLL SbxArray* pArgs, // Parameter (ab Index 1, kann NULL sein) SbxDataType eResType, // Returnwert - BOOL bCDecl ) // TRUE: nach C-Konventionen + sal_Bool bCDecl ) // sal_True: nach C-Konventionen { // No DllCall for "virtual" portal users if( needSecurityRestrictions() ) @@ -1265,13 +1285,13 @@ void SbiRuntime::DllCall Error( nErr ); PushVar( pRes ); } -USHORT -SbiRuntime::GetImageFlag( USHORT n ) const + +sal_uInt16 SbiRuntime::GetImageFlag( sal_uInt16 n ) const { return pImg->GetFlag( n ); } -USHORT -SbiRuntime::GetBase() + +sal_uInt16 SbiRuntime::GetBase() { return pImg->GetBase(); } diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx index f2f51c4406c7..40a1fa911437 100644..100755 --- a/basic/source/runtime/stdobj.cxx +++ b/basic/source/runtime/stdobj.cxx @@ -68,7 +68,7 @@ struct Methods { SbxDataType eType; // Datentyp short nArgs; // Argumente und Flags RtlCall pFunc; // Function Pointer - USHORT nHash; // Hashcode + sal_uInt16 nHash; // Hashcode }; struct StringHashCode @@ -135,6 +135,10 @@ static Methods aMethods[] = { { "Blue", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Blue),0 }, { "RGB-Value", SbxLONG, 0,NULL,0 }, +{ "CallByName", SbxVARIANT, 3 | _FUNCTION, RTLNAME(CallByName),0 }, + { "Object", SbxOBJECT, 0,NULL,0 }, + { "ProcedureName",SbxSTRING, 0,NULL,0 }, + { "CallType", SbxINTEGER, 0,NULL,0 }, { "CBool", SbxBOOL, 1 | _FUNCTION, RTLNAME(CBool),0 }, { "expression", SbxVARIANT, 0,NULL,0 }, { "CByte", SbxBYTE, 1 | _FUNCTION, RTLNAME(CByte),0 }, @@ -645,6 +649,10 @@ static Methods aMethods[] = { { "TimeValue", SbxDATE, 1 | _FUNCTION, RTLNAME(TimeValue),0 }, { "String", SbxSTRING, 0,NULL,0 }, { "TOGGLE", SbxINTEGER, _CPROP, RTLNAME(TOGGLE),0 }, +#ifdef DBG_TRACE_BASIC +{ "TraceCommand", SbxNULL, 1 | _FUNCTION, RTLNAME(TraceCommand),0 }, + { "Command", SbxSTRING, 0,NULL,0 }, +#endif { "Trim", SbxSTRING, 1 | _FUNCTION, RTLNAME(Trim),0 }, { "String", SbxSTRING, 0,NULL,0 }, { "True", SbxBOOL, _CPROP, RTLNAME(True),0 }, @@ -780,11 +788,11 @@ SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t ) if( !pVar ) { // sonst suchen - USHORT nHash_ = SbxVariable::MakeHashCode( rName ); + sal_uInt16 nHash_ = SbxVariable::MakeHashCode( rName ); Methods* p = aMethods; - BOOL bFound = FALSE; + sal_Bool bFound = sal_False; short nIndex = 0; - USHORT nSrchMask = _TYPEMASK; + sal_uInt16 nSrchMask = _TYPEMASK; switch( t ) { case SbxCLASS_METHOD: nSrchMask = _METHOD; break; @@ -799,14 +807,14 @@ SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t ) && ( rName.EqualsIgnoreCaseAscii( p->pName ) ) ) { SbiInstance* pInst = pINST; - bFound = TRUE; + bFound = sal_True; if( p->nArgs & _COMPTMASK ) { if( !pInst || !pInst->IsCompatibility() ) - bFound = FALSE; + bFound = sal_False; } if ( pInst && pInst->IsCompatibility() && VBABlackListQuery::isBlackListed( rName ) ) - bFound = FALSE; + bFound = sal_False; break; } nIndex += ( p->nArgs & _ARGSMASK ) + 1; @@ -834,8 +842,8 @@ SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t ) return pVar; } -// SetModified mu bei der RTL abgklemmt werden -void SbiStdObject::SetModified( BOOL ) +// SetModified mu� bei der RTL abgklemmt werden +void SbiStdObject::SetModified( sal_Bool ) { } @@ -850,17 +858,17 @@ void SbiStdObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, { SbxVariable* pVar = pHint->GetVar(); SbxArray* pPar_ = pVar->GetParameters(); - ULONG t = pHint->GetId(); - USHORT nCallId = (USHORT) pVar->GetUserData(); + sal_uIntPtr t = pHint->GetId(); + sal_uInt16 nCallId = (sal_uInt16) pVar->GetUserData(); if( nCallId ) { if( t == SBX_HINT_INFOWANTED ) pVar->SetInfo( GetInfo( (short) pVar->GetUserData() ) ); else { - BOOL bWrite = FALSE; + sal_Bool bWrite = sal_False; if( t == SBX_HINT_DATACHANGED ) - bWrite = TRUE; + bWrite = sal_True; if( t == SBX_HINT_DATAWANTED || bWrite ) { RtlCall p = (RtlCall) aMethods[ nCallId-1 ].pFunc; @@ -895,7 +903,7 @@ SbxInfo* SbiStdObject::GetInfo( short nIdx ) { p++; String aName_ = String::CreateFromAscii( p->pName ); - USHORT nFlags_ = ( p->nArgs >> 8 ) & 0x03; + sal_uInt16 nFlags_ = ( p->nArgs >> 8 ) & 0x03; if( p->nArgs & _OPT ) nFlags_ |= SBX_OPTIONAL; pInfo_->AddParam( aName_, p->eType, nFlags_ ); diff --git a/basic/source/runtime/stdobj1.cxx b/basic/source/runtime/stdobj1.cxx index 28bda15bcacc..10b4269227c9 100644..100755 --- a/basic/source/runtime/stdobj1.cxx +++ b/basic/source/runtime/stdobj1.cxx @@ -72,7 +72,7 @@ SbxObject* SbStdFactory::CreateObject( const String& rClassName ) -void SbStdPicture::PropType( SbxVariable* pVar, SbxArray*, BOOL bWrite ) +void SbStdPicture::PropType( SbxVariable* pVar, SbxArray*, sal_Bool bWrite ) { if( bWrite ) { @@ -81,7 +81,7 @@ void SbStdPicture::PropType( SbxVariable* pVar, SbxArray*, BOOL bWrite ) } GraphicType eType = aGraphic.GetType(); - INT16 nType = 0; + sal_Int16 nType = 0; if( eType == GRAPHIC_BITMAP ) nType = 1; @@ -93,7 +93,7 @@ void SbStdPicture::PropType( SbxVariable* pVar, SbxArray*, BOOL bWrite ) } -void SbStdPicture::PropWidth( SbxVariable* pVar, SbxArray*, BOOL bWrite ) +void SbStdPicture::PropWidth( SbxVariable* pVar, SbxArray*, sal_Bool bWrite ) { if( bWrite ) { @@ -105,10 +105,10 @@ void SbStdPicture::PropWidth( SbxVariable* pVar, SbxArray*, BOOL bWrite ) aSize = GetpApp()->GetAppWindow()->LogicToPixel( aSize, aGraphic.GetPrefMapMode() ); aSize = GetpApp()->GetAppWindow()->PixelToLogic( aSize, MapMode( MAP_TWIP ) ); - pVar->PutInteger( (INT16)aSize.Width() ); + pVar->PutInteger( (sal_Int16)aSize.Width() ); } -void SbStdPicture::PropHeight( SbxVariable* pVar, SbxArray*, BOOL bWrite ) +void SbStdPicture::PropHeight( SbxVariable* pVar, SbxArray*, sal_Bool bWrite ) { if( bWrite ) { @@ -120,7 +120,7 @@ void SbStdPicture::PropHeight( SbxVariable* pVar, SbxArray*, BOOL bWrite ) aSize = GetpApp()->GetAppWindow()->LogicToPixel( aSize, aGraphic.GetPrefMapMode() ); aSize = GetpApp()->GetAppWindow()->PixelToLogic( aSize, MapMode( MAP_TWIP ) ); - pVar->PutInteger( (INT16)aSize.Height() ); + pVar->PutInteger( (sal_Int16)aSize.Height() ); } @@ -170,8 +170,8 @@ void SbStdPicture::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, SbxVariable* pVar = pHint->GetVar(); SbxArray* pPar_ = pVar->GetParameters(); - USHORT nWhich = (USHORT)pVar->GetUserData(); - BOOL bWrite = pHint->GetId() == SBX_HINT_DATACHANGED; + sal_uInt16 nWhich = (sal_uInt16)pVar->GetUserData(); + sal_Bool bWrite = pHint->GetId() == SBX_HINT_DATACHANGED; // Propteries switch( nWhich ) @@ -187,7 +187,7 @@ void SbStdPicture::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, //----------------------------------------------------------------------------- -void SbStdFont::PropBold( SbxVariable* pVar, SbxArray*, BOOL bWrite ) +void SbStdFont::PropBold( SbxVariable* pVar, SbxArray*, sal_Bool bWrite ) { if( bWrite ) SetBold( pVar->GetBool() ); @@ -195,7 +195,7 @@ void SbStdFont::PropBold( SbxVariable* pVar, SbxArray*, BOOL bWrite ) pVar->PutBool( IsBold() ); } -void SbStdFont::PropItalic( SbxVariable* pVar, SbxArray*, BOOL bWrite ) +void SbStdFont::PropItalic( SbxVariable* pVar, SbxArray*, sal_Bool bWrite ) { if( bWrite ) SetItalic( pVar->GetBool() ); @@ -203,7 +203,7 @@ void SbStdFont::PropItalic( SbxVariable* pVar, SbxArray*, BOOL bWrite ) pVar->PutBool( IsItalic() ); } -void SbStdFont::PropStrikeThrough( SbxVariable* pVar, SbxArray*, BOOL bWrite ) +void SbStdFont::PropStrikeThrough( SbxVariable* pVar, SbxArray*, sal_Bool bWrite ) { if( bWrite ) SetStrikeThrough( pVar->GetBool() ); @@ -211,7 +211,7 @@ void SbStdFont::PropStrikeThrough( SbxVariable* pVar, SbxArray*, BOOL bWrite ) pVar->PutBool( IsStrikeThrough() ); } -void SbStdFont::PropUnderline( SbxVariable* pVar, SbxArray*, BOOL bWrite ) +void SbStdFont::PropUnderline( SbxVariable* pVar, SbxArray*, sal_Bool bWrite ) { if( bWrite ) SetUnderline( pVar->GetBool() ); @@ -219,15 +219,15 @@ void SbStdFont::PropUnderline( SbxVariable* pVar, SbxArray*, BOOL bWrite ) pVar->PutBool( IsUnderline() ); } -void SbStdFont::PropSize( SbxVariable* pVar, SbxArray*, BOOL bWrite ) +void SbStdFont::PropSize( SbxVariable* pVar, SbxArray*, sal_Bool bWrite ) { if( bWrite ) - SetSize( (USHORT)pVar->GetInteger() ); + SetSize( (sal_uInt16)pVar->GetInteger() ); else - pVar->PutInteger( (INT16)GetSize() ); + pVar->PutInteger( (sal_Int16)GetSize() ); } -void SbStdFont::PropName( SbxVariable* pVar, SbxArray*, BOOL bWrite ) +void SbStdFont::PropName( SbxVariable* pVar, SbxArray*, sal_Bool bWrite ) { if( bWrite ) SetFontName( pVar->GetString() ); @@ -292,8 +292,8 @@ void SbStdFont::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, SbxVariable* pVar = pHint->GetVar(); SbxArray* pPar_ = pVar->GetParameters(); - USHORT nWhich = (USHORT)pVar->GetUserData(); - BOOL bWrite = pHint->GetId() == SBX_HINT_DATACHANGED; + sal_uInt16 nWhich = (sal_uInt16)pVar->GetUserData(); + sal_Bool bWrite = pHint->GetId() == SBX_HINT_DATACHANGED; // Propteries switch( nWhich ) @@ -349,7 +349,7 @@ sal_Bool TransferableHelperImpl::GetData( const ::com::sun::star::datatransfer:: } */ -void SbStdClipboard::MethClear( SbxVariable*, SbxArray* pPar_, BOOL ) +void SbStdClipboard::MethClear( SbxVariable*, SbxArray* pPar_, sal_Bool ) { if( pPar_ && (pPar_->Count() > 1) ) { @@ -360,7 +360,7 @@ void SbStdClipboard::MethClear( SbxVariable*, SbxArray* pPar_, BOOL ) //Clipboard::Clear(); } -void SbStdClipboard::MethGetData( SbxVariable* pVar, SbxArray* pPar_, BOOL ) +void SbStdClipboard::MethGetData( SbxVariable* pVar, SbxArray* pPar_, sal_Bool ) { (void)pVar; @@ -370,7 +370,7 @@ void SbStdClipboard::MethGetData( SbxVariable* pVar, SbxArray* pPar_, BOOL ) return; } - USHORT nFormat = pPar_->Get(1)->GetInteger(); + sal_uInt16 nFormat = pPar_->Get(1)->GetInteger(); if( !nFormat || nFormat > 3 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -393,7 +393,7 @@ void SbStdClipboard::MethGetData( SbxVariable* pVar, SbxArray* pPar_, BOOL ) */ } -void SbStdClipboard::MethGetFormat( SbxVariable* pVar, SbxArray* pPar_, BOOL ) +void SbStdClipboard::MethGetFormat( SbxVariable* pVar, SbxArray* pPar_, sal_Bool ) { if( !pPar_ || (pPar_->Count() != 2) ) { @@ -401,18 +401,18 @@ void SbStdClipboard::MethGetFormat( SbxVariable* pVar, SbxArray* pPar_, BOOL ) return; } - USHORT nFormat = pPar_->Get(1)->GetInteger(); + sal_uInt16 nFormat = pPar_->Get(1)->GetInteger(); if( !nFormat || nFormat > 3 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - pVar->PutBool( FALSE ); + pVar->PutBool( sal_False ); //pVar->PutBool( Clipboard::HasFormat( nFormat ) ); } -void SbStdClipboard::MethGetText( SbxVariable* pVar, SbxArray* pPar_, BOOL ) +void SbStdClipboard::MethGetText( SbxVariable* pVar, SbxArray* pPar_, sal_Bool ) { if( pPar_ && (pPar_->Count() > 1) ) { @@ -424,7 +424,7 @@ void SbStdClipboard::MethGetText( SbxVariable* pVar, SbxArray* pPar_, BOOL ) //pVar->PutString( Clipboard::PasteString() ); } -void SbStdClipboard::MethSetData( SbxVariable* pVar, SbxArray* pPar_, BOOL ) +void SbStdClipboard::MethSetData( SbxVariable* pVar, SbxArray* pPar_, sal_Bool ) { (void)pVar; @@ -434,7 +434,7 @@ void SbStdClipboard::MethSetData( SbxVariable* pVar, SbxArray* pPar_, BOOL ) return; } - USHORT nFormat = pPar_->Get(2)->GetInteger(); + sal_uInt16 nFormat = pPar_->Get(2)->GetInteger(); if( !nFormat || nFormat > 3 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -458,7 +458,7 @@ void SbStdClipboard::MethSetData( SbxVariable* pVar, SbxArray* pPar_, BOOL ) */ } -void SbStdClipboard::MethSetText( SbxVariable* pVar, SbxArray* pPar_, BOOL ) +void SbStdClipboard::MethSetText( SbxVariable* pVar, SbxArray* pPar_, sal_Bool ) { (void)pVar; @@ -531,8 +531,8 @@ void SbStdClipboard::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, SbxVariable* pVar = pHint->GetVar(); SbxArray* pPar_ = pVar->GetParameters(); - USHORT nWhich = (USHORT)pVar->GetUserData(); - BOOL bWrite = pHint->GetId() == SBX_HINT_DATACHANGED; + sal_uInt16 nWhich = (sal_uInt16)pVar->GetUserData(); + sal_Bool bWrite = pHint->GetId() == SBX_HINT_DATACHANGED; // Methods switch( nWhich ) diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx index 156df6aa7e38..520df18ecdd5 100644..100755 --- a/basic/source/runtime/step0.cxx +++ b/basic/source/runtime/step0.cxx @@ -48,6 +48,7 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl:: const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj ); #include <algorithm> +#include <boost/unordered_map.hpp> // for a patch forward declaring these methods below makes sense // but, #FIXME lets really just move the methods to the top @@ -121,7 +122,6 @@ void SbiRuntime::StepCompare( SbxOperator eOp ) } } -#ifndef WIN static SbxVariable* pTRUE = NULL; static SbxVariable* pFALSE = NULL; static SbxVariable* pNULL = NULL; @@ -143,7 +143,7 @@ void SbiRuntime::StepCompare( SbxOperator eOp ) if( !pTRUE ) { pTRUE = new SbxVariable; - pTRUE->PutBool( TRUE ); + pTRUE->PutBool( sal_True ); pTRUE->AddRef(); } PushVar( pTRUE ); @@ -153,22 +153,11 @@ void SbiRuntime::StepCompare( SbxOperator eOp ) if( !pFALSE ) { pFALSE = new SbxVariable; - pFALSE->PutBool( FALSE ); + pFALSE->PutBool( sal_False ); pFALSE->AddRef(); } PushVar( pFALSE ); } -#else - SbxVariable* pRes = new SbxVariable; - if ( bVBAEnabled && ( p1->IsNull() || p2->IsNull() ) ) - pRes->PutNull(); - else - { - BOOL bRes = p2->Compare( eOp, *p1 ); - pRes->PutBool( bRes ); - } - PushVar( pRes ); -#endif } void SbiRuntime::StepEXP() { StepArith( SbxEXP ); } @@ -327,7 +316,7 @@ void SbiRuntime::StepIS() eType2 = refVar2->GetType(); } - BOOL bRes = BOOL( eType1 == SbxOBJECT && eType2 == SbxOBJECT ); + sal_Bool bRes = sal_Bool( eType1 == SbxOBJECT && eType2 == SbxOBJECT ); if ( bVBAEnabled && !bRes ) Error( SbERR_INVALID_USAGE_OBJECT ); bRes = ( bRes && refVar1->GetObject() == refVar2->GetObject() ); @@ -386,11 +375,11 @@ void SbiRuntime::StepPUT() SbxVariableRef refVal = PopVar(); SbxVariableRef refVar = PopVar(); // Store auf die eigene Methode (innerhalb einer Function)? - BOOL bFlagsChanged = FALSE; - USHORT n = 0; + sal_Bool bFlagsChanged = sal_False; + sal_uInt16 n = 0; if( (SbxVariable*) refVar == (SbxVariable*) pMeth ) { - bFlagsChanged = TRUE; + bFlagsChanged = sal_True; n = refVar->GetFlags(); refVar->SetFlag( SBX_WRITE ); } @@ -426,9 +415,54 @@ void SbiRuntime::StepPUT() } +// VBA Dim As New behavior handling, save init object information +struct DimAsNewRecoverItem +{ + String m_aObjClass; + String m_aObjName; + SbxObject* m_pObjParent; + SbModule* m_pClassModule; + + DimAsNewRecoverItem( void ) + : m_pObjParent( NULL ) + , m_pClassModule( NULL ) + {} + + DimAsNewRecoverItem( const String& rObjClass, const String& rObjName, + SbxObject* pObjParent, SbModule* pClassModule ) + : m_aObjClass( rObjClass ) + , m_aObjName( rObjName ) + , m_pObjParent( pObjParent ) + , m_pClassModule( pClassModule ) + {} + +}; + + +struct SbxVariablePtrHash +{ + size_t operator()( SbxVariable* pVar ) const + { return (size_t)pVar; } +}; + +typedef boost::unordered_map< SbxVariable*, DimAsNewRecoverItem, + SbxVariablePtrHash > DimAsNewRecoverHash; + +static DimAsNewRecoverHash GaDimAsNewRecoverHash; + +void removeDimAsNewRecoverItem( SbxVariable* pVar ) +{ + DimAsNewRecoverHash::iterator it = GaDimAsNewRecoverHash.find( pVar ); + if( it != GaDimAsNewRecoverHash.end() ) + GaDimAsNewRecoverHash.erase( it ); +} + + // Speichern Objektvariable // Nicht-Objekt-Variable fuehren zu Fehlern +static const char pCollectionStr[] = "Collection"; + void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, bool bHandleDefaultProp ) { // #67733 Typen mit Array-Flag sind auch ok @@ -478,11 +512,11 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b else { // Store auf die eigene Methode (innerhalb einer Function)? - BOOL bFlagsChanged = FALSE; - USHORT n = 0; + sal_Bool bFlagsChanged = sal_False; + sal_uInt16 n = 0; if( (SbxVariable*) refVar == (SbxVariable*) pMeth ) { - bFlagsChanged = TRUE; + bFlagsChanged = sal_True; n = refVar->GetFlags(); refVar->SetFlag( SBX_WRITE ); } @@ -531,8 +565,14 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b } } + // Handle Dim As New + sal_Bool bDimAsNew = bVBAEnabled && refVar->IsSet( SBX_DIM_AS_NEW ); + SbxBaseRef xPrevVarObj; + if( bDimAsNew ) + xPrevVarObj = refVar->GetObject(); + // Handle withevents - BOOL bWithEvents = refVar->IsSet( SBX_WITH_EVENTS ); + sal_Bool bWithEvents = refVar->IsSet( SBX_WITH_EVENTS ); if ( bWithEvents ) { Reference< XInterface > xComListener; @@ -549,7 +589,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b xComListener = createComListener( aControlAny, aVBAType, aPrefix, xScopeObj ); refVal->SetDeclareClassName( aDeclareClassName ); - refVal->SetComListener( xComListener ); // Hold reference + refVal->SetComListener( xComListener, &rBasic ); // Hold reference } *refVar = *refVal; @@ -559,6 +599,68 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b *refVar = *refVal; } + if ( bDimAsNew ) + { + if( !refVar->ISA(SbxObject) ) + { + SbxBase* pValObjBase = refVal->GetObject(); + if( pValObjBase == NULL ) + { + if( xPrevVarObj.Is() ) + { + // Object is overwritten with NULL, instantiate init object + DimAsNewRecoverHash::iterator it = GaDimAsNewRecoverHash.find( refVar ); + if( it != GaDimAsNewRecoverHash.end() ) + { + const DimAsNewRecoverItem& rItem = it->second; + if( rItem.m_pClassModule != NULL ) + { + SbClassModuleObject* pNewObj = new SbClassModuleObject( rItem.m_pClassModule ); + pNewObj->SetName( rItem.m_aObjName ); + pNewObj->SetParent( rItem.m_pObjParent ); + refVar->PutObject( pNewObj ); + } + else if( rItem.m_aObjClass.EqualsIgnoreCaseAscii( pCollectionStr ) ) + { + BasicCollection* pNewCollection = new BasicCollection( String( RTL_CONSTASCII_USTRINGPARAM(pCollectionStr) ) ); + pNewCollection->SetName( rItem.m_aObjName ); + pNewCollection->SetParent( rItem.m_pObjParent ); + refVar->PutObject( pNewCollection ); + } + } + } + } + else + { + // Does old value exist? + bool bFirstInit = !xPrevVarObj.Is(); + if( bFirstInit ) + { + // Store information to instantiate object later + SbxObject* pValObj = PTR_CAST(SbxObject,pValObjBase); + if( pValObj != NULL ) + { + String aObjClass = pValObj->GetClassName(); + + SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pValObjBase); + if( pClassModuleObj != NULL ) + { + SbModule* pClassModule = pClassModuleObj->getClassModule(); + GaDimAsNewRecoverHash[refVar] = + DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), pClassModule ); + } + else if( aObjClass.EqualsIgnoreCaseAscii( "Collection" ) ) + { + GaDimAsNewRecoverHash[refVar] = + DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), NULL ); + } + } + } + } + } + } + + // lhs is a property who's value is currently (Empty e.g. no broadcast yet) // in this case if there is a default prop involved the value of the // default property may infact be void so the type will also be SbxEMPTY @@ -599,14 +701,14 @@ void SbiRuntime::StepLSET() else { // Store auf die eigene Methode (innerhalb einer Function)? - USHORT n = refVar->GetFlags(); + sal_uInt16 n = refVar->GetFlags(); if( (SbxVariable*) refVar == (SbxVariable*) pMeth ) refVar->SetFlag( SBX_WRITE ); String aRefVarString = refVar->GetString(); String aRefValString = refVal->GetString(); - USHORT nVarStrLen = aRefVarString.Len(); - USHORT nValStrLen = aRefValString.Len(); + sal_uInt16 nVarStrLen = aRefVarString.Len(); + sal_uInt16 nValStrLen = aRefValString.Len(); String aNewStr; if( nVarStrLen > nValStrLen ) { @@ -635,14 +737,14 @@ void SbiRuntime::StepRSET() else { // Store auf die eigene Methode (innerhalb einer Function)? - USHORT n = refVar->GetFlags(); + sal_uInt16 n = refVar->GetFlags(); if( (SbxVariable*) refVar == (SbxVariable*) pMeth ) refVar->SetFlag( SBX_WRITE ); String aRefVarString = refVar->GetString(); String aRefValString = refVal->GetString(); - USHORT nPos = 0; - USHORT nVarStrLen = aRefVarString.Len(); + sal_uInt16 nPos = 0; + sal_uInt16 nVarStrLen = aRefVarString.Len(); if( nVarStrLen > aRefValString.Len() ) { aRefVarString.Fill(nVarStrLen,' '); @@ -703,10 +805,10 @@ void SbiRuntime::DimImpl( SbxVariableRef refVar ) // AB 2.4.1996, auch Arrays ohne Dimensionsangaben zulassen (VB-komp.) if( pDims ) { - for( USHORT i = 1; i < pDims->Count(); ) + for( sal_uInt16 i = 1; i < pDims->Count(); ) { - INT32 lb = pDims->Get( i++ )->GetLong(); - INT32 ub = pDims->Get( i++ )->GetLong(); + sal_Int32 lb = pDims->Get( i++ )->GetLong(); + sal_Int32 ub = pDims->Get( i++ )->GetLong(); if( ub < lb ) Error( SbERR_OUT_OF_RANGE ), ub = lb; pArray->AddDim32( lb, ub ); @@ -720,7 +822,7 @@ void SbiRuntime::DimImpl( SbxVariableRef refVar ) // Uno-Sequences der Laenge 0 eine Dimension anlegen pArray->unoAddDim( 0, -1 ); } - USHORT nSavFlags = refVar->GetFlags(); + sal_uInt16 nSavFlags = refVar->GetFlags(); refVar->ResetFlag( SBX_FIXED ); refVar->PutObject( pArray ); refVar->SetFlags( nSavFlags ); @@ -782,7 +884,7 @@ void SbiRuntime::StepREDIMP() short nDimsNew = pNewArray->GetDims(); short nDimsOld = pOldArray->GetDims(); short nDims = nDimsNew; - BOOL bRangeError = FALSE; + sal_Bool bRangeError = sal_False; // Store dims to use them for copying later sal_Int32* pLowerBounds = new sal_Int32[nDims]; @@ -791,7 +893,7 @@ void SbiRuntime::StepREDIMP() if( nDimsOld != nDimsNew ) { - bRangeError = TRUE; + bRangeError = sal_True; } else { @@ -808,7 +910,7 @@ void SbiRuntime::StepREDIMP() // All bounds but the last have to be the same if( i < nDims && ( lBoundNew != lBoundOld || uBoundNew != uBoundOld ) ) { - bRangeError = TRUE; + bRangeError = sal_True; break; } else @@ -877,7 +979,7 @@ void SbiRuntime::StepREDIMP_ERASE() void lcl_clearImpl( SbxVariableRef& refVar, SbxDataType& eType ) { - USHORT nSavFlags = refVar->GetFlags(); + sal_uInt16 nSavFlags = refVar->GetFlags(); refVar->ResetFlag( SBX_FIXED ); refVar->SetType( SbxDataType(eType & 0x0FFF) ); refVar->SetFlags( nSavFlags ); @@ -1046,7 +1148,7 @@ void SbiRuntime::StepINPUT() // zu fuellen, dann mit einem Stringwert if( !pVar->IsFixed() || pVar->IsNumeric() ) { - USHORT nLen = 0; + sal_uInt16 nLen = 0; if( !pVar->Scan( s, &nLen ) ) { err = SbxBase::GetError(); @@ -1169,7 +1271,7 @@ void SbiRuntime::StepENDCASE() void SbiRuntime::StepSTDERROR() { - pError = NULL; bError = TRUE; + pError = NULL; bError = sal_True; pInst->aErrorMsg = String(); pInst->nErr = 0L; pInst->nErl = 0; @@ -1184,14 +1286,14 @@ void SbiRuntime::StepNOERROR() pInst->nErl = 0; nError = 0L; SbxErrObject::getUnoErrObject()->Clear(); - bError = FALSE; + bError = sal_False; } // UP verlassen void SbiRuntime::StepLEAVE() { - bRun = FALSE; + bRun = sal_False; // If VBA and we are leaving an ErrorHandler then clear the error ( it's been processed ) if ( bInError && pError ) SbxErrObject::getUnoErrObject()->Clear(); @@ -1326,7 +1428,7 @@ void SbiRuntime::StepEMPTY() void SbiRuntime::StepERROR() { SbxVariableRef refCode = PopVar(); - USHORT n = refCode->GetUShort(); + sal_uInt16 n = refCode->GetUShort(); SbError error = StarBASIC::GetSfxFromVBError( n ); if ( bVBAEnabled ) pInst->Error( error ); diff --git a/basic/source/runtime/step1.cxx b/basic/source/runtime/step1.cxx index e023750cc27a..659152548e53 100644..100755 --- a/basic/source/runtime/step1.cxx +++ b/basic/source/runtime/step1.cxx @@ -44,14 +44,14 @@ bool checkUnoObjectType( SbUnoObject* refVal, // Laden einer numerischen Konstanten (+ID) -void SbiRuntime::StepLOADNC( UINT32 nOp1 ) +void SbiRuntime::StepLOADNC( sal_uInt32 nOp1 ) { SbxVariable* p = new SbxVariable( SbxDOUBLE ); // #57844 Lokalisierte Funktion benutzen String aStr = pImg->GetString( static_cast<short>( nOp1 ) ); // Auch , zulassen !!! - USHORT iComma = aStr.Search( ',' ); + sal_uInt16 iComma = aStr.Search( ',' ); if( iComma != STRING_NOTFOUND ) { String aStr1 = aStr.Copy( 0, iComma ); @@ -68,7 +68,7 @@ void SbiRuntime::StepLOADNC( UINT32 nOp1 ) // Laden einer Stringkonstanten (+ID) -void SbiRuntime::StepLOADSC( UINT32 nOp1 ) +void SbiRuntime::StepLOADSC( sal_uInt32 nOp1 ) { SbxVariable* p = new SbxVariable; p->PutString( pImg->GetString( static_cast<short>( nOp1 ) ) ); @@ -77,16 +77,16 @@ void SbiRuntime::StepLOADSC( UINT32 nOp1 ) // Immediate Load (+Wert) -void SbiRuntime::StepLOADI( UINT32 nOp1 ) +void SbiRuntime::StepLOADI( sal_uInt32 nOp1 ) { SbxVariable* p = new SbxVariable; - p->PutInteger( static_cast<INT16>( nOp1 ) ); + p->PutInteger( static_cast<sal_Int16>( nOp1 ) ); PushVar( p ); } // Speichern eines named Arguments in Argv (+Arg-Nr ab 1!) -void SbiRuntime::StepARGN( UINT32 nOp1 ) +void SbiRuntime::StepARGN( sal_uInt32 nOp1 ) { if( !refArgv ) StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); @@ -110,18 +110,18 @@ void SbiRuntime::StepARGN( UINT32 nOp1 ) // Konvertierung des Typs eines Arguments in Argv fuer DECLARE-Fkt. (+Typ) -void SbiRuntime::StepARGTYP( UINT32 nOp1 ) +void SbiRuntime::StepARGTYP( sal_uInt32 nOp1 ) { if( !refArgv ) StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); else { - BOOL bByVal = (nOp1 & 0x8000) != 0; // Ist BYVAL verlangt? + sal_Bool bByVal = (nOp1 & 0x8000) != 0; // Ist BYVAL verlangt? SbxDataType t = (SbxDataType) (nOp1 & 0x7FFF); SbxVariable* pVar = refArgv->Get( refArgv->Count() - 1 ); // letztes Arg - // BYVAL prfen - if( pVar->GetRefCount() > 2 ) // 2 ist normal fr BYVAL + // BYVAL pr�fen + if( pVar->GetRefCount() > 2 ) // 2 ist normal f�r BYVAL { // Parameter ist eine Referenz if( bByVal ) @@ -132,7 +132,7 @@ void SbiRuntime::StepARGTYP( UINT32 nOp1 ) refExprStk->Put( pVar, refArgv->Count() - 1 ); } else - pVar->SetFlag( SBX_REFERENCE ); // Ref-Flag fr DllMgr + pVar->SetFlag( SBX_REFERENCE ); // Ref-Flag f�r DllMgr } else { @@ -155,7 +155,7 @@ void SbiRuntime::StepARGTYP( UINT32 nOp1 ) // String auf feste Laenge bringen (+Laenge) -void SbiRuntime::StepPAD( UINT32 nOp1 ) +void SbiRuntime::StepPAD( sal_uInt32 nOp1 ) { SbxVariable* p = GetTOS(); String& s = (String&)(const String&) *p; @@ -167,20 +167,20 @@ void SbiRuntime::StepPAD( UINT32 nOp1 ) // Sprung (+Target) -void SbiRuntime::StepJUMP( UINT32 nOp1 ) +void SbiRuntime::StepJUMP( sal_uInt32 nOp1 ) { #ifdef DBG_UTIL // #QUESTION shouln't this be - // if( (BYTE*)( nOp1+pImagGetCode() ) >= pImg->GetCodeSize() ) + // if( (sal_uInt8*)( nOp1+pImagGetCode() ) >= pImg->GetCodeSize() ) if( nOp1 >= pImg->GetCodeSize() ) StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); #endif - pCode = (const BYTE*) pImg->GetCode() + nOp1; + pCode = (const sal_uInt8*) pImg->GetCode() + nOp1; } // TOS auswerten, bedingter Sprung (+Target) -void SbiRuntime::StepJUMPT( UINT32 nOp1 ) +void SbiRuntime::StepJUMPT( sal_uInt32 nOp1 ) { SbxVariableRef p = PopVar(); if( p->GetBool() ) @@ -189,7 +189,7 @@ void SbiRuntime::StepJUMPT( UINT32 nOp1 ) // TOS auswerten, bedingter Sprung (+Target) -void SbiRuntime::StepJUMPF( UINT32 nOp1 ) +void SbiRuntime::StepJUMPF( sal_uInt32 nOp1 ) { SbxVariableRef p = PopVar(); // In a test e.g. If Null then @@ -206,36 +206,36 @@ void SbiRuntime::StepJUMPF( UINT32 nOp1 ) // ... //Falls im Operanden 0x8000 gesetzt ist, Returnadresse pushen (ON..GOSUB) -void SbiRuntime::StepONJUMP( UINT32 nOp1 ) +void SbiRuntime::StepONJUMP( sal_uInt32 nOp1 ) { SbxVariableRef p = PopVar(); - INT16 n = p->GetInteger(); + sal_Int16 n = p->GetInteger(); if( nOp1 & 0x8000 ) { nOp1 &= 0x7FFF; //PushGosub( pCode + 3 * nOp1 ); PushGosub( pCode + 5 * nOp1 ); } - if( n < 1 || static_cast<UINT32>(n) > nOp1 ) - n = static_cast<INT16>( nOp1 + 1 ); - //nOp1 = (UINT32) ( (const char*) pCode - pImg->GetCode() ) + 3 * --n; - nOp1 = (UINT32) ( (const char*) pCode - pImg->GetCode() ) + 5 * --n; + if( n < 1 || static_cast<sal_uInt32>(n) > nOp1 ) + n = static_cast<sal_Int16>( nOp1 + 1 ); + //nOp1 = (sal_uInt32) ( (const char*) pCode - pImg->GetCode() ) + 3 * --n; + nOp1 = (sal_uInt32) ( (const char*) pCode - pImg->GetCode() ) + 5 * --n; StepJUMP( nOp1 ); } // UP-Aufruf (+Target) -void SbiRuntime::StepGOSUB( UINT32 nOp1 ) +void SbiRuntime::StepGOSUB( sal_uInt32 nOp1 ) { PushGosub( pCode ); if( nOp1 >= pImg->GetCodeSize() ) StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); - pCode = (const BYTE*) pImg->GetCode() + nOp1; + pCode = (const sal_uInt8*) pImg->GetCode() + nOp1; } // UP-Return (+0 oder Target) -void SbiRuntime::StepRETURN( UINT32 nOp1 ) +void SbiRuntime::StepRETURN( sal_uInt32 nOp1 ) { PopGosub(); if( nOp1 ) @@ -244,7 +244,7 @@ void SbiRuntime::StepRETURN( UINT32 nOp1 ) // FOR-Variable testen (+Endlabel) -void SbiRuntime::StepTESTFOR( UINT32 nOp1 ) +void SbiRuntime::StepTESTFOR( sal_uInt32 nOp1 ) { if( !pForStk ) { @@ -307,7 +307,7 @@ void SbiRuntime::StepTESTFOR( UINT32 nOp1 ) { BasicCollection* pCollection = (BasicCollection*)(SbxVariable*)pForStk->refEnd; SbxArrayRef xItemArray = pCollection->xItemArray; - INT32 nCount = xItemArray->Count32(); + sal_Int32 nCount = xItemArray->Count32(); if( pForStk->nCurCollectionIndex < nCount ) { SbxVariable* pRes = xItemArray->Get32( pForStk->nCurCollectionIndex ); @@ -346,7 +346,7 @@ void SbiRuntime::StepTESTFOR( UINT32 nOp1 ) // Tos+1 <= Tos+2 <= Tos, 2xremove (+Target) -void SbiRuntime::StepCASETO( UINT32 nOp1 ) +void SbiRuntime::StepCASETO( sal_uInt32 nOp1 ) { if( !refCaseStk || !refCaseStk->Count() ) StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); @@ -362,9 +362,9 @@ void SbiRuntime::StepCASETO( UINT32 nOp1 ) // Fehler-Handler -void SbiRuntime::StepERRHDL( UINT32 nOp1 ) +void SbiRuntime::StepERRHDL( sal_uInt32 nOp1 ) { - const BYTE* p = pCode; + const sal_uInt8* p = pCode; StepJUMP( nOp1 ); pError = pCode; pCode = p; @@ -377,7 +377,7 @@ void SbiRuntime::StepERRHDL( UINT32 nOp1 ) // Resume nach Fehlern (+0=statement, 1=next or Label) -void SbiRuntime::StepRESUME( UINT32 nOp1 ) +void SbiRuntime::StepRESUME( sal_uInt32 nOp1 ) { // AB #32714 Resume ohne Error? -> Fehler if( !bInError ) @@ -388,8 +388,8 @@ void SbiRuntime::StepRESUME( UINT32 nOp1 ) if( nOp1 ) { // Code-Zeiger auf naechstes Statement setzen - USHORT n1, n2; - pCode = pMod->FindNextStmnt( pErrCode, n1, n2, TRUE, pImg ); + sal_uInt16 n1, n2; + pCode = pMod->FindNextStmnt( pErrCode, n1, n2, sal_True, pImg ); } else pCode = pErrStmnt; @@ -402,7 +402,7 @@ void SbiRuntime::StepRESUME( UINT32 nOp1 ) pInst->nErr = 0; pInst->nErl = 0; nError = 0; - bInError = FALSE; + bInError = sal_False; // Error-Stack loeschen SbErrorStack*& rErrStack = GetSbData()->pErrStack; @@ -411,7 +411,7 @@ void SbiRuntime::StepRESUME( UINT32 nOp1 ) } // Kanal schliessen (+Kanal, 0=Alle) -void SbiRuntime::StepCLOSE( UINT32 nOp1 ) +void SbiRuntime::StepCLOSE( sal_uInt32 nOp1 ) { SbError err; if( !nOp1 ) @@ -430,7 +430,7 @@ void SbiRuntime::StepCLOSE( UINT32 nOp1 ) // Zeichen ausgeben (+char) -void SbiRuntime::StepPRCHAR( UINT32 nOp1 ) +void SbiRuntime::StepPRCHAR( sal_uInt32 nOp1 ) { ByteString s( (char) nOp1 ); pIosys->Write( s ); @@ -521,7 +521,7 @@ bool SbiRuntime::checkClass_Impl( const SbxVariableRef& refVal, return bOk; } -void SbiRuntime::StepSETCLASS_impl( UINT32 nOp1, bool bHandleDflt ) +void SbiRuntime::StepSETCLASS_impl( sal_uInt32 nOp1, bool bHandleDflt ) { SbxVariableRef refVal = PopVar(); SbxVariableRef refVar = PopVar(); @@ -532,17 +532,17 @@ void SbiRuntime::StepSETCLASS_impl( UINT32 nOp1, bool bHandleDflt ) StepSET_Impl( refVal, refVar, bHandleDflt ); // don't do handle dflt prop for a "proper" set } -void SbiRuntime::StepVBASETCLASS( UINT32 nOp1 ) +void SbiRuntime::StepVBASETCLASS( sal_uInt32 nOp1 ) { StepSETCLASS_impl( nOp1, false ); } -void SbiRuntime::StepSETCLASS( UINT32 nOp1 ) +void SbiRuntime::StepSETCLASS( sal_uInt32 nOp1 ) { StepSETCLASS_impl( nOp1, true ); } -void SbiRuntime::StepTESTCLASS( UINT32 nOp1 ) +void SbiRuntime::StepTESTCLASS( sal_uInt32 nOp1 ) { SbxVariableRef xObjVal = PopVar(); String aClass( pImg->GetString( static_cast<short>( nOp1 ) ) ); @@ -556,7 +556,7 @@ void SbiRuntime::StepTESTCLASS( UINT32 nOp1 ) // Library fuer anschliessenden Declare-Call definieren -void SbiRuntime::StepLIB( UINT32 nOp1 ) +void SbiRuntime::StepLIB( sal_uInt32 nOp1 ) { aLibName = pImg->GetString( static_cast<short>( nOp1 ) ); } @@ -565,14 +565,14 @@ void SbiRuntime::StepLIB( UINT32 nOp1 ) // Dieser Opcode wird vor DIM/REDIM-Anweisungen gepusht, // wenn nur ein Index angegeben wurde. -void SbiRuntime::StepBASED( UINT32 nOp1 ) +void SbiRuntime::StepBASED( sal_uInt32 nOp1 ) { SbxVariable* p1 = new SbxVariable; SbxVariableRef x2 = PopVar(); // #109275 Check compatiblity mode bool bCompatible = ((nOp1 & 0x8000) != 0); - USHORT uBase = static_cast<USHORT>(nOp1 & 1); // Can only be 0 or 1 + sal_uInt16 uBase = static_cast<sal_uInt16>(nOp1 & 1); // Can only be 0 or 1 p1->PutInteger( uBase ); if( !bCompatible ) x2->Compute( SbxPLUS, *p1 ); diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx index 543c69a34b97..2b8dbc71cf03 100644..100755 --- a/basic/source/runtime/step2.cxx +++ b/basic/source/runtime/step2.cxx @@ -57,7 +57,7 @@ SbxVariable* getVBAConstant( const String& rName ); // 0x8000 - Argv ist belegt SbxVariable* SbiRuntime::FindElement - ( SbxObject* pObj, UINT32 nOp1, UINT32 nOp2, SbError nNotFound, BOOL bLocal, BOOL bStatic ) + ( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2, SbError nNotFound, sal_Bool bLocal, sal_Bool bStatic ) { bool bIsVBAInterOp = SbiRuntime::isVBAEnabled(); if( bIsVBAInterOp ) @@ -75,7 +75,7 @@ SbxVariable* SbiRuntime::FindElement } else { - BOOL bFatalError = FALSE; + sal_Bool bFatalError = sal_False; SbxDataType t = (SbxDataType) nOp2; String aName( pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) ) ); // Hacky capture of Evaluate [] syntax @@ -108,8 +108,8 @@ SbxVariable* SbiRuntime::FindElement if( !pElem ) { // Die RTL brauchen wir nicht mehr zu durchsuchen! - BOOL bSave = rBasic.bNoRtl; - rBasic.bNoRtl = TRUE; + sal_Bool bSave = rBasic.bNoRtl; + rBasic.bNoRtl = sal_True; pElem = pObj->Find( aName, SbxCLASS_DONTCARE ); // #110004, #112015: Make private really private @@ -142,15 +142,19 @@ SbxVariable* SbiRuntime::FindElement else pElem = VBAConstantHelper::instance().getVBAConstant( aName ); } - // #72382 VORSICHT! Liefert jetzt wegen unbekannten - // Modulen IMMER ein Ergebnis! - SbUnoClass* pUnoClass = findUnoClass( aName ); - if( pUnoClass ) + + if( !pElem ) { - pElem = new SbxVariable( t ); - SbxValues aRes( SbxOBJECT ); - aRes.pObj = pUnoClass; - pElem->SbxVariable::Put( aRes ); + // #72382 VORSICHT! Liefert jetzt wegen unbekannten + // Modulen IMMER ein Ergebnis! + SbUnoClass* pUnoClass = findUnoClass( aName ); + if( pUnoClass ) + { + pElem = new SbxVariable( t ); + SbxValues aRes( SbxOBJECT ); + aRes.pObj = pUnoClass; + pElem->SbxVariable::Put( aRes ); + } } // #62939 Wenn eine Uno-Klasse gefunden wurde, muss @@ -176,14 +180,14 @@ SbxVariable* SbiRuntime::FindElement // Nicht da und nicht im Objekt? // Hat das Ding Parameter, nicht einrichten! if( nOp1 & 0x8000 ) - bFatalError = TRUE; + bFatalError = sal_True; // ALT: StarBASIC::FatalError( nNotFound ); // Sonst, falls keine Parameter sind, anderen Error Code verwenden if( !bLocal || pImg->GetFlag( SBIMG_EXPLICIT ) ) { // #39108 Bei explizit und als ELEM immer ein Fatal Error - bFatalError = TRUE; + bFatalError = sal_True; // Falls keine Parameter sind, anderen Error Code verwenden if( !( nOp1 & 0x8000 ) && nNotFound == SbERR_PROC_UNDEFINED ) @@ -228,19 +232,19 @@ SbxVariable* SbiRuntime::FindElement { // Soll der Typ konvertiert werden? SbxDataType t2 = pElem->GetType(); - BOOL bSet = FALSE; + sal_Bool bSet = sal_False; if( !( pElem->GetFlags() & SBX_FIXED ) ) { if( t != SbxVARIANT && t != t2 && t >= SbxINTEGER && t <= SbxSTRING ) - pElem->SetType( t ), bSet = TRUE; + pElem->SetType( t ), bSet = sal_True; } // pElem auf eine Ref zuweisen, um ggf. eine Temp-Var zu loeschen SbxVariableRef refTemp = pElem; // Moegliche Reste vom letzten Aufruf der SbxMethod beseitigen // Vorher Schreiben freigeben, damit kein Error gesetzt wird. - USHORT nSavFlags = pElem->GetFlags(); + sal_uInt16 nSavFlags = pElem->GetFlags(); pElem->SetFlag( SBX_READWRITE | SBX_NO_BROADCAST ); pElem->SbxValue::Clear(); pElem->SetFlags( nSavFlags ); @@ -309,8 +313,8 @@ SbxBase* SbiRuntime::FindElementExtern( const String& rName ) SbxInfo* pInfo = pMeth->GetInfo(); if( pInfo && refParams ) { - USHORT nParamCount = refParams->Count(); - USHORT j = 1; + sal_uInt16 nParamCount = refParams->Count(); + sal_uInt16 j = 1; const SbxParamInfo* pParam = pInfo->GetParam( j ); while( pParam ) { @@ -337,8 +341,8 @@ SbxBase* SbiRuntime::FindElementExtern( const String& rName ) if( !pElem ) { // RTL nicht durchsuchen! - BOOL bSave = rBasic.bNoRtl; - rBasic.bNoRtl = TRUE; + sal_Bool bSave = rBasic.bNoRtl; + rBasic.bNoRtl = sal_True; pElem = pMod->Find( rName, SbxCLASS_DONTCARE ); rBasic.bNoRtl = bSave; } @@ -350,20 +354,20 @@ SbxBase* SbiRuntime::FindElementExtern( const String& rName ) // Dabei auch die Argumente umsetzen, falls benannte Parameter // verwendet wurden -void SbiRuntime::SetupArgs( SbxVariable* p, UINT32 nOp1 ) +void SbiRuntime::SetupArgs( SbxVariable* p, sal_uInt32 nOp1 ) { if( nOp1 & 0x8000 ) { if( !refArgv ) StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); - BOOL bHasNamed = FALSE; - USHORT i; - USHORT nArgCount = refArgv->Count(); + sal_Bool bHasNamed = sal_False; + sal_uInt16 i; + sal_uInt16 nArgCount = refArgv->Count(); for( i = 1 ; i < nArgCount ; i++ ) { if( refArgv->GetAlias( i ).Len() ) { - bHasNamed = TRUE; break; + bHasNamed = sal_True; break; } } if( bHasNamed ) @@ -390,7 +394,7 @@ void SbiRuntime::SetupArgs( SbxVariable* p, UINT32 nOp1 ) { bError_ = false; - USHORT nCurPar = 1; + sal_uInt16 nCurPar = 1; AutomationNamedArgsSbxArray* pArg = new AutomationNamedArgsSbxArray( nArgCount ); ::rtl::OUString* pNames = pArg->getNames().getArray(); @@ -406,12 +410,40 @@ void SbiRuntime::SetupArgs( SbxVariable* p, UINT32 nOp1 ) } } } + else if( bVBAEnabled && p->GetType() == SbxOBJECT && (!p->ISA(SbxMethod) || !p->IsBroadcaster()) ) + { + // Check for default method with named parameters + SbxBaseRef pObj = (SbxBase*)p->GetObject(); + if( pObj && pObj->ISA(SbUnoObject) ) + { + SbUnoObject* pUnoObj = (SbUnoObject*)(SbxBase*)pObj; + Any aAny = pUnoObj->getUnoAny(); + + if( aAny.getValueType().getTypeClass() == TypeClass_INTERFACE ) + { + Reference< XInterface > x = *(Reference< XInterface >*)aAny.getValue(); + Reference< XDefaultMethod > xDfltMethod( x, UNO_QUERY ); + + rtl::OUString sDefaultMethod; + if ( xDfltMethod.is() ) + sDefaultMethod = xDfltMethod->getDefaultMethodName(); + if ( sDefaultMethod.getLength() ) + { + SbxVariable* meth = pUnoObj->Find( sDefaultMethod, SbxCLASS_METHOD ); + if( meth != NULL ) + pInfo = meth->GetInfo(); + if( pInfo ) + bError_ = false; + } + } + } + } if( bError_ ) Error( SbERR_NO_NAMED_ARGS ); } else { - USHORT nCurPar = 1; + sal_uInt16 nCurPar = 1; SbxArray* pArg = new SbxArray; for( i = 1 ; i < nArgCount ; i++ ) { @@ -420,7 +452,7 @@ void SbiRuntime::SetupArgs( SbxVariable* p, UINT32 nOp1 ) if( rName.Len() ) { // nCurPar wird auf den gefundenen Parameter gesetzt - USHORT j = 1; + sal_uInt16 j = 1; const SbxParamInfo* pParam = pInfo->GetParam( j ); while( pParam ) { @@ -511,7 +543,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem ) // Haben wir Index-Access? if( xIndexAccess.is() ) { - UINT32 nParamCount = (UINT32)pPar->Count() - 1; + sal_uInt32 nParamCount = (sal_uInt32)pPar->Count() - 1; if( nParamCount != 1 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -519,7 +551,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem ) } // Index holen - INT32 nIndex = pPar->Get( 1 )->GetLong(); + sal_Int32 nIndex = pPar->Get( 1 )->GetLong(); Reference< XInterface > xRet; try { @@ -588,6 +620,12 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem ) pCol->CollItem( pPar ); } } + else if( bVBAEnabled ) // !pObj + { + SbxArray* pParam = pElem->GetParameters(); + if( pParam != NULL ) + Error( SbERR_NO_OBJECT ); + } } } @@ -596,13 +634,13 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem ) // Laden eines Elements aus der Runtime-Library (+StringID+Typ) -void SbiRuntime::StepRTL( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepRTL( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { - PushVar( FindElement( rBasic.pRtl, nOp1, nOp2, SbERR_PROC_UNDEFINED, FALSE ) ); + PushVar( FindElement( rBasic.pRtl, nOp1, nOp2, SbERR_PROC_UNDEFINED, sal_False ) ); } void -SbiRuntime::StepFIND_Impl( SbxObject* pObj, UINT32 nOp1, UINT32 nOp2, SbError nNotFound, BOOL bLocal, BOOL bStatic ) +SbiRuntime::StepFIND_Impl( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2, SbError nNotFound, sal_Bool bLocal, sal_Bool bStatic ) { if( !refLocals ) refLocals = new SbxArray; @@ -610,34 +648,34 @@ SbiRuntime::StepFIND_Impl( SbxObject* pObj, UINT32 nOp1, UINT32 nOp2, SbError nN } // Laden einer lokalen/globalen Variablen (+StringID+Typ) -void SbiRuntime::StepFIND( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepFIND( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { - StepFIND_Impl( pMod, nOp1, nOp2, SbERR_PROC_UNDEFINED, TRUE ); + StepFIND_Impl( pMod, nOp1, nOp2, SbERR_PROC_UNDEFINED, sal_True ); } // Search inside a class module (CM) to enable global search in time -void SbiRuntime::StepFIND_CM( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepFIND_CM( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { SbClassModuleObject* pClassModuleObject = PTR_CAST(SbClassModuleObject,pMod); if( pClassModuleObject ) pMod->SetFlag( SBX_GBLSEARCH ); - StepFIND_Impl( pMod, nOp1, nOp2, SbERR_PROC_UNDEFINED, TRUE ); + StepFIND_Impl( pMod, nOp1, nOp2, SbERR_PROC_UNDEFINED, sal_True ); if( pClassModuleObject ) pMod->ResetFlag( SBX_GBLSEARCH ); } -void SbiRuntime::StepFIND_STATIC( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepFIND_STATIC( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { - StepFIND_Impl( pMod, nOp1, nOp2, SbERR_PROC_UNDEFINED, TRUE, TRUE ); + StepFIND_Impl( pMod, nOp1, nOp2, SbERR_PROC_UNDEFINED, sal_True, sal_True ); } // Laden eines Objekt-Elements (+StringID+Typ) // Das Objekt liegt auf TOS -void SbiRuntime::StepELEM( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepELEM( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { // Liegt auf dem TOS ein Objekt? SbxVariableRef pObjVar = PopVar(); @@ -656,7 +694,7 @@ void SbiRuntime::StepELEM( UINT32 nOp1, UINT32 nOp2 ) if( pObj ) SaveRef( (SbxVariable*)pObj ); - PushVar( FindElement( pObj, nOp1, nOp2, SbERR_NO_METHOD, FALSE ) ); + PushVar( FindElement( pObj, nOp1, nOp2, SbERR_NO_METHOD, sal_False ) ); } // Laden eines Parameters (+Offset+Typ) @@ -664,17 +702,17 @@ void SbiRuntime::StepELEM( UINT32 nOp1, UINT32 nOp2 ) // Der Datentyp SbxEMPTY zeigt an, daa kein Parameter angegeben ist. // Get( 0 ) darf EMPTY sein -void SbiRuntime::StepPARAM( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepPARAM( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { - USHORT i = static_cast<USHORT>( nOp1 & 0x7FFF ); + sal_uInt16 i = static_cast<sal_uInt16>( nOp1 & 0x7FFF ); SbxDataType t = (SbxDataType) nOp2; SbxVariable* p; // #57915 Missing sauberer loesen - USHORT nParamCount = refParams->Count(); + sal_uInt16 nParamCount = refParams->Count(); if( i >= nParamCount ) { - INT16 iLoop = i; + sal_Int16 iLoop = i; while( iLoop >= nParamCount ) { p = new SbxVariable(); @@ -700,7 +738,7 @@ void SbiRuntime::StepPARAM( UINT32 nOp1, UINT32 nOp2 ) //if( p->GetType() == SbxEMPTY && ( i ) ) { // Wenn ein Parameter fehlt, kann er OPTIONAL sein - BOOL bOpt = FALSE; + sal_Bool bOpt = sal_False; if( pMeth ) { SbxInfo* pInfo = pMeth->GetInfo(); @@ -710,7 +748,7 @@ void SbiRuntime::StepPARAM( UINT32 nOp1, UINT32 nOp2 ) if( pParam && ( (pParam->nFlags & SBX_OPTIONAL) != 0 ) ) { // Default value? - USHORT nDefaultId = sal::static_int_cast< USHORT >( + sal_uInt16 nDefaultId = sal::static_int_cast< sal_uInt16 >( pParam->nUserData & 0xffff ); if( nDefaultId > 0 ) { @@ -719,11 +757,11 @@ void SbiRuntime::StepPARAM( UINT32 nOp1, UINT32 nOp2 ) p->PutString( aDefaultStr ); refParams->Put( p, i ); } - bOpt = TRUE; + bOpt = sal_True; } } } - if( bOpt == FALSE ) + if( bOpt == sal_False ) Error( SbERR_NOT_OPTIONAL ); } else if( t != SbxVARIANT && (SbxDataType)(p->GetType() & 0x0FFF ) != t ) @@ -741,7 +779,7 @@ void SbiRuntime::StepPARAM( UINT32 nOp1, UINT32 nOp2 ) // Case-Test (+True-Target+Test-Opcode) -void SbiRuntime::StepCASEIS( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepCASEIS( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { if( !refCaseStk || !refCaseStk->Count() ) StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); @@ -757,13 +795,13 @@ void SbiRuntime::StepCASEIS( UINT32 nOp1, UINT32 nOp2 ) // Aufruf einer DLL-Prozedur (+StringID+Typ) // Auch hier zeigt das MSB des StringIDs an, dass Argv belegt ist -void SbiRuntime::StepCALL( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepCALL( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { String aName = pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) ); SbxArray* pArgs = NULL; if( nOp1 & 0x8000 ) pArgs = refArgv; - DllCall( aName, aLibName, pArgs, (SbxDataType) nOp2, FALSE ); + DllCall( aName, aLibName, pArgs, (SbxDataType) nOp2, sal_False ); aLibName = String(); if( nOp1 & 0x8000 ) PopArgv(); @@ -772,13 +810,13 @@ void SbiRuntime::StepCALL( UINT32 nOp1, UINT32 nOp2 ) // Aufruf einer DLL-Prozedur nach CDecl (+StringID+Typ) // Auch hier zeigt das MSB des StringIDs an, dass Argv belegt ist -void SbiRuntime::StepCALLC( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepCALLC( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { String aName = pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) ); SbxArray* pArgs = NULL; if( nOp1 & 0x8000 ) pArgs = refArgv; - DllCall( aName, aLibName, pArgs, (SbxDataType) nOp2, TRUE ); + DllCall( aName, aLibName, pArgs, (SbxDataType) nOp2, sal_True ); aLibName = String(); if( nOp1 & 0x8000 ) PopArgv(); @@ -787,14 +825,14 @@ void SbiRuntime::StepCALLC( UINT32 nOp1, UINT32 nOp2 ) // Beginn eines Statements (+Line+Col) -void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepSTMNT( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { // Wenn der Expr-Stack am Anfang einen Statements eine Variable enthaelt, // hat ein Trottel X als Funktion aufgerufen, obwohl es eine Variable ist! - BOOL bFatalExpr = FALSE; + sal_Bool bFatalExpr = sal_False; String sUnknownMethodName; if( nExprLvl > 1 ) - bFatalExpr = TRUE; + bFatalExpr = sal_True; else if( nExprLvl ) { SbxVariable* p = refExprStk->Get( 0 ); @@ -802,7 +840,7 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 ) && refLocals.Is() && refLocals->Find( p->GetName(), p->GetClass() ) ) { sUnknownMethodName = p->GetName(); - bFatalExpr = TRUE; + bFatalExpr = sal_True; } } // Der Expr-Stack ist nun nicht mehr notwendig @@ -822,7 +860,7 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 ) return; } pStmnt = pCode - 9; - USHORT nOld = nLine; + sal_uInt16 nOld = nLine; nLine = static_cast<short>( nOp1 ); // #29955 & 0xFF, um for-Schleifen-Ebene wegzufiltern @@ -834,8 +872,8 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 ) // around the final column of this statement to set nCol2 = 0xffff; - USHORT n1, n2; - const BYTE* p = pMod->FindNextStmnt( pCode, n1, n2 ); + sal_uInt16 n1, n2; + const sal_uInt8* p = pMod->FindNextStmnt( pCode, n1, n2 ); if( p ) { if( n1 == nOp1 ) @@ -848,8 +886,8 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 ) // #29955 for-Schleifen-Ebene korrigieren, #67452 NICHT im Error-Handler sonst Chaos if( !bInError ) { - // (Bei Sprngen aus Schleifen tritt hier eine Differenz auf) - USHORT nExspectedForLevel = static_cast<USHORT>( nOp2 / 0x100 ); + // (Bei Spr�ngen aus Schleifen tritt hier eine Differenz auf) + sal_uInt16 nExspectedForLevel = static_cast<sal_uInt16>( nOp2 / 0x100 ); if( pGosubStk ) nExspectedForLevel = nExspectedForLevel + pGosubStk->nStartForLvl; @@ -860,12 +898,12 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 ) } // 16.10.96: #31460 Neues Konzept fuer StepInto/Over/Out - // Erklrung siehe bei _ImplGetBreakCallLevel. + // Erkl�rung siehe bei _ImplGetBreakCallLevel. if( pInst->nCallLvl <= pInst->nBreakCallLvl ) //if( nFlags & SbDEBUG_STEPINTO ) { StarBASIC* pStepBasic = GetCurrentBasic( &rBasic ); - USHORT nNewFlags = pStepBasic->StepPoint( nLine, nCol1, nCol2 ); + sal_uInt16 nNewFlags = pStepBasic->StepPoint( nLine, nCol1, nCol2 ); // Neuen BreakCallLevel ermitteln pInst->CalcBreakCallLevel( nNewFlags ); @@ -874,10 +912,10 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 ) // Breakpoints nur bei STMNT-Befehlen in neuer Zeile! else if( ( nOp1 != nOld ) && ( nFlags & SbDEBUG_BREAK ) - && pMod->IsBP( static_cast<USHORT>( nOp1 ) ) ) + && pMod->IsBP( static_cast<sal_uInt16>( nOp1 ) ) ) { StarBASIC* pBreakBasic = GetCurrentBasic( &rBasic ); - USHORT nNewFlags = pBreakBasic->BreakPoint( nLine, nCol1, nCol2 ); + sal_uInt16 nNewFlags = pBreakBasic->BreakPoint( nLine, nCol1, nCol2 ); // Neuen BreakCallLevel ermitteln pInst->CalcBreakCallLevel( nNewFlags ); @@ -892,7 +930,7 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 ) // Kanalnummer // Dateiname -void SbiRuntime::StepOPEN( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepOPEN( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { SbxVariableRef pName = PopVar(); SbxVariableRef pChan = PopVar(); @@ -907,7 +945,7 @@ void SbiRuntime::StepOPEN( UINT32 nOp1, UINT32 nOp2 ) // Objekt kreieren (+StringID+StringID) -void SbiRuntime::StepCREATE( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepCREATE( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { String aClass( pImg->GetString( static_cast<short>( nOp2 ) ) ); SbxObject *pObj = SbxBase::CreateObject( aClass ); @@ -925,12 +963,12 @@ void SbiRuntime::StepCREATE( UINT32 nOp1, UINT32 nOp2 ) } } -void SbiRuntime::StepDCREATE( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepDCREATE( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { StepDCREATE_IMPL( nOp1, nOp2 ); } -void SbiRuntime::StepDCREATE_REDIMP( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepDCREATE_REDIMP( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { StepDCREATE_IMPL( nOp1, nOp2 ); } @@ -957,7 +995,7 @@ void implCopyDimArray_DCREATE( SbxDimArray* pNewArray, SbxDimArray* pOldArray, s } // #56204 Objekt-Array kreieren (+StringID+StringID), DCREATE == Dim-Create -void SbiRuntime::StepDCREATE_IMPL( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { SbxVariableRef refVar = PopVar(); @@ -979,11 +1017,11 @@ void SbiRuntime::StepDCREATE_IMPL( UINT32 nOp1, UINT32 nOp2 ) // Dimensionen auswerten short nDims = pArray->GetDims(); - INT32 nTotalSize = 0; + sal_Int32 nTotalSize = 0; // es muss ein eindimensionales Array sein - INT32 nLower, nUpper, nSize; - INT32 i; + sal_Int32 nLower, nUpper, nSize; + sal_Int32 i; for( i = 0 ; i < nDims ; i++ ) { pArray->GetDim32( i+1, nLower, nUpper ); @@ -1021,7 +1059,7 @@ void SbiRuntime::StepDCREATE_IMPL( UINT32 nOp1, UINT32 nOp2 ) short nDimsNew = pArray->GetDims(); short nDimsOld = pOldArray->GetDims(); short nDims = nDimsNew; - BOOL bRangeError = FALSE; + sal_Bool bRangeError = sal_False; // Store dims to use them for copying later sal_Int32* pLowerBounds = new sal_Int32[nDims]; @@ -1029,7 +1067,7 @@ void SbiRuntime::StepDCREATE_IMPL( UINT32 nOp1, UINT32 nOp2 ) sal_Int32* pActualIndices = new sal_Int32[nDims]; if( nDimsOld != nDimsNew ) { - bRangeError = TRUE; + bRangeError = sal_True; } else { @@ -1072,7 +1110,7 @@ void SbiRuntime::StepDCREATE_IMPL( UINT32 nOp1, UINT32 nOp2 ) SbxObject* createUserTypeImpl( const String& rClassName ); // sb.cxx -void SbiRuntime::StepTCREATE( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepTCREATE( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { String aName( pImg->GetString( static_cast<short>( nOp1 ) ) ); String aClass( pImg->GetString( static_cast<short>( nOp2 ) ) ); @@ -1086,17 +1124,29 @@ void SbiRuntime::StepTCREATE( UINT32 nOp1, UINT32 nOp2 ) PushVar( pNew ); } -void SbiRuntime::implCreateFixedString( SbxVariable* pStrVar, UINT32 nOp2 ) +void SbiRuntime::implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, sal_uInt32 nOp2 ) { - USHORT nCount = static_cast<USHORT>( nOp2 >> 17 ); // len = all bits above 0x10000 - String aStr; - aStr.Fill( nCount, 0 ); - pStrVar->PutString( aStr ); + bool bWithEvents = ((t & 0xff) == SbxOBJECT && (nOp2 & SBX_TYPE_WITH_EVENTS_FLAG) != 0); + if( bWithEvents ) + pVar->SetFlag( SBX_WITH_EVENTS ); + + bool bDimAsNew = ((nOp2 & SBX_TYPE_DIM_AS_NEW_FLAG) != 0); + if( bDimAsNew ) + pVar->SetFlag( SBX_DIM_AS_NEW ); + + bool bFixedString = ((t & 0xff) == SbxSTRING && (nOp2 & SBX_FIXED_LEN_STRING_FLAG) != 0); + if( bFixedString ) + { + sal_uInt16 nCount = static_cast<sal_uInt16>( nOp2 >> 17 ); // len = all bits above 0x10000 + String aStr; + aStr.Fill( nCount, 0 ); + pVar->PutString( aStr ); + } } // Einrichten einer lokalen Variablen (+StringID+Typ) -void SbiRuntime::StepLOCAL( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepLOCAL( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { if( !refLocals.Is() ) refLocals = new SbxArray; @@ -1106,23 +1156,18 @@ void SbiRuntime::StepLOCAL( UINT32 nOp1, UINT32 nOp2 ) SbxDataType t = (SbxDataType)(nOp2 & 0xffff); SbxVariable* p = new SbxVariable( t ); p->SetName( aName ); - bool bWithEvents = ((t & 0xff) == SbxOBJECT && (nOp2 & SBX_TYPE_WITH_EVENTS_FLAG) != 0); - if( bWithEvents ) - p->SetFlag( SBX_WITH_EVENTS ); - bool bFixedString = ((t & 0xff) == SbxSTRING && (nOp2 & SBX_FIXED_LEN_STRING_FLAG) != 0); - if( bFixedString ) - implCreateFixedString( p, nOp2 ); + implHandleSbxFlags( p, t, nOp2 ); refLocals->Put( p, refLocals->Count() ); } } // Einrichten einer modulglobalen Variablen (+StringID+Typ) -void SbiRuntime::StepPUBLIC_Impl( UINT32 nOp1, UINT32 nOp2, bool bUsedForClassModule ) +void SbiRuntime::StepPUBLIC_Impl( sal_uInt32 nOp1, sal_uInt32 nOp2, bool bUsedForClassModule ) { String aName( pImg->GetString( static_cast<short>( nOp1 ) ) ); SbxDataType t = (SbxDataType)(SbxDataType)(nOp2 & 0xffff);; - BOOL bFlag = pMod->IsSet( SBX_NO_MODIFY ); + sal_Bool bFlag = pMod->IsSet( SBX_NO_MODIFY ); pMod->SetFlag( SBX_NO_MODIFY ); SbxVariableRef p = pMod->Find( aName, SbxCLASS_PROPERTY ); if( p.Is() ) @@ -1138,21 +1183,16 @@ void SbiRuntime::StepPUBLIC_Impl( UINT32 nOp1, UINT32 nOp2, bool bUsedForClassMo // AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden' pProp->SetFlag( SBX_NO_MODIFY); - bool bWithEvents = ((t & 0xff) == SbxOBJECT && (nOp2 & SBX_TYPE_WITH_EVENTS_FLAG) != 0); - if( bWithEvents ) - pProp->SetFlag( SBX_WITH_EVENTS ); - bool bFixedString = ((t & 0xff) == SbxSTRING && (nOp2 & SBX_FIXED_LEN_STRING_FLAG) != 0); - if( bFixedString ) - implCreateFixedString( p, nOp2 ); + implHandleSbxFlags( pProp, t, nOp2 ); } } -void SbiRuntime::StepPUBLIC( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepPUBLIC( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { StepPUBLIC_Impl( nOp1, nOp2, false ); } -void SbiRuntime::StepPUBLIC_P( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepPUBLIC_P( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { // Creates module variable that isn't reinitialised when // between invocations ( for VBASupport & document basic only ) @@ -1165,7 +1205,7 @@ void SbiRuntime::StepPUBLIC_P( UINT32 nOp1, UINT32 nOp2 ) // Einrichten einer globalen Variablen (+StringID+Typ) -void SbiRuntime::StepGLOBAL( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepGLOBAL( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { if( pImg->GetFlag( SBIMG_CLASSMODULE ) ) StepPUBLIC_Impl( nOp1, nOp2, true ); @@ -1183,7 +1223,7 @@ void SbiRuntime::StepGLOBAL( UINT32 nOp1, UINT32 nOp2 ) pMod->AddVarName( aName ); } - BOOL bFlag = pStorage->IsSet( SBX_NO_MODIFY ); + sal_Bool bFlag = pStorage->IsSet( SBX_NO_MODIFY ); rBasic.SetFlag( SBX_NO_MODIFY ); SbxVariableRef p = pStorage->Find( aName, SbxCLASS_PROPERTY ); if( p.Is() ) @@ -1203,7 +1243,7 @@ void SbiRuntime::StepGLOBAL( UINT32 nOp1, UINT32 nOp2 ) // Creates global variable that isn't reinitialised when // basic is restarted, P=PERSIST (+StringID+Typ) -void SbiRuntime::StepGLOBAL_P( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepGLOBAL_P( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { if( pMod->pImage->bFirstInit ) { @@ -1215,7 +1255,7 @@ void SbiRuntime::StepGLOBAL_P( UINT32 nOp1, UINT32 nOp2 ) // Searches for global variable, behavior depends on the fact // if the variable is initialised for the first time -void SbiRuntime::StepFIND_G( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepFIND_G( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { if( pMod->pImage->bFirstInit ) { @@ -1253,7 +1293,7 @@ SbxVariable* SbiRuntime::StepSTATIC_Impl( String& aName, SbxDataType& t ) return p; } // Einrichten einer statischen Variablen (+StringID+Typ) -void SbiRuntime::StepSTATIC( UINT32 nOp1, UINT32 nOp2 ) +void SbiRuntime::StepSTATIC( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { String aName( pImg->GetString( static_cast<short>( nOp1 ) ) ); SbxDataType t = (SbxDataType) nOp2; diff --git a/basic/source/runtime/wnt-mingw.s b/basic/source/runtime/wnt-mingw.s index 8c332c1a8ce8..8c332c1a8ce8 100644..100755 --- a/basic/source/runtime/wnt-mingw.s +++ b/basic/source/runtime/wnt-mingw.s diff --git a/basic/source/runtime/wnt-x86.asm b/basic/source/runtime/wnt-x86.asm index 2a8710e34243..2a8710e34243 100644..100755 --- a/basic/source/runtime/wnt-x86.asm +++ b/basic/source/runtime/wnt-x86.asm diff --git a/basic/source/sample/collelem.cxx b/basic/source/sample/collelem.cxx index b7b2e717aedc..80ee91db309f 100644..100755 --- a/basic/source/sample/collelem.cxx +++ b/basic/source/sample/collelem.cxx @@ -56,7 +56,7 @@ void SampleElement::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, { SbxVariable* pVar = pHint->GetVar(); SbxArray* pPar_ = pVar->GetParameters(); - ULONG t = pHint->GetId(); + sal_uIntPtr t = pHint->GetId(); if( t == SBX_HINT_DATAWANTED && pVar->GetUserData() == 0x12345678 ) { // Die Say-Methode: diff --git a/basic/source/sample/makefile.mk b/basic/source/sample/makefile.mk index 5261f13cfe43..5261f13cfe43 100644..100755 --- a/basic/source/sample/makefile.mk +++ b/basic/source/sample/makefile.mk diff --git a/basic/source/sample/object.cxx b/basic/source/sample/object.cxx index 99501a1b7c70..2c3ca7e29797 100644..100755 --- a/basic/source/sample/object.cxx +++ b/basic/source/sample/object.cxx @@ -74,7 +74,7 @@ #define _BWRITE 0x0200 // kann as Lvalue verwendet werden #define _LVALUE _BWRITE // kann as Lvalue verwendet werden #define _READWRITE 0x0300 // beides -#define _OPT 0x0400 // TRUE: optionaler Parameter +#define _OPT 0x0400 // sal_True: optionaler Parameter #define _METHOD 0x1000 // Masken-Bit fuer eine Methode #define _PROPERTY 0x2000 // Masken-Bit fuer eine Property #define _COLL 0x4000 // Masken-Bit fuer eine Collection @@ -130,12 +130,12 @@ SbxVariable* SampleObject::Find( const String& rName, SbxClassType t ) // sonst suchen Methods* p = aMethods; short nIndex = 0; - BOOL bFound = FALSE; + sal_Bool bFound = sal_False; while( p->nArgs != -1 ) { if( rName.EqualsIgnoreCaseAscii( p->pName ) ) { - bFound = TRUE; break; + bFound = sal_True; break; } nIndex += ( p->nArgs & _ARGSMASK ) + 1; p = aMethods + nIndex; @@ -172,22 +172,22 @@ void SampleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCT, { SbxVariable* pVar = pHint->GetVar(); SbxArray* pPar_ = pVar->GetParameters(); - USHORT nIndex = (USHORT) pVar->GetUserData(); + sal_uInt16 nIndex = (sal_uInt16) pVar->GetUserData(); // kein Index: weiterreichen! if( nIndex ) { - ULONG t = pHint->GetId(); + sal_uIntPtr t = pHint->GetId(); if( t == SBX_HINT_INFOWANTED ) pVar->SetInfo( GetInfo( (short) pVar->GetUserData() ) ); else { - BOOL bWrite = FALSE; + sal_Bool bWrite = sal_False; if( t == SBX_HINT_DATACHANGED ) - bWrite = TRUE; + bWrite = sal_True; if( t == SBX_HINT_DATAWANTED || bWrite ) { // Parameter-Test fuer Methoden: - USHORT nPar = aMethods[ --nIndex ].nArgs & 0x00FF; + sal_uInt16 nPar = aMethods[ --nIndex ].nArgs & 0x00FF; // Element 0 ist der Returnwert if( ( !pPar_ && nPar ) || ( pPar_->Count() != nPar+1 ) ) @@ -217,7 +217,7 @@ SbxInfo* SampleObject::GetInfo( short nIdx ) { p++; String aName_ = String::CreateFromAscii( p->pName ); - USHORT nFlags_ = ( p->nArgs >> 8 ) & 0x03; + sal_uInt16 nFlags_ = ( p->nArgs >> 8 ) & 0x03; if( p->nArgs & _OPT ) nFlags_ |= SBX_OPTIONAL; pInfo_->AddParam( aName_, p->eType, nFlags_ ); @@ -227,13 +227,13 @@ SbxInfo* SampleObject::GetInfo( short nIdx ) //////////////////////////////////////////////////////////////////////////// -// Properties und Methoden legen beim Get (bPut = FALSE) den Returnwert -// im Element 0 des Argv ab; beim Put (bPut = TRUE) wird der Wert aus +// Properties und Methoden legen beim Get (bPut = sal_False) den Returnwert +// im Element 0 des Argv ab; beim Put (bPut = sal_True) wird der Wert aus // Element 0 gespeichert. // Die Methoden: -void SampleObject::Display( SbxVariable*, SbxArray* pPar_, BOOL ) +void SampleObject::Display( SbxVariable*, SbxArray* pPar_, sal_Bool ) { // GetString() loest u.U. auch einen Error aus! String s( pPar_->Get( 1 )->GetString() ); @@ -241,7 +241,7 @@ void SampleObject::Display( SbxVariable*, SbxArray* pPar_, BOOL ) InfoBox( NULL, s ).Execute(); } -void SampleObject::Square( SbxVariable* pVar, SbxArray* pPar_, BOOL ) +void SampleObject::Square( SbxVariable* pVar, SbxArray* pPar_, sal_Bool ) { double n = pPar_->Get( 1 )->GetDouble(); pVar->PutDouble( n * n ); @@ -249,14 +249,14 @@ void SampleObject::Square( SbxVariable* pVar, SbxArray* pPar_, BOOL ) // Callback nach BASIC: -void SampleObject::Event( SbxVariable*, SbxArray* pPar_, BOOL ) +void SampleObject::Event( SbxVariable*, SbxArray* pPar_, sal_Bool ) { Call( pPar_->Get( 1 )->GetString(), NULL ); } // Neues Element anlegen -void SampleObject::Create( SbxVariable* pVar, SbxArray* pPar_, BOOL ) +void SampleObject::Create( SbxVariable* pVar, SbxArray* pPar_, sal_Bool ) { pVar->PutObject( MakeObject( pPar_->Get( 1 )->GetString(), String( RTL_CONSTASCII_USTRINGPARAM("SampleElement") ) ) ); diff --git a/basic/source/sample/sample.bas b/basic/source/sample/sample.bas index d0e416871af0..d0e416871af0 100644..100755 --- a/basic/source/sample/sample.bas +++ b/basic/source/sample/sample.bas diff --git a/basic/source/sbx/format.src b/basic/source/sbx/format.src index 7e576134fad5..7e576134fad5 100644..100755 --- a/basic/source/sbx/format.src +++ b/basic/source/sbx/format.src diff --git a/basic/source/sbx/makefile.mk b/basic/source/sbx/makefile.mk index 332c6a0d426d..332c6a0d426d 100644..100755 --- a/basic/source/sbx/makefile.mk +++ b/basic/source/sbx/makefile.mk diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx index 0028696fa85b..f230a6b8ed83 100644..100755 --- a/basic/source/sbx/sbxarray.cxx +++ b/basic/source/sbx/sbxarray.cxx @@ -36,8 +36,8 @@ using namespace std; struct SbxDim { // an array-dimension: SbxDim* pNext; // Link - INT32 nLbound, nUbound; // Limitations - INT32 nSize; // Number of elements + sal_Int32 nLbound, nUbound; // Limitations + sal_Int32 nSize; // Number of elements }; class SbxVarEntry : public SbxVariableRef { @@ -89,7 +89,7 @@ SbxArray& SbxArray::operator=( const SbxArray& rArray ) eType = rArray.eType; Clear(); SbxVarRefs* pSrc = rArray.pData; - for( UINT32 i = 0; i < pSrc->size(); i++ ) + for( sal_uInt32 i = 0; i < pSrc->size(); i++ ) { SbxVarEntryPtr pSrcRef = (*pSrc)[i]; const SbxVariable* pSrc_ = *pSrcRef; @@ -127,8 +127,8 @@ SbxClassType SbxArray::GetClass() const void SbxArray::Clear() { - UINT32 nSize = pData->size(); - for( UINT32 i = 0 ; i < nSize ; i++ ) + sal_uInt32 nSize = pData->size(); + for( sal_uInt32 i = 0 ; i < nSize ; i++ ) { SbxVarEntry* pEntry = (*pData)[i]; delete pEntry; @@ -136,19 +136,19 @@ void SbxArray::Clear() pData->clear(); } -UINT32 SbxArray::Count32() const +sal_uInt32 SbxArray::Count32() const { return pData->size(); } -USHORT SbxArray::Count() const +sal_uInt16 SbxArray::Count() const { - UINT32 nCount = pData->size(); + sal_uInt32 nCount = pData->size(); DBG_ASSERT( nCount <= SBX_MAXINDEX, "SBX: Array-Index > SBX_MAXINDEX" ); - return (USHORT)nCount; + return (sal_uInt16)nCount; } -SbxVariableRef& SbxArray::GetRef32( UINT32 nIdx ) +SbxVariableRef& SbxArray::GetRef32( sal_uInt32 nIdx ) { // If necessary extend the array DBG_ASSERT( nIdx <= SBX_MAXINDEX32, "SBX: Array-Index > SBX_MAXINDEX32" ); @@ -166,7 +166,7 @@ SbxVariableRef& SbxArray::GetRef32( UINT32 nIdx ) return *((*pData)[nIdx]); } -SbxVariableRef& SbxArray::GetRef( USHORT nIdx ) +SbxVariableRef& SbxArray::GetRef( sal_uInt16 nIdx ) { // If necessary extend the array DBG_ASSERT( nIdx <= SBX_MAXINDEX, "SBX: Array-Index > SBX_MAXINDEX" ); @@ -184,7 +184,7 @@ SbxVariableRef& SbxArray::GetRef( USHORT nIdx ) return *((*pData)[nIdx]); } -SbxVariable* SbxArray::Get32( UINT32 nIdx ) +SbxVariable* SbxArray::Get32( sal_uInt32 nIdx ) { if( !CanRead() ) { @@ -203,7 +203,7 @@ SbxVariable* SbxArray::Get32( UINT32 nIdx ) return rRef; } -SbxVariable* SbxArray::Get( USHORT nIdx ) +SbxVariable* SbxArray::Get( sal_uInt16 nIdx ) { if( !CanRead() ) { @@ -222,7 +222,7 @@ SbxVariable* SbxArray::Get( USHORT nIdx ) return rRef; } -void SbxArray::Put32( SbxVariable* pVar, UINT32 nIdx ) +void SbxArray::Put32( SbxVariable* pVar, sal_uInt32 nIdx ) { if( !CanWrite() ) SetError( SbxERR_PROP_READONLY ); @@ -242,7 +242,7 @@ void SbxArray::Put32( SbxVariable* pVar, UINT32 nIdx ) } } -void SbxArray::Put( SbxVariable* pVar, USHORT nIdx ) +void SbxArray::Put( SbxVariable* pVar, sal_uInt16 nIdx ) { if( !CanWrite() ) SetError( SbxERR_PROP_READONLY ); @@ -262,7 +262,7 @@ void SbxArray::Put( SbxVariable* pVar, USHORT nIdx ) } } -const XubString& SbxArray::GetAlias( USHORT nIdx ) +const XubString& SbxArray::GetAlias( sal_uInt16 nIdx ) { if( !CanRead() ) { @@ -281,7 +281,7 @@ const XubString& SbxArray::GetAlias( USHORT nIdx ) return *rRef.pAlias; } -void SbxArray::PutAlias( const XubString& rAlias, USHORT nIdx ) +void SbxArray::PutAlias( const XubString& rAlias, sal_uInt16 nIdx ) { if( !CanWrite() ) SetError( SbxERR_PROP_READONLY ); @@ -295,7 +295,7 @@ void SbxArray::PutAlias( const XubString& rAlias, USHORT nIdx ) } } -void SbxArray::Insert32( SbxVariable* pVar, UINT32 nIdx ) +void SbxArray::Insert32( SbxVariable* pVar, sal_uInt32 nIdx ) { DBG_ASSERT( pData->size() <= SBX_MAXINDEX32, "SBX: Array wird zu gross" ); if( pData->size() > SBX_MAXINDEX32 ) @@ -318,7 +318,7 @@ void SbxArray::Insert32( SbxVariable* pVar, UINT32 nIdx ) SetFlag( SBX_MODIFIED ); } -void SbxArray::Insert( SbxVariable* pVar, USHORT nIdx ) +void SbxArray::Insert( SbxVariable* pVar, sal_uInt16 nIdx ) { DBG_ASSERT( pData->size() <= 0x3FF0, "SBX: Array wird zu gross" ); if( pData->size() > 0x3FF0 ) @@ -326,7 +326,7 @@ void SbxArray::Insert( SbxVariable* pVar, USHORT nIdx ) Insert32( pVar, nIdx ); } -void SbxArray::Remove32( UINT32 nIdx ) +void SbxArray::Remove32( sal_uInt32 nIdx ) { if( nIdx < pData->size() ) { @@ -337,7 +337,7 @@ void SbxArray::Remove32( UINT32 nIdx ) } } -void SbxArray::Remove( USHORT nIdx ) +void SbxArray::Remove( sal_uInt16 nIdx ) { if( nIdx < pData->size() ) { @@ -352,7 +352,7 @@ void SbxArray::Remove( SbxVariable* pVar ) { if( pVar ) { - for( UINT32 i = 0; i < pData->size(); i++ ) + for( sal_uInt32 i = 0; i < pData->size(); i++ ) { SbxVariableRef* pRef = (*pData)[i]; // SbxVariableRef* pRef = pData->GetObject( i ); @@ -371,8 +371,8 @@ void SbxArray::Merge( SbxArray* p ) { if( p ) { - UINT32 nSize = p->Count(); - for( UINT32 i = 0; i < nSize; i++ ) + sal_uInt32 nSize = p->Count(); + for( sal_uInt32 i = 0; i < nSize; i++ ) { SbxVarEntryPtr pRef1 = (*(p->pData))[i]; // Is the element by name already inside? @@ -381,8 +381,8 @@ void SbxArray::Merge( SbxArray* p ) if( pVar ) { XubString aName = pVar->GetName(); - USHORT nHash = pVar->GetHashCode(); - for( UINT32 j = 0; j < pData->size(); j++ ) + sal_uInt16 nHash = pVar->GetHashCode(); + for( sal_uInt32 j = 0; j < pData->size(); j++ ) { SbxVariableRef* pRef2 = (*pData)[j]; if( (*pRef2)->GetHashCode() == nHash @@ -409,10 +409,10 @@ void SbxArray::Merge( SbxArray* p ) // Search of an element via the user data. If the element is // object, it will also be scanned. -SbxVariable* SbxArray::FindUserData( UINT32 nData ) +SbxVariable* SbxArray::FindUserData( sal_uInt32 nData ) { SbxVariable* p = NULL; - for( UINT32 i = 0; i < pData->size(); i++ ) + for( sal_uInt32 i = 0; i < pData->size(); i++ ) { SbxVariableRef* pRef = (*pData)[i]; SbxVariable* pVar = *pRef; @@ -432,7 +432,7 @@ SbxVariable* SbxArray::FindUserData( UINT32 nData ) case SbxCLASS_OBJECT: { // Objects are not allowed to scan their parent. - USHORT nOld = pVar->GetFlags(); + sal_uInt16 nOld = pVar->GetFlags(); pVar->ResetFlag( SBX_GBLSEARCH ); p = ((SbxObject*) pVar)->FindUserData( nData ); pVar->SetFlags( nOld ); @@ -460,19 +460,19 @@ SbxVariable* SbxArray::FindUserData( UINT32 nData ) SbxVariable* SbxArray::Find( const XubString& rName, SbxClassType t ) { SbxVariable* p = NULL; - UINT32 nCount = pData->size(); + sal_uInt32 nCount = pData->size(); if( !nCount ) return NULL; - BOOL bExtSearch = IsSet( SBX_EXTSEARCH ); - USHORT nHash = SbxVariable::MakeHashCode( rName ); - for( UINT32 i = 0; i < nCount; i++ ) + sal_Bool bExtSearch = IsSet( SBX_EXTSEARCH ); + sal_uInt16 nHash = SbxVariable::MakeHashCode( rName ); + for( sal_uInt32 i = 0; i < nCount; i++ ) { SbxVariableRef* pRef = (*pData)[i]; SbxVariable* pVar = *pRef; if( pVar && pVar->IsVisible() ) { // The very secure search works as well, if there is no hashcode! - USHORT nVarHash = pVar->GetHashCode(); + sal_uInt16 nVarHash = pVar->GetHashCode(); if( ( !nVarHash || nVarHash == nHash ) && ( t == SbxCLASS_DONTCARE || pVar->GetClass() == t ) && ( pVar->GetName().EqualsIgnoreCaseAscii( rName ) ) ) @@ -489,7 +489,7 @@ SbxVariable* SbxArray::Find( const XubString& rName, SbxClassType t ) case SbxCLASS_OBJECT: { // Objects are not allowed to scan their parent. - USHORT nOld = pVar->GetFlags(); + sal_uInt16 nOld = pVar->GetFlags(); pVar->ResetFlag( SBX_GBLSEARCH ); p = ((SbxObject*) pVar)->Find( rName, t ); pVar->SetFlags( nOld ); @@ -511,18 +511,18 @@ SbxVariable* SbxArray::Find( const XubString& rName, SbxClassType t ) return p; } -BOOL SbxArray::LoadData( SvStream& rStrm, USHORT nVer ) +sal_Bool SbxArray::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { - UINT16 nElem; + sal_uInt16 nElem; Clear(); - BOOL bRes = TRUE; - USHORT f = nFlags; + sal_Bool bRes = sal_True; + sal_uInt16 f = nFlags; nFlags |= SBX_WRITE; rStrm >> nElem; nElem &= 0x7FFF; - for( UINT32 n = 0; n < nElem; n++ ) + for( sal_uInt32 n = 0; n < nElem; n++ ) { - UINT16 nIdx; + sal_uInt16 nIdx; rStrm >> nIdx; SbxVariable* pVar = (SbxVariable*) Load( rStrm ); if( pVar ) @@ -532,7 +532,7 @@ BOOL SbxArray::LoadData( SvStream& rStrm, USHORT nVer ) } else { - bRes = FALSE; break; + bRes = sal_False; break; } } if( bRes ) @@ -541,10 +541,10 @@ BOOL SbxArray::LoadData( SvStream& rStrm, USHORT nVer ) return bRes; } -BOOL SbxArray::StoreData( SvStream& rStrm ) const +sal_Bool SbxArray::StoreData( SvStream& rStrm ) const { - UINT32 nElem = 0; - UINT32 n; + sal_uInt32 nElem = 0; + sal_uInt32 n; // Which elements are even defined? for( n = 0; n < pData->size(); n++ ) { @@ -553,23 +553,23 @@ BOOL SbxArray::StoreData( SvStream& rStrm ) const if( p && !( p->GetFlags() & SBX_DONTSTORE ) ) nElem++; } - rStrm << (UINT16) nElem; + rStrm << (sal_uInt16) nElem; for( n = 0; n < pData->size(); n++ ) { SbxVariableRef* pRef = (*pData)[n]; SbxVariable* p = *pRef; if( p && !( p->GetFlags() & SBX_DONTSTORE ) ) { - rStrm << (UINT16) n; + rStrm << (sal_uInt16) n; if( !p->Store( rStrm ) ) - return FALSE; + return sal_False; } } return StorePrivateData( rStrm ); } // #100883 Method to set method directly to parameter array -void SbxArray::PutDirect( SbxVariable* pVar, UINT32 nIdx ) +void SbxArray::PutDirect( SbxVariable* pVar, sal_uInt32 nIdx ) { SbxVariableRef& rRef = GetRef32( nIdx ); rRef = pVar; @@ -632,7 +632,7 @@ void SbxDimArray::Clear() // Add a dimension -void SbxDimArray::AddDimImpl32( INT32 lb, INT32 ub, BOOL bAllowSize0 ) +void SbxDimArray::AddDimImpl32( sal_Int32 lb, sal_Int32 ub, sal_Bool bAllowSize0 ) { SbxError eRes = SbxERR_OK; if( ub < lb && !bAllowSize0 ) @@ -656,51 +656,51 @@ void SbxDimArray::AddDimImpl32( INT32 lb, INT32 ub, BOOL bAllowSize0 ) void SbxDimArray::AddDim( short lb, short ub ) { - AddDimImpl32( lb, ub, FALSE ); + AddDimImpl32( lb, ub, sal_False ); } void SbxDimArray::unoAddDim( short lb, short ub ) { - AddDimImpl32( lb, ub, TRUE ); + AddDimImpl32( lb, ub, sal_True ); } -void SbxDimArray::AddDim32( INT32 lb, INT32 ub ) +void SbxDimArray::AddDim32( sal_Int32 lb, sal_Int32 ub ) { - AddDimImpl32( lb, ub, FALSE ); + AddDimImpl32( lb, ub, sal_False ); } -void SbxDimArray::unoAddDim32( INT32 lb, INT32 ub ) +void SbxDimArray::unoAddDim32( sal_Int32 lb, sal_Int32 ub ) { - AddDimImpl32( lb, ub, TRUE ); + AddDimImpl32( lb, ub, sal_True ); } // Readout dimension data -BOOL SbxDimArray::GetDim32( INT32 n, INT32& rlb, INT32& rub ) const +sal_Bool SbxDimArray::GetDim32( sal_Int32 n, sal_Int32& rlb, sal_Int32& rub ) const { if( n < 1 || n > nDim ) { - SetError( SbxERR_BOUNDS ); rub = rlb = 0; return FALSE; + SetError( SbxERR_BOUNDS ); rub = rlb = 0; return sal_False; } SbxDim* p = pFirst; while( --n ) p = p->pNext; rub = p->nUbound; rlb = p->nLbound; - return TRUE; + return sal_True; } -BOOL SbxDimArray::GetDim( short n, short& rlb, short& rub ) const +sal_Bool SbxDimArray::GetDim( short n, short& rlb, short& rub ) const { - INT32 rlb32, rub32; - BOOL bRet = GetDim32( n, rlb32, rub32 ); + sal_Int32 rlb32, rub32; + sal_Bool bRet = GetDim32( n, rlb32, rub32 ); if( bRet ) { if( rlb32 < -SBX_MAXINDEX || rub32 > SBX_MAXINDEX ) { SetError( SbxERR_BOUNDS ); - return FALSE; + return sal_False; } rub = (short)rub32; rlb = (short)rlb32; @@ -710,15 +710,15 @@ BOOL SbxDimArray::GetDim( short n, short& rlb, short& rub ) const // Element-Ptr with the help of an index list -UINT32 SbxDimArray::Offset32( const INT32* pIdx ) +sal_uInt32 SbxDimArray::Offset32( const sal_Int32* pIdx ) { - UINT32 nPos = 0; + sal_uInt32 nPos = 0; for( SbxDim* p = pFirst; p; p = p->pNext ) { - INT32 nIdx = *pIdx++; + sal_Int32 nIdx = *pIdx++; if( nIdx < p->nLbound || nIdx > p->nUbound ) { - nPos = (UINT32)SBX_MAXINDEX32 + 1; break; + nPos = (sal_uInt32)SBX_MAXINDEX32 + 1; break; } nPos = nPos * p->nSize + nIdx - p->nLbound; } @@ -729,7 +729,7 @@ UINT32 SbxDimArray::Offset32( const INT32* pIdx ) return nPos; } -USHORT SbxDimArray::Offset( const short* pIdx ) +sal_uInt16 SbxDimArray::Offset( const short* pIdx ) { long nPos = 0; for( SbxDim* p = pFirst; p; p = p->pNext ) @@ -745,7 +745,7 @@ USHORT SbxDimArray::Offset( const short* pIdx ) { SetError( SbxERR_BOUNDS ); nPos = 0; } - return (USHORT) nPos; + return (sal_uInt16) nPos; } SbxVariableRef& SbxDimArray::GetRef( const short* pIdx ) @@ -763,17 +763,17 @@ void SbxDimArray::Put( SbxVariable* p, const short* pIdx ) SbxArray::Put( p, Offset( pIdx ) ); } -SbxVariableRef& SbxDimArray::GetRef32( const INT32* pIdx ) +SbxVariableRef& SbxDimArray::GetRef32( const sal_Int32* pIdx ) { return SbxArray::GetRef32( Offset32( pIdx ) ); } -SbxVariable* SbxDimArray::Get32( const INT32* pIdx ) +SbxVariable* SbxDimArray::Get32( const sal_Int32* pIdx ) { return SbxArray::Get32( Offset32( pIdx ) ); } -void SbxDimArray::Put32( SbxVariable* p, const INT32* pIdx ) +void SbxDimArray::Put32( SbxVariable* p, const sal_Int32* pIdx ) { SbxArray::Put32( p, Offset32( pIdx ) ); } @@ -781,38 +781,38 @@ void SbxDimArray::Put32( SbxVariable* p, const INT32* pIdx ) // Element-Number with the help of Parameter-Array -UINT32 SbxDimArray::Offset32( SbxArray* pPar ) +sal_uInt32 SbxDimArray::Offset32( SbxArray* pPar ) { if( nDim == 0 || !pPar || ( ( nDim != ( pPar->Count() - 1 ) ) && SbiRuntime::isVBAEnabled() ) ) { SetError( SbxERR_BOUNDS ); return 0; } - UINT32 nPos = 0; - USHORT nOff = 1; // Non element 0! + sal_uInt32 nPos = 0; + sal_uInt16 nOff = 1; // Non element 0! for( SbxDim* p = pFirst; p && !IsError(); p = p->pNext ) { - INT32 nIdx = pPar->Get( nOff++ )->GetLong(); + sal_Int32 nIdx = pPar->Get( nOff++ )->GetLong(); if( nIdx < p->nLbound || nIdx > p->nUbound ) { - nPos = (UINT32) SBX_MAXINDEX32+1; break; + nPos = (sal_uInt32) SBX_MAXINDEX32+1; break; } nPos = nPos * p->nSize + nIdx - p->nLbound; } - if( nPos > (UINT32) SBX_MAXINDEX32 ) + if( nPos > (sal_uInt32) SBX_MAXINDEX32 ) { SetError( SbxERR_BOUNDS ); nPos = 0; } return nPos; } -USHORT SbxDimArray::Offset( SbxArray* pPar ) +sal_uInt16 SbxDimArray::Offset( SbxArray* pPar ) { - UINT32 nPos = Offset32( pPar ); + sal_uInt32 nPos = Offset32( pPar ); if( nPos > (long) SBX_MAXINDEX ) { SetError( SbxERR_BOUNDS ); nPos = 0; } - return (USHORT) nPos; + return (sal_uInt16) nPos; } SbxVariableRef& SbxDimArray::GetRef( SbxArray* pPar ) @@ -830,27 +830,27 @@ void SbxDimArray::Put( SbxVariable* p, SbxArray* pPar ) SbxArray::Put32( p, Offset32( pPar ) ); } -BOOL SbxDimArray::LoadData( SvStream& rStrm, USHORT nVer ) +sal_Bool SbxDimArray::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { short nDimension; rStrm >> nDimension; for( short i = 0; i < nDimension && rStrm.GetError() == SVSTREAM_OK; i++ ) { - INT16 lb, ub; + sal_Int16 lb, ub; rStrm >> lb >> ub; AddDim( lb, ub ); } return SbxArray::LoadData( rStrm, nVer ); } -BOOL SbxDimArray::StoreData( SvStream& rStrm ) const +sal_Bool SbxDimArray::StoreData( SvStream& rStrm ) const { - rStrm << (INT16) nDim; + rStrm << (sal_Int16) nDim; for( short i = 0; i < nDim; i++ ) { short lb, ub; GetDim( i, lb, ub ); - rStrm << (INT16) lb << (INT16) ub; + rStrm << (sal_Int16) lb << (sal_Int16) ub; } return SbxArray::StoreData( rStrm ); } diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx index 6683fbdc56ee..77f34d90f370 100644..100755 --- a/basic/source/sbx/sbxbase.cxx +++ b/basic/source/sbx/sbxbase.cxx @@ -109,13 +109,13 @@ void SbxBase::Clear() DBG_CHKTHIS( SbxBase, 0 ); } -BOOL SbxBase::IsFixed() const +sal_Bool SbxBase::IsFixed() const { DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_FIXED ); } -void SbxBase::SetModified( BOOL b ) +void SbxBase::SetModified( sal_Bool b ) { DBG_CHKTHIS( SbxBase, 0 ); if( IsSet( SBX_NO_MODIFY ) ) @@ -138,9 +138,9 @@ void SbxBase::SetError( SbxError e ) p->eSbxError = e; } -BOOL SbxBase::IsError() +sal_Bool SbxBase::IsError() { - return BOOL( GetSbxData_Impl()->eSbxError != SbxERR_OK ); + return sal_Bool( GetSbxData_Impl()->eSbxError != SbxERR_OK ); } void SbxBase::ResetError() @@ -154,7 +154,7 @@ void SbxBase::AddFactory( SbxFactory* pFac ) const SbxFactory* pTemp = pFac; // From 1996-03-06: take the HandleLast-Flag into account - USHORT nPos = p->aFacs.Count(); // Insert-Position + sal_uInt16 nPos = p->aFacs.Count(); // Insert position if( !pFac->IsHandleLast() ) // Only if not self HandleLast { // Rank new factory in front of factories with HandleLast @@ -168,7 +168,7 @@ void SbxBase::AddFactory( SbxFactory* pFac ) void SbxBase::RemoveFactory( SbxFactory* pFac ) { SbxAppData* p = GetSbxData_Impl(); - for( USHORT i = 0; i < p->aFacs.Count(); i++ ) + for( sal_uInt16 i = 0; i < p->aFacs.Count(); i++ ) { if( p->aFacs.GetObject( i ) == pFac ) { @@ -178,7 +178,7 @@ void SbxBase::RemoveFactory( SbxFactory* pFac ) } -SbxBase* SbxBase::Create( UINT16 nSbxId, UINT32 nCreator ) +SbxBase* SbxBase::Create( sal_uInt16 nSbxId, sal_uInt32 nCreator ) { // #91626: Hack to skip old Basic dialogs // Problem: There does not exist a factory any more, @@ -204,7 +204,7 @@ SbxBase* SbxBase::Create( UINT16 nSbxId, UINT32 nCreator ) // Unknown type: go over the factories! SbxAppData* p = GetSbxData_Impl(); SbxBase* pNew = NULL; - for( USHORT i = 0; i < p->aFacs.Count(); i++ ) + for( sal_uInt16 i = 0; i < p->aFacs.Count(); i++ ) { SbxFactory* pFac = p->aFacs.GetObject( i ); pNew = pFac->Create( nSbxId, nCreator ); @@ -226,7 +226,7 @@ SbxObject* SbxBase::CreateObject( const XubString& rClass ) { SbxAppData* p = GetSbxData_Impl(); SbxObject* pNew = NULL; - for( USHORT i = 0; i < p->aFacs.Count(); i++ ) + for( sal_uInt16 i = 0; i < p->aFacs.Count(); i++ ) { pNew = p->aFacs.GetObject( i )->CreateObject( rClass ); if( pNew ) @@ -244,15 +244,15 @@ SbxObject* SbxBase::CreateObject( const XubString& rClass ) return pNew; } -static BOOL bStaticEnableBroadcasting = TRUE; +static sal_Bool bStaticEnableBroadcasting = sal_True; // Sbx-Solution in exchange for SfxBroadcaster::Enable() -void SbxBase::StaticEnableBroadcasting( BOOL bEnable ) +void SbxBase::StaticEnableBroadcasting( sal_Bool bEnable ) { bStaticEnableBroadcasting = bEnable; } -BOOL SbxBase::StaticIsEnabledBroadcasting( void ) +sal_Bool SbxBase::StaticIsEnabledBroadcasting( void ) { return bStaticEnableBroadcasting; } @@ -260,15 +260,15 @@ BOOL SbxBase::StaticIsEnabledBroadcasting( void ) SbxBase* SbxBase::Load( SvStream& rStrm ) { - UINT16 nSbxId, nFlags, nVer; - UINT32 nCreator, nSize; + sal_uInt16 nSbxId, nFlags, nVer; + sal_uInt32 nCreator, nSize; rStrm >> nCreator >> nSbxId >> nFlags >> nVer; // Correcting a foolishness of mine: if( nFlags & SBX_RESERVED ) nFlags = ( nFlags & ~SBX_RESERVED ) | SBX_GBLSEARCH; - ULONG nOldPos = rStrm.Tell(); + sal_uIntPtr nOldPos = rStrm.Tell(); rStrm >> nSize; SbxBase* p = Create( nSbxId, nCreator ); if( p ) @@ -276,7 +276,7 @@ SbxBase* SbxBase::Load( SvStream& rStrm ) p->nFlags = nFlags; if( p->LoadData( rStrm, nVer ) ) { - ULONG nNewPos = rStrm.Tell(); + sal_uIntPtr nNewPos = rStrm.Tell(); nOldPos += nSize; DBG_ASSERT( nOldPos >= nNewPos, "SBX: Zu viele Daten eingelesen" ); if( nOldPos != nNewPos ) @@ -304,81 +304,81 @@ SbxBase* SbxBase::Load( SvStream& rStrm ) // Skip the Sbx-Object inside the stream void SbxBase::Skip( SvStream& rStrm ) { - UINT16 nSbxId, nFlags, nVer; - UINT32 nCreator, nSize; + sal_uInt16 nSbxId, nFlags, nVer; + sal_uInt32 nCreator, nSize; rStrm >> nCreator >> nSbxId >> nFlags >> nVer; - ULONG nStartPos = rStrm.Tell(); + sal_uIntPtr nStartPos = rStrm.Tell(); rStrm >> nSize; rStrm.Seek( nStartPos + nSize ); } -BOOL SbxBase::Store( SvStream& rStrm ) +sal_Bool SbxBase::Store( SvStream& rStrm ) { DBG_CHKTHIS( SbxBase, 0 ); if( !( nFlags & SBX_DONTSTORE ) ) { - rStrm << (UINT32) GetCreator() - << (UINT16) GetSbxId() - << (UINT16) GetFlags() - << (UINT16) GetVersion(); - ULONG nOldPos = rStrm.Tell(); - rStrm << (UINT32) 0L; - BOOL bRes = StoreData( rStrm ); - ULONG nNewPos = rStrm.Tell(); + rStrm << (sal_uInt32) GetCreator() + << (sal_uInt16) GetSbxId() + << (sal_uInt16) GetFlags() + << (sal_uInt16) GetVersion(); + sal_uIntPtr nOldPos = rStrm.Tell(); + rStrm << (sal_uInt32) 0L; + sal_Bool bRes = StoreData( rStrm ); + sal_uIntPtr nNewPos = rStrm.Tell(); rStrm.Seek( nOldPos ); - rStrm << (UINT32) ( nNewPos - nOldPos ); + rStrm << (sal_uInt32) ( nNewPos - nOldPos ); rStrm.Seek( nNewPos ); if( rStrm.GetError() != SVSTREAM_OK ) - bRes = FALSE; + bRes = sal_False; if( bRes ) bRes = StoreCompleted(); return bRes; } else - return TRUE; + return sal_True; } -BOOL SbxBase::LoadData( SvStream&, USHORT ) +sal_Bool SbxBase::LoadData( SvStream&, sal_uInt16 ) { DBG_CHKTHIS( SbxBase, 0 ); - return FALSE; + return sal_False; } -BOOL SbxBase::StoreData( SvStream& ) const +sal_Bool SbxBase::StoreData( SvStream& ) const { DBG_CHKTHIS( SbxBase, 0 ); - return FALSE; + return sal_False; } -BOOL SbxBase::LoadPrivateData( SvStream&, USHORT ) +sal_Bool SbxBase::LoadPrivateData( SvStream&, sal_uInt16 ) { DBG_CHKTHIS( SbxBase, 0 ); - return TRUE; + return sal_True; } -BOOL SbxBase::StorePrivateData( SvStream& ) const +sal_Bool SbxBase::StorePrivateData( SvStream& ) const { DBG_CHKTHIS( SbxBase, 0 ); - return TRUE; + return sal_True; } -BOOL SbxBase::LoadCompleted() +sal_Bool SbxBase::LoadCompleted() { DBG_CHKTHIS( SbxBase, 0 ); - return TRUE; + return sal_True; } -BOOL SbxBase::StoreCompleted() +sal_Bool SbxBase::StoreCompleted() { DBG_CHKTHIS( SbxBase, 0 ); - return TRUE; + return sal_True; } //////////////////////////////// SbxFactory //////////////////////////////// -SbxBase* SbxFactory::Create( UINT16, UINT32 ) +SbxBase* SbxFactory::Create( sal_uInt16, sal_uInt32 ) { return NULL; } @@ -394,7 +394,7 @@ SbxInfo::~SbxInfo() {} void SbxInfo::AddParam - ( const XubString& rName, SbxDataType eType, USHORT nFlags ) + ( const XubString& rName, SbxDataType eType, sal_uInt16 nFlags ) { const SbxParamInfo* p = new SbxParamInfo( rName, eType, nFlags ); aParams.Insert( p, aParams.Count() ); @@ -407,7 +407,7 @@ void SbxInfo::AddParam( const SbxParamInfo& r ) aParams.Insert( p, aParams.Count() ); } -const SbxParamInfo* SbxInfo::GetParam( USHORT n ) const +const SbxParamInfo* SbxInfo::GetParam( sal_uInt16 n ) const { if( n < 1 || n > aParams.Count() ) return NULL; @@ -415,18 +415,18 @@ const SbxParamInfo* SbxInfo::GetParam( USHORT n ) const return aParams.GetObject( n-1 ); } -BOOL SbxInfo::LoadData( SvStream& rStrm, USHORT nVer ) +sal_Bool SbxInfo::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { aParams.Remove( 0, aParams.Count() ); - UINT16 nParam; + sal_uInt16 nParam; rStrm.ReadByteString( aComment, RTL_TEXTENCODING_ASCII_US ); rStrm.ReadByteString( aHelpFile, RTL_TEXTENCODING_ASCII_US ); rStrm >> nHelpId >> nParam; while( nParam-- ) { XubString aName; - UINT16 nType, nFlags; - UINT32 nUserData = 0; + sal_uInt16 nType, nFlags; + sal_uInt32 nUserData = 0; rStrm.ReadByteString( aName, RTL_TEXTENCODING_ASCII_US ); rStrm >> nType >> nFlags; if( nVer > 1 ) @@ -435,23 +435,23 @@ BOOL SbxInfo::LoadData( SvStream& rStrm, USHORT nVer ) SbxParamInfo* p = aParams.GetObject( aParams.Count() - 1 ); p->nUserData = nUserData; } - return TRUE; + return sal_True; } -BOOL SbxInfo::StoreData( SvStream& rStrm ) const +sal_Bool SbxInfo::StoreData( SvStream& rStrm ) const { rStrm.WriteByteString( aComment, RTL_TEXTENCODING_ASCII_US ); rStrm.WriteByteString( aHelpFile, RTL_TEXTENCODING_ASCII_US ); rStrm << nHelpId << aParams.Count(); - for( USHORT i = 0; i < aParams.Count(); i++ ) + for( sal_uInt16 i = 0; i < aParams.Count(); i++ ) { SbxParamInfo* p = aParams.GetObject( i ); rStrm.WriteByteString( p->aName, RTL_TEXTENCODING_ASCII_US ); - rStrm << (UINT16) p->eType - << (UINT16) p->nFlags - << (UINT32) p->nUserData; + rStrm << (sal_uInt16) p->eType + << (sal_uInt16) p->nFlags + << (sal_uInt32) p->nUserData; } - return TRUE; + return sal_True; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/sbx/sbxbool.cxx b/basic/source/sbx/sbxbool.cxx index 03b435af1ef6..7efb748355cc 100644..100755 --- a/basic/source/sbx/sbxbool.cxx +++ b/basic/source/sbx/sbxbool.cxx @@ -86,15 +86,15 @@ enum SbxBOOL ImpGetBool( const SbxValues* p ) else if( !p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_FALSE ) ) ) { // Jetzt kann es noch in eine Zahl konvertierbar sein - BOOL bError = TRUE; + sal_Bool bError = sal_True; double n; SbxDataType t; - USHORT nLen = 0; + sal_uInt16 nLen = 0; if( ImpScan( *p->pOUString, n, t, &nLen ) == SbxERR_OK ) { if( nLen == p->pOUString->getLength() ) { - bError = FALSE; + bError = sal_False; if( n != 0.0 ) nRes = SbxTRUE; } @@ -146,7 +146,7 @@ enum SbxBOOL ImpGetBool( const SbxValues* p ) return nRes; } -void ImpPutBool( SbxValues* p, INT16 n ) +void ImpPutBool( SbxValues* p, sal_Int16 n ) { if( n ) n = SbxTRUE; @@ -155,17 +155,17 @@ void ImpPutBool( SbxValues* p, INT16 n ) case SbxCHAR: p->nChar = (xub_Unicode) n; break; case SbxUINT: - p->nByte = (BYTE) n; break; + p->nByte = (sal_uInt8) n; break; case SbxINTEGER: case SbxBOOL: p->nInteger = n; break; case SbxLONG: p->nLong = n; break; case SbxULONG: - p->nULong = (UINT32) n; break; + p->nULong = (sal_uInt32) n; break; case SbxERROR: case SbxUSHORT: - p->nUShort = (UINT16) n; break; + p->nUShort = (sal_uInt16) n; break; case SbxSINGLE: p->nSingle = n; break; case SbxDATE: @@ -178,7 +178,7 @@ void ImpPutBool( SbxValues* p, INT16 n ) p->uInt64 = (sal_uInt64) n; break; case SbxDECIMAL: case SbxBYREF | SbxDECIMAL: - ImpCreateDecimal( p )->setInt( (INT16)n ); + ImpCreateDecimal( p )->setInt( (sal_Int16)n ); break; case SbxBYREF | SbxSTRING: @@ -194,7 +194,7 @@ void ImpPutBool( SbxValues* p, INT16 n ) { SbxValue* pVal = PTR_CAST(SbxValue,p->pObj); if( pVal ) - pVal->PutBool( BOOL( n != 0 ) ); + pVal->PutBool( sal_Bool( n != 0 ) ); else SbxBase::SetError( SbxERR_NO_OBJECT ); break; @@ -202,17 +202,17 @@ void ImpPutBool( SbxValues* p, INT16 n ) case SbxBYREF | SbxCHAR: *p->pChar = (xub_Unicode) n; break; case SbxBYREF | SbxBYTE: - *p->pByte = (BYTE) n; break; + *p->pByte = (sal_uInt8) n; break; case SbxBYREF | SbxINTEGER: case SbxBYREF | SbxBOOL: - *p->pInteger = (INT16) n; break; + *p->pInteger = (sal_Int16) n; break; case SbxBYREF | SbxERROR: case SbxBYREF | SbxUSHORT: - *p->pUShort = (UINT16) n; break; + *p->pUShort = (sal_uInt16) n; break; case SbxBYREF | SbxLONG: *p->pLong = n; break; case SbxBYREF | SbxULONG: - *p->pULong = (UINT32) n; break; + *p->pULong = (sal_uInt32) n; break; case SbxBYREF | SbxSINGLE: *p->pSingle = n; break; case SbxBYREF | SbxDATE: diff --git a/basic/source/sbx/sbxbyte.cxx b/basic/source/sbx/sbxbyte.cxx index cbdc32c30d4f..90d8ecc40a20 100644..100755 --- a/basic/source/sbx/sbxbyte.cxx +++ b/basic/source/sbx/sbxbyte.cxx @@ -32,10 +32,10 @@ #include <basic/sbx.hxx> #include "sbxconv.hxx" -BYTE ImpGetByte( const SbxValues* p ) +sal_uInt8 ImpGetByte( const SbxValues* p ) { SbxValues aTmp; - BYTE nRes; + sal_uInt8 nRes; start: switch( +p->eType ) { @@ -49,10 +49,10 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0; } else - nRes = (BYTE) p->nChar; + nRes = (sal_uInt8) p->nChar; break; case SbxBYTE: - nRes = (BYTE) p->nByte; break; + nRes = (sal_uInt8) p->nByte; break; case SbxINTEGER: case SbxBOOL: if( p->nInteger > SbxMAXBYTE ) @@ -64,16 +64,16 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0; } else - nRes = (BYTE) p->nInteger; + nRes = (sal_uInt8) p->nInteger; break; case SbxERROR: case SbxUSHORT: - if( p->nUShort > (USHORT) SbxMAXBYTE ) + if( p->nUShort > (sal_uInt16) SbxMAXBYTE ) { SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXBYTE; } else - nRes = (BYTE) p->nUShort; + nRes = (sal_uInt8) p->nUShort; break; case SbxLONG: if( p->nLong > SbxMAXBYTE ) @@ -85,7 +85,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0; } else - nRes = (BYTE) p->nLong; + nRes = (sal_uInt8) p->nLong; break; case SbxULONG: if( p->nULong > SbxMAXBYTE ) @@ -93,7 +93,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXBYTE; } else - nRes = (BYTE) p->nULong; + nRes = (sal_uInt8) p->nULong; break; case SbxCURRENCY: case SbxSALINT64: @@ -110,7 +110,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0; } else - nRes = (BYTE) val; + nRes = (sal_uInt8) val; break; } case SbxSALUINT64: @@ -119,7 +119,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXBYTE; } else - nRes = (BYTE) p->uInt64; + nRes = (sal_uInt8) p->uInt64; break; case SbxSINGLE: if( p->nSingle > SbxMAXBYTE ) @@ -131,7 +131,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0; } else - nRes = (BYTE) ImpRound( p->nSingle ); + nRes = (sal_uInt8) ImpRound( p->nSingle ); break; case SbxDATE: case SbxDOUBLE: @@ -157,7 +157,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0; } else - nRes = (BYTE) ImpRound( dVal ); + nRes = (sal_uInt8) ImpRound( dVal ); break; } case SbxBYREF | SbxSTRING: @@ -180,7 +180,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0; } else - nRes = (BYTE) ( d + 0.5 ); + nRes = (sal_uInt8) ( d + 0.5 ); } break; case SbxOBJECT: @@ -231,7 +231,7 @@ start: return nRes; } -void ImpPutByte( SbxValues* p, BYTE n ) +void ImpPutByte( SbxValues* p, sal_uInt8 n ) { switch( +p->eType ) { diff --git a/basic/source/sbx/sbxchar.cxx b/basic/source/sbx/sbxchar.cxx index f579eafa9047..ee4cb48b8efb 100644..100755 --- a/basic/source/sbx/sbxchar.cxx +++ b/basic/source/sbx/sbxchar.cxx @@ -145,7 +145,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMINCHAR; } else - nRes = (BYTE) ImpRound( dVal ); + nRes = (sal_uInt8) ImpRound( dVal ); break; } case SbxBYREF | SbxSTRING: @@ -276,17 +276,17 @@ start: case SbxBYREF | SbxCHAR: *p->pChar = n; break; case SbxBYREF | SbxBYTE: - *p->pByte = (BYTE) n; break; + *p->pByte = (sal_uInt8) n; break; case SbxBYREF | SbxINTEGER: case SbxBYREF | SbxBOOL: *p->pInteger = n; break; case SbxBYREF | SbxERROR: case SbxBYREF | SbxUSHORT: - *p->pUShort = (UINT16) n; break; + *p->pUShort = (sal_uInt16) n; break; case SbxBYREF | SbxLONG: - *p->pLong = (INT32) n; break; + *p->pLong = (sal_Int32) n; break; case SbxBYREF | SbxULONG: - *p->pULong = (UINT32) n; break; + *p->pULong = (sal_uInt32) n; break; case SbxBYREF | SbxSINGLE: *p->pSingle = (float) n; break; case SbxBYREF | SbxDATE: diff --git a/basic/source/sbx/sbxcoll.cxx b/basic/source/sbx/sbxcoll.cxx index e5518d79a2fd..7023be059f5e 100644..100755 --- a/basic/source/sbx/sbxcoll.cxx +++ b/basic/source/sbx/sbxcoll.cxx @@ -42,7 +42,7 @@ static const char* pCount; static const char* pAdd; static const char* pItem; static const char* pRemove; -static USHORT nCountHash = 0, nAddHash, nItemHash, nRemoveHash; +static sal_uInt16 nCountHash = 0, nAddHash, nItemHash, nRemoveHash; ///////////////////////////////////////////////////////////////////////// @@ -62,7 +62,7 @@ SbxCollection::SbxCollection( const XubString& rClass ) } Initialize(); // For Access on itself - StartListening( GetBroadcaster(), TRUE ); + StartListening( GetBroadcaster(), sal_True ); } SbxCollection::SbxCollection( const SbxCollection& rColl ) @@ -102,7 +102,7 @@ void SbxCollection::Initialize() p->SetFlag( SBX_DONTSTORE ); } -SbxVariable* SbxCollection::FindUserData( UINT32 nData ) +SbxVariable* SbxCollection::FindUserData( sal_uInt32 nData ) { if( GetParameters() ) { @@ -130,9 +130,9 @@ void SbxCollection::SFX_NOTIFY( SfxBroadcaster& rCst, const TypeId& rId1, const SbxHint* p = PTR_CAST(SbxHint,&rHint); if( p ) { - ULONG nId = p->GetId(); - BOOL bRead = BOOL( nId == SBX_HINT_DATAWANTED ); - BOOL bWrite = BOOL( nId == SBX_HINT_DATACHANGED ); + sal_uIntPtr nId = p->GetId(); + sal_Bool bRead = sal_Bool( nId == SBX_HINT_DATAWANTED ); + sal_Bool bWrite = sal_Bool( nId == SBX_HINT_DATACHANGED ); SbxVariable* pVar = p->GetVar(); SbxArray* pArg = pVar->GetParameters(); if( bRead || bWrite ) @@ -192,7 +192,7 @@ void SbxCollection::CollItem( SbxArray* pPar_ ) { short n = p->GetInteger(); if( n >= 1 && n <= (short) pObjs->Count() ) - pRes = pObjs->Get( (USHORT) n - 1 ); + pRes = pObjs->Get( (sal_uInt16) n - 1 ); } if( !pRes ) SetError( SbxERR_BAD_INDEX ); @@ -212,13 +212,13 @@ void SbxCollection::CollRemove( SbxArray* pPar_ ) if( n < 1 || n > (short) pObjs->Count() ) SetError( SbxERR_BAD_INDEX ); else - Remove( pObjs->Get( (USHORT) n - 1 ) ); + Remove( pObjs->Get( (sal_uInt16) n - 1 ) ); } } -BOOL SbxCollection::LoadData( SvStream& rStrm, USHORT nVer ) +sal_Bool SbxCollection::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { - BOOL bRes = SbxObject::LoadData( rStrm, nVer ); + sal_Bool bRes = SbxObject::LoadData( rStrm, nVer ); Initialize(); return bRes; } @@ -226,7 +226,7 @@ BOOL SbxCollection::LoadData( SvStream& rStrm, USHORT nVer ) ///////////////////////////////////////////////////////////////////////// SbxStdCollection::SbxStdCollection - ( const XubString& rClass, const XubString& rElem, BOOL b ) + ( const XubString& rClass, const XubString& rElem, sal_Bool b ) : SbxCollection( rClass ), aElemClass( rElem ), bAddRemoveOk( b ) {} @@ -278,9 +278,9 @@ void SbxStdCollection::CollRemove( SbxArray* pPar_ ) SbxCollection::CollRemove( pPar_ ); } -BOOL SbxStdCollection::LoadData( SvStream& rStrm, USHORT nVer ) +sal_Bool SbxStdCollection::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { - BOOL bRes = SbxCollection::LoadData( rStrm, nVer ); + sal_Bool bRes = SbxCollection::LoadData( rStrm, nVer ); if( bRes ) { rStrm.ReadByteString( aElemClass, RTL_TEXTENCODING_ASCII_US ); @@ -289,9 +289,9 @@ BOOL SbxStdCollection::LoadData( SvStream& rStrm, USHORT nVer ) return bRes; } -BOOL SbxStdCollection::StoreData( SvStream& rStrm ) const +sal_Bool SbxStdCollection::StoreData( SvStream& rStrm ) const { - BOOL bRes = SbxCollection::StoreData( rStrm ); + sal_Bool bRes = SbxCollection::StoreData( rStrm ); if( bRes ) { rStrm.WriteByteString( aElemClass, RTL_TEXTENCODING_ASCII_US ); diff --git a/basic/source/sbx/sbxconv.hxx b/basic/source/sbx/sbxconv.hxx index ad455b2872af..2a11f151d862 100644..100755 --- a/basic/source/sbx/sbxconv.hxx +++ b/basic/source/sbx/sbxconv.hxx @@ -34,19 +34,19 @@ class SbxArray; // SBXSCAN.CXX -extern void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, BOOL bCoreString=FALSE ); +extern void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, sal_Bool bCoreString=sal_False ); extern SbxError ImpScan - ( const ::rtl::OUString& rSrc, double& nVal, SbxDataType& rType, USHORT* pLen, - BOOL bAllowIntntl=FALSE, BOOL bOnlyIntntl=FALSE ); + ( const ::rtl::OUString& rSrc, double& nVal, SbxDataType& rType, sal_uInt16* pLen, + sal_Bool bAllowIntntl=sal_False, sal_Bool bOnlyIntntl=sal_False ); // with advanced evaluation (International, "TRUE"/"FALSE") -extern BOOL ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType ); +extern sal_Bool ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType ); // SBXINT.CXX double ImpRound( double ); -INT16 ImpGetInteger( const SbxValues* ); -void ImpPutInteger( SbxValues*, INT16 ); +sal_Int16 ImpGetInteger( const SbxValues* ); +void ImpPutInteger( SbxValues*, sal_Int16 ); sal_Int64 ImpGetInt64( const SbxValues* ); void ImpPutInt64( SbxValues*, sal_Int64 ); @@ -60,8 +60,8 @@ double ImpSalUInt64ToDouble( sal_uInt64 n ); // SBXLNG.CXX -INT32 ImpGetLong( const SbxValues* ); -void ImpPutLong( SbxValues*, INT32 ); +sal_Int32 ImpGetLong( const SbxValues* ); +void ImpPutLong( SbxValues*, sal_Int32 ); // SBXSNG.CXX @@ -71,7 +71,7 @@ void ImpPutSingle( SbxValues*, float ); // SBXDBL.CXX double ImpGetDouble( const SbxValues* ); -void ImpPutDouble( SbxValues*, double, BOOL bCoreString=FALSE ); +void ImpPutDouble( SbxValues*, double, sal_Bool bCoreString=sal_False ); // SBXCURR.CXX @@ -110,23 +110,23 @@ sal_Unicode ImpGetChar( const SbxValues* ); void ImpPutChar( SbxValues*, sal_Unicode ); // SBXBYTE.CXX -BYTE ImpGetByte( const SbxValues* ); -void ImpPutByte( SbxValues*, BYTE ); +sal_uInt8 ImpGetByte( const SbxValues* ); +void ImpPutByte( SbxValues*, sal_uInt8 ); // SBXUINT.CXX -UINT16 ImpGetUShort( const SbxValues* ); -void ImpPutUShort( SbxValues*, UINT16 ); +sal_uInt16 ImpGetUShort( const SbxValues* ); +void ImpPutUShort( SbxValues*, sal_uInt16 ); // SBXULNG.CXX -UINT32 ImpGetULong( const SbxValues* ); -void ImpPutULong( SbxValues*, UINT32 ); +sal_uInt32 ImpGetULong( const SbxValues* ); +void ImpPutULong( SbxValues*, sal_uInt32 ); // SBXBOOL.CXX enum SbxBOOL ImpGetBool( const SbxValues* ); -void ImpPutBool( SbxValues*, INT16 ); +void ImpPutBool( SbxValues*, sal_Int16 ); // ByteArray <--> String SbxArray* StringToByteArray(const ::rtl::OUString& rStr); diff --git a/basic/source/sbx/sbxcurr.cxx b/basic/source/sbx/sbxcurr.cxx index de80ea281b16..0ea500bb0ba2 100644..100755 --- a/basic/source/sbx/sbxcurr.cxx +++ b/basic/source/sbx/sbxcurr.cxx @@ -474,7 +474,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); val = 0; } - *p->pByte = (BYTE) val; break; + *p->pByte = (sal_uInt8) val; break; } case SbxBYREF | SbxINTEGER: case SbxBYREF | SbxBOOL: @@ -488,7 +488,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMININT; } - *p->pInteger = (INT16) val; break; + *p->pInteger = (sal_uInt16) val; break; } case SbxBYREF | SbxERROR: case SbxBYREF | SbxUSHORT: @@ -502,7 +502,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); val = 0; } - *p->pUShort = (UINT16) val; break; + *p->pUShort = (sal_uInt16) val; break; } case SbxBYREF | SbxLONG: { @@ -515,7 +515,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMINLNG; } - *p->pLong = (INT32) val; break; + *p->pLong = (sal_Int32) val; break; } case SbxBYREF | SbxULONG: { @@ -528,7 +528,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); val = 0; } - *p->pULong = (UINT32) val; + *p->pULong = (sal_uInt32) val; break; break; } case SbxBYREF | SbxCURRENCY: diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx index 282409f081d2..804506c18215 100644..100755 --- a/basic/source/sbx/sbxdate.cxx +++ b/basic/source/sbx/sbxdate.cxx @@ -122,13 +122,13 @@ double ImpGetDate( const SbxValues* p ) pFormatter->PutandConvertEntry( aStr, nCheckPos, nType, nIndex, LANGUAGE_GERMAN, eLangType ); - BOOL bSuccess = pFormatter->IsNumberFormat( *p->pOUString, nIndex, nRes ); + sal_Bool bSuccess = pFormatter->IsNumberFormat( *p->pOUString, nIndex, nRes ); if ( bSuccess ) { short nType_ = pFormatter->GetType( nIndex ); if(!(nType_ & ( NUMBERFORMAT_DATETIME | NUMBERFORMAT_DATE | NUMBERFORMAT_TIME | NUMBERFORMAT_DEFINED ))) - bSuccess = FALSE; + bSuccess = sal_False; } if ( !bSuccess ) @@ -317,7 +317,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = 0; } - *p->pByte = (BYTE) n; break; + *p->pByte = (sal_uInt8) n; break; case SbxBYREF | SbxINTEGER: case SbxBYREF | SbxBOOL: if( n > SbxMAXINT ) @@ -328,7 +328,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMININT; } - *p->pInteger = (INT16) n; break; + *p->pInteger = (sal_Int16) n; break; case SbxBYREF | SbxERROR: case SbxBYREF | SbxUSHORT: if( n > SbxMAXUINT ) @@ -339,7 +339,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = 0; } - *p->pUShort = (UINT16) n; break; + *p->pUShort = (sal_uInt16) n; break; case SbxBYREF | SbxLONG: if( n > SbxMAXLNG ) { @@ -349,7 +349,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINLNG; } - *p->pLong = (INT32) n; break; + *p->pLong = (sal_Int32) n; break; case SbxBYREF | SbxULONG: if( n > SbxMAXULNG ) { @@ -359,7 +359,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = 0; } - *p->pULong = (UINT32) n; break; + *p->pULong = (sal_uInt32) n; break; case SbxBYREF | SbxSINGLE: if( n > SbxMAXSNG ) { diff --git a/basic/source/sbx/sbxdbl.cxx b/basic/source/sbx/sbxdbl.cxx index 570da2cf0626..c4bbbe46c4ec 100644..100755 --- a/basic/source/sbx/sbxdbl.cxx +++ b/basic/source/sbx/sbxdbl.cxx @@ -141,7 +141,7 @@ double ImpGetDouble( const SbxValues* p ) return nRes; } -void ImpPutDouble( SbxValues* p, double n, BOOL bCoreString ) +void ImpPutDouble( SbxValues* p, double n, sal_Bool bCoreString ) { SbxValues aTmp; start: @@ -232,7 +232,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = 0; } - *p->pByte = (BYTE) n; break; + *p->pByte = (sal_uInt8) n; break; case SbxBYREF | SbxINTEGER: case SbxBYREF | SbxBOOL: if( n > SbxMAXINT ) @@ -243,7 +243,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMININT; } - *p->pInteger = (INT16) n; break; + *p->pInteger = (sal_Int16) n; break; case SbxBYREF | SbxERROR: case SbxBYREF | SbxUSHORT: if( n > SbxMAXUINT ) @@ -254,7 +254,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = 0; } - *p->pUShort = (UINT16) n; break; + *p->pUShort = (sal_uInt16) n; break; case SbxBYREF | SbxLONG: if( n > SbxMAXLNG ) { @@ -264,7 +264,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINLNG; } - *p->pLong = (INT32) n; break; + *p->pLong = (sal_Int32) n; break; case SbxBYREF | SbxULONG: if( n > SbxMAXULNG ) { @@ -274,7 +274,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = 0; } - *p->pULong = (UINT32) n; break; + *p->pULong = (sal_uInt32) n; break; case SbxBYREF | SbxSINGLE: if( n > SbxMAXSNG ) { diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx index 86464627ba73..91553270736a 100644..100755 --- a/basic/source/sbx/sbxdec.cxx +++ b/basic/source/sbx/sbxdec.cxx @@ -155,32 +155,32 @@ SbxDecimal::CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight void SbxDecimal::setChar( sal_Unicode val ) { - VarDecFromUI2( (USHORT)val, &maDec ); + VarDecFromUI2( (sal_uInt16)val, &maDec ); } -void SbxDecimal::setByte( BYTE val ) +void SbxDecimal::setByte( sal_uInt8 val ) { - VarDecFromUI1( (BYTE)val, &maDec ); + VarDecFromUI1( (sal_uInt8)val, &maDec ); } -void SbxDecimal::setShort( INT16 val ) +void SbxDecimal::setShort( sal_Int16 val ) { VarDecFromI2( (short)val, &maDec ); } -void SbxDecimal::setLong( INT32 val ) +void SbxDecimal::setLong( sal_Int32 val ) { VarDecFromI4( (long)val, &maDec ); } -void SbxDecimal::setUShort( UINT16 val ) +void SbxDecimal::setUShort( sal_uInt16 val ) { - VarDecFromUI2( (USHORT)val, &maDec ); + VarDecFromUI2( (sal_uInt16)val, &maDec ); } -void SbxDecimal::setULong( UINT32 val ) +void SbxDecimal::setULong( sal_uInt32 val ) { - VarDecFromUI4( (ULONG)val, &maDec ); + VarDecFromUI4( (sal_uIntPtr)val, &maDec ); } bool SbxDecimal::setSingle( float val ) @@ -197,12 +197,12 @@ bool SbxDecimal::setDouble( double val ) void SbxDecimal::setInt( int val ) { - setLong( (INT32)val ); + setLong( (sal_Int32)val ); } void SbxDecimal::setUInt( unsigned int val ) { - setULong( (UINT32)val ); + setULong( (sal_uInt32)val ); } // sbxscan.cxx @@ -258,31 +258,31 @@ bool SbxDecimal::getChar( sal_Unicode& rVal ) return bRet; } -bool SbxDecimal::getByte( BYTE& rVal ) +bool SbxDecimal::getByte( sal_uInt8& rVal ) { bool bRet = ( VarUI1FromDec( &maDec, &rVal ) == S_OK ); return bRet; } -bool SbxDecimal::getShort( INT16& rVal ) +bool SbxDecimal::getShort( sal_Int16& rVal ) { bool bRet = ( VarI2FromDec( &maDec, &rVal ) == S_OK ); return bRet; } -bool SbxDecimal::getLong( INT32& rVal ) +bool SbxDecimal::getLong( sal_Int32& rVal ) { bool bRet = ( VarI4FromDec( &maDec, &rVal ) == S_OK ); return bRet; } -bool SbxDecimal::getUShort( UINT16& rVal ) +bool SbxDecimal::getUShort( sal_uInt16& rVal ) { bool bRet = ( VarUI2FromDec( &maDec, &rVal ) == S_OK ); return bRet; } -bool SbxDecimal::getULong( UINT32& rVal ) +bool SbxDecimal::getULong( sal_uInt32& rVal ) { bool bRet = ( VarUI4FromDec( &maDec, &rVal ) == S_OK ); return bRet; @@ -302,7 +302,7 @@ bool SbxDecimal::getDouble( double& rVal ) bool SbxDecimal::getInt( int& rVal ) { - INT32 TmpVal; + sal_Int32 TmpVal; bool bRet = getLong( TmpVal ); rVal = TmpVal; return bRet; @@ -310,7 +310,7 @@ bool SbxDecimal::getInt( int& rVal ) bool SbxDecimal::getUInt( unsigned int& rVal ) { - UINT32 TmpVal; + sal_uInt32 TmpVal; bool bRet = getULong( TmpVal ); rVal = TmpVal; return bRet; @@ -361,11 +361,11 @@ SbxDecimal::CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight } void SbxDecimal::setChar( sal_Unicode val ) { (void)val; } -void SbxDecimal::setByte( BYTE val ) { (void)val; } -void SbxDecimal::setShort( INT16 val ) { (void)val; } -void SbxDecimal::setLong( INT32 val ) { (void)val; } -void SbxDecimal::setUShort( UINT16 val ) { (void)val; } -void SbxDecimal::setULong( UINT32 val ) { (void)val; } +void SbxDecimal::setByte( sal_uInt8 val ) { (void)val; } +void SbxDecimal::setShort( sal_Int16 val ) { (void)val; } +void SbxDecimal::setLong( sal_Int32 val ) { (void)val; } +void SbxDecimal::setUShort( sal_uInt16 val ) { (void)val; } +void SbxDecimal::setULong( sal_uInt32 val ) { (void)val; } bool SbxDecimal::setSingle( float val ) { (void)val; return false; } bool SbxDecimal::setDouble( double val ) { (void)val; return false; } void SbxDecimal::setInt( int val ) { (void)val; } @@ -373,11 +373,11 @@ void SbxDecimal::setUInt( unsigned int val ) { (void)val; } bool SbxDecimal::setString( ::rtl::OUString* pOUString ) { (void)pOUString; return false; } bool SbxDecimal::getChar( sal_Unicode& rVal ) { (void)rVal; return false; } -bool SbxDecimal::getByte( BYTE& rVal ) { (void)rVal; return false; } -bool SbxDecimal::getShort( INT16& rVal ) { (void)rVal; return false; } -bool SbxDecimal::getLong( INT32& rVal ) { (void)rVal; return false; } -bool SbxDecimal::getUShort( UINT16& rVal ) { (void)rVal; return false; } -bool SbxDecimal::getULong( UINT32& rVal ) { (void)rVal; return false; } +bool SbxDecimal::getByte( sal_uInt8& rVal ) { (void)rVal; return false; } +bool SbxDecimal::getShort( sal_Int16& rVal ) { (void)rVal; return false; } +bool SbxDecimal::getLong( sal_Int32& rVal ) { (void)rVal; return false; } +bool SbxDecimal::getUShort( sal_uInt16& rVal ) { (void)rVal; return false; } +bool SbxDecimal::getULong( sal_uInt32& rVal ) { (void)rVal; return false; } bool SbxDecimal::getSingle( float& rVal ) { (void)rVal; return false; } bool SbxDecimal::getDouble( double& rVal ) { (void)rVal; return false; } bool SbxDecimal::getInt( int& rVal ) { (void)rVal; return false; } diff --git a/basic/source/sbx/sbxdec.hxx b/basic/source/sbx/sbxdec.hxx index 5438c151e60f..c783010f0ed2 100644..100755 --- a/basic/source/sbx/sbxdec.hxx +++ b/basic/source/sbx/sbxdec.hxx @@ -62,7 +62,7 @@ class SbxDecimal #ifdef WIN32 DECIMAL maDec; #endif - INT32 mnRefCount; + sal_Int32 mnRefCount; public: SbxDecimal( void ); @@ -77,11 +77,11 @@ public: void fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ); void setChar( sal_Unicode val ); - void setByte( BYTE val ); - void setShort( INT16 val ); - void setLong( INT32 val ); - void setUShort( UINT16 val ); - void setULong( UINT32 val ); + void setByte( sal_uInt8 val ); + void setShort( sal_Int16 val ); + void setLong( sal_Int32 val ); + void setUShort( sal_uInt16 val ); + void setULong( sal_uInt32 val ); bool setSingle( float val ); bool setDouble( double val ); void setInt( int val ); @@ -98,11 +98,11 @@ public: } bool getChar( sal_Unicode& rVal ); - bool getByte( BYTE& rVal ); - bool getShort( INT16& rVal ); - bool getLong( INT32& rVal ); - bool getUShort( UINT16& rVal ); - bool getULong( UINT32& rVal ); + bool getByte( sal_uInt8& rVal ); + bool getShort( sal_Int16& rVal ); + bool getLong( sal_Int32& rVal ); + bool getUShort( sal_uInt16& rVal ); + bool getULong( sal_uInt32& rVal ); bool getSingle( float& rVal ); bool getDouble( double& rVal ); bool getInt( int& rVal ); diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx index cc48256fbfbc..f12ffc0bf817 100644..100755 --- a/basic/source/sbx/sbxexec.cxx +++ b/basic/source/sbx/sbxexec.cxx @@ -36,21 +36,21 @@ class SbxSimpleCharClass { public: - BOOL isAlpha( sal_Unicode c ) const + sal_Bool isAlpha( sal_Unicode c ) const { - BOOL bRet = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); + sal_Bool bRet = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); return bRet; } - BOOL isDigit( sal_Unicode c ) const + sal_Bool isDigit( sal_Unicode c ) const { - BOOL bRet = (c >= '0' && c <= '9'); + sal_Bool bRet = (c >= '0' && c <= '9'); return bRet; } - BOOL isAlphaNumeric( sal_Unicode c ) const + sal_Bool isAlphaNumeric( sal_Unicode c ) const { - BOOL bRet = isDigit( c ) || isAlpha( c ); + sal_Bool bRet = isDigit( c ) || isAlpha( c ); return bRet; } }; @@ -72,7 +72,7 @@ static const xub_Unicode* SkipWhitespace( const xub_Unicode* p ) static const xub_Unicode* Symbol( const xub_Unicode* p, XubString& rSym, const SbxSimpleCharClass& rCharClass ) { - USHORT nLen = 0; + sal_uInt16 nLen = 0; // Did we have a nonstandard symbol? if( *p == '[' ) { @@ -142,7 +142,7 @@ static SbxVariable* QualifiedName // a function (with optional parameters). static SbxVariable* Operand - ( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode** ppBuf, BOOL bVar ) + ( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode** ppBuf, sal_Bool bVar ) { static SbxSimpleCharClass aCharClass; @@ -154,7 +154,7 @@ static SbxVariable* Operand || *p == '&' ) ) { // A number could be scanned in directly! - USHORT nLen; + sal_uInt16 nLen; if( !refVar->Scan( XubString( p ), &nLen ) ) refVar.Clear(); else @@ -192,12 +192,12 @@ static SbxVariable* Operand static SbxVariable* MulDiv( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode** ppBuf ) { const xub_Unicode* p = *ppBuf; - SbxVariableRef refVar( Operand( pObj, pGbl, &p, FALSE ) ); + SbxVariableRef refVar( Operand( pObj, pGbl, &p, sal_False ) ); p = SkipWhitespace( p ); while( refVar.Is() && ( *p == '*' || *p == '/' ) ) { xub_Unicode cOp = *p++; - SbxVariableRef refVar2( Operand( pObj, pGbl, &p, FALSE ) ); + SbxVariableRef refVar2( Operand( pObj, pGbl, &p, sal_False ) ); if( refVar2.Is() ) { // temporary variable! @@ -256,7 +256,7 @@ static SbxVariable* PlusMinus( SbxObject* pObj, SbxObject* pGbl, const xub_Unico static SbxVariable* Assign( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode** ppBuf ) { const xub_Unicode* p = *ppBuf; - SbxVariableRef refVar( Operand( pObj, pGbl, &p, TRUE ) ); + SbxVariableRef refVar( Operand( pObj, pGbl, &p, sal_True ) ); p = SkipWhitespace( p ); if( refVar.Is() ) { @@ -304,7 +304,7 @@ static SbxVariable* Element SbxVariableRef refVar; if( aSym.Len() ) { - USHORT nOld = pObj->GetFlags(); + sal_uInt16 nOld = pObj->GetFlags(); if( pObj == pGbl ) pObj->SetFlag( SBX_GBLSEARCH ); refVar = pObj->Find( aSym, t ); @@ -318,7 +318,7 @@ static SbxVariable* Element { p++; SbxArrayRef refPar = new SbxArray; - USHORT nArg = 0; + sal_uInt16 nArg = 0; // We are once relaxed and accept as well // the line- or commandend as delimiter // Search parameter always global! diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx index 3e6aee717283..d1a85cb07d3a 100644..100755 --- a/basic/source/sbx/sbxform.cxx +++ b/basic/source/sbx/sbxform.cxx @@ -152,7 +152,7 @@ void SbxBasicFormater::ShowError( char * sErrMsg ) // um eine Position zu gr"osseren Indizes, d.h. es wird Platz f"ur // ein neues (einzuf"ugendes) Zeichen geschafft. // ACHTUNG: der String MUSS gross genug sein ! -inline void SbxBasicFormater::ShiftString( String& sStrg, USHORT nStartPos ) +inline void SbxBasicFormater::ShiftString( String& sStrg, sal_uInt16 nStartPos ) { sStrg.Erase( nStartPos,1 ); } @@ -175,7 +175,7 @@ void SbxBasicFormater::AppendDigit( String& sStrg, short nDigit ) // verschiebt den Dezimal-Punkt um eine Stelle nach links void SbxBasicFormater::LeftShiftDecimalPoint( String& sStrg ) { - USHORT nPos = sStrg.Search( cDecPoint ); + sal_uInt16 nPos = sStrg.Search( cDecPoint ); if( nPos!=STRING_NOTFOUND ) { @@ -189,13 +189,13 @@ void SbxBasicFormater::LeftShiftDecimalPoint( String& sStrg ) // es wird ein Flag zur"uckgeliefert, falls ein Overflow auftrat, // d.h. 99.99 --> 100.00, d.h. ein Gr"ossenordung ge"andert wurde // (geschieht beim Runden einer 9). -void SbxBasicFormater::StrRoundDigit( String& sStrg, short nPos, BOOL& bOverflow ) +void SbxBasicFormater::StrRoundDigit( String& sStrg, short nPos, sal_Bool& bOverflow ) { // wurde ggf ein falscher Index uebergeben --> Aufruf ignorieren if( nPos<0 ) return; - bOverflow = FALSE; + bOverflow = sal_False; // "uberspringe den Dezimalpunkt und Tausender-Trennzeichen sal_Unicode c = sStrg.GetChar( nPos ); if( nPos>0 && (c == cDecPoint || c == cThousandSep) ) @@ -219,7 +219,7 @@ void SbxBasicFormater::StrRoundDigit( String& sStrg, short nPos, BOOL& bOverflow ShiftString( sStrg,0 ); // f"uhrende 1 einf"ugen: z.B. 99.99 f"ur 0.0 sStrg.SetChar( 0, '1' ); - bOverflow = TRUE; + bOverflow = sal_True; } else { @@ -244,7 +244,7 @@ void SbxBasicFormater::StrRoundDigit( String& sStrg, short nPos, BOOL& bOverflow ShiftString( sStrg,nPos+1 ); // f"uhrende 1 einf"ugen sStrg.SetChar( nPos+1, '1' ); - bOverflow = TRUE; + bOverflow = sal_True; } } } @@ -252,7 +252,7 @@ void SbxBasicFormater::StrRoundDigit( String& sStrg, short nPos, BOOL& bOverflow // rundet in einem String die Ziffer an der angegebenen Stelle void SbxBasicFormater::StrRoundDigit( String& sStrg, short nPos ) { - BOOL bOverflow; + sal_Bool bOverflow; StrRoundDigit( sStrg,nPos,bOverflow ); } @@ -303,7 +303,7 @@ void SbxBasicFormater::InitExp( double _dNewExp ) // bestimmt die Ziffer an der angegebenen Stelle (gedacht zur Anwendung im // Scan-Durchlauf) -short SbxBasicFormater::GetDigitAtPosScan( short nPos, BOOL& bFoundFirstDigit ) +short SbxBasicFormater::GetDigitAtPosScan( short nPos, sal_Bool& bFoundFirstDigit ) { // Versuch eine gr"ossere Ziffer zu lesen, // z.B. Stelle 4 in 1.234, @@ -313,18 +313,18 @@ short SbxBasicFormater::GetDigitAtPosScan( short nPos, BOOL& bFoundFirstDigit ) return _NO_DIGIT; // bestimme den Index der Stelle in dem Number-String: // "uberlese das Vorzeichen - USHORT no = 1; + sal_uInt16 no = 1; // falls notwendig den Dezimal-Punkt "uberlesen: if( nPos<nNumExp ) no++; no += nNumExp-nPos; // Abfrage der ersten (g"ultigen) Ziffer der Zahl --> Flag setzen if( nPos==nNumExp ) - bFoundFirstDigit = TRUE; + bFoundFirstDigit = sal_True; return (short)(sSciNumStrg.GetChar( no ) - ASCII_0); } -short SbxBasicFormater::GetDigitAtPosExpScan( short nPos, BOOL& bFoundFirstDigit ) +short SbxBasicFormater::GetDigitAtPosExpScan( short nPos, sal_Bool& bFoundFirstDigit ) { // ist die abgefragte Stelle zu gross f"ur den Exponenten ? if( nPos>nExpExp ) @@ -332,11 +332,11 @@ short SbxBasicFormater::GetDigitAtPosExpScan( short nPos, BOOL& bFoundFirstDigit // bestimme den Index der Stelle in dem Number-String: // "uberlese das Vorzeichen - USHORT no = 1; + sal_uInt16 no = 1; no += nExpExp-nPos; // Abfrage der ersten (g"ultigen) Ziffer der Zahl --> Flag setzen if( nPos==nExpExp ) - bFoundFirstDigit = TRUE; + bFoundFirstDigit = sal_True; return (short)(sNumExpStrg.GetChar( no ) - ASCII_0); } @@ -344,7 +344,7 @@ short SbxBasicFormater::GetDigitAtPosExpScan( short nPos, BOOL& bFoundFirstDigit // Zahl ggf. NICHT normiert (z.B. 1.2345e-03) dargestellt werden soll, // sondern eventuell 123.345e-3 ! short SbxBasicFormater::GetDigitAtPosExpScan( double dNewExponent, short nPos, - BOOL& bFoundFirstDigit ) + sal_Bool& bFoundFirstDigit ) { // neuer Exponent wurde "ubergeben, aktualisiere // die tempor"aren Klassen-Variablen @@ -382,7 +382,7 @@ TODO: ggf einen 'intelligenten' Peek-Parser um Rundungsfehler bei // // ACHTUNG: anscheinend gibt es manchmal noch Probleme mit Rundungs-Fehlern! short SbxBasicFormater::GetDigitAtPos( double dNumber, short nPos, - double& dNextNumber, BOOL& bFoundFirstDigit ) + double& dNextNumber, sal_Bool& bFoundFirstDigit ) // ACHTUNG: nPos kann auch negativ werden, f"ur Stellen nach dem Dezimal-Punkt { double dDigit; @@ -399,7 +399,7 @@ short SbxBasicFormater::GetDigitAtPos( double dNumber, short nPos, if( nMaxDigit<nPos && !bFoundFirstDigit && nPos>=0 ) return _NO_DIGIT; // Ziffer gefunden, setze Flag: - bFoundFirstDigit = TRUE; + bFoundFirstDigit = sal_True; for( short i=nMaxDigit; i>=nPos; i-- ) { double dI = (double)i; @@ -431,14 +431,14 @@ short SbxBasicFormater::RoundDigit( double dNumber ) // und liefert diesen zur"uck. // Somit wird ein neuer String erzeugt, der vom Aufrufer wieder freigegeben // werden muss -String SbxBasicFormater::GetPosFormatString( const String& sFormatStrg, BOOL & bFound ) +String SbxBasicFormater::GetPosFormatString( const String& sFormatStrg, sal_Bool & bFound ) { - bFound = FALSE; // default... - USHORT nPos = sFormatStrg.Search( FORMAT_SEPARATOR ); + bFound = sal_False; // default... + sal_uInt16 nPos = sFormatStrg.Search( FORMAT_SEPARATOR ); if( nPos!=STRING_NOTFOUND ) { - bFound = TRUE; + bFound = sal_True; // der Format-String f"ur die positiven Zahlen ist alles // vor dem ersten ';' return sFormatStrg.Copy( 0,nPos ); @@ -450,10 +450,10 @@ String SbxBasicFormater::GetPosFormatString( const String& sFormatStrg, BOOL & b } // siehe auch GetPosFormatString() -String SbxBasicFormater::GetNegFormatString( const String& sFormatStrg, BOOL & bFound ) +String SbxBasicFormater::GetNegFormatString( const String& sFormatStrg, sal_Bool & bFound ) { - bFound = FALSE; // default... - USHORT nPos = sFormatStrg.Search( FORMAT_SEPARATOR ); + bFound = sal_False; // default... + sal_uInt16 nPos = sFormatStrg.Search( FORMAT_SEPARATOR ); if( nPos!=STRING_NOTFOUND ) { @@ -463,7 +463,7 @@ String SbxBasicFormater::GetNegFormatString( const String& sFormatStrg, BOOL & b String sTempStrg = sFormatStrg.Copy( nPos+1 ); // und suche darin ggf. ein weiteres ';' nPos = sTempStrg.Search( FORMAT_SEPARATOR ); - bFound = TRUE; + bFound = sal_True; if( nPos==STRING_NOTFOUND ) // keins gefunden, liefere alles... return sTempStrg; @@ -477,10 +477,10 @@ String SbxBasicFormater::GetNegFormatString( const String& sFormatStrg, BOOL & b } // siehe auch GetPosFormatString() -String SbxBasicFormater::Get0FormatString( const String& sFormatStrg, BOOL & bFound ) +String SbxBasicFormater::Get0FormatString( const String& sFormatStrg, sal_Bool & bFound ) { - bFound = FALSE; // default... - USHORT nPos = sFormatStrg.Search( FORMAT_SEPARATOR ); + bFound = sal_False; // default... + sal_uInt16 nPos = sFormatStrg.Search( FORMAT_SEPARATOR ); if( nPos!=STRING_NOTFOUND ) { @@ -492,7 +492,7 @@ String SbxBasicFormater::Get0FormatString( const String& sFormatStrg, BOOL & bFo nPos = sTempStrg.Search( FORMAT_SEPARATOR ); if( nPos!=STRING_NOTFOUND ) { - bFound = TRUE; + bFound = sal_True; sTempStrg = sTempStrg.Copy( nPos+1 ); nPos = sTempStrg.Search( FORMAT_SEPARATOR ); if( nPos==STRING_NOTFOUND ) @@ -509,10 +509,10 @@ String SbxBasicFormater::Get0FormatString( const String& sFormatStrg, BOOL & bFo } // siehe auch GetPosFormatString() -String SbxBasicFormater::GetNullFormatString( const String& sFormatStrg, BOOL & bFound ) +String SbxBasicFormater::GetNullFormatString( const String& sFormatStrg, sal_Bool & bFound ) { - bFound = FALSE; // default... - USHORT nPos = sFormatStrg.Search( FORMAT_SEPARATOR ); + bFound = sal_False; // default... + sal_uInt16 nPos = sFormatStrg.Search( FORMAT_SEPARATOR ); if( nPos!=STRING_NOTFOUND ) { @@ -529,7 +529,7 @@ String SbxBasicFormater::GetNullFormatString( const String& sFormatStrg, BOOL & nPos = sTempStrg.Search( FORMAT_SEPARATOR ); if( nPos!=STRING_NOTFOUND ) { - bFound = TRUE; + bFound = sal_True; return sTempStrg.Copy( nPos+1 ); } } @@ -546,11 +546,11 @@ short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg, short& nNoOfDigitsLeft, short& nNoOfDigitsRight, short& nNoOfOptionalDigitsLeft, short& nNoOfExponentDigits, short& nNoOfOptionalExponentDigits, - BOOL& bPercent, BOOL& bCurrency, BOOL& bScientific, - BOOL& bGenerateThousandSeparator, + sal_Bool& bPercent, sal_Bool& bCurrency, sal_Bool& bScientific, + sal_Bool& bGenerateThousandSeparator, short& nMultipleThousandSeparators ) { - USHORT nLen; + sal_uInt16 nLen; short nState = 0; nLen = sFormatStrg.Len(); @@ -560,9 +560,9 @@ short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg, nNoOfOptionalDigitsLeft = 0; nNoOfExponentDigits = 0; nNoOfOptionalExponentDigits = 0; - bPercent = FALSE; - bCurrency = FALSE; - bScientific = FALSE; + bPercent = sal_False; + bCurrency = sal_False; + bScientific = sal_False; // ab 11.7.97: sobald ein Komma in dem Format String gefunden wird, // werden alle 3 Zehnerpotenzen markiert (d.h. tausender, milionen, ...) // bisher wurde nur an den gesetzten Position ein Tausender-Separator @@ -571,7 +571,7 @@ short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg, bGenerateThousandSeparator = sFormatStrg.Search( ',' ) != STRING_NOTFOUND; nMultipleThousandSeparators = 0; // und untersuche den Format-String nach den gew"unschten Informationen - for( USHORT i=0; i<nLen; i++ ) + for( sal_uInt16 i=0; i<nLen; i++ ) { sal_Unicode c = sFormatStrg.GetChar( i ); switch( c ) { @@ -614,7 +614,7 @@ short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg, return -1; // ERROR: zu viele Dezimal-Punkte break; case '%': - bPercent = TRUE; + bPercent = sal_True; /* old: bPercent++; if( bPercent>1 ) @@ -622,7 +622,7 @@ short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg, */ break; case '(': - bCurrency = TRUE; + bCurrency = sal_True; break; case ',': { @@ -638,7 +638,7 @@ short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg, if( nNoOfDigitsLeft > 0 || nNoOfDigitsRight > 0 ) { nState = -1; // breche jetzt das Z"ahlen der Stellen ab - bScientific = TRUE; + bScientific = sal_True; } /* old: bScientific++; @@ -653,7 +653,7 @@ short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg, i++; break; case CREATE_1000SEP_CHAR: - bGenerateThousandSeparator = TRUE; + bGenerateThousandSeparator = sal_True; break; } } @@ -664,12 +664,12 @@ short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg, // erzeugt werden soll void SbxBasicFormater::ScanFormatString( double dNumber, const String& sFormatStrg, String& sReturnStrg, - BOOL bCreateSign ) + sal_Bool bCreateSign ) { short /*nErr,*/nNoOfDigitsLeft,nNoOfDigitsRight,nNoOfOptionalDigitsLeft, nNoOfExponentDigits,nNoOfOptionalExponentDigits, nMultipleThousandSeparators; - BOOL bPercent,bCurrency,bScientific,bGenerateThousandSeparator; + sal_Bool bPercent,bCurrency,bScientific,bGenerateThousandSeparator; // Initialisiere den Return-String sReturnStrg = String(); @@ -720,12 +720,12 @@ void SbxBasicFormater::ScanFormatString( double dNumber, double dExponent; short i,nLen; short nState,nDigitPos,nExponentPos,nMaxDigit,nMaxExponentDigit; - BOOL bFirstDigit,bFirstExponentDigit,bFoundFirstDigit, + sal_Bool bFirstDigit,bFirstExponentDigit,bFoundFirstDigit, bIsNegative,bZeroSpaceOn, bSignHappend,bDigitPosNegative; // Initialisierung der Arbeits-Variablen - bSignHappend = FALSE; - bFoundFirstDigit = FALSE; + bSignHappend = sal_False; + bFoundFirstDigit = sal_False; bIsNegative = dNumber<0.0; nLen = sFormatStrg.Len(); dExponent = get_number_of_digits( dNumber ); @@ -749,8 +749,8 @@ void SbxBasicFormater::ScanFormatString( double dNumber, // hier ben"otigt man keine Exponent-Daten ! bDigitPosNegative = (nDigitPos < 0); } - bFirstDigit = TRUE; - bFirstExponentDigit = TRUE; + bFirstDigit = sal_True; + bFirstExponentDigit = sal_True; nState = 0; // 0 --> Mantisse; 1 --> Exponent bZeroSpaceOn = 0; @@ -780,14 +780,14 @@ void SbxBasicFormater::ScanFormatString( double dNumber, // Behandlung der Mantisse if( bFirstDigit ) { - //org:bFirstDigit = FALSE; + //org:bFirstDigit = sal_False; // ggf. Vorzeichen erzeugen // Bem.: bei bCurrency soll das negative // Vorzeichen durch () angezeigt werden if( bIsNegative && !bCreateSign/*!bCurrency*/ && !bSignHappend ) { // nur einmal ein Vorzeichen ausgeben - bSignHappend = TRUE; + bSignHappend = sal_True; StrAppendChar( sReturnStrg,'-' ); } // hier jetzt "uberz"ahlige Stellen ausgeben, @@ -805,7 +805,7 @@ void SbxBasicFormater::ScanFormatString( double dNumber, // wurde wirklich eine Ziffer eingefuegt ? if( nTempDigit!=_NO_DIGIT ) // jetzt wurde wirklich eine Ziffer ausgegeben, Flag setzen - bFirstDigit = FALSE; + bFirstDigit = sal_False; // muss ggf. ein Tausender-Trennzeichen erzeugt werden? if( bGenerateThousandSeparator && ( c=='0' || nMaxDigit>=nDigitPos ) && j>0 && (j % 3 == 0) ) StrAppendChar( sReturnStrg,cThousandSep ); @@ -817,7 +817,7 @@ void SbxBasicFormater::ScanFormatString( double dNumber, { AppendDigit( sReturnStrg,0 ); // Ja // jetzt wurde wirklich eine Ziffer ausgegeben, Flag setzen - bFirstDigit = FALSE; + bFirstDigit = sal_False; bZeroSpaceOn = 1; // BEM.: bei Visual-Basic schaltet die erste 0 f"ur alle // nachfolgenden # (bis zum Dezimal-Punkt) die 0 ein, @@ -837,7 +837,7 @@ void SbxBasicFormater::ScanFormatString( double dNumber, // wurde wirklich eine Ziffer eingefuegt ? if( nTempDigit!=_NO_DIGIT ) // jetzt wurde wirklich eine Ziffer ausgegeben, Flag setzen - bFirstDigit = FALSE; + bFirstDigit = sal_False; // muss ggf. ein Tausender-Trennzeichen erzeugt werden? if( bGenerateThousandSeparator && ( c=='0' || nMaxDigit>=nDigitPos ) && nDigitPos>0 && (nDigitPos % 3 == 0) ) StrAppendChar( sReturnStrg,cThousandSep ); @@ -851,7 +851,7 @@ void SbxBasicFormater::ScanFormatString( double dNumber, if( bFirstExponentDigit ) { // Vorzeichen wurde schon bei e/E ausgegeben - bFirstExponentDigit = FALSE; + bFirstExponentDigit = sal_False; if( nMaxExponentDigit>nExponentPos ) // hier jetzt "uberz"ahlige Stellen ausgeben, // d.h. vom Format-String nicht erfasste Stellen @@ -912,7 +912,7 @@ void SbxBasicFormater::ScanFormatString( double dNumber, break; } - BOOL bOverflow = FALSE; + sal_Bool bOverflow = sal_False; #ifdef _with_sprintf short nNextDigit = GetDigitAtPosScan( nDigitPos,bFoundFirstDigit ); #else @@ -1046,7 +1046,7 @@ void SbxBasicFormater::ScanFormatString( double dNumber, String SbxBasicFormater::BasicFormatNull( String sFormatStrg ) { - BOOL bNullFormatFound; + sal_Bool bNullFormatFound; String sNullFormatStrg = GetNullFormatString( sFormatStrg,bNullFormatFound ); if( bNullFormatFound ) @@ -1058,7 +1058,7 @@ String SbxBasicFormater::BasicFormatNull( String sFormatStrg ) String SbxBasicFormater::BasicFormat( double dNumber, String sFormatStrg ) { - BOOL bPosFormatFound,bNegFormatFound,b0FormatFound; + sal_Bool bPosFormatFound,bNegFormatFound,b0FormatFound; // analysiere Format-String auf vordefinierte Formate: if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_GENERALNUMBER ) ) @@ -1107,7 +1107,7 @@ String SbxBasicFormater::BasicFormat( double dNumber, String sFormatStrg ) // verwende String fuer positive Werte sTempStrg = sPosFormatStrg; } - ScanFormatString( dNumber, sTempStrg, sReturnStrg,/*bCreateSign=*/FALSE ); + ScanFormatString( dNumber, sTempStrg, sReturnStrg,/*bCreateSign=*/sal_False ); } else { @@ -1136,33 +1136,33 @@ String SbxBasicFormater::BasicFormat( double dNumber, String sFormatStrg ) { ScanFormatString( dNumber, (/*sPosFormatStrg!=EMPTYFORMATSTRING*/bPosFormatFound ? sPosFormatStrg : sFormatStrg), - sReturnStrg,/*bCreateSign=*/FALSE ); + sReturnStrg,/*bCreateSign=*/sal_False ); } } return sReturnStrg; } -BOOL SbxBasicFormater::isBasicFormat( String sFormatStrg ) +sal_Bool SbxBasicFormater::isBasicFormat( String sFormatStrg ) { if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_GENERALNUMBER ) ) - return TRUE; + return sal_True; if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_CURRENCY ) ) - return TRUE; + return sal_True; if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_FIXED ) ) - return TRUE; + return sal_True; if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_STANDARD ) ) - return TRUE; + return sal_True; if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_PERCENT ) ) - return TRUE; + return sal_True; if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_SCIENTIFIC ) ) - return TRUE; + return sal_True; if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_YESNO ) ) - return TRUE; + return sal_True; if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_TRUEFALSE ) ) - return TRUE; + return sal_True; if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_ONOFF ) ) - return TRUE; - return FALSE; + return sal_True; + return sal_False; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/sbx/sbxint.cxx b/basic/source/sbx/sbxint.cxx index 285295c05f45..289622a016fd 100644..100755 --- a/basic/source/sbx/sbxint.cxx +++ b/basic/source/sbx/sbxint.cxx @@ -37,10 +37,10 @@ double ImpRound( double d ) return d + ( d < 0 ? -0.5 : 0.5 ); } -INT16 ImpGetInteger( const SbxValues* p ) +sal_Int16 ImpGetInteger( const SbxValues* p ) { SbxValues aTmp; - INT16 nRes; + sal_Int16 nRes; start: switch( +p->eType ) { @@ -57,12 +57,12 @@ start: nRes = p->nInteger; break; case SbxERROR: case SbxUSHORT: - if( p->nUShort > (USHORT) SbxMAXINT ) + if( p->nUShort > (sal_uInt16) SbxMAXINT ) { SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXINT; } else - nRes = (INT16) p->nUShort; + nRes = (sal_Int16) p->nUShort; break; case SbxLONG: if( p->nLong > SbxMAXINT ) @@ -74,7 +74,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMININT; } else - nRes = (INT16) p->nLong; + nRes = (sal_Int16) p->nLong; break; case SbxULONG: if( p->nULong > SbxMAXINT ) @@ -82,7 +82,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXINT; } else - nRes = (INT16) p->nULong; + nRes = (sal_Int16) p->nULong; break; case SbxSINGLE: if( p->nSingle > SbxMAXINT ) @@ -94,7 +94,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMININT; } else - nRes = (INT16) ImpRound( p->nSingle ); + nRes = (sal_Int16) ImpRound( p->nSingle ); break; case SbxCURRENCY: { @@ -109,7 +109,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMININT; } else - nRes = (INT16) (tstVal); + nRes = (sal_Int16) (tstVal); break; } case SbxSALINT64: @@ -122,7 +122,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMININT; } else - nRes = (INT16) p->nInt64; + nRes = (sal_Int16) p->nInt64; break; case SbxSALUINT64: if( p->uInt64 > SbxMAXINT ) @@ -130,7 +130,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXINT; } else - nRes = (INT16) p->uInt64; + nRes = (sal_Int16) p->uInt64; break; case SbxDATE: case SbxDOUBLE: @@ -155,7 +155,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMININT; } else - nRes = (INT16) ImpRound( dVal ); + nRes = (sal_Int16) ImpRound( dVal ); break; } case SbxLPSTR: @@ -178,7 +178,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMININT; } else - nRes = (INT16) ImpRound( d ); + nRes = (sal_Int16) ImpRound( d ); } break; case SbxOBJECT: @@ -229,7 +229,7 @@ start: return nRes; } -void ImpPutInteger( SbxValues* p, INT16 n ) +void ImpPutInteger( SbxValues* p, sal_Int16 n ) { SbxValues aTmp; start: @@ -302,7 +302,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = 0; } - *p->pByte = (BYTE) n; break; + *p->pByte = (sal_uInt8) n; break; case SbxBYREF | SbxINTEGER: case SbxBYREF | SbxBOOL: *p->pInteger = n; break; @@ -312,15 +312,15 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = 0; } - *p->pUShort = (UINT16) n; break; + *p->pUShort = (sal_uInt16) n; break; case SbxBYREF | SbxLONG: - *p->pLong = (INT32) n; break; + *p->pLong = (sal_Int32) n; break; case SbxBYREF | SbxULONG: if( n < 0 ) { SbxBase::SetError( SbxERR_OVERFLOW ); n = 0; } - *p->pULong = (UINT32) n; break; + *p->pULong = (sal_uInt32) n; break; case SbxBYREF | SbxCURRENCY: *p->pnInt64 = n * CURRENCY_FACTOR; break; case SbxBYREF | SbxSALINT64: @@ -587,7 +587,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = 0; } - *p->pByte = (BYTE) n; break; + *p->pByte = (sal_uInt8) n; break; case SbxBYREF | SbxINTEGER: case SbxBYREF | SbxBOOL: if( n > SbxMAXINT ) @@ -598,7 +598,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMININT; } - *p->pInteger = (INT16) n; break; + *p->pInteger = (sal_Int16) n; break; case SbxBYREF | SbxERROR: case SbxBYREF | SbxUSHORT: if( n > SbxMAXUINT ) @@ -609,7 +609,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = 0; } - *p->pUShort = (UINT16) n; break; + *p->pUShort = (sal_uInt16) n; break; case SbxBYREF | SbxLONG: if( n > SbxMAXLNG ) { @@ -619,7 +619,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINLNG; } - *p->pLong = (INT32) n; break; + *p->pLong = (sal_Int32) n; break; case SbxBYREF | SbxULONG: if( n > SbxMAXULNG ) { @@ -629,7 +629,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = 0; } - *p->pULong = (UINT32) n; break; + *p->pULong = (sal_uInt32) n; break; case SbxBYREF | SbxSINGLE: *p->pSingle = (float) n; break; case SbxBYREF | SbxDATE: @@ -857,33 +857,33 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXBYTE; } - *p->pByte = (BYTE) n; break; + *p->pByte = (sal_uInt8) n; break; case SbxBYREF | SbxINTEGER: case SbxBYREF | SbxBOOL: if( n > SbxMAXINT ) { SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXINT; } - *p->pInteger = (INT16) n; break; + *p->pInteger = (sal_Int16) n; break; case SbxBYREF | SbxERROR: case SbxBYREF | SbxUSHORT: if( n > SbxMAXUINT ) { SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXUINT; } - *p->pUShort = (UINT16) n; break; + *p->pUShort = (sal_uInt16) n; break; case SbxBYREF | SbxLONG: if( n > SbxMAXLNG ) { SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXLNG; } - *p->pLong = (INT32) n; break; + *p->pLong = (sal_Int32) n; break; case SbxBYREF | SbxULONG: if( n > SbxMAXULNG ) { SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXULNG; } - *p->pULong = (UINT32) n; break; + *p->pULong = (sal_uInt32) n; break; case SbxBYREF | SbxSINGLE: *p->pDouble = (float)ImpSalUInt64ToDouble( n ); break; case SbxBYREF | SbxDATE: diff --git a/basic/source/sbx/sbxlng.cxx b/basic/source/sbx/sbxlng.cxx index 32e994520c13..dd772fe4a52a 100644..100755 --- a/basic/source/sbx/sbxlng.cxx +++ b/basic/source/sbx/sbxlng.cxx @@ -32,10 +32,10 @@ #include <basic/sbx.hxx> #include "sbxconv.hxx" -INT32 ImpGetLong( const SbxValues* p ) +sal_Int32 ImpGetLong( const SbxValues* p ) { SbxValues aTmp; - INT32 nRes; + sal_Int32 nRes; start: switch( +p->eType ) { @@ -61,7 +61,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXLNG; } else - nRes = (INT32) p->nULong; + nRes = (sal_Int32) p->nULong; break; case SbxSINGLE: if( p->nSingle > SbxMAXLNG ) @@ -73,7 +73,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMINLNG; } else - nRes = (INT32) ImpRound( p->nSingle ); + nRes = (sal_Int32) ImpRound( p->nSingle ); break; case SbxSALINT64: nRes = p->nInt64; @@ -84,7 +84,7 @@ start: case SbxCURRENCY: { sal_Int64 tstVal = p->nInt64 / CURRENCY_FACTOR; - nRes = (INT32) (tstVal); + nRes = (sal_Int32) (tstVal); if( tstVal < SbxMINLNG || SbxMAXLNG < tstVal ) SbxBase::SetError( SbxERR_OVERFLOW ); if( SbxMAXLNG < tstVal ) nRes = SbxMAXLNG; if( tstVal < SbxMINLNG ) nRes = SbxMINLNG; @@ -114,7 +114,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMINLNG; } else - nRes = (INT32) ImpRound( dVal ); + nRes = (sal_Int32) ImpRound( dVal ); break; } case SbxBYREF | SbxSTRING: @@ -137,7 +137,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMINLNG; } else - nRes = (INT32) ImpRound( d ); + nRes = (sal_Int32) ImpRound( d ); } break; case SbxOBJECT: @@ -189,7 +189,7 @@ start: return nRes; } -void ImpPutLong( SbxValues* p, INT32 n ) +void ImpPutLong( SbxValues* p, sal_Int32 n ) { SbxValues aTmp; @@ -267,7 +267,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = 0; } - *p->pByte = (BYTE) n; break; + *p->pByte = (sal_uInt8) n; break; case SbxBYREF | SbxINTEGER: case SbxBYREF | SbxBOOL: if( n > SbxMAXINT ) @@ -278,7 +278,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMININT; } - *p->pInteger = (INT16) n; break; + *p->pInteger = (sal_Int16) n; break; case SbxBYREF | SbxERROR: case SbxBYREF | SbxUSHORT: if( n > SbxMAXUINT ) @@ -289,7 +289,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = 0; } - *p->pUShort = (UINT16) n; break; + *p->pUShort = (sal_uInt16) n; break; case SbxBYREF | SbxLONG: *p->pLong = n; break; case SbxBYREF | SbxULONG: @@ -297,7 +297,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = 0; } - *p->pULong = (UINT32) n; break; + *p->pULong = (sal_uInt32) n; break; case SbxBYREF | SbxSALINT64: *p->pnInt64 = n; break; case SbxBYREF | SbxSALUINT64: diff --git a/basic/source/sbx/sbxmstrm.cxx b/basic/source/sbx/sbxmstrm.cxx index e4ed782d75b2..e4ed782d75b2 100644..100755 --- a/basic/source/sbx/sbxmstrm.cxx +++ b/basic/source/sbx/sbxmstrm.cxx diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx index 45f2d46ed254..a6d089602ba4 100644..100755 --- a/basic/source/sbx/sbxobj.cxx +++ b/basic/source/sbx/sbxobj.cxx @@ -41,7 +41,7 @@ TYPEINIT2(SbxObject,SbxVariable,SfxListener) static const char* pNameProp; // Name-Property static const char* pParentProp; // Parent-Property -static USHORT nNameHash = 0, nParentHash = 0; +static sal_uInt16 nNameHash = 0, nParentHash = 0; ///////////////////////////////////////////////////////////////////////// @@ -86,18 +86,18 @@ SbxObject& SbxObject::operator=( const SbxObject& r ) pDfltProp = r.pDfltProp; SetName( r.GetName() ); SetFlags( r.GetFlags() ); - SetModified( TRUE ); + SetModified( sal_True ); } return *this; } static void CheckParentsOnDelete( SbxObject* pObj, SbxArray* p ) { - for( USHORT i = 0; i < p->Count(); i++ ) + for( sal_uInt16 i = 0; i < p->Count(); i++ ) { SbxVariableRef& rRef = p->GetRef( i ); if( rRef->IsBroadcaster() ) - pObj->EndListening( rRef->GetBroadcaster(), TRUE ); + pObj->EndListening( rRef->GetBroadcaster(), sal_True ); // Did the element have more then one reference and still a Listener? if( rRef->GetRefCount() > 1 ) { @@ -112,6 +112,9 @@ SbxObject::~SbxObject() CheckParentsOnDelete( this, pProps ); CheckParentsOnDelete( this, pMethods ); CheckParentsOnDelete( this, pObjs ); + + // avoid handling in ~SbxVariable as SBX_DIM_AS_NEW == SBX_GBLSEARCH + ResetFlag( SBX_DIM_AS_NEW ); } SbxDataType SbxObject::GetType() const @@ -136,7 +139,7 @@ void SbxObject::Clear() p->ResetFlag( SBX_WRITE ); p->SetFlag( SBX_DONTSTORE ); pDfltProp = NULL; - SetModified( FALSE ); + SetModified( sal_False ); } void SbxObject::SFX_NOTIFY( SfxBroadcaster&, const TypeId&, @@ -145,14 +148,14 @@ void SbxObject::SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SbxHint* p = PTR_CAST(SbxHint,&rHint); if( p ) { - ULONG nId = p->GetId(); - BOOL bRead = BOOL( nId == SBX_HINT_DATAWANTED ); - BOOL bWrite = BOOL( nId == SBX_HINT_DATACHANGED ); + sal_uIntPtr nId = p->GetId(); + sal_Bool bRead = sal_Bool( nId == SBX_HINT_DATAWANTED ); + sal_Bool bWrite = sal_Bool( nId == SBX_HINT_DATACHANGED ); SbxVariable* pVar = p->GetVar(); if( bRead || bWrite ) { XubString aVarName( pVar->GetName() ); - USHORT nHash_ = MakeHashCode( aVarName ); + sal_uInt16 nHash_ = MakeHashCode( aVarName ); if( nHash_ == nNameHash && aVarName.EqualsIgnoreCaseAscii( pNameProp ) ) { @@ -173,12 +176,12 @@ void SbxObject::SFX_NOTIFY( SfxBroadcaster&, const TypeId&, } } -BOOL SbxObject::IsClass( const XubString& rName ) const +sal_Bool SbxObject::IsClass( const XubString& rName ) const { - return BOOL( aClassName.EqualsIgnoreCaseAscii( rName ) ); + return sal_Bool( aClassName.EqualsIgnoreCaseAscii( rName ) ); } -SbxVariable* SbxObject::FindUserData( UINT32 nData ) +SbxVariable* SbxObject::FindUserData( sal_uInt32 nData ) { if( !GetAll( SbxCLASS_DONTCARE ) ) return NULL; @@ -195,10 +198,10 @@ SbxVariable* SbxObject::FindUserData( UINT32 nData ) while( !pRes && pCur->pParent ) { // I myself was already searched through! - USHORT nOwn = pCur->GetFlags(); + sal_uInt16 nOwn = pCur->GetFlags(); pCur->ResetFlag( SBX_EXTSEARCH ); // I search already global! - USHORT nPar = pCur->pParent->GetFlags(); + sal_uInt16 nPar = pCur->pParent->GetFlags(); pCur->pParent->ResetFlag( SBX_GBLSEARCH ); pRes = pCur->pParent->FindUserData( nData ); pCur->SetFlags( nOwn ); @@ -212,7 +215,7 @@ SbxVariable* SbxObject::FindUserData( UINT32 nData ) SbxVariable* SbxObject::Find( const XubString& rName, SbxClassType t ) { #ifdef DBG_UTIL - static USHORT nLvl = 0; + static sal_uInt16 nLvl = 0; static const char* pCls[] = { "DontCare","Array","Value","Variable","Method","Property","Object" }; ByteString aNameStr1( (const UniString&)rName, RTL_TEXTENCODING_ASCII_US ); @@ -262,10 +265,10 @@ SbxVariable* SbxObject::Find( const XubString& rName, SbxClassType t ) while( !pRes && pCur->pParent ) { // I myself was already searched through! - USHORT nOwn = pCur->GetFlags(); + sal_uInt16 nOwn = pCur->GetFlags(); pCur->ResetFlag( SBX_EXTSEARCH ); // I search already global! - USHORT nPar = pCur->pParent->GetFlags(); + sal_uInt16 nPar = pCur->pParent->GetFlags(); pCur->pParent->ResetFlag( SBX_GBLSEARCH ); pRes = pCur->pParent->Find( rName, t ); pCur->SetFlags( nOwn ); @@ -290,7 +293,7 @@ SbxVariable* SbxObject::Find( const XubString& rName, SbxClassType t ) // The whole thing recursive, because Call() might be overloaded // Qualified names are allowed -BOOL SbxObject::Call( const XubString& rName, SbxArray* pParam ) +sal_Bool SbxObject::Call( const XubString& rName, SbxArray* pParam ) { SbxVariable* pMeth = FindQualified( rName, SbxCLASS_DONTCARE); if( pMeth && pMeth->ISA(SbxMethod) ) @@ -300,10 +303,10 @@ BOOL SbxObject::Call( const XubString& rName, SbxArray* pParam ) pMeth->SetParameters( pParam ); pMeth->Broadcast( SBX_HINT_DATAWANTED ); pMeth->SetParameters( NULL ); - return TRUE; + return sal_True; } SetError( SbxERR_NO_METHOD ); - return FALSE; + return sal_False; } SbxProperty* SbxObject::GetDfltProperty() @@ -321,14 +324,14 @@ void SbxObject::SetDfltProperty( const XubString& rName ) if ( rName != aDfltPropName ) pDfltProp = NULL; aDfltPropName = rName; - SetModified( TRUE ); + SetModified( sal_True ); } void SbxObject::SetDfltProperty( SbxProperty* p ) { if( p ) { - USHORT n; + sal_uInt16 n; SbxArray* pArray = FindVar( p, n ); pArray->Put( p, n ); if( p->GetParent() != this ) @@ -336,14 +339,14 @@ void SbxObject::SetDfltProperty( SbxProperty* p ) Broadcast( SBX_HINT_OBJECTCHANGED ); } pDfltProp = p; - SetModified( TRUE ); + SetModified( sal_True ); } // Search of a already available variable. If she was located, // the index will be set, elsewise will be delivered the Count of the Array. // In any case it will be delivered the correct Array. -SbxArray* SbxObject::FindVar( SbxVariable* pVar, USHORT& nArrayIdx ) +SbxArray* SbxObject::FindVar( SbxVariable* pVar, sal_uInt16& nArrayIdx ) { SbxArray* pArray = NULL; if( pVar ) switch( pVar->GetClass() ) @@ -362,7 +365,7 @@ SbxArray* SbxObject::FindVar( SbxVariable* pVar, USHORT& nArrayIdx ) pArray->ResetFlag( SBX_EXTSEARCH ); SbxVariable* pOld = pArray->Find( pVar->GetName(), pVar->GetClass() ); if( pOld ) - for( USHORT i = 0; i < pArray->Count(); i++ ) + for( sal_uInt16 i = 0; i < pArray->Count(); i++ ) { SbxVariableRef& rRef = pArray->GetRef( i ); if( (SbxVariable*) rRef == pOld ) @@ -432,9 +435,9 @@ SbxVariable* SbxObject::Make( const XubString& rName, SbxClassType ct, SbxDataTy } pVar->SetParent( this ); pArray->Put( pVar, pArray->Count() ); - SetModified( TRUE ); + SetModified( sal_True ); // The object listen always - StartListening( pVar->GetBroadcaster(), TRUE ); + StartListening( pVar->GetBroadcaster(), sal_True ); Broadcast( SBX_HINT_OBJECTCHANGED ); return pVar; } @@ -470,9 +473,9 @@ SbxObject* SbxObject::MakeObject( const XubString& rName, const XubString& rClas pVar->SetName( rName ); pVar->SetParent( this ); pObjs->Put( pVar, pObjs->Count() ); - SetModified( TRUE ); + SetModified( sal_True ); // The object listen always - StartListening( pVar->GetBroadcaster(), TRUE ); + StartListening( pVar->GetBroadcaster(), sal_True ); Broadcast( SBX_HINT_OBJECTCHANGED ); } return pVar; @@ -480,7 +483,7 @@ SbxObject* SbxObject::MakeObject( const XubString& rName, const XubString& rClas void SbxObject::Insert( SbxVariable* pVar ) { - USHORT nIdx; + sal_uInt16 nIdx; SbxArray* pArray = FindVar( pVar, nIdx ); if( pArray ) { @@ -512,7 +515,7 @@ void SbxObject::Insert( SbxVariable* pVar ) } #endif */ - EndListening( pOld->GetBroadcaster(), TRUE ); + EndListening( pOld->GetBroadcaster(), sal_True ); if( pVar->GetClass() == SbxCLASS_PROPERTY ) { if( pOld == pDfltProp ) @@ -520,11 +523,11 @@ void SbxObject::Insert( SbxVariable* pVar ) } } } - StartListening( pVar->GetBroadcaster(), TRUE ); + StartListening( pVar->GetBroadcaster(), sal_True ); pArray->Put( pVar, nIdx ); if( pVar->GetParent() != this ) pVar->SetParent( this ); - SetModified( TRUE ); + SetModified( sal_True ); Broadcast( SBX_HINT_OBJECTCHANGED ); #ifdef DBG_UTIL static const char* pCls[] = @@ -561,11 +564,11 @@ void SbxObject::QuickInsert( SbxVariable* pVar ) } if( pArray ) { - StartListening( pVar->GetBroadcaster(), TRUE ); + StartListening( pVar->GetBroadcaster(), sal_True ); pArray->Put( pVar, pArray->Count() ); if( pVar->GetParent() != this ) pVar->SetParent( this ); - SetModified( TRUE ); + SetModified( sal_True ); #ifdef DBG_UTIL static const char* pCls[] = { "DontCare","Array","Value","Variable","Method","Property","Object" }; @@ -600,11 +603,11 @@ void SbxObject::VCPtrInsert( SbxVariable* pVar ) } if( pArray ) { - StartListening( pVar->GetBroadcaster(), TRUE ); + StartListening( pVar->GetBroadcaster(), sal_True ); pArray->Put( pVar, pArray->Count() ); if( pVar->GetParent() != this ) pVar->SetParent( this ); - SetModified( TRUE ); + SetModified( sal_True ); Broadcast( SBX_HINT_OBJECTCHANGED ); } } @@ -616,7 +619,7 @@ void SbxObject::Remove( const XubString& rName, SbxClassType t ) void SbxObject::Remove( SbxVariable* pVar ) { - USHORT nIdx; + sal_uInt16 nIdx; SbxArray* pArray = FindVar( pVar, nIdx ); if( pArray && nIdx < pArray->Count() ) { @@ -629,13 +632,13 @@ void SbxObject::Remove( SbxVariable* pVar ) #endif SbxVariableRef pVar_ = pArray->Get( nIdx ); if( pVar_->IsBroadcaster() ) - EndListening( pVar_->GetBroadcaster(), TRUE ); + EndListening( pVar_->GetBroadcaster(), sal_True ); if( (SbxVariable*) pVar_ == pDfltProp ) pDfltProp = NULL; pArray->Remove( nIdx ); if( pVar_->GetParent() == this ) pVar_->SetParent( NULL ); - SetModified( TRUE ); + SetModified( sal_True ); Broadcast( SBX_HINT_OBJECTCHANGED ); } } @@ -643,26 +646,26 @@ void SbxObject::Remove( SbxVariable* pVar ) // From 1997-03-23, cleanup per Pointer for Controls (double names!) void SbxObject::VCPtrRemove( SbxVariable* pVar ) { - USHORT nIdx; + sal_uInt16 nIdx; // New FindVar-Method, otherwise identical with the normal method SbxArray* pArray = VCPtrFindVar( pVar, nIdx ); if( pArray && nIdx < pArray->Count() ) { SbxVariableRef xVar = pArray->Get( nIdx ); if( xVar->IsBroadcaster() ) - EndListening( xVar->GetBroadcaster(), TRUE ); + EndListening( xVar->GetBroadcaster(), sal_True ); if( (SbxVariable*) xVar == pDfltProp ) pDfltProp = NULL; pArray->Remove( nIdx ); if( xVar->GetParent() == this ) xVar->SetParent( NULL ); - SetModified( TRUE ); + SetModified( sal_True ); Broadcast( SBX_HINT_OBJECTCHANGED ); } } // From 1997-03-23, associated special method, search only by Pointer -SbxArray* SbxObject::VCPtrFindVar( SbxVariable* pVar, USHORT& nArrayIdx ) +SbxArray* SbxObject::VCPtrFindVar( SbxVariable* pVar, sal_uInt16& nArrayIdx ) { SbxArray* pArray = NULL; if( pVar ) switch( pVar->GetClass() ) @@ -677,7 +680,7 @@ SbxArray* SbxObject::VCPtrFindVar( SbxVariable* pVar, USHORT& nArrayIdx ) if( pArray ) { nArrayIdx = pArray->Count(); - for( USHORT i = 0; i < pArray->Count(); i++ ) + for( sal_uInt16 i = 0; i < pArray->Count(); i++ ) { SbxVariableRef& rRef = pArray->GetRef( i ); if( (SbxVariable*) rRef == pVar ) @@ -691,9 +694,9 @@ SbxArray* SbxObject::VCPtrFindVar( SbxVariable* pVar, USHORT& nArrayIdx ) -void SbxObject::SetPos( SbxVariable* pVar, USHORT nPos ) +void SbxObject::SetPos( SbxVariable* pVar, sal_uInt16 nPos ) { - USHORT nIdx; + sal_uInt16 nIdx; SbxArray* pArray = FindVar( pVar, nIdx ); if( pArray ) { @@ -706,41 +709,41 @@ void SbxObject::SetPos( SbxVariable* pVar, USHORT nPos ) pArray->Insert( refVar, nPos ); } } -// SetModified( TRUE ); +// SetModified( sal_True ); // Broadcast( SBX_HINT_OBJECTCHANGED ); } -static BOOL LoadArray( SvStream& rStrm, SbxObject* pThis, SbxArray* pArray ) +static sal_Bool LoadArray( SvStream& rStrm, SbxObject* pThis, SbxArray* pArray ) { SbxArrayRef p = (SbxArray*) SbxBase::Load( rStrm ); if( !p.Is() ) - return FALSE; - for( USHORT i = 0; i < p->Count(); i++ ) + return sal_False; + for( sal_uInt16 i = 0; i < p->Count(); i++ ) { SbxVariableRef& r = p->GetRef( i ); SbxVariable* pVar = r; if( pVar ) { pVar->SetParent( pThis ); - pThis->StartListening( pVar->GetBroadcaster(), TRUE ); + pThis->StartListening( pVar->GetBroadcaster(), sal_True ); } } pArray->Merge( p ); - return TRUE; + return sal_True; } // The load of an object is additive! -BOOL SbxObject::LoadData( SvStream& rStrm, USHORT nVer ) +sal_Bool SbxObject::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { // Help for the read in of old objects: just TRUE back, // LoadPrivateData() had to set the default status up if( !nVer ) - return TRUE; + return sal_True; pDfltProp = NULL; if( !SbxVariable::LoadData( rStrm, nVer ) ) - return FALSE; + return sal_False; // If it contains no alien object, insert ourselves if( aData.eType == SbxOBJECT && !aData.pObj ) aData.pObj = this; @@ -748,11 +751,11 @@ BOOL SbxObject::LoadData( SvStream& rStrm, USHORT nVer ) XubString aDfltProp; rStrm.ReadByteString( aClassName, RTL_TEXTENCODING_ASCII_US ); rStrm.ReadByteString( aDfltProp, RTL_TEXTENCODING_ASCII_US ); - ULONG nPos = rStrm.Tell(); + sal_uIntPtr nPos = rStrm.Tell(); rStrm >> nSize; if( !LoadPrivateData( rStrm, nVer ) ) - return FALSE; - ULONG nNewPos = rStrm.Tell(); + return sal_False; + sal_uIntPtr nNewPos = rStrm.Tell(); nPos += nSize; DBG_ASSERT( nPos >= nNewPos, "SBX: Zu viele Daten eingelesen" ); if( nPos != nNewPos ) @@ -760,39 +763,39 @@ BOOL SbxObject::LoadData( SvStream& rStrm, USHORT nVer ) if( !LoadArray( rStrm, this, pMethods ) || !LoadArray( rStrm, this, pProps ) || !LoadArray( rStrm, this, pObjs ) ) - return FALSE; + return sal_False; // Set properties if( aDfltProp.Len() ) pDfltProp = (SbxProperty*) pProps->Find( aDfltProp, SbxCLASS_PROPERTY ); - SetModified( FALSE ); - return TRUE; + SetModified( sal_False ); + return sal_True; } -BOOL SbxObject::StoreData( SvStream& rStrm ) const +sal_Bool SbxObject::StoreData( SvStream& rStrm ) const { if( !SbxVariable::StoreData( rStrm ) ) - return FALSE; + return sal_False; XubString aDfltProp; if( pDfltProp ) aDfltProp = pDfltProp->GetName(); rStrm.WriteByteString( aClassName, RTL_TEXTENCODING_ASCII_US ); rStrm.WriteByteString( aDfltProp, RTL_TEXTENCODING_ASCII_US ); - ULONG nPos = rStrm.Tell(); - rStrm << (UINT32) 0L; + sal_uIntPtr nPos = rStrm.Tell(); + rStrm << (sal_uInt32) 0L; if( !StorePrivateData( rStrm ) ) - return FALSE; - ULONG nNew = rStrm.Tell(); + return sal_False; + sal_uIntPtr nNew = rStrm.Tell(); rStrm.Seek( nPos ); - rStrm << (UINT32) ( nNew - nPos ); + rStrm << (sal_uInt32) ( nNew - nPos ); rStrm.Seek( nNew ); if( !pMethods->Store( rStrm ) ) - return FALSE; + return sal_False; if( !pProps->Store( rStrm ) ) - return FALSE; + return sal_False; if( !pObjs->Store( rStrm ) ) - return FALSE; - ((SbxObject*) this)->SetModified( FALSE ); - return TRUE; + return sal_False; + ((SbxObject*) this)->SetModified( sal_False ); + return sal_True; } XubString SbxObject::GenerateSource( const XubString &rLinePrefix, @@ -802,7 +805,7 @@ XubString SbxObject::GenerateSource( const XubString &rLinePrefix, XubString aSource; SbxArrayRef xProps( GetProperties() ); bool bLineFeed = false; - for ( USHORT nProp = 0; nProp < xProps->Count(); ++nProp ) + for ( sal_uInt16 nProp = 0; nProp < xProps->Count(); ++nProp ) { SbxPropertyRef xProp = (SbxProperty*) xProps->Get(nProp); XubString aPropName( xProp->GetName() ); @@ -850,7 +853,7 @@ XubString SbxObject::GenerateSource( const XubString &rLinePrefix, return aSource; } -static BOOL CollectAttrs( const SbxBase* p, XubString& rRes ) +static sal_Bool CollectAttrs( const SbxBase* p, XubString& rRes ) { XubString aAttrs; if( p->IsHidden() ) @@ -878,19 +881,19 @@ static BOOL CollectAttrs( const SbxBase* p, XubString& rRes ) rRes.AssignAscii( " (" ); rRes += aAttrs; rRes += ')'; - return TRUE; + return sal_True; } else { rRes.Erase(); - return FALSE; + return sal_False; } } -void SbxObject::Dump( SvStream& rStrm, BOOL bFill ) +void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill ) { // Shifting - static USHORT nLevel = 0; + static sal_uInt16 nLevel = 0; if ( nLevel > 10 ) { rStrm << "<too deep>" << endl; @@ -898,7 +901,7 @@ void SbxObject::Dump( SvStream& rStrm, BOOL bFill ) } ++nLevel; String aIndent; - for ( USHORT n = 1; n < nLevel; ++n ) + for ( sal_uInt16 n = 1; n < nLevel; ++n ) aIndent.AppendAscii( " " ); // if necessary complete the object @@ -909,7 +912,7 @@ void SbxObject::Dump( SvStream& rStrm, BOOL bFill ) ByteString aNameStr( (const UniString&)GetName(), RTL_TEXTENCODING_ASCII_US ); ByteString aClassNameStr( (const UniString&)aClassName, RTL_TEXTENCODING_ASCII_US ); rStrm << "Object( " - << ByteString::CreateFromInt64( (ULONG) this ).GetBuffer() << "=='" + << ByteString::CreateFromInt64( (sal_uIntPtr) this ).GetBuffer() << "=='" << ( aNameStr.Len() ? aNameStr.GetBuffer() : "<unnamed>" ) << "', " << "of class '" << aClassNameStr.GetBuffer() << "', " << "counts " @@ -919,7 +922,7 @@ void SbxObject::Dump( SvStream& rStrm, BOOL bFill ) { ByteString aParentNameStr( (const UniString&)GetName(), RTL_TEXTENCODING_ASCII_US ); rStrm << "in parent " - << ByteString::CreateFromInt64( (ULONG) GetParent() ).GetBuffer() + << ByteString::CreateFromInt64( (sal_uIntPtr) GetParent() ).GetBuffer() << "=='" << ( aParentNameStr.Len() ? aParentNameStr.GetBuffer() : "<unnamed>" ) << "'"; } else @@ -938,7 +941,7 @@ void SbxObject::Dump( SvStream& rStrm, BOOL bFill ) // Methods rStrm << aIndentNameStr.GetBuffer() << "- Methods:" << endl; - for( USHORT i = 0; i < pMethods->Count(); i++ ) + for( sal_uInt16 i = 0; i < pMethods->Count(); i++ ) { SbxVariableRef& r = pMethods->GetRef( i ); SbxVariable* pVar = r; @@ -971,7 +974,7 @@ void SbxObject::Dump( SvStream& rStrm, BOOL bFill ) // Properties rStrm << aIndentNameStr.GetBuffer() << "- Properties:" << endl; { - for( USHORT i = 0; i < pProps->Count(); i++ ) + for( sal_uInt16 i = 0; i < pProps->Count(); i++ ) { SbxVariableRef& r = pProps->GetRef( i ); SbxVariable* pVar = r; @@ -1005,7 +1008,7 @@ void SbxObject::Dump( SvStream& rStrm, BOOL bFill ) // Objects rStrm << aIndentNameStr.GetBuffer() << "- Objects:" << endl; { - for( USHORT i = 0; i < pObjs->Count(); i++ ) + for( sal_uInt16 i = 0; i < pObjs->Count(); i++ ) { SbxVariableRef& r = pObjs->GetRef( i ); SbxVariable* pVar = r; @@ -1029,7 +1032,7 @@ SvDispatch* SbxObject::GetSvDispatch() return NULL; } -BOOL SbxMethod::Run( SbxValues* pValues ) +sal_Bool SbxMethod::Run( SbxValues* pValues ) { SbxValues aRes; if( !pValues ) @@ -1048,7 +1051,7 @@ SbxClassType SbxProperty::GetClass() const return SbxCLASS_PROPERTY; } -void SbxObject::GarbageCollection( ULONG /*nObjects*/ ) +void SbxObject::GarbageCollection( sal_uIntPtr /* nObjects */ ) /* [Description] diff --git a/basic/source/sbx/sbxres.cxx b/basic/source/sbx/sbxres.cxx index 61080be5deb1..5b6466e21e2c 100644..100755 --- a/basic/source/sbx/sbxres.cxx +++ b/basic/source/sbx/sbxres.cxx @@ -81,12 +81,12 @@ static const char* pSbxRes[] = { "True" }; -const char* GetSbxRes( USHORT nId ) +const char* GetSbxRes( sal_uInt16 nId ) { return ( ( nId > SBXRES_MAX ) ? "???" : pSbxRes[ nId ] ); } -SbxRes::SbxRes( USHORT nId ) +SbxRes::SbxRes( sal_uInt16 nId ) : ::rtl::OUString( ::rtl::OUString::createFromAscii( GetSbxRes( nId ) ) ) {} diff --git a/basic/source/sbx/sbxres.hxx b/basic/source/sbx/sbxres.hxx index 135dcf80f7c9..c50b197a4e88 100644..100755 --- a/basic/source/sbx/sbxres.hxx +++ b/basic/source/sbx/sbxres.hxx @@ -79,10 +79,10 @@ class SbxRes : public ::rtl::OUString { public: - SbxRes( USHORT ); + SbxRes( sal_uInt16 ); }; -const char* GetSbxRes( USHORT ); +const char* GetSbxRes( sal_uInt16 ); #endif diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index c7cfe6e6850e..3b6d37286cd1 100644..100755 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -71,7 +71,7 @@ void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep ) // Fixed ist und das ganze nicht hineinpasst! SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType, - USHORT* pLen, BOOL bAllowIntntl, BOOL bOnlyIntntl ) + sal_uInt16* pLen, sal_Bool bAllowIntntl, sal_Bool bOnlyIntntl ) { ::rtl::OString aBStr( ::rtl::OUStringToOString( rWSrc, RTL_TEXTENCODING_ASCII_US ) ); @@ -102,15 +102,15 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType const char* pStart = aBStr.getStr(); const char* p = pStart; char buf[ 80 ], *q = buf; - BOOL bRes = TRUE; - BOOL bMinus = FALSE; + sal_Bool bRes = sal_True; + sal_Bool bMinus = sal_False; nVal = 0; SbxDataType eScanType = SbxSINGLE; // Whitespace wech while( *p &&( *p == ' ' || *p == '\t' ) ) p++; // Zahl? Dann einlesen und konvertieren. if( *p == '-' ) - p++, bMinus = TRUE; + p++, bMinus = sal_True; if( isdigit( *p ) ||( (*p == cNonIntntlComma || *p == cIntntlComma || *p == cIntntl1000) && isdigit( *(p+1 ) ) ) ) { @@ -171,7 +171,7 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType *q = 0; // Komma, Exponent mehrfach vorhanden? if( comma > 1 || exp > 1 ) - bRes = FALSE; + bRes = sal_False; // Kann auf Integer gefaltet werden? if( !comma && !exp ) { @@ -203,7 +203,7 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType { case 'O': cmp = "01234567"; base = 8; ndig = 11; break; case 'H': break; - default : bRes = FALSE; + default : bRes = sal_False; } long l = 0; int i; @@ -212,7 +212,7 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType char ch = sal::static_int_cast< char >( toupper( *p ) ); p++; if( strchr( cmp, ch ) ) *q++ = ch; - else bRes = FALSE; + else bRes = sal_False; } *q = 0; for( q = buf; *q; q++ ) @@ -221,7 +221,7 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType if( i > 9 ) i -= 7; l =( l * base ) + i; if( !ndig-- ) - bRes = FALSE; + bRes = sal_False; } if( *p == '&' ) p++; nVal = (double) l; @@ -234,7 +234,7 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType return SbxERR_CONVERSION; } if( pLen ) - *pLen = (USHORT) ( p - pStart ); + *pLen = (sal_uInt16) ( p - pStart ); if( !bRes ) return SbxERR_CONVERSION; if( bMinus ) @@ -244,12 +244,12 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType } // Schnittstelle fuer CDbl im Basic -SbxError SbxValue::ScanNumIntnl( const String& rSrc, double& nVal, BOOL bSingle ) +SbxError SbxValue::ScanNumIntnl( const String& rSrc, double& nVal, sal_Bool bSingle ) { SbxDataType t; - USHORT nLen = 0; + sal_uInt16 nLen = 0; SbxError nRetError = ImpScan( rSrc, nVal, t, &nLen, - /*bAllowIntntl*/FALSE, /*bOnlyIntntl*/TRUE ); + /*bAllowIntntl*/sal_False, /*bOnlyIntntl*/sal_True ); // Komplett gelesen? if( nRetError == SbxERR_OK && nLen != rSrc.Len() ) nRetError = SbxERR_CONVERSION; @@ -270,20 +270,20 @@ static double roundArray[] = { /*************************************************************************** |* -|* void myftoa( double, char *, short, short, BOOL, BOOL ) +|* void myftoa( double, char *, short, short, sal_Bool, sal_Bool ) |* |* Beschreibung: Konversion double --> ASCII |* Parameter: double die Zahl. |* char * der Zielpuffer |* short Anzahl Nachkommastellen |* short Weite des Exponenten( 0=kein E ) -|* BOOL TRUE: mit 1000er Punkten -|* BOOL TRUE: formatfreie Ausgabe +|* sal_Bool sal_True: mit 1000er Punkten +|* sal_Bool sal_True: formatfreie Ausgabe |* ***************************************************************************/ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth, - BOOL bPt, BOOL bFix, sal_Unicode cForceThousandSep = 0 ) + sal_Bool bPt, sal_Bool bFix, sal_Unicode cForceThousandSep = 0 ) { short nExp = 0; // Exponent @@ -391,7 +391,7 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth, #pragma warning(disable: 4748) // "... because optimizations are disabled ..." #endif -void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, BOOL bCoreString ) +void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, sal_Bool bCoreString ) { char *q; char cBuf[ 40 ], *p = cBuf; @@ -407,7 +407,7 @@ void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, BOOL bCoreStrin } double dMaxNumWithoutExp = (nPrec == 6) ? 1E6 : 1E14; myftoa( nNum, p, nPrec,( nNum &&( nNum < 1E-1 || nNum >= dMaxNumWithoutExp ) ) ? 4:0, - FALSE, TRUE, cDecimalSep ); + sal_False, sal_True, cDecimalSep ); // Trailing Zeroes weg: for( p = cBuf; *p &&( *p != 'E' ); p++ ) {} q = p; p--; @@ -422,13 +422,13 @@ void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, BOOL bCoreStrin #pragma optimize( "", on ) #endif -BOOL ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType ) +sal_Bool ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType ) { // Merken, ob ueberhaupt was geaendert wurde - BOOL bChanged = FALSE; + sal_Bool bChanged = sal_False; ::rtl::OUString aNewString; - // Nur Spezial-Flle behandeln, als Default tun wir nichts + // Nur Spezial-F�lle behandeln, als Default tun wir nichts switch( eTargetType ) { // Bei Fliesskomma International beruecksichtigen @@ -451,25 +451,25 @@ BOOL ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType ) { sal_Unicode* pStr = (sal_Unicode*)aNewString.getStr(); pStr[nPos] = (sal_Unicode)'.'; - bChanged = TRUE; + bChanged = sal_True; } } break; } - // Bei BOOL TRUE und FALSE als String pruefen + // Bei sal_Bool sal_True und sal_False als String pruefen case SbxBOOL: { if( rSrc.equalsIgnoreAsciiCaseAscii( "true" ) ) { aNewString = ::rtl::OUString::valueOf( (sal_Int32)SbxTRUE ); - bChanged = TRUE; + bChanged = sal_True; } else if( rSrc.equalsIgnoreAsciiCaseAscii( "false" ) ) { aNewString = ::rtl::OUString::valueOf( (sal_Int32)SbxFALSE ); - bChanged = TRUE; + bChanged = sal_True; } break; } @@ -490,7 +490,7 @@ BOOL ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType ) // lasse diesen Code vorl"aufig drin, zum 'abgucken' // der bisherigen Implementation -static USHORT printfmtnum( double nNum, XubString& rRes, const XubString& rWFmt ) +static sal_uInt16 printfmtnum( double nNum, XubString& rRes, const XubString& rWFmt ) { const String& rFmt = rWFmt; char cFill = ' '; // Fuellzeichen @@ -499,10 +499,10 @@ static USHORT printfmtnum( double nNum, XubString& rRes, const XubString& rWFmt short nPrec = 0; // Anzahl Nachkommastellen short nWidth = 0; // Zahlenweite gesamnt short nLen; // Laenge konvertierte Zahl - BOOL bPoint = FALSE; // TRUE: mit 1000er Kommas - BOOL bTrail = FALSE; // TRUE, wenn folgendes Minus - BOOL bSign = FALSE; // TRUE: immer mit Vorzeichen - BOOL bNeg = FALSE; // TRUE: Zahl ist negativ + sal_Bool bPoint = sal_False; // sal_True: mit 1000er Kommas + sal_Bool bTrail = sal_False; // sal_True, wenn folgendes Minus + sal_Bool bSign = sal_False; // sal_True: immer mit Vorzeichen + sal_Bool bNeg = sal_False; // sal_True: Zahl ist negativ char cBuf [1024]; // Zahlenpuffer char * p; const char* pFmt = rFmt; @@ -518,7 +518,7 @@ static USHORT printfmtnum( double nNum, XubString& rRes, const XubString& rWFmt case 0: break; case '+': - bSign = TRUE; nWidth++; break; + bSign = sal_True; nWidth++; break; case '*': nWidth++; cFill = '*'; if( *pFmt == '$' ) nWidth++, pFmt++, cPre = '$'; @@ -537,7 +537,7 @@ static USHORT printfmtnum( double nNum, XubString& rRes, const XubString& rWFmt // 1000er Kommas? if( *pFmt == ',' ) { - nWidth++; pFmt++; bPoint = TRUE; + nWidth++; pFmt++; bPoint = sal_True; } else break; } // Nachkomma: @@ -551,14 +551,14 @@ static USHORT printfmtnum( double nNum, XubString& rRes, const XubString& rWFmt pFmt++, nExpDig++, nWidth++; // Folgendes Minus: if( !bSign && *pFmt == '-' ) - pFmt++, bTrail = TRUE; + pFmt++, bTrail = sal_True; // Zahl konvertieren: if( nPrec > 15 ) nPrec = 15; - if( nNum < 0.0 ) nNum = -nNum, bNeg = TRUE; + if( nNum < 0.0 ) nNum = -nNum, bNeg = sal_True; p = cBuf; if( bSign ) *p++ = bNeg ? '-' : '+'; - myftoa( nNum, p, nPrec, nExpDig, bPoint, FALSE ); + myftoa( nNum, p, nPrec, nExpDig, bPoint, sal_False ); nLen = strlen( cBuf ); // Ueberlauf? @@ -573,12 +573,12 @@ static USHORT printfmtnum( double nNum, XubString& rRes, const XubString& rWFmt if( bTrail ) rRes += bNeg ? '-' : ' '; - return (USHORT) ( pFmt - (const char*) rFmt ); + return (sal_uInt16) ( pFmt - (const char*) rFmt ); } #endif //_old_format_code_ -static USHORT printfmtstr( const XubString& rStr, XubString& rRes, const XubString& rFmt ) +static sal_uInt16 printfmtstr( const XubString& rStr, XubString& rRes, const XubString& rFmt ) { const xub_Unicode* pStr = rStr.GetBuffer(); const xub_Unicode* pFmtStart = rFmt.GetBuffer(); @@ -603,12 +603,12 @@ static USHORT printfmtstr( const XubString& rStr, XubString& rRes, const XubStri rRes = rStr; break; } - return (USHORT) ( pFmt - pFmtStart ); + return (sal_uInt16) ( pFmt - pFmtStart ); } ///////////////////////////////////////////////////////////////////////// -BOOL SbxValue::Scan( const XubString& rSrc, USHORT* pLen ) +sal_Bool SbxValue::Scan( const XubString& rSrc, sal_uInt16* pLen ) { SbxError eRes = SbxERR_OK; if( !CanWrite() ) @@ -627,10 +627,10 @@ BOOL SbxValue::Scan( const XubString& rSrc, USHORT* pLen ) } if( eRes ) { - SetError( eRes ); return FALSE; + SetError( eRes ); return sal_False; } else - return TRUE; + return sal_True; } @@ -648,7 +648,7 @@ ResMgr* implGetResMgr( void ) class SbxValueFormatResId : public ResId { public: - SbxValueFormatResId( USHORT nId ) + SbxValueFormatResId( sal_uInt16 nId ) : ResId( nId, *implGetResMgr() ) {} }; @@ -693,7 +693,7 @@ static VbaFormatInfo pFormatInfoTable[] = VbaFormatInfo* getFormatInfo( const String& rFmt ) { VbaFormatInfo* pInfo = NULL; - INT16 i = 0; + sal_Int16 i = 0; while( (pInfo = pFormatInfoTable + i )->mpVbaFormat != NULL ) { if( rFmt.EqualsIgnoreCaseAscii( pInfo->mpVbaFormat ) ) @@ -713,11 +713,11 @@ VbaFormatInfo* getFormatInfo( const String& rFmt ) #define VBAFORMAT_UPPERCASE ">" // From methods1.cxx -INT16 implGetWeekDay( double aDate, bool bFirstDayParam = false, INT16 nFirstDay = 0 ); +sal_Int16 implGetWeekDay( double aDate, bool bFirstDayParam = false, sal_Int16 nFirstDay = 0 ); // from methods.cxx -INT16 implGetMinute( double dDate ); -INT16 implGetDateYear( double aDate ); -BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet ); +sal_Int16 implGetMinute( double dDate ); +sal_Int16 implGetDateYear( double aDate ); +sal_Bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double& rdRet ); void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const { @@ -751,7 +751,7 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const double nNumber; Color* pCol; - BOOL bSuccess = aFormatter.IsNumberFormat( aStr, nIndex, nNumber ); + sal_Bool bSuccess = aFormatter.IsNumberFormat( aStr, nIndex, nNumber ); // number format, use SvNumberFormatter to handle it. if( bSuccess ) @@ -804,7 +804,7 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const else if( aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_N ) || aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_NN )) { - INT32 nMin = implGetMinute( nNumber ); + sal_Int32 nMin = implGetMinute( nNumber ); if( nMin < 10 && aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_NN ) ) { // Minute in two digits @@ -819,15 +819,15 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const } else if( aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_W )) { - INT32 nWeekDay = implGetWeekDay( nNumber ); + sal_Int32 nWeekDay = implGetWeekDay( nNumber ); rRes = String::CreateFromInt32( nWeekDay ); } else if( aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_Y )) { - INT16 nYear = implGetDateYear( nNumber ); + sal_Int16 nYear = implGetDateYear( nNumber ); double dBaseDate; implDateSerial( nYear, 1, 1, dBaseDate ); - INT32 nYear32 = 1 + INT32( nNumber - dBaseDate ); + sal_Int32 nYear32 = 1 + sal_Int32( nNumber - dBaseDate ); rRes = String::CreateFromInt32( nYear32 ); } else @@ -948,7 +948,7 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const // #45355 wenn es numerisch ist, muss gewandelt werden if( IsNumericRTL() ) { - ScanNumIntnl( GetString(), d, /*bSingle*/FALSE ); + ScanNumIntnl( GetString(), d, /*bSingle*/sal_False ); goto cvt2; } else diff --git a/basic/source/sbx/sbxsng.cxx b/basic/source/sbx/sbxsng.cxx index 68bdcfe58609..62c98131a2c2 100644..100755 --- a/basic/source/sbx/sbxsng.cxx +++ b/basic/source/sbx/sbxsng.cxx @@ -260,7 +260,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = 0; } - *p->pByte = (BYTE) n; break; + *p->pByte = (sal_uInt8) n; break; case SbxBYREF | SbxINTEGER: case SbxBYREF | SbxBOOL: if( n > SbxMAXINT ) @@ -271,7 +271,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMININT; } - *p->pInteger = (INT16) n; break; + *p->pInteger = (sal_Int16) n; break; case SbxBYREF | SbxERROR: case SbxBYREF | SbxUSHORT: if( n > SbxMAXUINT ) @@ -282,10 +282,10 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = 0; } - *p->pUShort = (UINT16) n; break; + *p->pUShort = (sal_uInt16) n; break; case SbxBYREF | SbxLONG: { - INT32 i; + sal_Int32 i; if( n > SbxMAXLNG ) { SbxBase::SetError( SbxERR_OVERFLOW ); i = SbxMAXLNG; @@ -296,13 +296,13 @@ start: } else { - i = sal::static_int_cast< INT32 >(n); + i = sal::static_int_cast< sal_Int32 >(n); } *p->pLong = i; break; } case SbxBYREF | SbxULONG: { - UINT32 i; + sal_uInt32 i; if( n > SbxMAXULNG ) { SbxBase::SetError( SbxERR_OVERFLOW ); i = SbxMAXULNG; @@ -313,7 +313,7 @@ start: } else { - i = sal::static_int_cast< UINT32 >(n); + i = sal::static_int_cast< sal_uInt32 >(n); } *p->pULong = i; break; } diff --git a/basic/source/sbx/sbxstr.cxx b/basic/source/sbx/sbxstr.cxx index 1b634d57d66c..27d1ca192868 100644..100755 --- a/basic/source/sbx/sbxstr.cxx +++ b/basic/source/sbx/sbxstr.cxx @@ -148,9 +148,9 @@ XubString aRes; aTmp.eType = SbxSTRING; if( p->eType == SbxDOUBLE ) - ImpPutDouble( &aTmp, p->nDouble, TRUE ); // true = bCoreString + ImpPutDouble( &aTmp, p->nDouble, sal_True ); // true = bCoreString else - ImpPutDouble( &aTmp, *p->pDouble, TRUE ); // true = bCoreString + ImpPutDouble( &aTmp, *p->pDouble, sal_True ); // true = bCoreString return aRes; } else @@ -228,7 +228,7 @@ void ImpPutString( SbxValues* p, const ::rtl::OUString* n ) case SbxBYREF | SbxINTEGER: *p->pInteger = ImpGetInteger( p ); break; case SbxBYREF | SbxBOOL: - *p->pUShort = sal::static_int_cast< UINT16 >( ImpGetBool( p ) ); + *p->pUShort = sal::static_int_cast< sal_uInt16 >( ImpGetBool( p ) ); break; case SbxBYREF | SbxERROR: case SbxBYREF | SbxUSHORT: @@ -275,10 +275,10 @@ SbxArray* StringToByteArray(const ::rtl::OUString& rStr) pArray->unoAddDim( 0, -1 ); } - for( USHORT i=0; i< nArraySize; i++) + for( sal_uInt16 i=0; i< nArraySize; i++) { SbxVariable* pNew = new SbxVariable( SbxBYTE ); - BYTE aByte = static_cast< BYTE >( i%2 ? ((*pSrc) >> 8) & 0xff : (*pSrc) & 0xff ); + sal_uInt8 aByte = static_cast< sal_uInt8 >( i%2 ? ((*pSrc) >> 8) & 0xff : (*pSrc) & 0xff ); pNew->PutByte( aByte ); pNew->SetFlag( SBX_WRITE ); pArray->Put( pNew, i ); @@ -291,10 +291,10 @@ SbxArray* StringToByteArray(const ::rtl::OUString& rStr) // Convert an array of bytes to string (2bytes per character) ::rtl::OUString ByteArrayToString(SbxArray* pArr) { - USHORT nCount = pArr->Count(); + sal_uInt16 nCount = pArr->Count(); ::rtl::OUStringBuffer aStrBuf; sal_Unicode aChar = 0; - for( USHORT i = 0 ; i < nCount ; i++ ) + for( sal_uInt16 i = 0 ; i < nCount ; i++ ) { sal_Unicode aTempChar = pArr->Get(i)->GetByte(); if( i%2 ) diff --git a/basic/source/sbx/sbxuint.cxx b/basic/source/sbx/sbxuint.cxx index 3115fd850f89..5922b3571987 100644..100755 --- a/basic/source/sbx/sbxuint.cxx +++ b/basic/source/sbx/sbxuint.cxx @@ -32,10 +32,10 @@ #include <basic/sbx.hxx> #include "sbxconv.hxx" -UINT16 ImpGetUShort( const SbxValues* p ) +sal_uInt16 ImpGetUShort( const SbxValues* p ) { SbxValues aTmp; - UINT16 nRes; + sal_uInt16 nRes; start: switch( +p->eType ) { @@ -71,7 +71,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0; } else - nRes = (UINT16) p->nLong; + nRes = (sal_uInt16) p->nLong; break; case SbxULONG: if( p->nULong > SbxMAXUINT ) @@ -79,7 +79,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXUINT; } else - nRes = (UINT16) p->nULong; + nRes = (sal_uInt16) p->nULong; break; case SbxCURRENCY: if( p->nInt64 / CURRENCY_FACTOR > SbxMAXUINT ) @@ -91,7 +91,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0; } else - nRes = (UINT16) (p->nInt64 / CURRENCY_FACTOR); + nRes = (sal_uInt16) (p->nInt64 / CURRENCY_FACTOR); break; case SbxSALINT64: if( p->nInt64 > SbxMAXUINT ) @@ -103,7 +103,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0; } else - nRes = (UINT16) p->nInt64; + nRes = (sal_uInt16) p->nInt64; break; case SbxSALUINT64: if( p->uInt64 > SbxMAXUINT ) @@ -111,7 +111,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXUINT; } else - nRes = (UINT16) p->uInt64; + nRes = (sal_uInt16) p->uInt64; break; case SbxSINGLE: if( p->nSingle > SbxMAXUINT ) @@ -123,7 +123,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0; } else - nRes = (UINT16) ( p->nSingle + 0.5 ); + nRes = (sal_uInt16) ( p->nSingle + 0.5 ); break; case SbxDATE: case SbxDOUBLE: @@ -149,7 +149,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0; } else - nRes = (UINT16) ( dVal + 0.5 ); + nRes = (sal_uInt16) ( dVal + 0.5 ); break; } case SbxBYREF | SbxSTRING: @@ -172,7 +172,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0; } else - nRes = (UINT16) ( d + 0.5 ); + nRes = (sal_uInt16) ( d + 0.5 ); } break; case SbxOBJECT: @@ -223,7 +223,7 @@ start: return nRes; } -void ImpPutUShort( SbxValues* p, UINT16 n ) +void ImpPutUShort( SbxValues* p, sal_uInt16 n ) { SbxValues aTmp; @@ -289,14 +289,14 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXBYTE; } - *p->pByte = (BYTE) n; break; + *p->pByte = (sal_uInt8) n; break; case SbxBYREF | SbxINTEGER: case SbxBYREF | SbxBOOL: if( n > SbxMAXINT ) { SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXINT; } - *p->pInteger = (INT16) n; break; + *p->pInteger = (sal_Int16) n; break; case SbxBYREF | SbxERROR: case SbxBYREF | SbxUSHORT: *p->pUShort = n; break; diff --git a/basic/source/sbx/sbxulng.cxx b/basic/source/sbx/sbxulng.cxx index 10c1dbd4f8d7..b8f74b4bf5e6 100644..100755 --- a/basic/source/sbx/sbxulng.cxx +++ b/basic/source/sbx/sbxulng.cxx @@ -32,10 +32,10 @@ #include <basic/sbx.hxx> #include "sbxconv.hxx" -UINT32 ImpGetULong( const SbxValues* p ) +sal_uInt32 ImpGetULong( const SbxValues* p ) { SbxValues aTmp; - UINT32 nRes; + sal_uInt32 nRes; start: switch( +p->eType ) { @@ -81,7 +81,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0; } else - nRes = (UINT32) ( p->nSingle + 0.5 ); + nRes = (sal_uInt32) ( p->nSingle + 0.5 ); break; case SbxDATE: case SbxDOUBLE: @@ -116,7 +116,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0; } else - nRes = (UINT32) ( dVal + 0.5 ); + nRes = (sal_uInt32) ( dVal + 0.5 ); break; } case SbxBYREF | SbxSTRING: @@ -139,7 +139,7 @@ start: SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0; } else - nRes = (UINT32) ( d + 0.5 ); + nRes = (sal_uInt32) ( d + 0.5 ); } break; case SbxOBJECT: @@ -190,7 +190,7 @@ start: return nRes; } -void ImpPutULong( SbxValues* p, UINT32 n ) +void ImpPutULong( SbxValues* p, sal_uInt32 n ) { SbxValues aTmp; start: @@ -257,27 +257,27 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXBYTE; } - *p->pByte = (BYTE) n; break; + *p->pByte = (sal_uInt8) n; break; case SbxBYREF | SbxINTEGER: case SbxBYREF | SbxBOOL: if( n > SbxMAXINT ) { SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXINT; } - *p->pInteger = (INT16) n; break; + *p->pInteger = (sal_Int16) n; break; case SbxBYREF | SbxERROR: case SbxBYREF | SbxUSHORT: if( n > SbxMAXUINT ) { SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXUINT; } - *p->pUShort = (UINT16) n; break; + *p->pUShort = (sal_uInt16) n; break; case SbxBYREF | SbxLONG: if( n > SbxMAXLNG ) { SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXLNG; } - *p->pLong = (INT32) n; break; + *p->pLong = (sal_Int32) n; break; case SbxBYREF | SbxULONG: *p->pULong = n; break; case SbxBYREF | SbxSINGLE: diff --git a/basic/source/sbx/sbxvals.cxx b/basic/source/sbx/sbxvals.cxx new file mode 100755 index 000000000000..71a3bfc7f0d8 --- /dev/null +++ b/basic/source/sbx/sbxvals.cxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_basic.hxx" + +#define _TLBIGINT_INT64 +#include <tools/bigint.hxx> +#include <basic/sbx.hxx> + +///////////////////////////// BigInt/Currency ////////////////////////////// + +SbxValues::SbxValues( const BigInt &rBig ) : eType(SbxCURRENCY) +{ + rBig.INT64( &nLong64 ); +} + +//TODO: BigInt is TOOLS_DLLPUBLIC, and its four member functions only declared +// and defined within basic (#define _TLBIGINT_INT64) are a bad hack that causes +// "warning C4273: 'function' : inconsistent dll linkage" on MSC; this whole +// mess should be cleaned up properly (e.g., by completely removing Sbx[U]INT64 +// and using sal_[u]Int64 instead): +#if defined _MSC_VER +#pragma warning(disable: 4273) +#endif + +sal_Bool BigInt::INT64( SbxINT64 *p ) const +{ + if( bIsBig ) { + if( nLen > 4 || (nNum[3] & 0x8000) ) + return sal_False; + + p->nLow = ((sal_uInt32)nNum[1] << 16) | (sal_uInt32)nNum[0]; + p->nHigh = ((sal_uInt32)nNum[3] << 16) | (sal_uInt32)nNum[2]; + if( bIsNeg ) + p->CHS(); + } + else + p->Set( (sal_Int32)nVal ); + + return sal_True; +} + +BigInt::BigInt( const SbxINT64 &r ) +{ + BigInt a10000 = 0x10000; + + *this = r.nHigh; + if( r.nHigh ) + *this *= a10000; + *this += (sal_uInt16)(r.nLow >> 16); + *this *= a10000; + *this += (sal_uInt16)r.nLow; +} + +sal_Bool BigInt::UINT64( SbxUINT64 *p ) const +{ + if( bIsBig ) { + if( bIsNeg || nLen > 4 ) + return sal_False; + + p->nLow = ((sal_uInt32)nNum[1] << 16) | (sal_uInt32)nNum[0]; + p->nHigh = ((sal_uInt32)nNum[3] << 16) | (sal_uInt32)nNum[2]; + } + else { + if( nVal < 0 ) + return sal_False; + + p->Set( (sal_uInt32)nVal ); + } + + return sal_True; +} + +BigInt::BigInt( const SbxUINT64 &r ) +{ + BigInt a10000 = 0x10000; + + *this = BigInt(r.nHigh); + if( r.nHigh ) + *this *= a10000; + *this += (sal_uInt16)(r.nLow >> 16); + *this *= a10000; + *this += (sal_uInt16)r.nLow; +} diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index 6838e68eeeaa..2c3adaa4302d 100644..100755 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -62,7 +62,7 @@ int matherr( struct _exception* p ) #endif default: SbxBase::SetError( SbxERR_NOTIMP ); break; } - return TRUE; + return sal_True; } #endif @@ -87,21 +87,21 @@ SbxValue::SbxValue( SbxDataType t, void* p ) : SbxBase() if( p ) switch( t & 0x0FFF ) { - case SbxINTEGER: n |= SbxBYREF; aData.pInteger = (INT16*) p; break; + case SbxINTEGER: n |= SbxBYREF; aData.pInteger = (sal_Int16*) p; break; case SbxSALUINT64: n |= SbxBYREF; aData.puInt64 = (sal_uInt64*) p; break; case SbxSALINT64: case SbxCURRENCY: n |= SbxBYREF; aData.pnInt64 = (sal_Int64*) p; break; - case SbxLONG: n |= SbxBYREF; aData.pLong = (INT32*) p; break; + case SbxLONG: n |= SbxBYREF; aData.pLong = (sal_Int32*) p; break; case SbxSINGLE: n |= SbxBYREF; aData.pSingle = (float*) p; break; case SbxDATE: case SbxDOUBLE: n |= SbxBYREF; aData.pDouble = (double*) p; break; case SbxSTRING: n |= SbxBYREF; aData.pOUString = (::rtl::OUString*) p; break; case SbxERROR: case SbxUSHORT: - case SbxBOOL: n |= SbxBYREF; aData.pUShort = (UINT16*) p; break; - case SbxULONG: n |= SbxBYREF; aData.pULong = (UINT32*) p; break; + case SbxBOOL: n |= SbxBYREF; aData.pUShort = (sal_uInt16*) p; break; + case SbxULONG: n |= SbxBYREF; aData.pULong = (sal_uInt32*) p; break; case SbxCHAR: n |= SbxBYREF; aData.pChar = (sal_Unicode*) p; break; - case SbxBYTE: n |= SbxBYREF; aData.pByte = (BYTE*) p; break; + case SbxBYTE: n |= SbxBYREF; aData.pByte = (sal_uInt8*) p; break; case SbxINT: n |= SbxBYREF; aData.pInt = (int*) p; break; case SbxOBJECT: aData.pObj = (SbxBase*) p; @@ -222,8 +222,8 @@ SbxValue::~SbxValue() { HACK(nicht bei Parent-Prop - sonst CyclicRef) SbxVariable *pThisVar = PTR_CAST(SbxVariable, this); - BOOL bParentProp = pThisVar && 5345 == - ( (INT16) ( pThisVar->GetUserData() & 0xFFFF ) ); + sal_Bool bParentProp = pThisVar && 5345 == + ( (sal_Int16) ( pThisVar->GetUserData() & 0xFFFF ) ); if ( !bParentProp ) aData.pObj->ReleaseRef(); } @@ -253,8 +253,8 @@ void SbxValue::Clear() { HACK(nicht bei Parent-Prop - sonst CyclicRef) SbxVariable *pThisVar = PTR_CAST(SbxVariable, this); - BOOL bParentProp = pThisVar && 5345 == - ( (INT16) ( pThisVar->GetUserData() & 0xFFFF ) ); + sal_Bool bParentProp = pThisVar && 5345 == + ( (sal_Int16) ( pThisVar->GetUserData() & 0xFFFF ) ); if ( !bParentProp ) aData.pObj->ReleaseRef(); } @@ -279,7 +279,7 @@ void SbxValue::Clear() // Dummy -void SbxValue::Broadcast( ULONG ) +void SbxValue::Broadcast( sal_uIntPtr ) {} //////////////////////////// Readout data ////////////////////////////// @@ -291,11 +291,13 @@ void SbxValue::Broadcast( ULONG ) SbxValue* SbxValue::TheRealValue() const { - return TheRealValue( TRUE ); + return TheRealValue( sal_True ); } // #55226 ship additional information -SbxValue* SbxValue::TheRealValue( BOOL bObjInObjError ) const +bool handleToStringForCOMObjects( SbxObject* pObj, SbxValue* pVal ); // sbunoobj.cxx + +SbxValue* SbxValue::TheRealValue( sal_Bool bObjInObjError ) const { SbxValue* p = (SbxValue*) this; for( ;; ) @@ -320,8 +322,12 @@ SbxValue* SbxValue::TheRealValue( BOOL bObjInObjError ) const ((SbxValue*) pObj)->aData.eType == SbxOBJECT && ((SbxValue*) pObj)->aData.pObj == pObj ) { - SetError( SbxERR_BAD_PROP_VALUE ); - p = NULL; + bool bSuccess = handleToStringForCOMObjects( pObj, p ); + if( !bSuccess ) + { + SetError( SbxERR_BAD_PROP_VALUE ); + p = NULL; + } } else if( pDflt ) p = pDflt; @@ -364,9 +370,9 @@ SbxValue* SbxValue::TheRealValue( BOOL bObjInObjError ) const return p; } -BOOL SbxValue::Get( SbxValues& rRes ) const +sal_Bool SbxValue::Get( SbxValues& rRes ) const { - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; SbxError eOld = GetError(); if( eOld != SbxERR_OK ) ResetError(); @@ -401,7 +407,7 @@ BOOL SbxValue::Get( SbxValues& rRes ) const case SbxDECIMAL: rRes.pDecimal = ImpGetDecimal( &p->aData ); break; case SbxDATE: rRes.nDouble = ImpGetDate( &p->aData ); break; case SbxBOOL: - rRes.nUShort = sal::static_int_cast< UINT16 >( + rRes.nUShort = sal::static_int_cast< sal_uInt16 >( ImpGetBool( &p->aData ) ); break; case SbxCHAR: rRes.nChar = ImpGetChar( &p->aData ); break; @@ -456,18 +462,18 @@ BOOL SbxValue::Get( SbxValues& rRes ) const } if( !IsError() ) { - bRes = TRUE; + bRes = sal_True; if( eOld != SbxERR_OK ) SetError( eOld ); } return bRes; } -BOOL SbxValue::GetNoBroadcast( SbxValues& rRes ) +sal_Bool SbxValue::GetNoBroadcast( SbxValues& rRes ) { - USHORT nFlags_ = GetFlags(); + sal_uInt16 nFlags_ = GetFlags(); SetFlag( SBX_NO_BROADCAST ); - BOOL bRes = Get( rRes ); + sal_Bool bRes = Get( rRes ); SetFlags( nFlags_ ); return bRes; } @@ -507,7 +513,7 @@ const XubString& SbxValue::GetCoreString() const return aResult; } -BOOL SbxValue::HasObject() const +sal_Bool SbxValue::HasObject() const { ErrCode eErr = GetError(); SbxValues aRes; @@ -517,31 +523,31 @@ BOOL SbxValue::HasObject() const return 0 != aRes.pObj; } -BOOL SbxValue::GetBool() const +sal_Bool SbxValue::GetBool() const { SbxValues aRes; aRes.eType = SbxBOOL; Get( aRes ); - return BOOL( aRes.nUShort != 0 ); + return sal_Bool( aRes.nUShort != 0 ); } #define GET( g, e, t, m ) \ t SbxValue::g() const { SbxValues aRes(e); Get( aRes ); return aRes.m; } -GET( GetByte, SbxBYTE, BYTE, nByte ) +GET( GetByte, SbxBYTE, sal_uInt8, nByte ) GET( GetChar, SbxCHAR, xub_Unicode, nChar ) GET( GetCurrency, SbxCURRENCY, sal_Int64, nInt64 ) GET( GetDate, SbxDATE, double, nDouble ) GET( GetData, SbxDATAOBJECT, void*, pData ) GET( GetDouble, SbxDOUBLE, double, nDouble ) -GET( GetErr, SbxERROR, UINT16, nUShort ) +GET( GetErr, SbxERROR, sal_uInt16, nUShort ) GET( GetInt, SbxINT, int, nInt ) -GET( GetInteger, SbxINTEGER, INT16, nInteger ) -GET( GetLong, SbxLONG, INT32, nLong ) +GET( GetInteger, SbxINTEGER, sal_Int16, nInteger ) +GET( GetLong, SbxLONG, sal_Int32, nLong ) GET( GetObject, SbxOBJECT, SbxBase*, pObj ) GET( GetSingle, SbxSINGLE, float, nSingle ) -GET( GetULong, SbxULONG, UINT32, nULong ) -GET( GetUShort, SbxUSHORT, UINT16, nUShort ) +GET( GetULong, SbxULONG, sal_uInt32, nULong ) +GET( GetUShort, SbxUSHORT, sal_uInt16, nUShort ) GET( GetInt64, SbxSALINT64, sal_Int64, nInt64 ) GET( GetUInt64, SbxSALUINT64, sal_uInt64, uInt64 ) GET( GetDecimal, SbxDECIMAL, SbxDecimal*, pDecimal ) @@ -549,9 +555,9 @@ GET( GetDecimal, SbxDECIMAL, SbxDecimal*, pDecimal ) //////////////////////////// Write data ///////////////////////////// -BOOL SbxValue::Put( const SbxValues& rVal ) +sal_Bool SbxValue::Put( const SbxValues& rVal ) { - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; SbxError eOld = GetError(); if( eOld != SbxERR_OK ) ResetError(); @@ -565,7 +571,7 @@ BOOL SbxValue::Put( const SbxValues& rVal ) // the real values SbxValue* p = this; if( rVal.eType != SbxOBJECT ) - p = TheRealValue( FALSE ); // #55226 Don't allow an error here + p = TheRealValue( sal_False ); // Don't allow an error here if( p ) { if( !p->CanWrite() ) @@ -594,16 +600,16 @@ BOOL SbxValue::Put( const SbxValues& rVal ) case SbxSTRING: ImpPutString( &p->aData, rVal.pOUString ); break; case SbxINT: #if SAL_TYPES_SIZEOFINT == 2 - ImpPutInteger( &p->aData, (INT16) rVal.nInt ); + ImpPutInteger( &p->aData, (sal_Int16) rVal.nInt ); #else - ImpPutLong( &p->aData, (INT32) rVal.nInt ); + ImpPutLong( &p->aData, (sal_Int32) rVal.nInt ); #endif break; case SbxUINT: #if SAL_TYPES_SIZEOFINT == 2 - ImpPutUShort( &p->aData, (UINT16) rVal.nUInt ); + ImpPutUShort( &p->aData, (sal_uInt16) rVal.nUInt ); #else - ImpPutULong( &p->aData, (UINT32) rVal.nUInt ); + ImpPutULong( &p->aData, (sal_uInt32) rVal.nUInt ); #endif break; case SbxOBJECT: @@ -628,8 +634,8 @@ BOOL SbxValue::Put( const SbxValues& rVal ) } HACK(nicht bei Parent-Prop - sonst CyclicRef) SbxVariable *pThisVar = PTR_CAST(SbxVariable, this); - BOOL bParentProp = pThisVar && 5345 == - ( (INT16) ( pThisVar->GetUserData() & 0xFFFF ) ); + sal_Bool bParentProp = pThisVar && 5345 == + ( (sal_Int16) ( pThisVar->GetUserData() & 0xFFFF ) ); if ( !bParentProp ) p->aData.pObj->AddRef(); } @@ -649,11 +655,11 @@ BOOL SbxValue::Put( const SbxValues& rVal ) } if( !IsError() ) { - p->SetModified( TRUE ); + p->SetModified( sal_True ); p->Broadcast( SBX_HINT_DATACHANGED ); if( eOld != SbxERR_OK ) SetError( eOld ); - bRes = TRUE; + bRes = sal_True; } } } @@ -667,7 +673,7 @@ BOOL SbxValue::Put( const SbxValues& rVal ) // if Float were declared with ',' as the decimal seperator or BOOl // explicit with "TRUE" or "FALSE". // Implementation in ImpConvStringExt (SBXSCAN.CXX) -BOOL SbxValue::PutStringExt( const ::rtl::OUString& r ) +sal_Bool SbxValue::PutStringExt( const ::rtl::OUString& r ) { // Copy; if it is Unicode convert it immediately ::rtl::OUString aStr( r ); @@ -682,7 +688,7 @@ BOOL SbxValue::PutStringExt( const ::rtl::OUString& r ) // Only if really something was converted, take the copy, // elsewise take the original (Unicode remain) - BOOL bRet; + sal_Bool bRet; if( ImpConvStringExt( aStr, eTargetType ) ) aRes.pOUString = (::rtl::OUString*)&aStr; else @@ -690,7 +696,7 @@ BOOL SbxValue::PutStringExt( const ::rtl::OUString& r ) // #34939: Set a Fixed-Flag at Strings. which contain a number, and // if this has a Num-Type, so that the type will not be changed - USHORT nFlags_ = GetFlags(); + sal_uInt16 nFlags_ = GetFlags(); if( ( eTargetType >= SbxINTEGER && eTargetType <= SbxCURRENCY ) || ( eTargetType >= SbxCHAR && eTargetType <= SbxUINT ) || eTargetType == SbxBOOL ) @@ -702,7 +708,7 @@ BOOL SbxValue::PutStringExt( const ::rtl::OUString& r ) } Put( aRes ); - bRet = BOOL( !IsError() ); + bRet = sal_Bool( !IsError() ); // If it throwed an error with FIXED, set it back // (UI-Action should not cast an error, but only fail) @@ -713,102 +719,102 @@ BOOL SbxValue::PutStringExt( const ::rtl::OUString& r ) return bRet; } -BOOL SbxValue::PutString( const xub_Unicode* p ) +sal_Bool SbxValue::PutString( const xub_Unicode* p ) { ::rtl::OUString aVal( p ); SbxValues aRes; aRes.eType = SbxSTRING; aRes.pOUString = &aVal; Put( aRes ); - return BOOL( !IsError() ); + return sal_Bool( !IsError() ); } -BOOL SbxValue::PutBool( BOOL b ) +sal_Bool SbxValue::PutBool( sal_Bool b ) { SbxValues aRes; aRes.eType = SbxBOOL; - aRes.nUShort = sal::static_int_cast< UINT16 >(b ? SbxTRUE : SbxFALSE); + aRes.nUShort = sal::static_int_cast< sal_uInt16 >(b ? SbxTRUE : SbxFALSE); Put( aRes ); - return BOOL( !IsError() ); + return sal_Bool( !IsError() ); } -BOOL SbxValue::PutEmpty() +sal_Bool SbxValue::PutEmpty() { - BOOL bRet = SetType( SbxEMPTY ); - SetModified( TRUE ); + sal_Bool bRet = SetType( SbxEMPTY ); + SetModified( sal_True ); return bRet; } -BOOL SbxValue::PutNull() +sal_Bool SbxValue::PutNull() { - BOOL bRet = SetType( SbxNULL ); + sal_Bool bRet = SetType( SbxNULL ); if( bRet ) - SetModified( TRUE ); + SetModified( sal_True ); return bRet; } // Special decimal methods -BOOL SbxValue::PutDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ) +sal_Bool SbxValue::PutDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ) { SbxValue::Clear(); aData.pDecimal = new SbxDecimal( rAutomationDec ); aData.pDecimal->addRef(); aData.eType = SbxDECIMAL; - return TRUE; + return sal_True; } -BOOL SbxValue::fillAutomationDecimal +sal_Bool SbxValue::fillAutomationDecimal ( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ) { SbxDecimal* pDecimal = GetDecimal(); if( pDecimal != NULL ) { pDecimal->fillAutomationDecimal( rAutomationDec ); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } -BOOL SbxValue::PutpChar( const xub_Unicode* p ) +sal_Bool SbxValue::PutpChar( const xub_Unicode* p ) { ::rtl::OUString aVal( p ); SbxValues aRes; aRes.eType = SbxLPSTR; aRes.pOUString = &aVal; Put( aRes ); - return BOOL( !IsError() ); + return sal_Bool( !IsError() ); } -BOOL SbxValue::PutString( const ::rtl::OUString& r ) +sal_Bool SbxValue::PutString( const ::rtl::OUString& r ) { SbxValues aRes; aRes.eType = SbxSTRING; aRes.pOUString = (::rtl::OUString*) &r; Put( aRes ); - return BOOL( !IsError() ); + return sal_Bool( !IsError() ); } #define PUT( p, e, t, m ) \ -BOOL SbxValue::p( t n ) \ -{ SbxValues aRes(e); aRes.m = n; Put( aRes ); return BOOL( !IsError() ); } +sal_Bool SbxValue::p( t n ) \ +{ SbxValues aRes(e); aRes.m = n; Put( aRes ); return sal_Bool( !IsError() ); } -PUT( PutByte, SbxBYTE, BYTE, nByte ) +PUT( PutByte, SbxBYTE, sal_uInt8, nByte ) PUT( PutChar, SbxCHAR, sal_Unicode, nChar ) PUT( PutCurrency, SbxCURRENCY, const sal_Int64&, nInt64 ) PUT( PutDate, SbxDATE, double, nDouble ) PUT( PutData, SbxDATAOBJECT, void*, pData ) PUT( PutDouble, SbxDOUBLE, double, nDouble ) -PUT( PutErr, SbxERROR, UINT16, nUShort ) +PUT( PutErr, SbxERROR, sal_uInt16, nUShort ) PUT( PutInt, SbxINT, int, nInt ) -PUT( PutInteger, SbxINTEGER, INT16, nInteger ) -PUT( PutLong, SbxLONG, INT32, nLong ) +PUT( PutInteger, SbxINTEGER, sal_Int16, nInteger ) +PUT( PutLong, SbxLONG, sal_Int32, nLong ) PUT( PutObject, SbxOBJECT, SbxBase*, pObj ) PUT( PutSingle, SbxSINGLE, float, nSingle ) -PUT( PutULong, SbxULONG, UINT32, nULong ) -PUT( PutUShort, SbxUSHORT, UINT16, nUShort ) +PUT( PutULong, SbxULONG, sal_uInt32, nULong ) +PUT( PutUShort, SbxUSHORT, sal_uInt16, nUShort ) PUT( PutInt64, SbxSALINT64, sal_Int64, nInt64 ) PUT( PutUInt64, SbxSALUINT64, sal_uInt64, uInt64 ) PUT( PutDecimal, SbxDECIMAL, SbxDecimal*, pDecimal ) @@ -816,7 +822,7 @@ PUT( PutDecimal, SbxDECIMAL, SbxDecimal*, pDecimal ) ////////////////////////// Setting of the data type /////////////////////////// -BOOL SbxValue::IsFixed() const +sal_Bool SbxValue::IsFixed() const { return ( (GetFlags() & SBX_FIXED) | (aData.eType & SbxBYREF) ) != 0; } @@ -825,22 +831,22 @@ BOOL SbxValue::IsFixed() const // or if it contains a complete convertible String // #41692, implement it for RTL and Basic-Core seperably -BOOL SbxValue::IsNumeric() const +sal_Bool SbxValue::IsNumeric() const { - return ImpIsNumeric( /*bOnlyIntntl*/FALSE ); + return ImpIsNumeric( /*bOnlyIntntl*/sal_False ); } -BOOL SbxValue::IsNumericRTL() const +sal_Bool SbxValue::IsNumericRTL() const { - return ImpIsNumeric( /*bOnlyIntntl*/TRUE ); + return ImpIsNumeric( /*bOnlyIntntl*/sal_True ); } -BOOL SbxValue::ImpIsNumeric( BOOL bOnlyIntntl ) const +sal_Bool SbxValue::ImpIsNumeric( sal_Bool bOnlyIntntl ) const { if( !CanRead() ) { - SetError( SbxERR_PROP_WRITEONLY ); return FALSE; + SetError( SbxERR_PROP_WRITEONLY ); return sal_False; } // Test downcast!!! if( this->ISA(SbxVariable) ) @@ -853,14 +859,14 @@ BOOL SbxValue::ImpIsNumeric( BOOL bOnlyIntntl ) const ::rtl::OUString s( *aData.pOUString ); double n; SbxDataType t2; - USHORT nLen = 0; - if( ImpScan( s, n, t2, &nLen, /*bAllowIntntl*/FALSE, bOnlyIntntl ) == SbxERR_OK ) - return BOOL( nLen == s.getLength() ); + sal_uInt16 nLen = 0; + if( ImpScan( s, n, t2, &nLen, /*bAllowIntntl*/sal_False, bOnlyIntntl ) == SbxERR_OK ) + return sal_Bool( nLen == s.getLength() ); } - return FALSE; + return sal_False; } else - return BOOL( t == SbxEMPTY + return sal_Bool( t == SbxEMPTY || ( t >= SbxINTEGER && t <= SbxCURRENCY ) || ( t >= SbxCHAR && t <= SbxUINT ) ); } @@ -880,19 +886,19 @@ SbxDataType SbxValue::GetFullType() const return aData.eType; } -BOOL SbxValue::SetType( SbxDataType t ) +sal_Bool SbxValue::SetType( SbxDataType t ) { DBG_ASSERT( !( t & 0xF000 ), "Setzen von BYREF|ARRAY verboten!" ); if( ( t == SbxEMPTY && aData.eType == SbxVOID ) || ( aData.eType == SbxEMPTY && t == SbxVOID ) ) - return TRUE; + return sal_True; if( ( t & 0x0FFF ) == SbxVARIANT ) { // Trial to set the data type to Variant ResetFlag( SBX_FIXED ); if( IsFixed() ) { - SetError( SbxERR_CONVERSION ); return FALSE; + SetError( SbxERR_CONVERSION ); return sal_False; } t = SbxEMPTY; } @@ -900,7 +906,7 @@ BOOL SbxValue::SetType( SbxDataType t ) { if( !CanWrite() || IsFixed() ) { - SetError( SbxERR_CONVERSION ); return FALSE; + SetError( SbxERR_CONVERSION ); return sal_False; } else { @@ -915,12 +921,12 @@ BOOL SbxValue::SetType( SbxDataType t ) { HACK(nicht bei Parent-Prop - sonst CyclicRef) SbxVariable *pThisVar = PTR_CAST(SbxVariable, this); - UINT16 nSlotId = pThisVar - ? ( (INT16) ( pThisVar->GetUserData() & 0xFFFF ) ) + sal_uInt16 nSlotId = pThisVar + ? ( (sal_Int16) ( pThisVar->GetUserData() & 0xFFFF ) ) : 0; DBG_ASSERT( nSlotId != 5345 || pThisVar->GetName() == UniString::CreateFromAscii( "Parent" ), "SID_PARENTOBJECT heisst nicht 'Parent'" ); - BOOL bParentProp = 5345 == nSlotId; + sal_Bool bParentProp = 5345 == nSlotId; if ( !bParentProp ) aData.pObj->ReleaseRef(); } @@ -932,31 +938,31 @@ BOOL SbxValue::SetType( SbxDataType t ) aData.eType = t; } } - return TRUE; + return sal_True; } -BOOL SbxValue::Convert( SbxDataType eTo ) +sal_Bool SbxValue::Convert( SbxDataType eTo ) { eTo = SbxDataType( eTo & 0x0FFF ); if( ( aData.eType & 0x0FFF ) == eTo ) - return TRUE; + return sal_True; if( !CanWrite() ) - return FALSE; + return sal_False; if( eTo == SbxVARIANT ) { // Trial to set the data type to Variant ResetFlag( SBX_FIXED ); if( IsFixed() ) { - SetError( SbxERR_CONVERSION ); return FALSE; + SetError( SbxERR_CONVERSION ); return sal_False; } else - return TRUE; + return sal_True; } // Converting from zero doesn't work. Once zero, always zero! if( aData.eType == SbxNULL ) { - SetError( SbxERR_CONVERSION ); return FALSE; + SetError( SbxERR_CONVERSION ); return sal_False; } // Conversion of the data: @@ -970,17 +976,17 @@ BOOL SbxValue::Convert( SbxDataType eTo ) { SetType( eTo ); Put( aNew ); - SetModified( TRUE ); + SetModified( sal_True ); } Broadcast( SBX_HINT_CONVERTED ); - return TRUE; + return sal_True; } else - return FALSE; + return sal_False; } ////////////////////////////////// Calculating ///////////////////////////////// -BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp ) +sal_Bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp ) { bool bVBAInterop = SbiRuntime::isVBAEnabled(); @@ -1334,7 +1340,7 @@ Lbl_OpIsDouble: } Lbl_OpIsEmpty: - BOOL bRes = BOOL( !IsError() ); + sal_Bool bRes = sal_Bool( !IsError() ); if( bRes && eOld != SbxERR_OK ) SetError( eOld ); return bRes; @@ -1342,11 +1348,11 @@ Lbl_OpIsEmpty: // The comparison routine deliver TRUE or FALSE. -BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const +sal_Bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const { bool bVBAInterop = SbiRuntime::isVBAEnabled(); - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; SbxError eOld = GetError(); if( eOld != SbxERR_OK ) ResetError(); @@ -1354,24 +1360,24 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const SetError( SbxERR_PROP_WRITEONLY ); else if( GetType() == SbxNULL && rOp.GetType() == SbxNULL && !bVBAInterop ) { - bRes = TRUE; + bRes = sal_True; } else if( GetType() == SbxEMPTY && rOp.GetType() == SbxEMPTY ) - bRes = !bVBAInterop ? TRUE : ( eOp == SbxEQ ? TRUE : FALSE ); + bRes = !bVBAInterop ? sal_True : ( eOp == SbxEQ ? sal_True : sal_False ); // Special rule 1: If an operand is zero, the result is FALSE else if( GetType() == SbxNULL || rOp.GetType() == SbxNULL ) - bRes = FALSE; + bRes = sal_False; // Special rule 2: If both are variant and one is numeric // and the other is a String, num is < str else if( !IsFixed() && !rOp.IsFixed() && ( rOp.GetType() == SbxSTRING && GetType() != SbxSTRING && IsNumeric() ) && !bVBAInterop ) - bRes = BOOL( eOp == SbxLT || eOp == SbxLE || eOp == SbxNE ); + bRes = sal_Bool( eOp == SbxLT || eOp == SbxLE || eOp == SbxNE ); else if( !IsFixed() && !rOp.IsFixed() && ( GetType() == SbxSTRING && rOp.GetType() != SbxSTRING && rOp.IsNumeric() ) && !bVBAInterop ) - bRes = BOOL( eOp == SbxGT || eOp == SbxGE || eOp == SbxNE ); + bRes = sal_Bool( eOp == SbxGT || eOp == SbxGE || eOp == SbxNE ); else { SbxValues aL, aR; @@ -1383,17 +1389,17 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const if( Get( aL ) && rOp.Get( aR ) ) switch( eOp ) { case SbxEQ: - bRes = BOOL( *aL.pOUString == *aR.pOUString ); break; + bRes = sal_Bool( *aL.pOUString == *aR.pOUString ); break; case SbxNE: - bRes = BOOL( *aL.pOUString != *aR.pOUString ); break; + bRes = sal_Bool( *aL.pOUString != *aR.pOUString ); break; case SbxLT: - bRes = BOOL( *aL.pOUString < *aR.pOUString ); break; + bRes = sal_Bool( *aL.pOUString < *aR.pOUString ); break; case SbxGT: - bRes = BOOL( *aL.pOUString > *aR.pOUString ); break; + bRes = sal_Bool( *aL.pOUString > *aR.pOUString ); break; case SbxLE: - bRes = BOOL( *aL.pOUString <= *aR.pOUString ); break; + bRes = sal_Bool( *aL.pOUString <= *aR.pOUString ); break; case SbxGE: - bRes = BOOL( *aL.pOUString >= *aR.pOUString ); break; + bRes = sal_Bool( *aL.pOUString >= *aR.pOUString ); break; default: SetError( SbxERR_NOTIMP ); } @@ -1407,17 +1413,17 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const switch( eOp ) { case SbxEQ: - bRes = BOOL( aL.nSingle == aR.nSingle ); break; + bRes = sal_Bool( aL.nSingle == aR.nSingle ); break; case SbxNE: - bRes = BOOL( aL.nSingle != aR.nSingle ); break; + bRes = sal_Bool( aL.nSingle != aR.nSingle ); break; case SbxLT: - bRes = BOOL( aL.nSingle < aR.nSingle ); break; + bRes = sal_Bool( aL.nSingle < aR.nSingle ); break; case SbxGT: - bRes = BOOL( aL.nSingle > aR.nSingle ); break; + bRes = sal_Bool( aL.nSingle > aR.nSingle ); break; case SbxLE: - bRes = BOOL( aL.nSingle <= aR.nSingle ); break; + bRes = sal_Bool( aL.nSingle <= aR.nSingle ); break; case SbxGE: - bRes = BOOL( aL.nSingle >= aR.nSingle ); break; + bRes = sal_Bool( aL.nSingle >= aR.nSingle ); break; default: SetError( SbxERR_NOTIMP ); } @@ -1433,17 +1439,17 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const switch( eOp ) { case SbxEQ: - bRes = BOOL( eRes == SbxDecimal::EQ ); break; + bRes = sal_Bool( eRes == SbxDecimal::EQ ); break; case SbxNE: - bRes = BOOL( eRes != SbxDecimal::EQ ); break; + bRes = sal_Bool( eRes != SbxDecimal::EQ ); break; case SbxLT: - bRes = BOOL( eRes == SbxDecimal::LT ); break; + bRes = sal_Bool( eRes == SbxDecimal::LT ); break; case SbxGT: - bRes = BOOL( eRes == SbxDecimal::GT ); break; + bRes = sal_Bool( eRes == SbxDecimal::GT ); break; case SbxLE: - bRes = BOOL( eRes != SbxDecimal::GT ); break; + bRes = sal_Bool( eRes != SbxDecimal::GT ); break; case SbxGE: - bRes = BOOL( eRes != SbxDecimal::LT ); break; + bRes = sal_Bool( eRes != SbxDecimal::LT ); break; default: SetError( SbxERR_NOTIMP ); } @@ -1466,17 +1472,17 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const switch( eOp ) { case SbxEQ: - bRes = BOOL( aL.nDouble == aR.nDouble ); break; + bRes = sal_Bool( aL.nDouble == aR.nDouble ); break; case SbxNE: - bRes = BOOL( aL.nDouble != aR.nDouble ); break; + bRes = sal_Bool( aL.nDouble != aR.nDouble ); break; case SbxLT: - bRes = BOOL( aL.nDouble < aR.nDouble ); break; + bRes = sal_Bool( aL.nDouble < aR.nDouble ); break; case SbxGT: - bRes = BOOL( aL.nDouble > aR.nDouble ); break; + bRes = sal_Bool( aL.nDouble > aR.nDouble ); break; case SbxLE: - bRes = BOOL( aL.nDouble <= aR.nDouble ); break; + bRes = sal_Bool( aL.nDouble <= aR.nDouble ); break; case SbxGE: - bRes = BOOL( aL.nDouble >= aR.nDouble ); break; + bRes = sal_Bool( aL.nDouble >= aR.nDouble ); break; default: SetError( SbxERR_NOTIMP ); } @@ -1488,7 +1494,7 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const if ( bVBAInterop && eOp == SbxEQ && GetError() == SbxERR_CONVERSION ) { ResetError(); - bRes = FALSE; + bRes = sal_False; } } } @@ -1500,12 +1506,12 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const ///////////////////////////// Reading/Writing //////////////////////////// -BOOL SbxValue::LoadData( SvStream& r, USHORT ) +sal_Bool SbxValue::LoadData( SvStream& r, sal_uInt16 ) { // #TODO see if these types are really dumped to any stream // more than likely this is functionality used in the binfilter alone SbxValue::Clear(); - UINT16 nType; + sal_uInt16 nType; r >> nType; aData.eType = SbxDataType( nType ); switch( nType ) @@ -1525,7 +1531,7 @@ BOOL SbxValue::LoadData( SvStream& r, USHORT ) if( ImpScan( aVal, d, t, NULL ) != SbxERR_OK || t == SbxDOUBLE ) { aData.nSingle = 0.0F; - return FALSE; + return sal_False; } aData.nSingle = (float) d; break; @@ -1540,7 +1546,7 @@ BOOL SbxValue::LoadData( SvStream& r, USHORT ) if( ImpScan( aVal, aData.nDouble, t, NULL ) != SbxERR_OK ) { aData.nDouble = 0.0; - return FALSE; + return sal_False; } break; } @@ -1576,7 +1582,7 @@ BOOL SbxValue::LoadData( SvStream& r, USHORT ) r >> aData.nUShort; break; case SbxOBJECT: { - BYTE nMode; + sal_uInt8 nMode; r >> nMode; switch( nMode ) { @@ -1585,7 +1591,7 @@ BOOL SbxValue::LoadData( SvStream& r, USHORT ) break; case 1: aData.pObj = SbxBase::Load( r ); - return BOOL( aData.pObj != NULL ); + return sal_Bool( aData.pObj != NULL ); case 2: aData.pObj = this; break; @@ -1605,7 +1611,7 @@ BOOL SbxValue::LoadData( SvStream& r, USHORT ) r >> aData.nULong; break; case SbxINT: { - BYTE n; + sal_uInt8 n; r >> n; // Match the Int on this system? if( n > SAL_TYPES_SIZEOFINT ) @@ -1616,7 +1622,7 @@ BOOL SbxValue::LoadData( SvStream& r, USHORT ) } case SbxUINT: { - BYTE n; + sal_uInt8 n; r >> n; // Match the UInt on this system? if( n > SAL_TYPES_SIZEOFINT ) @@ -1641,14 +1647,14 @@ BOOL SbxValue::LoadData( SvStream& r, USHORT ) ResetFlag(SBX_FIXED); aData.eType = SbxNULL; DBG_ASSERT( !this, "Nicht unterstuetzer Datentyp geladen" ); - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } -BOOL SbxValue::StoreData( SvStream& r ) const +sal_Bool SbxValue::StoreData( SvStream& r ) const { - UINT16 nType = sal::static_int_cast< UINT16 >(aData.eType); + sal_uInt16 nType = sal::static_int_cast< sal_uInt16 >(aData.eType); r << nType; switch( nType & 0x0FFF ) { @@ -1699,14 +1705,14 @@ BOOL SbxValue::StoreData( SvStream& r ) const { if( PTR_CAST(SbxValue,aData.pObj) != this ) { - r << (BYTE) 1; + r << (sal_uInt8) 1; return aData.pObj->Store( r ); } else - r << (BYTE) 2; + r << (sal_uInt8) 2; } else - r << (BYTE) 0; + r << (sal_uInt8) 0; break; case SbxCHAR: { @@ -1720,13 +1726,13 @@ BOOL SbxValue::StoreData( SvStream& r ) const r << aData.nULong; break; case SbxINT: { - BYTE n = SAL_TYPES_SIZEOFINT; + sal_uInt8 n = SAL_TYPES_SIZEOFINT; r << n << (sal_Int32)aData.nInt; break; } case SbxUINT: { - BYTE n = SAL_TYPES_SIZEOFINT; + sal_uInt8 n = SAL_TYPES_SIZEOFINT; r << n << (sal_uInt32)aData.nUInt; break; } @@ -1743,9 +1749,9 @@ BOOL SbxValue::StoreData( SvStream& r ) const break; default: DBG_ASSERT( !this, "Speichern eines nicht unterstuetzten Datentyps" ); - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index 35eb5e4bd38f..9a981cccc7ca 100644..100755 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -47,9 +47,9 @@ using namespace com::sun::star::uno; TYPEINIT1(SbxVariable,SbxValue) TYPEINIT1(SbxHint,SfxSimpleHint) -extern UINT32 nVarCreator; // in SBXBASE.CXX, fuer LoadData() +extern sal_uInt32 nVarCreator; // in SBXBASE.CXX, fuer LoadData() #ifdef DBG_UTIL -static ULONG nVar = 0; +static sal_uIntPtr nVar = 0; #endif ///////////////////////////// SbxVariableImpl //////////////////////////// @@ -59,13 +59,17 @@ class SbxVariableImpl friend class SbxVariable; String m_aDeclareClassName; Reference< XInterface > m_xComListener; + StarBASIC* m_pComListenerParentBasic; SbxVariableImpl( void ) + : m_pComListenerParentBasic( NULL ) {} SbxVariableImpl( const SbxVariableImpl& r ) : m_aDeclareClassName( r.m_aDeclareClassName ) , m_xComListener( r.m_xComListener ) - {} + , m_pComListenerParentBasic( r.m_pComListenerParentBasic ) + { + } }; @@ -83,12 +87,18 @@ SbxVariable::SbxVariable() : SbxValue() #endif } +void registerComListenerVariableForBasic( SbxVariable* pVar, StarBASIC* pBasic ); + SbxVariable::SbxVariable( const SbxVariable& r ) : SvRefBase( r ), SbxValue( r ), mpPar( r.mpPar ), pInfo( r.pInfo ) { mpSbxVariableImpl = NULL; if( r.mpSbxVariableImpl != NULL ) + { mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl ); + if( mpSbxVariableImpl->m_xComListener.is() ) + registerComListenerVariableForBasic( this, mpSbxVariableImpl->m_pComListenerParentBasic ); + } pCst = NULL; if( r.CanRead() ) { @@ -123,6 +133,8 @@ SbxVariable::SbxVariable( SbxDataType t, void* p ) : SbxValue( t, p ) #endif } +void removeDimAsNewRecoverItem( SbxVariable* pVar ); + SbxVariable::~SbxVariable() { #ifdef DBG_UTIL @@ -132,6 +144,8 @@ SbxVariable::~SbxVariable() if ( maName.EqualsAscii( aCellsStr ) ) maName.AssignAscii( aCellsStr, sizeof( aCellsStr )-1 ); #endif + if( IsSet( SBX_DIM_AS_NEW )) + removeDimAsNewRecoverItem( this ); delete mpSbxVariableImpl; delete pCst; } @@ -148,7 +162,7 @@ SfxBroadcaster& SbxVariable::GetBroadcaster() // Perhaps some day one could cut the parameter 0. // then the copying will be dropped ... -void SbxVariable::Broadcast( ULONG nHintId ) +void SbxVariable::Broadcast( sal_uIntPtr nHintId ) { if( pCst && !IsSet( SBX_NO_BROADCAST ) && StaticIsEnabledBroadcasting() ) { @@ -163,7 +177,7 @@ void SbxVariable::Broadcast( ULONG nHintId ) // Avoid further broadcasting SfxBroadcaster* pSave = pCst; pCst = NULL; - USHORT nSaveFlags = GetFlags(); + sal_uInt16 nSaveFlags = GetFlags(); SetFlag( SBX_READWRITE ); if( mpPar.Is() ) // Register this as element 0, but don't change over the parent! @@ -181,7 +195,7 @@ SbxInfo* SbxVariable::GetInfo() { Broadcast( SBX_HINT_INFOWANTED ); if( pInfo.Is() ) - SetModified( TRUE ); + SetModified( sal_True ); } return pInfo; } @@ -228,7 +242,7 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const aTmp += cType; } aTmp += '('; - for( USHORT i = 0; i < pInfo->aParams.Count(); i++ ) + for( sal_uInt16 i = 0; i < pInfo->aParams.Count(); i++ ) { const SbxParamInfo* q = pInfo->aParams.GetObject( i ); int nt = q->eType & 0x0FFF; @@ -262,7 +276,7 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const aTmp += String( SbxRes( STRING_AS ) ); if( nt < 32 ) aTmp += String( SbxRes( - sal::static_int_cast< USHORT >( STRING_TYPES + nt ) ) ); + sal::static_int_cast< sal_uInt16 >( STRING_TYPES + nt ) ) ); else aTmp += String( SbxRes( STRING_ANY ) ); } @@ -275,7 +289,7 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const aTmp += String( SbxRes( STRING_AS ) ); if( et < 32 ) aTmp += String( SbxRes( - sal::static_int_cast< USHORT >( STRING_TYPES + et ) ) ); + sal::static_int_cast< sal_uInt16 >( STRING_TYPES + et ) ) ); else aTmp += String( SbxRes( STRING_ANY ) ); } @@ -285,21 +299,21 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const // Create a simple hashcode: the first six characters were evaluated. -USHORT SbxVariable::MakeHashCode( const XubString& rName ) +sal_uInt16 SbxVariable::MakeHashCode( const XubString& rName ) { - USHORT n = 0; - USHORT nLen = rName.Len(); + sal_uInt16 n = 0; + sal_uInt16 nLen = rName.Len(); if( nLen > 6 ) nLen = 6; const xub_Unicode* p = rName.GetBuffer(); while( nLen-- ) { - BYTE c = (BYTE)*p; + sal_uInt8 c = (sal_uInt8)*p; p++; // If we have a commen sigen break!! if( c >= 0x80 ) return 0; - n = sal::static_int_cast< USHORT >( ( n << 3 ) + toupper( c ) ); + n = sal::static_int_cast< sal_uInt16 >( ( n << 3 ) + toupper( c ) ); } return n; } @@ -311,7 +325,11 @@ SbxVariable& SbxVariable::operator=( const SbxVariable& r ) SbxValue::operator=( r ); delete mpSbxVariableImpl; if( r.mpSbxVariableImpl != NULL ) + { mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl ); + if( mpSbxVariableImpl->m_xComListener.is() ) + registerComListenerVariableForBasic( this, mpSbxVariableImpl->m_pComListenerParentBasic ); + } else mpSbxVariableImpl = NULL; return *this; @@ -334,7 +352,7 @@ SbxClassType SbxVariable::GetClass() const return SbxCLASS_VARIABLE; } -void SbxVariable::SetModified( BOOL b ) +void SbxVariable::SetModified( sal_Bool b ) { if( IsSet( SBX_NO_MODIFY ) ) return; @@ -350,11 +368,11 @@ void SbxVariable::SetParent( SbxObject* p ) if ( p && ISA(SbxObject) ) { // then this had to be a child of the new parent - BOOL bFound = FALSE; + sal_Bool bFound = sal_False; SbxArray *pChilds = p->GetObjects(); if ( pChilds ) { - for ( USHORT nIdx = 0; !bFound && nIdx < pChilds->Count(); ++nIdx ) + for ( sal_uInt16 nIdx = 0; !bFound && nIdx < pChilds->Count(); ++nIdx ) bFound = ( this == pChilds->Get(nIdx) ); } if ( !bFound ) @@ -392,26 +410,35 @@ void SbxVariable::SetDeclareClassName( const String& rDeclareClassName ) pImpl->m_aDeclareClassName = rDeclareClassName; } -void SbxVariable::SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener ) +void SbxVariable::SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener, + StarBASIC* pParentBasic ) { SbxVariableImpl* pImpl = getImpl(); pImpl->m_xComListener = xComListener; + pImpl->m_pComListenerParentBasic = pParentBasic; + registerComListenerVariableForBasic( this, pParentBasic ); +} + +void SbxVariable::ClearComListener( void ) +{ + SbxVariableImpl* pImpl = getImpl(); + pImpl->m_xComListener.clear(); } ////////////////////////////// Loading/Saving ///////////////////////////// -BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer ) +sal_Bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { - UINT16 nType; - BYTE cMark; + sal_uInt16 nType; + sal_uInt8 cMark; rStrm >> cMark; if( cMark == 0xFF ) { if( !SbxValue::LoadData( rStrm, nVer ) ) - return FALSE; + return sal_False; rStrm.ReadByteString( maName, RTL_TEXTENCODING_ASCII_US ); - UINT32 nTemp; + sal_uInt32 nTemp; rStrm >> nTemp; nUserData = nTemp; } @@ -420,7 +447,7 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer ) rStrm.SeekRel( -1L ); rStrm >> nType; rStrm.ReadByteString( maName, RTL_TEXTENCODING_ASCII_US ); - UINT32 nTemp; + sal_uInt32 nTemp; rStrm >> nTemp; nUserData = nTemp; // correction: old methods have instead of SbxNULL now SbxEMPTY @@ -448,7 +475,7 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer ) if( ImpScan( aTmpString, d, t, NULL ) != SbxERR_OK || t == SbxDOUBLE ) { aTmp.nSingle = 0; - return FALSE; + return sal_False; } aTmp.nSingle = (float) d; break; @@ -462,7 +489,7 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer ) if( ImpScan( aTmpString, aTmp.nDouble, t, NULL ) != SbxERR_OK ) { aTmp.nDouble = 0; - return FALSE; + return sal_False; } break; } @@ -476,11 +503,11 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer ) default: aData.eType = SbxNULL; DBG_ASSERT( !this, "Nicht unterstuetzer Datentyp geladen" ); - return FALSE; + return sal_False; } // putt value if( nType != SbxNULL && nType != SbxEMPTY && !Put( aTmp ) ) - return FALSE; + return sal_False; } rStrm >> cMark; // cMark is also a version number! @@ -489,29 +516,29 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer ) if( cMark ) { if( cMark > 2 ) - return FALSE; + return sal_False; pInfo = new SbxInfo; - pInfo->LoadData( rStrm, (USHORT) cMark ); + pInfo->LoadData( rStrm, (sal_uInt16) cMark ); } // Load private data only, if it is a SbxVariable if( GetClass() == SbxCLASS_VARIABLE && !LoadPrivateData( rStrm, nVer ) ) - return FALSE; + return sal_False; ((SbxVariable*) this)->Broadcast( SBX_HINT_DATACHANGED ); nHash = MakeHashCode( maName ); - SetModified( TRUE ); - return TRUE; + SetModified( sal_True ); + return sal_True; } -BOOL SbxVariable::StoreData( SvStream& rStrm ) const +sal_Bool SbxVariable::StoreData( SvStream& rStrm ) const { - rStrm << (BYTE) 0xFF; // Marker - BOOL bValStore; + rStrm << (sal_uInt8) 0xFF; // Marker + sal_Bool bValStore; if( this->IsA( TYPE(SbxMethod) ) ) { // #50200 Avoid that objects , which during the runtime // as return-value are saved in the method as a value were saved SbxVariable* pThis = (SbxVariable*)this; - USHORT nSaveFlags = GetFlags(); + sal_uInt16 nSaveFlags = GetFlags(); pThis->SetFlag( SBX_WRITE ); pThis->SbxValue::Clear(); pThis->SetFlags( nSaveFlags ); @@ -525,23 +552,23 @@ BOOL SbxVariable::StoreData( SvStream& rStrm ) const else bValStore = SbxValue::StoreData( rStrm ); if( !bValStore ) - return FALSE; + return sal_False; // if( !SbxValue::StoreData( rStrm ) ) - // return FALSE; + // return sal_False; rStrm.WriteByteString( maName, RTL_TEXTENCODING_ASCII_US ); - rStrm << (UINT32)nUserData; + rStrm << (sal_uInt32)nUserData; if( pInfo.Is() ) { - rStrm << (BYTE) 2; // Version 2: with UserData! + rStrm << (sal_uInt8) 2; // Version 2: with UserData! pInfo->StoreData( rStrm ); } else - rStrm << (BYTE) 0; + rStrm << (sal_uInt8) 0; // Save private data only, if it is a SbxVariable if( GetClass() == SbxCLASS_VARIABLE ) return StorePrivateData( rStrm ); else - return TRUE; + return sal_True; } ////////////////////////////// SbxInfo /////////////////////////////////// @@ -549,7 +576,7 @@ BOOL SbxVariable::StoreData( SvStream& rStrm ) const SbxInfo::SbxInfo() : aHelpFile(), nHelpId( 0 ), aParams() {} -SbxInfo::SbxInfo( const String& r, UINT32 n ) +SbxInfo::SbxInfo( const String& r, sal_uInt32 n ) : aHelpFile( r ), nHelpId( n ), aParams() {} @@ -582,7 +609,7 @@ SbxAlias::~SbxAlias() EndListening( xAlias->GetBroadcaster() ); } -void SbxAlias::Broadcast( ULONG nHt ) +void SbxAlias::Broadcast( sal_uIntPtr nHt ) { if( xAlias.Is() && StaticIsEnabledBroadcasting() ) { @@ -612,11 +639,11 @@ void SbxAlias::SFX_NOTIFY( SfxBroadcaster&, const TypeId&, } } -void SbxVariable::Dump( SvStream& rStrm, BOOL bFill ) +void SbxVariable::Dump( SvStream& rStrm, sal_Bool bFill ) { ByteString aBNameStr( (const UniString&)GetName( SbxNAME_SHORT_TYPES ), RTL_TEXTENCODING_ASCII_US ); rStrm << "Variable( " - << ByteString::CreateFromInt64( (ULONG) this ).GetBuffer() << "==" + << ByteString::CreateFromInt64( (sal_uIntPtr) this ).GetBuffer() << "==" << aBNameStr.GetBuffer(); ByteString aBParentNameStr( (const UniString&)GetParent()->GetName(), RTL_TEXTENCODING_ASCII_US ); if ( GetParent() ) diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx index 6af1675b9175..04df56763a13 100644..100755 --- a/basic/source/uno/dlgcont.cxx +++ b/basic/source/uno/dlgcont.cxx @@ -144,7 +144,7 @@ bool writeOasis2OOoLibraryElement( if (! xSMgr.is()) { - return FALSE; + return sal_False; } Reference< xml::sax::XParser > xParser( @@ -166,7 +166,7 @@ bool writeOasis2OOoLibraryElement( if ( !xParser.is() || !xWriter.is() ) { - return FALSE; + return sal_False; } Sequence<Any> aArgs( 1 ); @@ -187,7 +187,7 @@ bool writeOasis2OOoLibraryElement( xParser->parseStream( source ); - return TRUE; + return sal_True; } void SAL_CALL SfxDialogLibraryContainer::writeLibraryElement @@ -206,13 +206,13 @@ void SAL_CALL SfxDialogLibraryContainer::writeLibraryElement Reference< XInputStream > xInput( xISP->createInputStream() ); - bool bComplete = FALSE; + bool bComplete = sal_False; if ( mbOasis2OOoFormat ) { bComplete = writeOasis2OOoLibraryElement( xInput, xOutput ); } - if ( bComplete == FALSE ) + if ( bComplete == sal_False ) { Sequence< sal_Int8 > bytes; sal_Int32 nRead = xInput->readBytes( bytes, xInput->available() ); @@ -280,7 +280,7 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e { // if we cannot get the version then the // Oasis2OOoTransformer will not be used - OSL_ASSERT(FALSE); + OSL_ASSERT(sal_False); } } @@ -411,7 +411,7 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement { OSL_ENSURE( 0, "Parsing error\n" ); SfxErrorContext aEc( ERRCTX_SFX_LOADBASIC, aFile ); - ULONG nErrorCode = ERRCODE_IO_GENERAL; + sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL; ErrorHandler::HandleError( nErrorCode ); return aRetAny; } diff --git a/basic/source/uno/makefile.mk b/basic/source/uno/makefile.mk index 52e7f7004c4d..52e7f7004c4d 100644..100755 --- a/basic/source/uno/makefile.mk +++ b/basic/source/uno/makefile.mk diff --git a/basic/source/uno/modsizeexceeded.cxx b/basic/source/uno/modsizeexceeded.cxx index d36f424bb532..d46108e92dad 100644..100755 --- a/basic/source/uno/modsizeexceeded.cxx +++ b/basic/source/uno/modsizeexceeded.cxx @@ -28,9 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_basic.hxx" -#include "modsizeexceeded.hxx" +#include "basic/modsizeexceeded.hxx" -#include <framework/interaction.hxx> +#include <comphelper/interaction.hxx> #include <com/sun/star/script/ModuleSizeExceededRequest.hpp> using namespace com::sun::star; @@ -46,8 +46,8 @@ ModuleSizeExceeded::ModuleSizeExceeded( const uno::Sequence< ::rtl::OUString >& m_aRequest <<= aReq; - m_xAbort.set( uno::Reference< task::XInteractionAbort >(new framework::ContinuationAbort), uno::UNO_QUERY ); - m_xApprove.set( uno::Reference< task::XInteractionApprove >(new framework::ContinuationApprove ), uno::UNO_QUERY ); + m_xAbort.set( uno::Reference< task::XInteractionAbort >(new comphelper::OInteractionAbort), uno::UNO_QUERY ); + m_xApprove.set( uno::Reference< task::XInteractionApprove >(new comphelper::OInteractionApprove ), uno::UNO_QUERY ); m_lContinuations.realloc( 2 ); m_lContinuations[0] = m_xApprove; m_lContinuations[1] = m_xAbort; @@ -56,15 +56,15 @@ ModuleSizeExceeded::ModuleSizeExceeded( const uno::Sequence< ::rtl::OUString >& sal_Bool ModuleSizeExceeded::isAbort() const { - framework::ContinuationAbort* pBase = static_cast< framework::ContinuationAbort* >( m_xAbort.get() ); - return pBase->isSelected(); + comphelper::OInteractionAbort* pBase = static_cast< comphelper::OInteractionAbort* >( m_xAbort.get() ); + return pBase->wasSelected(); } sal_Bool ModuleSizeExceeded::isApprove() const { - framework::ContinuationApprove* pBase = static_cast< framework::ContinuationApprove* >( m_xApprove.get() ); - return pBase->isSelected(); + comphelper::OInteractionApprove* pBase = static_cast< comphelper::OInteractionApprove* >( m_xApprove.get() ); + return pBase->wasSelected(); } diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index 9c65b6a5f2b8..9479d56e0844 100644..100755 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -738,7 +738,7 @@ sal_Bool SfxLibraryContainer::init_Impl( if( nPass == 0 ) { SfxErrorContext aEc( ERRCTX_SFX_LOADBASIC, aFileName ); - ULONG nErrorCode = ERRCODE_IO_GENERAL; + sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL; ErrorHandler::HandleError( nErrorCode ); } } @@ -760,7 +760,7 @@ sal_Bool SfxLibraryContainer::init_Impl( { xInput.clear(); SfxErrorContext aEc( ERRCTX_SFX_LOADBASIC, aFileName ); - ULONG nErrorCode = ERRCODE_IO_GENERAL; + sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL; ErrorHandler::HandleError( nErrorCode ); } } @@ -1489,7 +1489,7 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib, throw; SfxErrorContext aEc( ERRCTX_SFX_SAVEDOC, aElementPath ); - ULONG nErrorCode = ERRCODE_IO_GENERAL; + sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL; ErrorHandler::HandleError( nErrorCode ); } } @@ -1601,7 +1601,7 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib, throw; SfxErrorContext aEc( ERRCTX_SFX_SAVEDOC, aLibInfoPath ); - ULONG nErrorCode = ERRCODE_IO_GENERAL; + sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL; ErrorHandler::HandleError( nErrorCode ); } } @@ -1676,7 +1676,7 @@ sal_Bool SfxLibraryContainer::implLoadLibraryIndexFile( SfxLibrary* pLib, if( !GbMigrationSuppressErrors ) { SfxErrorContext aEc( ERRCTX_SFX_LOADBASIC, aLibInfoPath ); - ULONG nErrorCode = ERRCODE_IO_GENERAL; + sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL; ErrorHandler::HandleError( nErrorCode ); } } @@ -1700,7 +1700,7 @@ sal_Bool SfxLibraryContainer::implLoadLibraryIndexFile( SfxLibrary* pLib, { OSL_ENSURE( 0, "Parsing error\n" ); SfxErrorContext aEc( ERRCTX_SFX_LOADBASIC, aLibInfoPath ); - ULONG nErrorCode = ERRCODE_IO_GENERAL; + sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL; ErrorHandler::HandleError( nErrorCode ); return sal_False; } @@ -2029,7 +2029,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto } catch( uno::Exception& ) { - ULONG nErrorCode = ERRCODE_IO_GENERAL; + sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL; ErrorHandler::HandleError( nErrorCode ); } } @@ -2051,7 +2051,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto { xOut.clear(); SfxErrorContext aEc( ERRCTX_SFX_SAVEDOC, aLibInfoPath ); - ULONG nErrorCode = ERRCODE_IO_GENERAL; + sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL; ErrorHandler::HandleError( nErrorCode ); } @@ -2081,7 +2081,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto catch( uno::Exception& ) { OSL_ENSURE( sal_False, "Problem during storing of libraries!\n" ); - ULONG nErrorCode = ERRCODE_IO_GENERAL; + sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL; ErrorHandler::HandleError( nErrorCode ); } } @@ -2808,19 +2808,37 @@ OUString SAL_CALL SfxLibraryContainer::getOriginalLibraryLinkURL( const OUString void SAL_CALL SfxLibraryContainer::setVBACompatibilityMode( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException) { - BasicManager* pBasMgr = getBasicManager(); - if( pBasMgr ) + /* The member variable mbVBACompat must be set first, the following call + to getBasicManager() may call getVBACompatibilityMode() which returns + this value. */ + mbVBACompat = _vbacompatmodeon; + if( BasicManager* pBasMgr = getBasicManager() ) { // get the standard library - String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) ); - if ( pBasMgr->GetName().Len() ) - aLibName = pBasMgr->GetName(); + String aLibName = pBasMgr->GetName(); + if ( aLibName.Len() == 0 ) + aLibName = String( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) ); - StarBASIC* pBasic = pBasMgr->GetLib( aLibName ); - if( pBasic ) + if( StarBASIC* pBasic = pBasMgr->GetLib( aLibName ) ) pBasic->SetVBAEnabled( _vbacompatmodeon ); + + /* If in VBA compatibility mode, force creation of the VBA Globals + object. Each application will create an instance of its own + implementation and store it in its Basic manager. Implementations + will do all necessary additional initialization, such as + registering the global "This***Doc" UNO constant, starting the + document events processor etc. + */ + if( mbVBACompat ) try + { + Reference< frame::XModel > xModel( mxOwnerDocument ); // weak-ref -> ref + Reference< XMultiServiceFactory > xFactory( xModel, UNO_QUERY_THROW ); + xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) ); + } + catch( Exception& ) + { + } } - mbVBACompat = _vbacompatmodeon; } void SAL_CALL SfxLibraryContainer::setProjectName( const ::rtl::OUString& _projectname ) throw (RuntimeException) diff --git a/basic/source/uno/sbmodule.cxx b/basic/source/uno/sbmodule.cxx index 3c8d115b1912..3c8d115b1912 100644..100755 --- a/basic/source/uno/sbmodule.cxx +++ b/basic/source/uno/sbmodule.cxx diff --git a/basic/source/uno/sbmodule.hxx b/basic/source/uno/sbmodule.hxx index 2dd0b3dd7910..2dd0b3dd7910 100644..100755 --- a/basic/source/uno/sbmodule.hxx +++ b/basic/source/uno/sbmodule.hxx diff --git a/basic/source/uno/sbservices.cxx b/basic/source/uno/sbservices.cxx index 5c4e1fc98309..5c4e1fc98309 100644..100755 --- a/basic/source/uno/sbservices.cxx +++ b/basic/source/uno/sbservices.cxx diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx index d6bd191cd0da..ebfc68863ea0 100644..100755 --- a/basic/source/uno/scriptcont.cxx +++ b/basic/source/uno/scriptcont.cxx @@ -61,7 +61,7 @@ #include <basic/basmgr.hxx> #include <basic/sbmod.hxx> #include <basic/basicmanagerrepository.hxx> -#include "modsizeexceeded.hxx" +#include "basic/modsizeexceeded.hxx" #include <xmlscript/xmlmod_imexp.hxx> #include <cppuhelper/factory.hxx> #include <com/sun/star/util/VetoException.hpp> @@ -82,7 +82,7 @@ using namespace com::sun::star; using namespace cppu; using namespace osl; -using com::sun::star::uno::Reference; +using ::rtl::OUString; using ::rtl::OUString; @@ -300,7 +300,7 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement catch( Exception& ) { SfxErrorContext aEc( ERRCTX_SFX_LOADBASIC, aFile ); - ULONG nErrorCode = ERRCODE_IO_GENERAL; + sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL; ErrorHandler::HandleError( nErrorCode ); } @@ -311,24 +311,21 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement // aMod.aName ignored if( aMod.aModuleType.getLength() > 0 ) { - if( !getVBACompatibilityMode() ) + /* If in VBA compatibility mode, force creation of the VBA Globals + object. Each application will create an instance of its own + implementation and store it in its Basic manager. Implementations + will do all necessary additional initialization, such as + registering the global "This***Doc" UNO constant, starting the + document events processor etc. + */ + if( getVBACompatibilityMode() ) try + { + Reference< frame::XModel > xModel( mxOwnerDocument ); // weak-ref -> ref + Reference< XMultiServiceFactory > xFactory( xModel, UNO_QUERY_THROW ); + xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) ); + } + catch( Exception& ) { - setVBACompatibilityMode( sal_True ); - - Any aGlobs; - Sequence< Any > aArgs(1); - Reference<frame::XModel > xModel( mxOwnerDocument ); - aArgs[ 0 ] <<= xModel; - - BasicManager* pBasicMgr = getBasicManager(); - if( pBasicMgr ) - { - aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ), aArgs ); - pBasicMgr->SetGlobalUNOConstant( "VBAGlobals", aGlobs ); - } - pBasicMgr = BasicManagerRepository::getApplicationBasicManager( sal_False ); - if( pBasicMgr ) - pBasicMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[0] ); } script::ModuleInfo aModInfo; @@ -353,25 +350,21 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement RTL_CONSTASCII_STRINGPARAM("document") )) { aModInfo.ModuleType = ModuleType::DOCUMENT; - Reference<frame::XModel > xModel( mxOwnerDocument ); - Reference< XMultiServiceFactory> xSF( xModel, UNO_QUERY); - Reference< container::XNameAccess > xVBACodeNameAccess; - if( xSF.is() ) + + // #163691# use the same codename access instance for all document modules + if( !mxCodeNameAccess.is() ) try { - try - { - xVBACodeNameAccess.set( xSF->createInstance( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "ooo.vba.VBAObjectModuleObjectProvider"))), - UNO_QUERY ); - } - catch(uno::Exception&) {} + Reference<frame::XModel > xModel( mxOwnerDocument ); + Reference< XMultiServiceFactory> xSF( xModel, UNO_QUERY_THROW ); + mxCodeNameAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAObjectModuleObjectProvider" ) ) ), UNO_QUERY ); } - if( xVBACodeNameAccess.is() ) + catch( Exception& ) {} + + if( mxCodeNameAccess.is() ) { try { - aModInfo.ModuleObject.set( xVBACodeNameAccess->getByName( aElementName), uno::UNO_QUERY ); + aModInfo.ModuleObject.set( mxCodeNameAccess->getByName( aElementName), uno::UNO_QUERY ); } catch(uno::Exception&) { @@ -661,7 +654,7 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, throw uno::RuntimeException(); SvMemoryStream aMemStream; - /*BOOL bStore = */pMod->StoreBinaryData( aMemStream ); + /*sal_Bool bStore = */pMod->StoreBinaryData( aMemStream ); sal_Int32 nSize = (sal_Int32)aMemStream.Tell(); Sequence< sal_Int8 > aBinSeq( nSize ); @@ -802,7 +795,7 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE ); SvMemoryStream aMemStream; - /*BOOL bStore = */pMod->StoreBinaryData( aMemStream ); + /*sal_Bool bStore = */pMod->StoreBinaryData( aMemStream ); sal_Int32 nSize = (sal_Int32)aMemStream.Tell(); Sequence< sal_Int8 > aBinSeq( nSize ); @@ -959,7 +952,7 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary if( !pMod ) { pMod = pBasicLib->MakeModule( aElementName, String() ); - pBasicLib->SetModified( FALSE ); + pBasicLib->SetModified( sal_False ); } //OUString aCodeStreamName( RTL_CONSTASCII_USTRINGPARAM("code.bin") ); @@ -981,7 +974,7 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), nError ); } - /*BOOL bRet = */pMod->LoadBinaryData( *pStream ); + /*sal_Bool bRet = */pMod->LoadBinaryData( *pStream ); // TODO: Check return value delete pStream; @@ -1071,7 +1064,7 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary if( !pMod ) { pMod = pBasicLib->MakeModule( aElementName, String() ); - pBasicLib->SetModified( FALSE ); + pBasicLib->SetModified( sal_False ); } try { @@ -1090,7 +1083,7 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary nError ); } - /*BOOL bRet = */pMod->LoadBinaryData( *pStream ); + /*sal_Bool bRet = */pMod->LoadBinaryData( *pStream ); // TODO: Check return value delete pStream; diff --git a/basic/util/makefile.mk b/basic/util/makefile.mk index 534b8a25bd14..635b29369868 100644..100755 --- a/basic/util/makefile.mk +++ b/basic/util/makefile.mk @@ -137,4 +137,10 @@ $(MISC)$/$(SHL1TARGET).flt: makefile.mk $(SRS)$/basic.srs: $(TYPE) $(SRS)$/classes.srs + $(SRS)$/runtime.srs + $(SRS)$/sbx.srs > $@ +ALLTAR : $(MISC)/sb.component +$(MISC)/sb.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + sb.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt sb.component diff --git a/basic/util/sb.component b/basic/util/sb.component new file mode 100755 index 000000000000..4687bd1e7d0b --- /dev/null +++ b/basic/util/sb.component @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.sfx2.DialogLibraryContainer"> + <service name="com.sun.star.script.DialogLibraryContainer"/> + <service name="com.sun.star.script.DocumentDialogLibraryContainer"/> + </implementation> + <implementation name="com.sun.star.comp.sfx2.ScriptLibraryContainer"> + <service name="com.sun.star.script.DocumentScriptLibraryContainer"/> + <service name="com.sun.star.script.ScriptLibraryContainer"/> + </implementation> +</component> diff --git a/basic/win/res/basic.ico b/basic/win/res/basic.ico Binary files differindex c453a0fa988f..c453a0fa988f 100644..100755 --- a/basic/win/res/basic.ico +++ b/basic/win/res/basic.ico diff --git a/basic/win/res/testtool.ico b/basic/win/res/testtool.ico Binary files differindex db880c8678a7..db880c8678a7 100644..100755 --- a/basic/win/res/testtool.ico +++ b/basic/win/res/testtool.ico diff --git a/basic/win/res/work.ico b/basic/win/res/work.ico Binary files differindex 43e3b5b3df03..43e3b5b3df03 100644..100755 --- a/basic/win/res/work.ico +++ b/basic/win/res/work.ico diff --git a/basic/workben/mgrtest.cxx b/basic/workben/mgrtest.cxx new file mode 100755 index 000000000000..7e3efc597ac1 --- /dev/null +++ b/basic/workben/mgrtest.cxx @@ -0,0 +1,591 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_basic.hxx" +#include <vcl/svapp.hxx> +#include <vcl/wrkwin.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/sound.hxx> +#include <basic/basmgr.hxx> +#include <basic/sbx.hxx> +#include <basic/sbmod.hxx> +#include <basic/basrdll.hxx> + +//#include <sv.hxx> +//#include <basic.hxx> +//#include <sostor.hxx> + +// Defines for ToolBox-Id's +#define TB_NEW 1 +#define TB_OPENSTORAGE 2 +#define TB_SAVESTORAGE 3 +#define TB_ORG 4 +#define TB_CREATELIB1 10 +#define TB_CREATELIB2 11 +#define TB_CREATELIB3 12 +#define TB_LOADLIB1 20 +#define TB_LOADLIB2 21 +#define TB_LOADLIB3 22 +#define TB_STORELIBX 30 +#define TB_UNLOADX 31 +#define TB_LOADX 32 +#define TB_EXECX 33 +#define TB_REMOVEX 34 +#define TB_REMOVEDELX 35 + +#define TB_LIB0 40 +#define TB_LIB1 41 +#define TB_LIB2 42 +#define TB_LIB3 43 + +const char* pLib1Str = "Lib1"; +const char* pLib2Str = "Lib2"; +const char* pLib3Str = "Lib3"; + +// Test-Application +class TestApp : public Application +{ +public: + virtual void Main( void ); + virtual void Main( int, char*[] ); +}; + +// Test-Window with a ToolBox to choose a test from +// and the typically used virtual methods +class TestWindow : public WorkWindow +{ +private: + ToolBox aToolBox; + BasicManager* pBasMgr; + + void CheckError(); + sal_uInt16 nLibX; + DECL_LINK( BasicErrorHdl, StarBASIC * ); + + +public: + TestWindow(); + ~TestWindow(); + + virtual void Paint( const Rectangle& ); + virtual void Resize(); + virtual void KeyInput( const KeyEvent& rKeyEvt ); + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + + DECL_LINK( TBSelect, ToolBox * ); + void UpdateToolBox(); + void ShowInfo(); +}; + +TestWindow::~TestWindow() +{ +} + +TestWindow::TestWindow() : + WorkWindow( NULL, WB_APP | WB_STDWORK | WB_3DLOOK | WB_CLIPCHILDREN ) , + aToolBox( this, WinBits( WB_BORDER | WB_3DLOOK | WB_SCROLL | WB_LINESPACING ) ) +{ + nLibX = 0; + + aToolBox.SetButtonType( BUTTON_TEXT ); + aToolBox.SetLineCount( 2 ); + aToolBox.SetPosPixel( Point( 0, 0 ) ); + aToolBox.SetSelectHdl( LINK( this, TestWindow, TBSelect ) ); + + Font aFont; + aFont.SetName( "Helv" ); + aFont.SetSize( Size( 0, 6 ) ); + aFont.SetPitch( PITCH_VARIABLE ); + aFont.SetFamily( FAMILY_SWISS ); + aFont.SetTransparent( sal_True ); + aFont.SetAlign( ALIGN_TOP ); + aToolBox.SetFont( aFont ); + SetFont( aFont ); + + aToolBox.InsertItem( TB_NEW, "New" ); + aToolBox.SetHelpText( TB_NEW, "New BasicManager" ); + aToolBox.InsertItem( TB_OPENSTORAGE, "Load" ); + aToolBox.SetHelpText( TB_OPENSTORAGE, "Load Storage D:\\MYSTORE.SVS" ); + aToolBox.InsertItem( TB_SAVESTORAGE, "Save" ); + aToolBox.SetHelpText( TB_SAVESTORAGE, "Save Storage D:\\MYSTORE.SVS" ); + + aToolBox.InsertSeparator(); + + aToolBox.InsertItem( TB_ORG, "Verwalten" ); + aToolBox.SetHelpText( TB_ORG, "Libaries verwalten" ); + + aToolBox.InsertSeparator(); + + aToolBox.InsertItem( TB_LIB0, "0" ); + aToolBox.SetHelpText( TB_LIB0, "Aktuelle Lib: STANDARD" ); + aToolBox.InsertItem( TB_LIB1, "1" ); + aToolBox.SetHelpText( TB_LIB1, "Aktuelle Lib: 1" ); + aToolBox.InsertItem( TB_LIB2, "2" ); + aToolBox.SetHelpText( TB_LIB2, "Aktuelle Lib: 2" ); + aToolBox.InsertItem( TB_LIB3, "3" ); + aToolBox.SetHelpText( TB_LIB3, "Aktuelle Lib: 3" ); + + aToolBox.InsertBreak(); + aToolBox.InsertItem( TB_CREATELIB1, "CreateLib1" ); + aToolBox.SetHelpText( TB_CREATELIB1, "Create Libary LIB1" ); + aToolBox.InsertItem( TB_CREATELIB2, "CreateLib2" ); + aToolBox.SetHelpText( TB_CREATELIB2, "Create Libary LIB2" ); + aToolBox.InsertItem( TB_CREATELIB3, "CreateLib3" ); + aToolBox.SetHelpText( TB_CREATELIB3, "Create Libary LIB3" ); + + aToolBox.InsertSeparator(); + aToolBox.InsertItem( TB_LOADLIB1, "LoadLib1" ); + aToolBox.SetHelpText( TB_LOADLIB1, "Load Libary LIB1" ); + aToolBox.InsertItem( TB_LOADLIB2, "LoadLib2" ); + aToolBox.SetHelpText( TB_LOADLIB2, "Load Libary LIB2" ); + aToolBox.InsertItem( TB_LOADLIB3, "LoadLib3" ); + aToolBox.SetHelpText( TB_LOADLIB3, "Load Libary LIB3" ); + + aToolBox.InsertSeparator(); + aToolBox.InsertItem( TB_STORELIBX, "StoreLibX" ); + aToolBox.SetHelpText( TB_STORELIBX, "Store Libary LIBX" ); + aToolBox.InsertItem( TB_UNLOADX, "UnloadX" ); + aToolBox.SetHelpText( TB_UNLOADX, "Unload Libary LIBX" ); + aToolBox.InsertItem( TB_LOADX, "LoadX" ); + aToolBox.SetHelpText( TB_LOADX, "Load Libary LIBX" ); + aToolBox.InsertItem( TB_EXECX, "ExecX" ); + aToolBox.SetHelpText( TB_EXECX, "Execute 'Libary' LIBX" ); + aToolBox.InsertItem( TB_REMOVEX, "RemoveX" ); + aToolBox.SetHelpText( TB_REMOVEX, "Remove Libary LIBX" ); + aToolBox.InsertItem( TB_REMOVEDELX, "RemDelX" ); + aToolBox.SetHelpText( TB_REMOVEDELX, "Remove and delete Libary LIBX" ); + + pBasMgr = 0; + + Show(); + UpdateToolBox(); + aToolBox.Show(); +} +void TestWindow::ShowInfo() +{ + Invalidate(); + Update(); + long nH = GetTextSize( "X" ).Height(); + if ( pBasMgr ) + { + Point aPos( 10, aToolBox.GetSizePixel().Height()+5 ); + for ( sal_uInt16 nLib = 0; nLib < pBasMgr->GetLibCount(); nLib++ ) + { + String aOutStr( nLib ); + aOutStr +=": "; + StarBASIC* pL = pBasMgr->GetLib( nLib ); + aOutStr += '['; + aOutStr += pBasMgr->GetLibName( nLib ); + aOutStr += "]<"; + if ( pL ) + aOutStr += pL->GetName(); + else + aOutStr += "NoLoaded"; + aOutStr += ">, Storage='"; + aOutStr += pBasMgr->GetLibStorageName( nLib ); + aOutStr += "', bLoaded="; + aOutStr += (sal_uInt16)pBasMgr->IsLibLoaded( nLib ); + DrawText( aPos, aOutStr ); + aPos.Y() += nH; + } + } +} + +void TestWindow::UpdateToolBox() +{ + // View of some buttons as checked or disabled if + // wished by tests + aToolBox.EnableItem( TB_ORG, (sal_Bool)(sal_uIntPtr)pBasMgr ); + + aToolBox.EnableItem( TB_CREATELIB1, (sal_Bool)(sal_uIntPtr)pBasMgr ); + aToolBox.EnableItem( TB_CREATELIB2, (sal_Bool)(sal_uIntPtr)pBasMgr ); + aToolBox.EnableItem( TB_CREATELIB3, (sal_Bool)(sal_uIntPtr)pBasMgr ); + + aToolBox.EnableItem( TB_LOADLIB1, (sal_Bool)(sal_uIntPtr)pBasMgr ); + aToolBox.EnableItem( TB_LOADLIB2, (sal_Bool)(sal_uIntPtr)pBasMgr ); + aToolBox.EnableItem( TB_LOADLIB3, (sal_Bool)(sal_uIntPtr)pBasMgr ); + + aToolBox.EnableItem( TB_STORELIBX, (sal_Bool)(sal_uIntPtr)pBasMgr ); + aToolBox.EnableItem( TB_EXECX, (sal_Bool)(sal_uIntPtr)pBasMgr ); + aToolBox.EnableItem( TB_UNLOADX, (sal_Bool)(sal_uIntPtr)pBasMgr ); + aToolBox.EnableItem( TB_LOADX, (sal_Bool)(sal_uIntPtr)pBasMgr ); + aToolBox.EnableItem( TB_REMOVEX, (sal_Bool)(sal_uIntPtr)pBasMgr ); + aToolBox.EnableItem( TB_REMOVEDELX, (sal_Bool)(sal_uIntPtr)pBasMgr ); + + aToolBox.CheckItem( TB_LIB0, nLibX == 0 ); + aToolBox.CheckItem( TB_LIB1, nLibX == 1 ); + aToolBox.CheckItem( TB_LIB2, nLibX == 2 ); + aToolBox.CheckItem( TB_LIB3, nLibX == 3 ); +} + +IMPL_LINK( TestWindow, TBSelect, ToolBox *, p ) +{ + sal_uInt16 nId = aToolBox.GetCurItemId(); + sal_Bool bChecked = aToolBox.IsItemChecked( nId ); + switch ( nId ) + { + case TB_NEW: + { + delete pBasMgr; + pBasMgr = new BasicManager( new StarBASIC ); + pBasMgr->SetStorageName( "d:\\mystore.svs" ); + } + break; + case TB_OPENSTORAGE: + { + delete pBasMgr; + SvStorageRef xStorage = new SvStorage( "d:\\mystore.svs", STREAM_READ | STREAM_SHARE_DENYWRITE ); + DBG_ASSERT( xStorage.Is(), "Kein Storage!" ); + pBasMgr = new BasicManager( *xStorage ); + } + break; + case TB_SAVESTORAGE: + { + if ( pBasMgr) + { + SvStorageRef xStorage = new SvStorage( "d:\\mystore.svs" ); + DBG_ASSERT( xStorage.Is(), "Kein Storage!" ); + pBasMgr->Store( *xStorage ); + } + } + break; + case TB_ORG: + { + if ( pBasMgr) + { + InfoBox( 0, "Organisieren..." ).Execute(); + } + } + break; + case TB_CREATELIB1: + { + if ( pBasMgr ) + { + sal_uInt16 nLib = pBasMgr->GetLibId( pBasMgr->CreateLib( pLib1Str ) ); + if ( nLib != LIB_NOTFOUND ) + { + pBasMgr->SetLibStorageName( nLib, "d:\\mystore.svs" ); + StarBASIC* pLib = pBasMgr->GetLib( pLib1Str ); + DBG_ASSERT( pLib, "Lib?!" ); + String aSource( "Sub SubInLib1Mod1\nprint\"XXX\"\nEnd Sub"); + SbModule* pM = pLib->MakeModule( "ModLib1", aSource ); + DBG_ASSERT( pM, "Modul?" ); + pLib->Compile( pM ); + } + else + InfoBox( 0, "CreateLibary fehlgeschlagen..." ).Execute(); + } + } + break; + case TB_CREATELIB2: + { + if ( pBasMgr ) + { + sal_uInt16 nLib = pBasMgr->GetLibId( pBasMgr->CreateLib( pLib2Str ) ); + if ( nLib != LIB_NOTFOUND ) + { + pBasMgr->SetLibStorageName( nLib, "d:\\mystore.svs" ); + StarBASIC* pLib = pBasMgr->GetLib( pLib2Str ); + DBG_ASSERT( pLib, "Lib?!" ); + SbModule* pM = pLib->MakeModule( "ModuleLib2", "Sub SubInLib2\n print \"Tralala\" \nEnd Sub\n" ); + pLib->Compile( pM ); + } + else + InfoBox( 0, "CreateLibary fehlgeschlagen..." ).Execute(); + } + } + break; + case TB_CREATELIB3: + { + if ( pBasMgr ) + { + // liegt in einem anderen Storage !!! + sal_uInt16 nLib = pBasMgr->GetLibId( pBasMgr->CreateLib( pLib3Str ) ); + if ( nLib != LIB_NOTFOUND ) + { + pBasMgr->SetLibStorageName( nLib, "d:\\mystore2.svs" ); + StarBASIC* pLib = pBasMgr->GetLib( pLib3Str ); + DBG_ASSERT( pLib, "Lib?!" ); + SbModule* pM = pLib->MakeModule( "ModuleLib2", "Sub XYZInLib3\n print \"?!\" \nEnd Sub\n" ); + pLib->Compile( pM ); + } + else + InfoBox( 0, "CreateLibary fehlgeschlagen..." ).Execute(); + } + } + break; + case TB_LOADLIB1: + { + if ( pBasMgr ) + { + SvStorageRef xStorage = new SvStorage( "d:\\mystore.svs" ); + if ( !pBasMgr->AddLib( *xStorage, pLib1Str, sal_False ) ) + Sound::Beep(); + } + } + break; + case TB_LOADLIB2: + { + if ( pBasMgr ) + { + SvStorageRef xStorage = new SvStorage( "d:\\mystore.svs" ); + if ( !pBasMgr->AddLib( *xStorage, pLib2Str, sal_False ) ) + Sound::Beep(); + } + } + break; + case TB_LOADLIB3: + { + if ( pBasMgr ) + { + // liegt in einem anderen Storage !!! + SvStorageRef xStorage = new SvStorage( "d:\\mystore2.svs" ); + if ( !pBasMgr->AddLib( *xStorage, pLib3Str, sal_False ) ) + Sound::Beep(); + } + } + break; + case TB_STORELIBX: + { + if ( pBasMgr ) + pBasMgr->StoreLib( nLibX ); + } + break; + case TB_UNLOADX: + { + if ( pBasMgr ) + pBasMgr->UnloadLib( nLibX ); + } + break; + case TB_LOADX: + { + if ( pBasMgr ) + pBasMgr->LoadLib( nLibX ); + } + break; + case TB_REMOVEX: + { + if ( pBasMgr ) + pBasMgr->RemoveLib( nLibX, sal_False ); + } + break; + case TB_REMOVEDELX: + { + if ( pBasMgr ) + pBasMgr->RemoveLib( nLibX, sal_True ); + } + break; + case TB_EXECX: + { + if ( pBasMgr ) + { + StarBASIC* pBasic = pBasMgr->GetLib( nLibX ); + if ( pBasic && pBasic->GetModules()->Count() ) + { + pBasic->SetErrorHdl( LINK( this, TestWindow, BasicErrorHdl ) ); + + SbModule* pMod = (SbModule*)pBasic->GetModules()->Get( 0 ); + if ( pMod && pMod->GetMethods()->Count() ) + pMod->GetMethods()->Get(0)->GetInteger(); + } + } + } + break; + + case TB_LIB0: nLibX = 0; + break; + case TB_LIB1: nLibX = 1; + break; + case TB_LIB2: nLibX = 2; + break; + case TB_LIB3: nLibX = 3; + break; + } + + UpdateToolBox(); + CheckError(); + ShowInfo(); + return 0; +} + +void TestWindow::CheckError() +{ + if ( pBasMgr ) + { + BasicError* pError = pBasMgr->GetFirstError(); + while ( pError ) + { + String aErrorStr; + String aReasonStr; + switch ( pError->GetErrorId() ) + { + case BASERR_ID_STDLIBOPEN: + aErrorStr = "Standard-Lib konnte nicht geoffnet werden."; + break; + case BASERR_ID_STDLIBSAVE: + aErrorStr = "Standard-Lib konnte nicht gespeichert werden."; + break; + case BASERR_ID_LIBLOAD: + aErrorStr = "Lib konnte nicht geoffnet werden."; + break; + case BASERR_ID_LIBCREATE: + aErrorStr = "Lib konnte nicht erzeugt werden."; + break; + case BASERR_ID_LIBSAVE: + aErrorStr = "Lib konnte nicht gespeichert werden."; + break; + case BASERR_ID_MGROPEN: + aErrorStr = "Manager konnte nicht geladen werden."; + break; + case BASERR_ID_MGRSAVE: + aErrorStr = "Manager konnte nicht gespeichert werden."; + break; + case BASERR_ID_UNLOADLIB: + aErrorStr = "Libary konnte nicht entladen werden."; + break; + case BASERR_ID_REMOVELIB: + aErrorStr = "Libary konnte nicht entfernt werden."; + break; + default: + aErrorStr = "Unbekannter Fehler!"; + } + + switch ( pError->GetReason() ) + { + case BASERR_REASON_OPENSTORAGE: + aReasonStr = "Der Storage konnte nicht geoeffnet werden"; + break; + case BASERR_REASON_OPENLIBSTORAGE: + aReasonStr = "Der Lib-Storage konnte nicht geoeffnet werden"; + break; + case BASERR_REASON_OPENMGRSTREAM: + aReasonStr = "Der Manager-Stream konnte nicht geoeffnet werden"; + break; + case BASERR_REASON_OPENLIBSTREAM: + aReasonStr = "Der Basic-Stream konnte nicht geoeffnet werden"; + break; + case BASERR_REASON_STDLIB: + aReasonStr = "STANDARD-Lib"; + break; + case BASERR_REASON_BASICLOADERROR: + aReasonStr = "Fehler beim Laden des Basics"; + default: + aReasonStr = " - "; + } + + String aErr( aErrorStr ); + aErr += "\nGrund: "; + aErr += aReasonStr; + InfoBox( 0, aErr ).Execute(); + + pError = pBasMgr->GetNextError(); + } + pBasMgr->ClearErrors(); + } +} + +void __EXPORT TestWindow::Paint( const Rectangle& rRec ) +{ +} + +void __EXPORT TestWindow::Resize() +{ + Size aTBSz = aToolBox.CalcWindowSizePixel(); + aToolBox.SetSizePixel( Size( GetOutputSizePixel().Width(), aTBSz.Height()) ); + Invalidate(); + ShowInfo(); +} + +void __EXPORT TestWindow::KeyInput( const KeyEvent& rKEvt ) +{ + char nCharCode = rKEvt.GetCharCode(); + sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode(); + + // Nur bei Alt-Return + if ( ( nCode == KEY_RETURN ) && rKEvt.GetKeyCode().IsMod2() ) + ; + else + WorkWindow::KeyInput( rKEvt ); + + UpdateToolBox(); +} + +void __EXPORT TestWindow::MouseMove( const MouseEvent& rMEvt ) +{ +} + +void __EXPORT TestWindow::MouseButtonDown( const MouseEvent& rMEvt ) +{ + ShowInfo(); +} + +void __EXPORT TestWindow::MouseButtonUp( const MouseEvent& rMEvt ) +{ + UpdateToolBox(); +} + +IMPL_LINK( TestWindow, BasicErrorHdl, StarBASIC *, pBasic ) +{ + String aErrorText( pBasic->GetErrorText() ); + + String aErrorTextPrefix; + if( pBasic->IsCompilerError() ) + { + aErrorTextPrefix = "Compilererror: "; + } + else + { + aErrorTextPrefix = "Runtimeerror: "; + aErrorTextPrefix += pBasic->GetErrorCode(); + aErrorTextPrefix += " "; + } + + InfoBox( 0, String( aErrorTextPrefix + aErrorText ) ).Execute(); + return 0; +} + +void __EXPORT TestApp::Main( void ) +{ + Main( 0, NULL ); +} + +void __EXPORT TestApp::Main( int, char*[] ) +{ + BasicDLL aBasiDLL; + SvFactory::Init(); + EnableSVLook(); + TestWindow aWindow; + Execute(); + SvFactory::DeInit(); +} + + +TestApp aTestApp; |